fix(base): classify +form-submit as high-risk-write#1969
fix(base): classify +form-submit as high-risk-write#1969yballul-bytedance wants to merge 1 commit into
Conversation
Form submission writes and submits data through a public share link, an irreversible action that should require explicit confirmation. Reclassify the shortcut from write to high-risk-write so the runner's --yes gate fires before execution, matching +form-delete and other high-risk base commands. Update the lark-base skill docs (--yes on all examples, param table, tips) and add tests pinning the confirmation gate (unit) and dry-run structure (e2e).
📝 WalkthroughWalkthroughChangesForm Submit Confirmation
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@c352583ab7932211166230214dfc4052b8937b39🧩 Skill updatenpx skills add yballul-bytedance/cli#fix/form-subimit-high-risk -y -g |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@skills/lark-base/references/lark-base-form-submit.md`:
- Line 78: Update the `--yes` entry in the parameter table for the documented
command to state that confirmation is required only for actual execution, while
explicitly exempting `--dry-run`. Keep the existing `confirmation_required`
behavior for high-risk writes without `--yes` and ensure the wording remains
precise and machine-consumable.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 581f5ffc-b845-4fc5-bd1f-d3cf665c401c
📒 Files selected for processing (5)
shortcuts/base/base_form_submit.goshortcuts/base/base_shortcuts_test.goskills/lark-base/SKILL.mdskills/lark-base/references/lark-base-form-submit.mdtests/cli_e2e/base/base_form_submit_dryrun_test.go
| | `--share-token <token>` | 是 | 表单分享 Token(必填),从表单分享链接中提取 | | ||
| | `--base-token <token>` | 条件必填 | Base token;**当 `--json` 包含 `attachments` 时必须提供**,用于将附件上传到 Base Drive Media | | ||
| | `--json <json>` | 是 | JSON 对象,包含 `"fields"`(普通字段值)和 `"attachments"`(附件上传),详见下方说明 | | ||
| | `--yes` | 是 | 确认高风险写操作。本命令为 high-risk-write,不带 `--yes` 会返回 `confirmation_required` | |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Make the --yes requirement conditional for dry-run.
The parameter table says --yes is always required, but this document states that --dry-run does not require it. Update the row to say it is required for execution only, or explicitly document the dry-run exception.
As per coding guidelines, CLI flag documentation must remain precise and machine-consumable.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@skills/lark-base/references/lark-base-form-submit.md` at line 78, Update the
`--yes` entry in the parameter table for the documented command to state that
confirmation is required only for actual execution, while explicitly exempting
`--dry-run`. Keep the existing `confirmation_required` behavior for high-risk
writes without `--yes` and ensure the wording remains precise and
machine-consumable.
Source: Coding guidelines
|
|
||
| 通过表单分享链接填写并提交多维表格表单。仅支持分享模式(share_token),支持填写普通字段值和上传本地文件作为附件。 | ||
|
|
||
| > **⚠️ 高风险写操作(high-risk-write):** 本命令会向表单写入并提交数据,属于高风险写操作,必须额外传递 `--yes` 进行确认,否则会返回 `confirmation_required` 错误并退出。当用户明确要求提交且目标表单无歧义时,直接附加 `--yes`,无需再次询问。 |
There was a problem hiding this comment.
--yes的主要目的是引导agent对风险操作给人确认,我们是否有地方说明什么情况下是要给人确认的。
There was a problem hiding this comment.
🤔只要命令是 high-risk,无论是什么情况下都应该让人确认?high-risk 是这个定义
Summary
base +form-submitfills and submits data through a public form share link — an outward-facing, irreversible write. It was classified aswrite, so it ran without confirmation. This PR reclassifies it ashigh-risk-writeso the runner's--yesconfirmation gate fires before execution, consistent with+form-deleteand other high-risk base commands.Changes
shortcuts/base/base_form_submit.go:Riskwrite→high-risk-write; addbaseHighRiskYesTipto Tips. The runner auto-registers--yesand returnsconfirmation_required(exit 10) when it is missing.skills/lark-base/references/lark-base-form-submit.md: high-risk warning banner,--yeson all examples,--yesrow in the param table, and a tip note.skills/lark-base/SKILL.md: note+form-submitrequires--yesin the high-risk list and form-details section.TestFormSubmitRequiresConfirmationunit test pins the typedconfirmation_requiredgate; existing execute-path tests pass--yes; newtests/cli_e2e/base/base_form_submit_dryrun_test.godry-run E2E.Test Plan
go test ./shortcuts/base/)go test ./tests/cli_e2e/base/)gofmt -l,go vet,go mod tidycleanRelated Issues
Summary by CodeRabbit
New Features
Bug Fixes
--yesconfirmation flag before execution.Documentation