feat: support visible_rule for form questions - #1891
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughForm question create and update commands preserve ChangesForm visible rule support
Estimated code review effort: 3 (Moderate) | ~30 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant BaseFormQuestionsCommand
participant DryRunAPI
CLI->>BaseFormQuestionsCommand: Provide questions JSON with visible_rule
BaseFormQuestionsCommand->>DryRunAPI: Parse questions and attach request body
DryRunAPI-->>CLI: Print POST or PATCH preview with visible_rule
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/cli_e2e/base/coverage.md (1)
53-56: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAlign testcase reference formatting in the Command Table.
For consistency with the rest of the Command Table, please include the filename prefix (
base_form_questions_dryrun_test.go::) before the testcase names.💅 Proposed nitpick fix
-| ✓ | base +form-questions-create | shortcut | TestBaseFormQuestionsCreateVisibleRuleDryRun | questions[].visible_rule | dry-run: request shape + visible_rule body passthrough | +| ✓ | base +form-questions-create | shortcut | base_form_questions_dryrun_test.go::TestBaseFormQuestionsCreateVisibleRuleDryRun | questions[].visible_rule | dry-run: request shape + visible_rule body passthrough | | ✕ | base +form-questions-delete | shortcut | | none | form workflows not covered | | ✕ | base +form-questions-list | shortcut | | none | form workflows not covered | -| ✓ | base +form-questions-update | shortcut | TestBaseFormQuestionsUpdateVisibleRuleDryRun | questions[].visible_rule | dry-run: request shape + visible_rule body passthrough | +| ✓ | base +form-questions-update | shortcut | base_form_questions_dryrun_test.go::TestBaseFormQuestionsUpdateVisibleRuleDryRun | questions[].visible_rule | dry-run: request shape + visible_rule body passthrough |🤖 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 `@tests/cli_e2e/base/coverage.md` around lines 53 - 56, Update the testcase references in the Command Table entries for form-questions-create and form-questions-update to prepend base_form_questions_dryrun_test.go:: to each testcase name, matching the established formatting used elsewhere in the table.
🤖 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.
Nitpick comments:
In `@tests/cli_e2e/base/coverage.md`:
- Around line 53-56: Update the testcase references in the Command Table entries
for form-questions-create and form-questions-update to prepend
base_form_questions_dryrun_test.go:: to each testcase name, matching the
established formatting used elsewhere in the table.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 679a67ee-c059-4f3e-833f-9a2cefb5de69
📒 Files selected for processing (11)
shortcuts/base/base_form_execute_test.goshortcuts/base/base_form_questions_create.goshortcuts/base/base_form_questions_update.goshortcuts/base/base_shortcuts_test.goskills/lark-base/SKILL.mdskills/lark-base/references/lark-base-filter-condition.mdskills/lark-base/references/lark-base-form-questions-create.mdskills/lark-base/references/lark-base-form-questions-update.mdskills/lark-base/references/lark-base-view-set-filter.mdtests/cli_e2e/base/base_form_questions_dryrun_test.gotests/cli_e2e/base/coverage.md
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@cafa042e28a7244865cd65c6e7574ee0de93d318🧩 Skill updatenpx skills add yballul-bytedance/cli#feat/form-question-visible-rule -y -g |
0fd0d04 to
f753d1f
Compare
f753d1f to
05209d4
Compare
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 `@shortcuts/base/base_form_questions_create.go`:
- Around line 30-42: Update the DryRun callback in the questions creation flow
to handle json.Unmarshal errors for runtime.Str("questions") instead of silently
returning an API without a body. Ensure invalid JSON is rejected or propagated
consistently with the normal execution path, while valid JSON continues to
populate the request body through api.Body.
🪄 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 Plus
Run ID: a3322fb1-5946-40e5-95c4-ba8caf4087e0
📒 Files selected for processing (4)
shortcuts/base/base_form_execute_test.goshortcuts/base/base_form_questions_create.goshortcuts/base/base_form_questions_update.goshortcuts/base/base_shortcuts_test.go
🚧 Files skipped from review as they are similar to previous changes (3)
- shortcuts/base/base_shortcuts_test.go
- shortcuts/base/base_form_questions_update.go
- shortcuts/base/base_form_execute_test.go
05209d4 to
3ccc19f
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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-view-set-filter.md`:
- Line 9: 更新 lark-base-view-set-filter.md 中对 conditions 字段的描述,明确 conditions
是条件元组数组,并将 field 表述为每个条件元组的第一个元素(field);不要再使用暗示对象属性的 “conditions.field”
表述,同时保持字段名或字段 ID 的语义不变。
In `@skills/lark-base/SKILL.md`:
- Line 119: Update the +form-questions-update guidance in SKILL.md to qualify
empty-string, null, and empty-array behavior with “when accepted by the API,”
matching the caveat in base_form_questions_update.go. Preserve the existing
full-replacement and pre-read guidance.
🪄 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 Plus
Run ID: 2fbb119f-9b47-4342-b683-73016f731e38
📒 Files selected for processing (11)
shortcuts/base/base_form_execute_test.goshortcuts/base/base_form_questions_create.goshortcuts/base/base_form_questions_update.goshortcuts/base/base_shortcuts_test.goskills/lark-base/SKILL.mdskills/lark-base/references/lark-base-filter-condition.mdskills/lark-base/references/lark-base-form-questions-create.mdskills/lark-base/references/lark-base-form-questions-update.mdskills/lark-base/references/lark-base-view-set-filter.mdtests/cli_e2e/base/base_form_questions_dryrun_test.gotests/cli_e2e/base/coverage.md
🚧 Files skipped from review as they are similar to previous changes (8)
- skills/lark-base/references/lark-base-filter-condition.md
- tests/cli_e2e/base/base_form_questions_dryrun_test.go
- skills/lark-base/references/lark-base-form-questions-create.md
- shortcuts/base/base_form_execute_test.go
- shortcuts/base/base_form_questions_create.go
- skills/lark-base/references/lark-base-form-questions-update.md
- shortcuts/base/base_form_questions_update.go
- tests/cli_e2e/base/coverage.md
3ccc19f to
580e0eb
Compare
Form questions can now carry a visible_rule (display condition) so a question shows only when earlier questions match the rule. The rule shares the exact same structure as the view filter, so extract that structure into a single shared reference (lark-base-filter-condition.md) that both view-set-filter and visible_rule point to. - create/update shortcuts: document visible_rule in --questions help and transcribe the questions body (including visible_rule) into dry-run output - document that form question updates use full overwrite semantics and must preserve existing fields via read-modify-write - skill refs: add visible_rule sections to form-questions create/update, note it is only needed when the user asks for a display condition, and clarify that the shared tuple filter protocol does not apply to data-query filters - tests: pin flag help, verbatim visible_rule passthrough on create/update/list, and add dry-run E2E coverage Co-authored-by: TRAE CLI <noreply@bytedance.com>
580e0eb to
cafa042
Compare
Summary
Form questions can now carry a
visible_rule(display condition) so a question is shown only when earlier questions satisfy the rule. The rule shares the exact same structure as the view filter, so that structure is extracted into a single shared reference that both+view-set-filterandvisible_rulepoint to.Changes
visible_rulein the--questionsflag help for+form-questions-create/+form-questions-update, and transcribe the questions body (includingvisible_rule) into dry-run output so the preview reflects what is actually sent.skills/lark-base/references/lark-base-filter-condition.md) as the SSOT for the{logic, conditions}structure;lark-base-view-set-filter.mdnow references it instead of duplicating it.visible_rulesections to the form-questions create/update refs (only needed when the user asks for a display condition; note that+form-questions-listreturns it verbatim), and wire the new ref intoSKILL.md.visible_rulepassthrough on create/update/list, and add dry-run E2E coverage.Test Plan
go test ./shortcuts/base/, dry-run E2E undertests/cli_e2e/base/)lark-cli base +form-questions-create/-listflow works against a real Base (BOE), including creating and reading back a question with avisible_ruleRelated Issues
Summary by CodeRabbit
New Features
visible_ruleend-to-end (including list output and dry-run request previews).+form-questions-updatesupports full overwrite: omitted fields fall back/default, andvisible_rulecan be cleared withnull(or empty/omitted for always shown).Documentation
visible_rule/filter-condition reference (structure, operators, examples) and linked it from form/view docs.visible_ruleexamples and update semantics.Tests
visible_rulepassthrough and dry-run payload fidelity.