fix(sheets): correct scope name from "sheets:spreadsheet:read" to "sheets:spreadsheet:readonly"#902
fix(sheets): correct scope name from "sheets:spreadsheet:read" to "sheets:spreadsheet:readonly"#902EvanYao826 wants to merge 3 commits into
Conversation
…eets:spreadsheet:readonly' The Feishu Open Platform uses 'sheets:spreadsheet:readonly' as the actual scope name for read access to spreadsheets. The incorrect scope 'sheets:spreadsheet:read' was hardcoded in all sheets shortcut commands, causing the local precheck to reject tokens that had the correct scopes. Fixed all 36 occurrences across 9 shortcut files, updated the registry test, and corrected the SKILL.md documentation table. Fixes larksuite#838
|
|
📝 WalkthroughWalkthroughReplaces all occurrences of the incorrect OAuth scope ChangesSheets OAuth Scope Correction
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
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 |
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 `@internal/registry/registry_test.go`:
- Around line 240-241: The test assertion message is stale: when checking
aaSet["sheets:spreadsheet:readonly"] in registry_test.go (inside the test that
verifies auto-approve sets), update the t.Error message to mention
"sheets:spreadsheet:readonly" instead of the old "sheets:spreadsheet:read" so
the failure message matches the checked scope (refer to aaSet and the
"sheets:spreadsheet:readonly" key to locate the assertion).
In `@shortcuts/sheets/lark_sheets_sheet_management.go`:
- Line 500: The Scopes slice incorrectly includes the non-existent scope
"sheets:spreadsheet:write_only"; replace that value with the official write
scope "sheets:spreadsheet" wherever it's used (e.g., the Scopes: []string{...}
declarations in this file) so that write permissions use "sheets:spreadsheet"
and read-only remains "sheets:spreadsheet:readonly"; update all occurrences
noted in the review (the other Scopes declarations around the same code paths)
to avoid using the custom "write_only" scope.
🪄 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: 5cc3906e-8b97-494f-9e56-4143b559c203
📒 Files selected for processing (11)
internal/registry/registry_test.goshortcuts/sheets/lark_sheets_cell_data.goshortcuts/sheets/lark_sheets_cell_images.goshortcuts/sheets/lark_sheets_cell_style_and_merge.goshortcuts/sheets/lark_sheets_dropdown.goshortcuts/sheets/lark_sheets_filter_views.goshortcuts/sheets/lark_sheets_float_images.goshortcuts/sheets/lark_sheets_row_column_management.goshortcuts/sheets/lark_sheets_sheet_management.goshortcuts/sheets/lark_sheets_spreadsheet_management.goskills/lark-sheets/SKILL.md
Address CodeRabbit review: the error message in TestLoadAutoApproveSet still referenced the old scope name.
|
I have read the CLA Document and I hereby sign the CLA |
|
@CLAassistant recheck please |
|
@CLAassistant recheck |
|
@CLAassistant recheck |
Summary
Fixes #838
The Feishu Open Platform uses
sheets:spreadsheet:readonlyas the actual scope name for read access to spreadsheets. The incorrect scopesheets:spreadsheet:readwas hardcoded in all sheets shortcut commands, causing the local precheck to reject tokens that had the correct scopes (:readonly,:write_only,:create).Changes
"sheets:spreadsheet:read"with"sheets:spreadsheet:readonly"across 9 sheets shortcut filesinternal/registry/registry_test.goto use the correct scope nameskills/lark-sheets/SKILL.mddocumentation tableFiles modified
shortcuts/sheets/lark_sheets_cell_data.goshortcuts/sheets/lark_sheets_cell_images.goshortcuts/sheets/lark_sheets_cell_style_and_merge.goshortcuts/sheets/lark_sheets_dropdown.goshortcuts/sheets/lark_sheets_filter_views.goshortcuts/sheets/lark_sheets_float_images.goshortcuts/sheets/lark_sheets_row_column_management.goshortcuts/sheets/lark_sheets_sheet_management.goshortcuts/sheets/lark_sheets_spreadsheet_management.gointernal/registry/registry_test.goskills/lark-sheets/SKILL.mdTesting
Verified that
scope_overrides.jsonalready containssheets:spreadsheet:readonlyin both the priority overrides and the recommend allow list, confirming this is the correct scope name.Summary by CodeRabbit
sheets:spreadsheet:readonly(and retainsheets:spreadsheet:write_onlywhere applicable).readonlyscope.