Skip to content

feat: support visible_rule for form questions - #1891

Merged
yballul-bytedance merged 1 commit into
larksuite:mainfrom
yballul-bytedance:feat/form-question-visible-rule
Jul 30, 2026
Merged

feat: support visible_rule for form questions#1891
yballul-bytedance merged 1 commit into
larksuite:mainfrom
yballul-bytedance:feat/form-question-visible-rule

Conversation

@yballul-bytedance

@yballul-bytedance yballul-bytedance commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

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-filter and visible_rule point to.

Changes

  • Document visible_rule in the --questions flag help for +form-questions-create / +form-questions-update, and transcribe the questions body (including visible_rule) into dry-run output so the preview reflects what is actually sent.
  • Add a shared filter-condition reference (skills/lark-base/references/lark-base-filter-condition.md) as the SSOT for the {logic, conditions} structure; lark-base-view-set-filter.md now references it instead of duplicating it.
  • Add visible_rule sections to the form-questions create/update refs (only needed when the user asks for a display condition; note that +form-questions-list returns it verbatim), and wire the new ref into SKILL.md.
  • Tests: pin flag help, verbatim visible_rule passthrough on create/update/list, and add dry-run E2E coverage.

Test Plan

  • Unit tests pass (go test ./shortcuts/base/, dry-run E2E under tests/cli_e2e/base/)
  • Manual local verification confirms the lark-cli base +form-questions-create/-list flow works against a real Base (BOE), including creating and reading back a question with a visible_rule

Related Issues

  • None

Summary by CodeRabbit

  • New Features

    • Form question create/update now preserves conditional visibility via visible_rule end-to-end (including list output and dry-run request previews).
    • +form-questions-update supports full overwrite: omitted fields fall back/default, and visible_rule can be cleared with null (or empty/omitted for always shown).
  • Documentation

    • Added a shared visible_rule/filter-condition reference (structure, operators, examples) and linked it from form/view docs.
    • Expanded CLI help and command guides with visible_rule examples and update semantics.
  • Tests

    • Added unit and CLI e2e coverage to verify visible_rule passthrough and dry-run payload fidelity.
    • Updated E2E coverage metrics.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Form question create and update commands preserve visible_rule in API and dry-run payloads. Flag descriptions and Lark Base references document the shared condition protocol, while unit and E2E tests validate list output, request bodies, and dry-run coverage.

Changes

Form visible rule support

Layer / File(s) Summary
Condition contract and command documentation
skills/lark-base/SKILL.md, skills/lark-base/references/lark-base-filter-condition.md, skills/lark-base/references/lark-base-form-questions-*.md, skills/lark-base/references/lark-base-view-set-filter.md
Documents the shared filter condition structure and its use for form question visible_rule, including references, updates, clearing, and supported values.
Command payload and dry-run forwarding
shortcuts/base/base_form_questions_create.go, shortcuts/base/base_form_questions_update.go
Adds visible_rule to flag descriptions and includes parsed questions data in create and update dry-run request bodies.
Passthrough and coverage validation
shortcuts/base/base_form_execute_test.go, shortcuts/base/base_shortcuts_test.go, tests/cli_e2e/base/base_form_questions_dryrun_test.go, tests/cli_e2e/base/coverage.md
Verifies list output, create/update request bodies, dry-run methods and endpoints, and updated coverage entries for visible_rule passthrough.

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
Loading

Possibly related PRs

  • larksuite/cli#1870: Introduces the dry-run success-envelope contract used by the new form-question dry-run assertions.

Suggested labels: domain/base, size/M

Suggested reviewers: liangshuo-1

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and directly describes the main change: adding visible_rule support for form questions.
Description check ✅ Passed The description includes all required sections and provides a clear summary, changes, test plan, and related issues.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added domain/base PR touches the base domain size/L Large or sensitive change across domains or core paths labels Jul 14, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
tests/cli_e2e/base/coverage.md (1)

53-56: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Align 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

📥 Commits

Reviewing files that changed from the base of the PR and between 8acd55e and 9e24135.

📒 Files selected for processing (11)
  • shortcuts/base/base_form_execute_test.go
  • shortcuts/base/base_form_questions_create.go
  • shortcuts/base/base_form_questions_update.go
  • shortcuts/base/base_shortcuts_test.go
  • skills/lark-base/SKILL.md
  • skills/lark-base/references/lark-base-filter-condition.md
  • skills/lark-base/references/lark-base-form-questions-create.md
  • skills/lark-base/references/lark-base-form-questions-update.md
  • skills/lark-base/references/lark-base-view-set-filter.md
  • tests/cli_e2e/base/base_form_questions_dryrun_test.go
  • tests/cli_e2e/base/coverage.md

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@cafa042e28a7244865cd65c6e7574ee0de93d318

🧩 Skill update

npx skills add yballul-bytedance/cli#feat/form-question-visible-rule -y -g

@yballul-bytedance
yballul-bytedance force-pushed the feat/form-question-visible-rule branch 2 times, most recently from 0fd0d04 to f753d1f Compare July 15, 2026 02:53
@yballul-bytedance
yballul-bytedance force-pushed the feat/form-question-visible-rule branch from f753d1f to 05209d4 Compare July 28, 2026 09:14

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between f753d1f and 05209d4.

📒 Files selected for processing (4)
  • shortcuts/base/base_form_execute_test.go
  • shortcuts/base/base_form_questions_create.go
  • shortcuts/base/base_form_questions_update.go
  • shortcuts/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

Comment thread shortcuts/base/base_form_questions_create.go
@yballul-bytedance
yballul-bytedance force-pushed the feat/form-question-visible-rule branch from 05209d4 to 3ccc19f Compare July 28, 2026 10:09

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 05209d4 and 3ccc19f.

📒 Files selected for processing (11)
  • shortcuts/base/base_form_execute_test.go
  • shortcuts/base/base_form_questions_create.go
  • shortcuts/base/base_form_questions_update.go
  • shortcuts/base/base_shortcuts_test.go
  • skills/lark-base/SKILL.md
  • skills/lark-base/references/lark-base-filter-condition.md
  • skills/lark-base/references/lark-base-form-questions-create.md
  • skills/lark-base/references/lark-base-form-questions-update.md
  • skills/lark-base/references/lark-base-view-set-filter.md
  • tests/cli_e2e/base/base_form_questions_dryrun_test.go
  • tests/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

Comment thread skills/lark-base/references/lark-base-view-set-filter.md
Comment thread skills/lark-base/SKILL.md
@yballul-bytedance
yballul-bytedance force-pushed the feat/form-question-visible-rule branch from 3ccc19f to 580e0eb Compare July 28, 2026 12:46
Comment thread skills/lark-base/references/lark-base-filter-condition.md Outdated
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>
@yballul-bytedance
yballul-bytedance merged commit 68a77ee into larksuite:main Jul 30, 2026
25 checks passed
@liangshuo-1 liangshuo-1 mentioned this pull request Jul 30, 2026
3 tasks
@liangshuo-1 liangshuo-1 mentioned this pull request Jul 31, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain/base PR touches the base domain size/L Large or sensitive change across domains or core paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants