fix(wiki): reuse 131006 terminal guidance on copy and move - #2349
fix(wiki): reuse 131006 terminal guidance on copy and move#2349ViperCai wants to merge 1 commit into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughWiki permission handling now classifies error ChangesWiki permission-denied handling
Estimated code review effort: 3 (Moderate) | ~25 minutes Merge Risk: ⚪ Minimal · up to The PR centralizes terminal permission guidance for Wiki copy and move operations and adds tests and documentation; no actionable merge-blocking risk remains beyond normal checks and review. Sequence Diagram(s)sequenceDiagram
participant WikiOperation
participant WikiAPI
participant PermissionAnnotation
participant TaskPoller
WikiOperation->>WikiAPI: Execute Wiki operation
WikiAPI-->>WikiOperation: Return error 131006
WikiOperation->>PermissionAnnotation: Apply operation-specific hint
PermissionAnnotation-->>WikiOperation: Return terminal annotated error
TaskPoller->>PermissionAnnotation: Classify task permission error
PermissionAnnotation-->>TaskPoller: Stop polling without retry
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@336e39d9edd723fa0af28a637d52f40a0361b80c🧩 Skill updatenpx skills add larksuite/cli#fix/wiki-copy-move-permission-guidance -y -g |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2349 +/- ##
==========================================
+ Coverage 76.35% 76.44% +0.08%
==========================================
Files 1043 1046 +3
Lines 114771 115134 +363
==========================================
+ Hits 87638 88016 +378
+ Misses 20385 20366 -19
- Partials 6748 6752 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
dc3816e to
d3ec09e
Compare
| // on the relevant parent nodes; copying or moving to a space root can also | ||
| // require wiki space membership or administrator permission. | ||
| func wikiWritePermissionDeniedHint() string { | ||
| return "The current user or app/bot identity lacks Wiki container permission for this write. This is resource access, not app scope authorization. Do not retry the same request, reauthorize, or switch identity as trial and error; ask the resource owner or wiki administrator to grant container edit permission on the relevant source or destination parent node. Copying or moving to a space root can also require wiki space membership or administrator permission. Use an accessible resource if that access cannot be granted." |
There was a problem hiding this comment.
[P2] Keep write recovery specific to each move mode
This hint is shared by node copy, Wiki node move, and docs-to-wiki, but those 131006 cases do not share one resource-permission set. The official node-move contract requires edit permission on the moved node in addition to source and destination parent-container edit permission. For docs-to-wiki, 131006 can instead mean that the source Drive document lacks manage permission or its parent folder lacks edit permission. Following the current Wiki-container-only hint can therefore leave these cases unresolved even after the requested grant. Please use operation-specific hints, or include the moved-node and source-Drive requirements in the relevant paths.
References: https://open.feishu.cn/document/server-docs/docs/wiki-v2/space-node/move and https://open.feishu.cn/document/server-docs/docs/wiki-v2/task/get?lang=zh-CN
| ) | ||
| if err != nil { | ||
| return nil, err | ||
| return nil, annotateWikiWritePermissionDenied(err) |
There was a problem hiding this comment.
[P2] Treat 131006 from task polling as terminal
After this call returns a task_id, the GetMoveTask endpoint can itself return 131006. GetMoveTask currently returns that error without the new annotation, and pollWikiMoveTask unconditionally treats every poll error as transient, so the command makes all 30 attempts and finally tells the caller to retry status lookup. That contradicts the new terminal no-retry contract. Please annotate 131006 on the task-result path and short-circuit polling before the next attempt, with recovery appropriate to the documented task permission failure.
Reference: https://open.feishu.cn/document/server-docs/docs/wiki-v2/task/get?lang=zh-CN
461132e to
469f828
Compare
wiki +node-get already treats 131006 as a non-retryable resource-access error. Apply the same terminal classification to +node-copy and +move, with path-specific recovery: copy uses parent container edit, node move also needs edit on the moved node, and docs-to-wiki can require Drive manage plus parent-folder edit. Treat task-lookup 131006 as terminal instead of polling it 30 times. Keep the existing read-access hint on get/list and on move's get_node resolve.
469f828 to
336e39d
Compare
| // requires container edit on the source or destination parent; a space-root | ||
| // target can also require wiki space membership or administrator permission. | ||
| func wikiCopyPermissionDeniedHint() string { | ||
| return "The current user or app/bot identity lacks Wiki container permission for this copy. This is resource access, not app scope authorization. Do not retry the same request, reauthorize, or switch identity as trial and error; ask the resource owner or wiki administrator to grant container edit permission on the relevant source or destination parent node. Copying to a space root can also require wiki space membership or administrator permission. Use an accessible resource if that access cannot be granted." |
There was a problem hiding this comment.
[P2] Include source-node access in copy recovery
The mounted regression for this path explicitly models 131006 as node permission denied, user needs read permission, but this hint only asks for container edit permission on source or destination parents, and the test rejects any read-access guidance. If the caller cannot read the source node, granting parent-container edit access does not make that source copyable, so the terminal error still directs the owner to a recovery that cannot fix the request. Because 131006 conflates source-node and destination-container ACL failures and this code intentionally does not branch on the unstable message text, please make the stable copy hint cover source-node read or copy access as well as destination-parent container edit, or keep it permission-neutral.
Reference: https://open.feishu.cn/document/server-docs/docs/wiki-v2/space-node/copy?lang=zh-CN
Summary
wiki +node-getalready treats Wiki131006as a terminal resource-access error.wiki +node-copyandwiki +movestill returned the generic permission hint, so agents could keep retrying the same copy/move after a node or parent ACL failure.Changes
annotateWikiPermissionDeniedfor Wiki131006.wiki +node-copyandwiki +move(including move-timeget_noderesolve).+node-get/+node-listthrough the same helper so the hint stays in one place.Test Plan
go test ./shortcuts/wiki -count=1lark-cli wiki +node-copy/lark-cli wiki +move131006 flow works as expectedRelated Issues
Summary by CodeRabbit
Bug Fixes
Documentation