fix(output): classify wiki lock-contention error (131009) with retry hint#1014
fix(output): classify wiki lock-contention error (131009) with retry hint#1014leeguooooo wants to merge 1 commit into
Conversation
|
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 (2)
📝 WalkthroughWalkthroughAdds a new Lark API error constant for wiki write-lock contention, classifies it in ClassifyLarkError as an API conflict with a retry/backoff hint, and adds a unit test verifying the classification and hint text. ChangesWiki Lock Contention Error Handling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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@ae3d352f6b907750d0ade31afb5c67ccd4d1418b🧩 Skill updatenpx skills add leeguooooo/cli#fix/classify-wiki-lock-contention -y -g |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1014 +/- ##
=======================================
Coverage 67.76% 67.76%
=======================================
Files 590 590
Lines 55194 55196 +2
=======================================
+ Hits 37400 37402 +2
Misses 14682 14682
Partials 3112 3112 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
CI lint is failing because this branch was cut from an older A rebase onto the latest git fetch origin main
git rebase origin/main
git push --force-with-lease |
…hint Wiki write-path operations (most commonly `wiki +node-create` against the same parent) surface code 131009 "lock contention" under concurrent calls. Currently this falls through to the generic "api_error" classification, giving users no hint that it is transient and safe to retry. Mirror the existing `LarkErrDriveResourceContention` (1061045) treatment: add a named constant, classify as "conflict", and emit a hint that points the caller toward exponential backoff or serializing sibling-node writes. Refs: larksuite#1012
52e0ce4 to
ae3d352
Compare
|
Done — rebased onto latest Verified locally with the same lint invocation CI uses: go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.6 run --new-from-rev=upstream/main
# 0 issues.The depguard violation in Thanks for the quick turnaround review @fangshuyu-768! |
Summary
Wiki write-path operations (most commonly
wiki +node-createagainst the same parent) surface code 131009 "lock contention" under concurrent calls. Currently this falls through to the generic"api_error"classification, giving users no hint that it is transient and safe to retry.This PR mirrors the existing
LarkErrDriveResourceContention(1061045) treatment: add a named constant, classify as"conflict", and emit a hint that points the caller toward exponential backoff or serializing sibling-node writes.Changes
LarkErrWikiLockContention = 131009constant ininternal/output/lark_errors.go(ExitAPI, "conflict", <retry hint>)alongside the existing Drive contention caseTestClassifyLarkError_WikiLockContentioncovering exit code / type / hint substringTest Plan
gofmt -l ./internal/output/— cleango vet ./internal/output/...— cleango test ./internal/output/... -run "WikiLock" -v— passmake unit-test— passScope note
This PR only adds classification + hint, matching the existing Drive contention precedent. It does not add client-side retry — that's left as a separate design decision (see issue #1012 for context). Downstream tools can already detect the
"conflict"errType and retry on their side; this PR removes the need for downstream tools to hardcode131009themselves.Related Issues
Summary by CodeRabbit