fix(wiki): retry node copy lock contention - #2292
Conversation
|
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 (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughWiki node copy now retries lock-contention errors with bounded exponential backoff, respects context cancellation, preserves typed error details, and documents the behavior. Tests cover successful retries, non-retryable errors, cancellation, and retry exhaustion. ChangesWiki node copy retry
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant RunWikiNodeCopy
participant runWikiNodeCopyWithRetry
participant WikiAPI
participant Context
RunWikiNodeCopy->>runWikiNodeCopyWithRetry: prepared API path and request body
runWikiNodeCopyWithRetry->>WikiAPI: copy wiki node
WikiAPI-->>runWikiNodeCopyWithRetry: lock-contention error
runWikiNodeCopyWithRetry->>Context: check cancellation during backoff
runWikiNodeCopyWithRetry->>WikiAPI: retry copy request
WikiAPI-->>runWikiNodeCopyWithRetry: success or final wrapped error
runWikiNodeCopyWithRetry-->>RunWikiNodeCopy: copied node data or preserved error contract
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
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/wiki/wiki_list_copy_test.go`:
- Around line 627-646: Extend TestRunWikiNodeCopyDoesNotRetryOtherErrors to
inspect errs.ProblemOf(err) and assert the returned error has
errs.CategoryAuthorization and errs.SubtypePermissionDenied metadata, while
retaining the existing single-call and cause-preservation assertions.
In `@shortcuts/wiki/wiki_node_copy.go`:
- Around line 125-129: Update the cancellation branch in the backoff select to
return a *errs.NetworkError, using SubtypeNetworkTimeout for deadline expiry and
SubtypeNetworkTransport for other cancellations, while preserving ctx.Err() via
WithCause. Add a backoff-cancellation test that verifies the error metadata and
cause and confirms no additional API call occurs.
🪄 Autofix
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 Plus
Run ID: 6ec0eb3d-339f-4405-a249-e6461c2ef910
📒 Files selected for processing (3)
shortcuts/wiki/wiki_list_copy_test.goshortcuts/wiki/wiki_node_copy.goskills/lark-wiki/references/lark-wiki-node-copy.md
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@e17f8e18ebfe51e8d5d8dc70d459eaecabb9fcb4🧩 Skill updatenpx skills add larksuite/cli#fix/wiki-node-copy-lock-retry -y -g |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2292 +/- ##
==========================================
- Coverage 76.47% 76.45% -0.02%
==========================================
Files 1013 1025 +12
Lines 112079 113750 +1671
==========================================
+ Hits 85709 86967 +1258
- Misses 19858 20110 +252
- Partials 6512 6673 +161 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
fdc5c5a to
e17f8e1
Compare
Summary
wiki +node-copywhen the Wiki API returns lock-contention code131009Safety
Retries are limited to the explicit
131009response, which represents write-lock contention. Network failures and other API errors are not retried, avoiding ambiguous retries for this non-idempotent operation.Testing
go test ./shortcuts/wiki/...node scripts/skill-format-check/index.jsgit diff --checkSummary by CodeRabbit
Bug Fixes
Documentation