Skip to content

feat(base): add dashboard and form share shortcuts - #2282

Open
wanghm25 wants to merge 1 commit into
larksuite:mainfrom
wanghm25:codex/base-share-management-cli
Open

feat(base): add dashboard and form share shortcuts#2282
wanghm25 wants to merge 1 commit into
larksuite:mainfrom
wanghm25:codex/base-share-management-cli

Conversation

@wanghm25

@wanghm25 wanghm25 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

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

  • Add base +dashboard-share-get and base +dashboard-share-update.
  • Add base +form-share-get and base +form-share-update for share enablement, access scope, anonymous identity, and login requirements.
  • Support invite, tenant, and anyone for both dashboard and form --access-scope; invite is invite-only access and does not disable the share page.
  • Allow --allow-anonymous=true with --require-login=true; this means sign-in is required while the submitted identity is anonymized.
  • Reject deferred form submission-policy flags instead of mixing them into the share command family.
  • Keep no-change validation errors free of misleading param metadata and expose valid update flags through hint.
  • Lock explicit false PATCH behavior, invite-only scope, and login-plus-anonymous behavior with request-body and deployment-gated live E2E coverage.
  • Register the four shortcuts and document them in the bundled lark-base skill.

Test Plan

  • make build
  • make unit-test
  • make vet
  • make fmt-check
  • node scripts/skill-format-check/index.js
  • go test ./tests/cli_e2e/base -run '^TestBaseShare(DryRun|Workflow)$' -count=1 -v (all dry-run cases passed; live workflow skipped behind LARK_CLI_E2E_BASE_SHARE_READY=1)
  • go mod tidy leaves go.mod and go.sum unchanged
  • QUALITY_GATE_CHANGED_FROM=main make quality-gate after commit
  • golangci-lint, custom lint, lint tests, and license checks

Related Issues

  • None

Summary by CodeRabbit

  • New Features
    • Added commands to view and update sharing settings for Base forms and dashboards.
    • Supports enabling or disabling sharing, access scopes, anonymous submissions, login requirements, and dashboard sharing options.
    • Updates preserve explicitly selected values and provide dry-run support.
  • Bug Fixes
    • Added validation to prevent incomplete updates, unsupported access scopes, and disabling sharing alongside other changes.
  • Documentation
    • Updated Base guidance with form- and dashboard-sharing instructions.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Added 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.

Changes

Base sharing

Layer / File(s) Summary
Shared update validation and fields
shortcuts/base/share_common.go
Added shared access-scope constants, update validation, exclusive disabling checks, and request-body mapping for changed fields.
Form sharing shortcuts
shortcuts/base/form_share.go, shortcuts/base/share_execute_test.go
Added form share get/update commands with anonymous-submission and login settings. Tests cover endpoints, payloads, explicit false values, and validation.
Dashboard sharing shortcuts
shortcuts/base/dashboard_share.go, shortcuts/base/share_execute_test.go
Added dashboard share get/update commands with source visibility and automatic-analysis settings. Tests cover endpoints, payloads, explicit false values, and disabling rules.
Shortcut registration and end-to-end coverage
shortcuts/base/shortcuts.go, shortcuts/base/base_shortcuts_test.go, tests/cli_e2e/base/*, skills/lark-base/SKILL.md
Registered the four shortcuts. Added dry-run and workflow tests, updated coverage metrics, and documented sharing command semantics.

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
Loading

Suggested labels: documentation

Suggested reviewers: zgz2048, kongenpei

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% 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 clearly and concisely identifies the addition of dashboard and form sharing shortcuts, which is the main change.
Description check ✅ Passed The description includes the required Summary, Changes, Test Plan, and Related Issues sections with specific scope and verification details.
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 size/M Single-domain feat or fix with limited business impact and removed size/L Large or sensitive change across domains or core paths labels Aug 11, 2026
@wanghm25
wanghm25 force-pushed the codex/base-share-management-cli branch from b859a53 to 8fb71c2 Compare August 12, 2026 10:27
- 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
@wanghm25
wanghm25 marked this pull request as ready for review August 12, 2026 11:41
@wanghm25
wanghm25 force-pushed the codex/base-share-management-cli branch from 8fb71c2 to 063db15 Compare August 12, 2026 11:41

@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 `@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

📥 Commits

Reviewing files that changed from the base of the PR and between 5190cfd and 063db15.

📒 Files selected for processing (10)
  • shortcuts/base/base_shortcuts_test.go
  • shortcuts/base/dashboard_share.go
  • shortcuts/base/form_share.go
  • shortcuts/base/share_common.go
  • shortcuts/base/share_execute_test.go
  • shortcuts/base/shortcuts.go
  • skills/lark-base/SKILL.md
  • tests/cli_e2e/base/base_share_dryrun_test.go
  • tests/cli_e2e/base/base_share_workflow_test.go
  • tests/cli_e2e/base/coverage.md

Comment on lines +23 to +35
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`)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 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

@github-actions

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add wanghm25/cli#codex/base-share-management-cli -y -g

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/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant