feat(base): add dashboard and form share shortcuts - #2282
Conversation
📝 WalkthroughWalkthroughAdded Base form and dashboard sharing get/update shortcuts. The commands support partial PATCH updates, explicit boolean values, validation, dry-run output, API execution, shortcut registration, skill guidance, and CLI end-to-end coverage. ChangesBase sharing
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant BaseFormShareUpdate
participant FormShareEndpoint
CLI->>BaseFormShareUpdate: provide form identifiers and changed flags
BaseFormShareUpdate->>FormShareEndpoint: PATCH form share settings
FormShareEndpoint-->>BaseFormShareUpdate: return share response
BaseFormShareUpdate-->>CLI: output response data
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 |
b859a53 to
8fb71c2
Compare
- preserve explicit false values and validate partial share updates - add dry-run and deployment-gated live E2E coverage - document share routing in the bundled Base skill
8fb71c2 to
063db15
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 `@tests/cli_e2e/base/base_share_dryrun_test.go`:
- Around line 23-35: Strengthen the “dashboard partial update” test and the
corresponding partial-update cases to assert the complete PATCH contract: verify
the expected PATCH URL and confirm each request body omits fields not supplied
by that invocation, including any unspecified enabled field. Keep the existing
assertions for supplied values and use the captured request output from
runBaseDryRun.
🪄 Autofix
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: 34701898-499d-4f9b-ae12-2853717ea056
📒 Files selected for processing (10)
shortcuts/base/base_shortcuts_test.goshortcuts/base/dashboard_share.goshortcuts/base/form_share.goshortcuts/base/share_common.goshortcuts/base/share_execute_test.goshortcuts/base/shortcuts.goskills/lark-base/SKILL.mdtests/cli_e2e/base/base_share_dryrun_test.gotests/cli_e2e/base/base_share_workflow_test.gotests/cli_e2e/base/coverage.md
| t.Run("dashboard partial update", func(t *testing.T) { | ||
| result := runBaseDryRun(t, 0, | ||
| "base", "+dashboard-share-update", | ||
| "--base-token", "app_x", | ||
| "--dashboard-id", "dsh_1", | ||
| "--access-scope", "invite", | ||
| "--show-source=false", | ||
| "--enable-auto-analysis=true", | ||
| ) | ||
| assert.Contains(t, result.Stdout, `"method": "PATCH"`) | ||
| assert.Contains(t, result.Stdout, `"access_scope": "invite"`) | ||
| assert.Contains(t, result.Stdout, `"show_source": false`) | ||
| assert.Contains(t, result.Stdout, `"enable_auto_analysis": true`) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Assert the complete PATCH request contract.
These checks only assert positive output fragments. A regression can route PATCH to a different endpoint or emit an unspecified enabled field and still pass.
Assert each PATCH URL. Assert that omitted fields are absent from each partial-update body.
Proposed test additions
assert.Contains(t, result.Stdout, `"method": "PATCH"`)
+assert.Contains(t, result.Stdout, "/open-apis/base/v3/bases/app_x/dashboards/dsh_1/share")
+assert.NotContains(t, result.Stdout, `"enabled":`)
assert.Contains(t, result.Stdout, `"access_scope": "invite"`)
assert.Contains(t, result.Stdout, `"method": "PATCH"`)
+assert.Contains(t, result.Stdout, "/open-apis/base/v3/bases/app_x/tables/tbl_1/forms/vew_1/share")
+assert.NotContains(t, result.Stdout, `"enabled":`)
assert.Contains(t, result.Stdout, `"access_scope": "anyone"`)As per coding guidelines, “Every behavior change requires a nearby regression test that fails when the implementation is reverted.”
Also applies to: 49-62
🤖 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/base_share_dryrun_test.go` around lines 23 - 35,
Strengthen the “dashboard partial update” test and the corresponding
partial-update cases to assert the complete PATCH contract: verify the expected
PATCH URL and confirm each request body omits fields not supplied by that
invocation, including any unspecified enabled field. Keep the existing
assertions for supplied values and use the captured request output from
runBaseDryRun.
Source: Coding guidelines
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@063db150b9d2cac0d48ac83a5edac79d49e6520b🧩 Skill updatenpx skills add wanghm25/cli#codex/base-share-management-cli -y -g |
Summary
Add first-class Base shortcuts for dashboard and form share management, covering share switches, invite-only/tenant/anyone access scopes, dashboard source/AI options, and form anonymous/login access settings. Form submission limits and notifications are intentionally kept outside the share command family. The PR remains in draft until the matching Base v3 OpenAPI is deployed.
Changes
base +dashboard-share-getandbase +dashboard-share-update.base +form-share-getandbase +form-share-updatefor share enablement, access scope, anonymous identity, and login requirements.invite,tenant, andanyonefor both dashboard and form--access-scope;inviteis invite-only access and does not disable the share page.--allow-anonymous=truewith--require-login=true; this means sign-in is required while the submitted identity is anonymized.parammetadata and expose valid update flags throughhint.falsePATCH behavior, invite-only scope, and login-plus-anonymous behavior with request-body and deployment-gated live E2E coverage.lark-baseskill.Test Plan
make buildmake unit-testmake vetmake fmt-checknode scripts/skill-format-check/index.jsgo test ./tests/cli_e2e/base -run '^TestBaseShare(DryRun|Workflow)$' -count=1 -v(all dry-run cases passed; live workflow skipped behindLARK_CLI_E2E_BASE_SHARE_READY=1)go mod tidyleavesgo.modandgo.sumunchangedQUALITY_GATE_CHANGED_FROM=main make quality-gateafter commitRelated Issues
Summary by CodeRabbit