feat: support bot identity - #2288
Conversation
📝 WalkthroughWalkthroughMinutes, Note, and VC shortcuts now support bot identity where configured. VC recording validation resolves identity-specific credentials. Tests and skill documentation cover identity continuity, permission handling, user-only transcript boundaries, and bot dry-run request flows. ChangesShortcut contracts and validation
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant Shortcut
participant CredentialResolver
participant LarkAPI
CLI->>Shortcut: Run command with --as bot
Shortcut->>CredentialResolver: Resolve token for the selected identity
CredentialResolver-->>Shortcut: Return token and scopes
Shortcut->>LarkAPI: Send bot-authenticated request
LarkAPI-->>CLI: Return shortcut output or permission error
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 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@58a4c8806b49eb53fadac244dc68417ee0dc5225🧩 Skill updatenpx skills add larksuite/cli#feat/support_bot_identity -y -g |
There was a problem hiding this comment.
Actionable comments posted: 7
🤖 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/vc/skill_docs_test.go`:
- Around line 45-80: Strengthen TestVCSearchIdentityDocsMatchAuthTypes and
TestVCBotShortcutsIdentityDocsMatchAuthTypes to compare exact AuthTypes slices:
VCSearch must be []string{"user"}, while VCDetail and VCRecording must each be
[]string{"user", "bot"}. Bind documentation assertions to each command’s
identity line, requiring +search to state user-only and +detail/+recording to
state --as bot support on their respective lines rather than relying on broad
document-level Contains checks.
In `@skills/lark-minutes/references/lark-minutes-apply-permission.md`:
- Around line 22-26: Update the parameter table in the permission-application
documentation to add the missing `--as <user|bot>` option, mark it as optional,
and document its default value consistently with the existing examples and
user/bot support.
In `@skills/lark-minutes/SKILL.md`:
- Around line 23-25: Propagate the inherited identity explicitly through every
workflow example that consumes a minute_token or note_id: in
skills/lark-minutes/SKILL.md lines 23-25, add the matching --as value to each
such example; in skills/lark-vc/references/lark-vc-recording.md lines 43-47, add
it to the downstream minutes +download example; in
skills/lark-vc/references/vc-domain-boundaries.md lines 102-103 and 116, add the
same identity to vc +detail, minutes +detail, docs +fetch, and the preferred
note +detail examples; after consent, use --as user for note +transcript at
lines 154-156.
- Line 25: Update the Minutes and VC skill documentation to replace raw `minutes
get` references with the normalized `minutes minutes get` command, including the
command reference in the shown default-identity guidance. Keep all other command
names and identity-option behavior unchanged.
In `@tests/cli_e2e/minutes/minutes_apply_permission_test.go`:
- Around line 45-60: Add direct assertions that the emitted identity field
equals "bot" in the dry-run request checks at
tests/cli_e2e/minutes/minutes_apply_permission_test.go:45-60,
tests/cli_e2e/minutes/minutes_detail_dryrun_test.go:25-42,
tests/cli_e2e/vc/vc_detail_dryrun_test.go:24-42, and both request-chain sites in
tests/cli_e2e/vc/vc_recording_dryrun_test.go:23-36 and 56-69, alongside the
existing request field assertions.
In `@tests/cli_e2e/minutes/minutes_detail_dryrun_test.go`:
- Around line 15-35: Update TestMinutesDetailDryRun_BotIdentity to remove the
--transcript argument so it only verifies bot access to minute metadata. Add a
separate bot transcript rejection test for minutes +detail that includes
--transcript and asserts the documented typed identity error metadata and
non-success result, preserving transcript access as user-only.
In `@tests/cli_e2e/vc/vc_recording_dryrun_test.go`:
- Around line 67-69: Replace the stdout substring assertions in the VC recording
dry-run test with direct request-chain assertions using clie2e.DryRunGet.
Validate each api.N request in order for the primary-calendar,
instance-relation, and recording sequence, including request count, HTTP
methods, and endpoint paths.
🪄 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: 1094ac48-148e-4ec6-b21e-b07340e66828
📒 Files selected for processing (32)
shortcuts/minutes/bot_identity_test.goshortcuts/minutes/minutes_apply_permission.goshortcuts/minutes/minutes_detail.goshortcuts/minutes/skill_docs_test.goshortcuts/note/note_detail.goshortcuts/note/note_test.goshortcuts/note/skill_docs_test.goshortcuts/vc/bot_identity_test.goshortcuts/vc/skill_docs_test.goshortcuts/vc/vc_detail.goshortcuts/vc/vc_notes.goshortcuts/vc/vc_recording.goshortcuts/vc/vc_recording_test.goskills/lark-doc/SKILL.mdskills/lark-minutes/SKILL.mdskills/lark-minutes/references/lark-minutes-apply-permission.mdskills/lark-minutes/references/lark-minutes-detail.mdskills/lark-minutes/references/lark-minutes-download.mdskills/lark-note/SKILL.mdskills/lark-note/references/lark-note-detail.mdskills/lark-note/references/lark-note-transcript.mdskills/lark-shared/SKILL.mdskills/lark-vc/SKILL.mdskills/lark-vc/references/lark-vc-detail.mdskills/lark-vc/references/lark-vc-recording.mdskills/lark-vc/references/vc-domain-boundaries.mdtests/cli_e2e/minutes/minutes_apply_permission_test.gotests/cli_e2e/minutes/minutes_detail_dryrun_test.gotests/cli_e2e/note/coverage.mdtests/cli_e2e/note/note_dryrun_test.gotests/cli_e2e/vc/vc_detail_dryrun_test.gotests/cli_e2e/vc/vc_recording_dryrun_test.go
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2288 +/- ##
==========================================
+ Coverage 76.44% 76.45% +0.01%
==========================================
Files 1013 1013
Lines 111957 112031 +74
==========================================
+ Hits 85588 85657 +69
- Misses 19859 19862 +3
- Partials 6510 6512 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
2e92814 to
58a4c88
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 `@skills/lark-vc/references/lark-vc-detail.md`:
- Around line 4-13: Update the vc detail command documentation around “--as bot”
to state that bot credentials must be configured before using this identity, in
addition to requiring access to the meeting. Keep the existing command examples
and permission guidance unchanged.
🪄 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: 6aadca04-d74f-4496-94be-0b9f0e83a3ec
📒 Files selected for processing (3)
skills/lark-minutes/references/lark-minutes-detail.mdskills/lark-vc/references/lark-vc-detail.mdskills/lark-vc/references/lark-vc-recording.md
🚧 Files skipped from review as they are similar to previous changes (2)
- skills/lark-minutes/references/lark-minutes-detail.md
- skills/lark-vc/references/lark-vc-recording.md
Resolve the SKILL.md conflict in favor of the restructured body, and relocate the two sections #2288 added to the old monolith into lark-shared-identity-and-permissions.md verbatim, at the same relative positions they held upstream: identity continuity across command workflows (after the identity-selection principles) and the missing-scope vs resource-ACL recovery table (inside the permission-failure section). No upstream sentence is dropped.
Summary
Changes
Test Plan
lark-cli <domain> <command>flow works as expectedRelated Issues
Summary by CodeRabbit
New Features
Documentation