feat: support bot identity for search shortcuts - #2194
Conversation
sa: safe doc: skills/lark-im, skills/lark-minutes cfg: none test: unit test, dry-run e2e, live TAT smoke
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
💤 Files with no reviewable changes (3)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR enables bot identity support for IM message search and Minutes search. It updates shortcut metadata, dry-run and integration tests, identity-restriction coverage, dry-run JSON parsing, and product documentation for user and bot execution paths. ChangesSearch identity support
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
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 |
There was a problem hiding this comment.
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-minutes/references/lark-minutes-search.md`:
- Around line 84-90: Update the permission and recovery guidance in the Lark
minutes search documentation to distinguish identities: recommend `lark-cli auth
login` only for user authentication and `me` resolution, while instructing bot
callers to verify the tenant access token and the application’s
`minutes:minutes.search:read` scope. Keep the existing user and bot
authentication behavior unchanged.
In `@tests/cli_e2e/im/message_search_tat_dryrun_test.go`:
- Around line 25-38: Add an assertion in the identity subtests for
tests/cli_e2e/im/message_search_tat_dryrun_test.go lines 25-38 and
tests/cli_e2e/minutes/minutes_search_dryrun_test.go lines 25-38 that the dry-run
identity field equals the loop’s identity value, using
clie2e.DryRunGet(result.Stdout, "identity").String() after validating the
command result.
🪄 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: 9630db48-84d5-469d-9bec-65354b72c56f
📒 Files selected for processing (13)
cmd/root_integration_test.goshortcuts/im/im_messages_search.goshortcuts/im/im_messages_search_execute_test.goshortcuts/minutes/minutes_search.goshortcuts/minutes/minutes_search_test.goskills/lark-im/SKILL.mdskills/lark-im/references/lark-im-chat-messages-list.mdskills/lark-im/references/lark-im-messages-search.mdskills/lark-minutes/SKILL.mdskills/lark-minutes/references/lark-minutes-search.mdtests/cli_e2e/im/message_search_tat_dryrun_test.gotests/cli_e2e/minutes/minutes_search_dryrun_test.gotests/plugin_e2e/restrict_test.go
|
Validation update:
|
sa: safe doc: skills/lark-im cfg: none test: unit test, dry-run e2e
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
shortcuts/minutes/minutes_search.go (1)
246-249: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winClarify the bot filter help.
Bot identity is now supported, but the adjacent
--owner-idsand--participant-idshelp text still tells every caller to use"me". A bot call with that value fails validation. State that"me"is user-only and that bot calls require an explicit useropen_id.🤖 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 `@shortcuts/minutes/minutes_search.go` around lines 246 - 249, Update the help text for the adjacent --owner-ids and --participant-ids options in the minutes search command to clarify that "me" is valid only for user authentication, while bot callers must provide an explicit user open_id. Keep the existing search behavior and option definitions unchanged.
🤖 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/im/im_messages_search_execute_test.go`:
- Around line 256-285: The test TestImMessagesSearchWarnsOnChatEnrichmentFailure
currently fails the only chat batch and does not cover preservation of earlier
results. Update its fixtures to include more than chatBatchQuerySize distinct
chat IDs, return successful chat context for the first batch, fail the
subsequent batch, and assert the search output retains the first batch’s context
while stderr contains the enrichment warning.
- Around line 235-251: Update the error-path assertions in
shortcuts/im/im_messages_search_execute_test.go:235-251 and
shortcuts/minutes/minutes_search_test.go:231-244 to call errs.ProblemOf and
verify the expected category and subtype; in the minutes test, retain the
ValidationError.Param assertion, and in both tests assert the preserved cause
when provided. Keep errors.As for type-specific fields such as
PermissionError.Identity and ValidationError.Param.
In `@shortcuts/minutes/minutes_search.go`:
- Around line 96-98: Add table-driven coverage for the request-builder path by
invoking buildMinutesSearchBody or buildMinutesSearchFilter with a bot identity
and the "Me" value, and assert that it rejects the request directly. Keep the
existing MinutesSearch.Validate coverage, ensuring the new test verifies the
validation used by both DryRun and Execute paths.
In `@tests/cli_e2e/minutes/minutes_search_dryrun_test.go`:
- Around line 65-68: Expand the validation assertions in the minutes search
dry-run test to verify result.Stderr.error.type and result.Stderr.error.message
directly, and assert that result.Stdout is empty. Keep the existing subtype,
parameter, and hint checks, preserving the complete structured error envelope
and stdout behavior.
---
Outside diff comments:
In `@shortcuts/minutes/minutes_search.go`:
- Around line 246-249: Update the help text for the adjacent --owner-ids and
--participant-ids options in the minutes search command to clarify that "me" is
valid only for user authentication, while bot callers must provide an explicit
user open_id. Keep the existing search behavior and option definitions
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: beeffbd4-2912-4bdf-8392-927560db4e62
📒 Files selected for processing (7)
shortcuts/im/im_messages_search.goshortcuts/im/im_messages_search_execute_test.goshortcuts/minutes/minutes_search.goshortcuts/minutes/minutes_search_test.goskills/lark-im/references/lark-im-message-enrichment.mdskills/lark-im/references/lark-im-messages-search.mdtests/cli_e2e/minutes/minutes_search_dryrun_test.go
This reverts commit 34ddb5b.
PR Quality SummaryCI did not complete successfully. Use the failed check links below to decide whether this PR needs a code change or a rerun. Failed checks
deterministic-gate
|
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@f85424bdc323db6b0ce603bee39210f947d6ffbd🧩 Skill updatenpx skills add arnold9672/cli#feat/search-tat-bot-identity -y -g |
#2194 extended `im +messages-search` to `AuthTypes: {user, bot}` but left the affordance example and the skill reference asserting user-only, so the dual-identity guard added by #2199 fails on main. sa: safe doc: affordance/im.md, skills/lark-im cfg: none test: go test -race ./cmd/... ./internal/... ./shortcuts/... ./extension/...
#2194 extended `im +messages-search` to `AuthTypes: {user, bot}` but left the affordance example and the skill reference asserting user-only, so the dual-identity guard added by #2199 fails on main. sa: safe doc: affordance/im.md, skills/lark-im cfg: none test: go test -race ./cmd/... ./internal/... ./shortcuts/... ./extension/...
* feat: support bot identity for search shortcuts sa: safe doc: skills/lark-im, skills/lark-minutes cfg: none test: unit test, dry-run e2e, live TAT smoke * test: assert dry-run search identities * fix: validate bot search filters and enrichment scopes sa: safe doc: skills/lark-im cfg: none test: unit test, dry-run e2e * Revert "fix: validate bot search filters and enrichment scopes" This reverts commit 34ddb5b. Co-authored-by: TRAE CLI <traecli@bytedance.com>
sa: safe
doc: skills/lark-im, skills/lark-minutes
cfg: none
test: unit test, dry-run e2e, live TAT smoke
Summary
im +messages-searchandminutes +searchso TAT calls can pass CLI identity checks.Verification
git diff --check origin/main..HEADgo test ./shortcuts/im ./shortcuts/minutes ./cmd -run 'TestImMessagesSearch|TestMinutesSearch|TestIntegration_StrictModeBot_ProfileOverride'\n-go test ./tests/plugin_e2e -run 'TestLegacyRestrictReasonCodesRemainVisible|TestIdentityMismatchDenial'\n-LARK_CLI_BIN=/Users/jiahongnan/goworkspace/src/github.com/larksuite/cli/.harness_local/lark-cli-test go test ./tests/cli_e2e/im ./tests/cli_e2e/minutes -run 'TestIMMessagesSearchDryRunSupportsUserAndBotIdentity|TestMinutesSearchDryRunSupportsUserAndBotIdentity'\n- Live TAT smoke with test app: message search and minutes search returnedok=true, identity=bot.Summary by CodeRabbit
New Features
mefilters.Documentation
Tests