Skip to content

feat: support bot identity - #2288

Merged
zhangjun-bytedance merged 1 commit into
mainfrom
feat/support_bot_identity
Aug 11, 2026
Merged

feat: support bot identity#2288
zhangjun-bytedance merged 1 commit into
mainfrom
feat/support_bot_identity

Conversation

@zhangjun-bytedance

@zhangjun-bytedance zhangjun-bytedance commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

Changes

  • Change 1
  • Change 2

Test Plan

  • Unit tests pass
  • Manual local verification confirms the lark-cli <domain> <command> flow works as expected

Related Issues

  • None

Summary by CodeRabbit

  • New Features

    • Added bot identity support for VC details, notes, and recordings; Minutes details and permission requests; and Note details.
    • Added bot-compatible dry-run workflows for previewing requests, artifacts, permissions, and calendar-based recording lookups.
  • Documentation

    • Clarified identity continuity across related commands and workflows.
    • Added guidance for bot permissions, scope errors, and explicit consent before switching identities.
    • Documented that Note transcripts remain user-only.

@github-actions github-actions Bot added domain/ccm PR touches the ccm domain domain/vc PR touches the vc domain size/L Large or sensitive change across domains or core paths labels Aug 11, 2026
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Minutes, 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.

Changes

Shortcut contracts and validation

Layer / File(s) Summary
Minutes and Note identity contracts
shortcuts/minutes/..., shortcuts/note/...
Minutes and Note detail and permission commands support bot identity. Note transcripts remain user-only. Tests verify authentication contracts, request flows, validation errors, and documentation.
VC identity and credential resolution
shortcuts/vc/...
VC detail, notes, and recording support bot identity. Recording validation resolves tokens through runtime.Factory.Credential.ResolveToken and checks identity-specific scopes.
Identity continuity documentation
skills/lark-*/...
Skill documentation defines explicit identity propagation, permission recovery, bot scope handling, and consent before switching from bot to user.
End-to-end bot dry-run validation
tests/cli_e2e/...
Dry-run tests verify bot identity, request paths, permission payloads, output data, help text, and calendar-event request chains.

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
Loading

Possibly related PRs

  • larksuite/cli#2257: Aligns shortcut-declared AuthTypes with --as behavior and help or completion output.
  • larksuite/cli#2278: Expands related bot-identity changes across the same shortcuts, tests, and documentation.

Suggested reviewers: liangshuo-1

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description keeps the required headings but contains placeholder change items and an uncompleted test plan. Replace the placeholders with a summary of the bot identity changes, list the actual changes, and mark or update the test plan with completed verification details.
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 (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: adding bot identity support.
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
  • Commit unit tests in branch feat/support_bot_identity

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 commented Aug 11, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add larksuite/cli#feat/support_bot_identity -y -g

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

📥 Commits

Reviewing files that changed from the base of the PR and between 82e628b and 2e92814.

📒 Files selected for processing (32)
  • shortcuts/minutes/bot_identity_test.go
  • shortcuts/minutes/minutes_apply_permission.go
  • shortcuts/minutes/minutes_detail.go
  • shortcuts/minutes/skill_docs_test.go
  • shortcuts/note/note_detail.go
  • shortcuts/note/note_test.go
  • shortcuts/note/skill_docs_test.go
  • shortcuts/vc/bot_identity_test.go
  • shortcuts/vc/skill_docs_test.go
  • shortcuts/vc/vc_detail.go
  • shortcuts/vc/vc_notes.go
  • shortcuts/vc/vc_recording.go
  • shortcuts/vc/vc_recording_test.go
  • skills/lark-doc/SKILL.md
  • skills/lark-minutes/SKILL.md
  • skills/lark-minutes/references/lark-minutes-apply-permission.md
  • skills/lark-minutes/references/lark-minutes-detail.md
  • skills/lark-minutes/references/lark-minutes-download.md
  • skills/lark-note/SKILL.md
  • skills/lark-note/references/lark-note-detail.md
  • skills/lark-note/references/lark-note-transcript.md
  • skills/lark-shared/SKILL.md
  • skills/lark-vc/SKILL.md
  • skills/lark-vc/references/lark-vc-detail.md
  • skills/lark-vc/references/lark-vc-recording.md
  • skills/lark-vc/references/vc-domain-boundaries.md
  • tests/cli_e2e/minutes/minutes_apply_permission_test.go
  • tests/cli_e2e/minutes/minutes_detail_dryrun_test.go
  • tests/cli_e2e/note/coverage.md
  • tests/cli_e2e/note/note_dryrun_test.go
  • tests/cli_e2e/vc/vc_detail_dryrun_test.go
  • tests/cli_e2e/vc/vc_recording_dryrun_test.go

Comment thread shortcuts/vc/skill_docs_test.go
Comment thread skills/lark-minutes/references/lark-minutes-apply-permission.md
Comment thread skills/lark-minutes/SKILL.md
Comment thread skills/lark-minutes/SKILL.md
Comment thread tests/cli_e2e/minutes/minutes_apply_permission_test.go
Comment thread tests/cli_e2e/minutes/minutes_detail_dryrun_test.go
Comment thread tests/cli_e2e/vc/vc_recording_dryrun_test.go
@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.45%. Comparing base (a18ccd6) to head (58a4c88).
⚠️ Report is 3 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zhangjun-bytedance
zhangjun-bytedance force-pushed the feat/support_bot_identity branch from 2e92814 to 58a4c88 Compare August 11, 2026 07:03

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2e92814 and 58a4c88.

📒 Files selected for processing (3)
  • skills/lark-minutes/references/lark-minutes-detail.md
  • skills/lark-vc/references/lark-vc-detail.md
  • skills/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

Comment thread skills/lark-vc/references/lark-vc-detail.md
@zhangjun-bytedance
zhangjun-bytedance merged commit 6d6b688 into main Aug 11, 2026
43 of 58 checks passed
@zhangjun-bytedance
zhangjun-bytedance deleted the feat/support_bot_identity branch August 11, 2026 07:44
leave330 added a commit that referenced this pull request Aug 11, 2026
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.
@liangshuo-1 liangshuo-1 mentioned this pull request Aug 11, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain/ccm PR touches the ccm domain domain/vc PR touches the vc 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