feat(drive): add +permission-get-setting shortcut - #1738
Conversation
|
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 (9)
📝 WalkthroughWalkthroughThis PR adds a new ChangesPermission get setting shortcut
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant DrivePermissionGetSetting
participant readDrivePermissionGetSettingSpec
participant OpenAPI
User->>DrivePermissionGetSetting: run with --token or --url
DrivePermissionGetSetting->>readDrivePermissionGetSettingSpec: parse and validate input
readDrivePermissionGetSettingSpec-->>DrivePermissionGetSetting: Token/Type spec
DrivePermissionGetSetting->>OpenAPI: GET permissions/{token}/public
OpenAPI-->>DrivePermissionGetSetting: permission_public response
DrivePermissionGetSetting-->>User: formatted output
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@8b50be52311a59878156ebd12ef3fc1665043e4f🧩 Skill updatenpx skills add larksuite/cli#feat/drive-folder-permission-get -y -g |
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 `@shortcuts/drive/drive_folder_permission_get.go`:
- Around line 21-64: The validation errors in readDriveFolderPermissionGetSpec
mix the failing input with recovery guidance in the message, which should be
moved to .WithHint(...). Update the checks around rawURL/rawToken, the
unsupported URL case, and the non-folder ref.Type branch so the error message
only states what failed and .WithHint(...) carries guidance like which flag to
pass or what folder URL format is accepted; keep the param on the actual failing
input such as --url or --folder-token.
- Around line 87-95: The driveFolderPermissionGetSpec.output method is falling
back to the entire data map when permission_public is missing, which reshapes
the output unexpectedly; update output to return only the nested
permission_public object (or an empty/absent value) instead of data, and keep
the behavior localized to driveFolderPermissionGetSpec.output and common.GetMap
handling. Add a test covering the missing permission_public case to verify the
response does not expose unrelated top-level fields.
🪄 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: 57f56f6c-bd78-4676-8c24-5648173b585e
📒 Files selected for processing (9)
shortcuts/drive/drive_folder_permission_get.goshortcuts/drive/drive_folder_permission_get_test.goshortcuts/drive/shortcuts.goshortcuts/drive/shortcuts_test.goskills/lark-drive/SKILL.mdskills/lark-drive/references/lark-drive-folder-permission-get.mdskills/lark-drive/references/lark-drive-workflow-permission-governance-commands.mdskills/lark-drive/references/lark-drive-workflow-permission-governance.mdtests/cli_e2e/drive/drive_folder_permission_get_dryrun_test.go
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1738 +/- ##
==========================================
+ Coverage 75.18% 75.19% +0.01%
==========================================
Files 913 914 +1
Lines 96656 96781 +125
==========================================
+ Hits 72671 72776 +105
- Misses 18395 18407 +12
- Partials 5590 5598 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
6af0efc to
d7b3445
Compare
bf93327 to
ec73d34
Compare
Add a Drive shortcut for reading public permission settings across supported documents, files, folders, and wiki nodes. Resolve URLs into typed resources, preserve permission_public output for machine consumers, and document the shortcut in the permission-governance workflow. Key features: - Infer resource type and token from supported Drive URLs while requiring --type for bare tokens - Query the Drive v2 public permission endpoint with typed validation and user or bot identity - Support folder permission inspection without recursing into child resources - Add unit, dry-run E2E, live workflow, output, and skill guidance coverage
Harden +permission-get-setting after review findings so callers receive only the documented permission payload and folder support is verified against the live workflow. This prevents malformed responses from being presented as permission settings and keeps the command guidance aligned with the shortcut contract. Key fixes: - Reject responses without data.permission_public instead of projecting arbitrary payload fields - Render complete permission settings in pretty output and mark --token required - Exercise a created Drive folder in the live workflow and add the command reference - Correct folder resolution guidance while retaining the shortcut's documented URL forms
19557f0 to
8b50be5
Compare
Add a Drive shortcut for reading a folder's own public permission settings through the v2 permission endpoint. This gives agents a typed, folder-specific path when raw permission.public get does not accept folder targets, without turning folder permission checks into recursive governance scans.
Key features:
Accept exactly one folder locator through --url or --folder-token and validate non-folder inputs before API calls
Return permission_public unchanged so callers can reason from server-provided fields
Register the shortcut and cover unit plus dry-run E2E behavior
Document when to use +folder-permission-get in lark-drive permission workflows
Summary
Changes
Test Plan
lark-cli <domain> <command>flow works as expectedRelated Issues
Summary by CodeRabbit
New Features
Documentation
Bug Fixes
Tests