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
…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
|
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)
📝 WalkthroughWalkthroughThis PR adds support for handling a transient Lark API error that occurs during concurrent wiki writes. A new error constant is defined, the error classification function is extended to recognize it as a retryable conflict, and test coverage validates the expected behavior. ChangesWiki Lock Contention Error Handling
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 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 |
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