Skip to content

fix: support bot identity for drive search#1670

Merged
fangshuyu-768 merged 1 commit into
mainfrom
feat/drive-search-app-identity
Jun 30, 2026
Merged

fix: support bot identity for drive search#1670
fangshuyu-768 merged 1 commit into
mainfrom
feat/drive-search-app-identity

Conversation

@liujinkun2025

@liujinkun2025 liujinkun2025 commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Enable drive +search to run with bot identity so app-only configurations can use Search v2 doc/wiki search without being blocked by identity pruning. The current-user convenience filters remain documented as requiring a user open_id.

Changes

  • Add bot identity support to drive +search.
  • Add unit coverage for the shortcut identity declaration.
  • Add dry-run E2E coverage for drive +search --as bot.
  • Update the shortcut-specific drive search skill reference with the user/bot identity boundary.

Test Plan

  • Unit tests pass: go test ./shortcuts/drive
  • Dry-run E2E passes: go test ./tests/cli_e2e/drive -run TestDriveSearchDryRun
  • Manual local verification confirms the lark-cli drive +search --as bot --dry-run flow works as expected

Related Issues

  • None

Summary by CodeRabbit

  • New Features
    • Drive search now supports both user and bot authentication identities.
  • Documentation
    • Updated drive +search documentation to clarify identity boundary behavior and how to use explicit identity options when searching.
  • Tests
    • Added unit coverage to confirm drive search advertises support for both user and bot.
    • Added an end-to-end dry-run test ensuring bot-identity search requests are constructed correctly and reflected in CLI output.

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

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 35205579-f98a-4159-8f2c-7b5871fb4b21

📥 Commits

Reviewing files that changed from the base of the PR and between acff247 and f47339f.

📒 Files selected for processing (4)
  • shortcuts/drive/drive_search.go
  • shortcuts/drive/shortcuts_test.go
  • skills/lark-drive/references/lark-drive-search.md
  • tests/cli_e2e/drive/drive_search_dryrun_test.go
✅ Files skipped from review due to trivial changes (1)
  • skills/lark-drive/references/lark-drive-search.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • shortcuts/drive/drive_search.go
  • shortcuts/drive/shortcuts_test.go
  • tests/cli_e2e/drive/drive_search_dryrun_test.go

📝 Walkthrough

Walkthrough

DriveSearch.AuthTypes now includes bot in addition to user. Tests cover the new value in unit and e2e dry-run paths, and the drive search reference doc now describes user and bot identity usage.

Changes

Bot identity support for drive +search

Layer / File(s) Summary
AuthTypes field and unit test
shortcuts/drive/drive_search.go, shortcuts/drive/shortcuts_test.go
DriveSearch.AuthTypes adds "bot"; a new parallel unit test asserts the exact []string{"user", "bot"} value via reflect.DeepEqual.
E2E dry-run test for bot identity
tests/cli_e2e/drive/drive_search_dryrun_test.go
TestDriveSearchDryRun_BotIdentity runs drive +search with DefaultAs: "bot" in dry-run mode and checks the HTTP method, URL, body query, and --as bot wiring.
Reference doc identity boundary update
skills/lark-drive/references/lark-drive-search.md
Intro updated to mention both user and application identity; new paragraph documents --as user/--as bot switching and creator-id flag guidance when bot lacks a configured open_id.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

  • larksuite/cli#658: Introduced the original DriveSearch shortcut in shortcuts/drive/drive_search.go, the same variable modified by this PR.

Suggested reviewers

  • fangshuyu-768
  • SunPeiYang996

Poem

🐇 A bunny hopped through search by moonlit glow,
With user and bot, the drive can now both go.
A test in paw, a doc in tow,
The search path learned a new identity flow.
Hoppy queries, tidy and bright,
Two auth modes hopping left and right.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% 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 describes the main change: enabling bot identity support for drive search.
Description check ✅ Passed The description matches the template and includes summary, changes, test plan, and related issues.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/drive-search-app-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.

@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.73%. Comparing base (22108c3) to head (f47339f).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1670      +/-   ##
==========================================
+ Coverage   74.71%   74.73%   +0.02%     
==========================================
  Files         810      811       +1     
  Lines       81881    81965      +84     
==========================================
+ Hits        61178    61258      +80     
- Misses      16135    16138       +3     
- Partials     4568     4569       +1     

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

@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add larksuite/cli#feat/drive-search-app-identity -y -g

@liujinkun2025
liujinkun2025 force-pushed the feat/drive-search-app-identity branch from 08af4ba to acff247 Compare June 30, 2026 07:19

@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/drive/drive_search_dryrun_test.go`:
- Around line 173-195: The dry-run test for drive search is still only
validating a request shape that matches the user path, so it does not prove the
bot identity path is used. Update the test around clie2e.RunCmd for drive
+search to assert a bot-specific observable signal from the recorded output,
such as the emitted identity/as field in the dry-run payload if available, so
the case actually verifies DefaultAs: "bot" and the --as bot behavior.
🪄 Autofix (Beta)

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

Run ID: 0e067c58-56bd-4415-8b71-6dd68086faee

📥 Commits

Reviewing files that changed from the base of the PR and between 22108c3 and acff247.

📒 Files selected for processing (4)
  • shortcuts/drive/drive_search.go
  • shortcuts/drive/shortcuts_test.go
  • skills/lark-drive/references/lark-drive-search.md
  • tests/cli_e2e/drive/drive_search_dryrun_test.go

Comment thread tests/cli_e2e/drive/drive_search_dryrun_test.go
@liujinkun2025
liujinkun2025 force-pushed the feat/drive-search-app-identity branch from acff247 to f47339f Compare June 30, 2026 09:08
@fangshuyu-768
fangshuyu-768 merged commit 214318a into main Jun 30, 2026
42 of 44 checks passed
@fangshuyu-768
fangshuyu-768 deleted the feat/drive-search-app-identity branch June 30, 2026 13:59
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 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