fix(calendar): support bot identity in +search-event#2010
Conversation
|
|
aa56a91 to
b45cbfe
Compare
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughCalendar event search now supports bot authentication. Documentation clarifies user and bot calendar access scopes, while end-to-end tests cover bot request generation and searching for a newly created event. ChangesCalendar search bot support
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant E2ETest
participant CLI
participant CalendarAPI
E2ETest->>CLI: Create searchable event as bot
CLI->>CalendarAPI: Create event
CalendarAPI-->>CLI: Return event_id
E2ETest->>CLI: Run +search-event as bot
CLI->>CalendarAPI: Search events
CalendarAPI-->>CLI: Return matching event_id
E2ETest->>CLI: Delete event during cleanup
CLI->>CalendarAPI: Delete event
Possibly related PRs
Suggested reviewers: ✨ 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 |
Summary
calendar +search-eventrejects bot identity during local shortcut validation, even though the underlying Search Event API and the generatedcalendar events search_eventcommand support bot access. This prevents agents from locating events in calendars accessible to the application, including events created and managed by the application itself.Official API: https://open.larkoffice.com/document/server-docs/calendar-v4/calendar-event/search
Evidence
The generated command schema advertises both identities:
{ "access_tokens": ["bot", "user"] }Before this change, the shortcut fails before making an API request:
The generated command succeeds with the same bot identity and returns an event created in the application's primary calendar:
After changing the shortcut identity declaration, a locally built CLI successfully finds the same event through
calendar +search-event --as bot.This isolates the failure to the shortcut's local
AuthTypesdeclaration rather than the Open Platform API or application permissions.Scope and permission boundary
This change does not expand calendar visibility. User identity continues to search calendars accessible to the user; bot identity searches only calendars accessible to the application. Bot identity does not automatically gain access to users' personal calendars.
Changes
calendar +search-eventto run withuserorbotidentity.+search-event, then clean it up.Test Plan
make unit-testgo vet ./...gofmt -l .produces no outputgo mod tidyproduces nogo.mod/go.sumchangesgolangci-lint --new-from-rev=origin/mainreports0 issuesRelated Issues
Summary by CodeRabbit
New Features
Documentation
Tests