fix(sheets): replace unreal :read scope with :readonly in shortcuts#909
fix(sheets): replace unreal :read scope with :readonly in shortcuts#909EthanGuo-coder wants to merge 1 commit into
Conversation
All sheets shortcuts declared sheets:spreadsheet:read, but that scope does not exist on the Feishu Open Platform; the real name is sheets:spreadsheet:readonly. The framework's preflight does exact-string scope matching, so tokens carrying the correct readonly / write_only / create scopes were rejected with a misleading missing-scope hint and the shortcut layer became unusable. Replace 35 occurrences across 9 shortcuts/sheets/*.go files and 3 in internal/registry/registry_test.go. Add two regression tests: one guarding the literal scope string, one feeding a real-Feishu-scope token through auth.MissingScopes against every sheets-only shortcut. Fixes larksuite#838 Co-Authored-By: Claude <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (11)
📝 WalkthroughWalkthroughThis PR corrects OAuth scope names across all 38 Sheets shortcuts by replacing the non-existent ChangesSheets OAuth Scope Alignment
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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
All
lark-cli sheetsshortcuts declaredsheets:spreadsheet:readas a required scope, but that scope name does not exist on the Feishu Open Platform — the real name issheets:spreadsheet:readonly. Because the framework's preflight (internal/auth/scope.goMissingScopes) does exact-string scope matching, tokens that carried the correct:readonly/:write_only/:createscopes were rejected with a misleadingmissing required scope(s): sheets:spreadsheet:readhint, and the entire sheets shortcut layer was unusable.Changes
sheets:spreadsheet:readwithsheets:spreadsheet:readonlyin every sheets shortcut declaration (35 occurrences across 9 files undershortcuts/sheets/).internal/registry/registry_test.goso the auto-approve-set test reflects the real scope name.shortcuts/sheets/shortcuts_test.go:TestShortcuts_NoUnrealReadScope— walks every registered sheets shortcut and fails if any re-declares the unreal:readform.TestShortcuts_PrecheckAcceptsFeishuSheetsScopes— feeds a token granted the documented Feishu sheets scopes (:create/:readonly/:write_only) throughauth.MissingScopesagainst every sheets-only shortcut'sScopes, and fails if any shortcut is rejected. This pins the precheck behaviour the issue reported.Test Plan
go test ./shortcuts/sheets/...passes (both new tests included).go test ./internal/registry/...passes.TestShortcuts_PrecheckAcceptsFeishuSheetsScopeshermetically verifies thatlark-cli sheets +read/+write/+append/+find(and every other sheets-only shortcut) no longer reject tokens holdingsheets:spreadsheet:readonly/:write_only/:create.Related Issues
Summary by CodeRabbit
sheets:spreadsheet:readonlyvariant instead of the deprecatedsheets:spreadsheet:readscope across read, write, styling, filtering, and management shortcuts.