fix: do not fail landed writes or captured reads on unlock - #41
Conversation
Unlock after a captured HEAD or a landed put/register is not lock_failed. Callers would retry a write that already committed or skip a valid snapshot. Existing conflicts still record the unlock error; a successful put warns unlock_failed the same way dirty_marker_failed does.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
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 (4)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe kernel now preserves successful writes and snapshots when lock release fails. Release errors are joined with conflicts or reported as ChangesUnlock error handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: 🔵 Low · up to Writes and captured reads now remain successful when cleanup reports an error, preventing unsafe retries and skipped valid snapshots. A bounded follow-up risk remains because a real cleanup failure could leave lock state unresolved and is not surfaced for successful reads or registrations, affecting contention recovery and diagnosis. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 3 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 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 |
Spell the order as statements so unlock failure cannot be read as skipping fn(snapshot).
Intent
Unlock failure after a captured publisher HEAD or a landed put/register must not become
lock_failed/cortex_unavailable. Callers would skip a valid snapshot or retry a write that already committed.Decisions
withReadSnapshot: capture HEAD, release, runfn(snapshot), thenattachUnlockthe callback result. Do not skip the read.attachUnlock(nil, rerr)stays nil. Unlock joins only an existing conflict (Detail.unlock).Putrecordsunlock_failedas a warning, same class asdirty_marker_failed.Registersuccess stays(cortex, nil)so a retry cannot createduplicate_cortex.cortex_unavailable.Checks
TestAttachUnlockPreservesSuccessAndJoinsFailureTestUnlockAfterLandedPutIsWarningNotConflict(injectedreleaseHook; get sees landed bytes)TestUnlockAfterSnapshotDoesNotSkipGetgolangci-lint run ./...0 issuesgo test -race -count=1 ./...pass./scripts/smoke.shpassProduction impact
Runtime lock/unlock path only. No CLI/MCP schema change except optional
warnings: [{rule: unlock_failed}]on an otherwise successful put. No migration.Rollback
Revert the merge. Prior behavior treated post-success unlock as
lock_failed.Residual risk
Syncsuccess with unlock failure is now success with no warning field (SyncResulthas none). Follow-up, not this slice.Getsuccess with unlock failure has no warning channel.Base:
4d141c45(origin/master). Head:2875c6cf4dab89561c7bd67164475841061c6696(fix: run captured snapshot read before attaching unlock).Summary by CodeRabbit
Delivery verification (2026-09-01, final head
2875c6c)go test -race -count=1 -run 'TestAttachUnlockPreservesSuccessAndJoinsFailure|TestUnlockAfterLandedPutIsWarningNotConflict|TestUnlockAfterSnapshotDoesNotSkipGet'— pass (injected release failure; get sees landed bytes; snapshot read not skipped).go test -race -count=1 ./...— all 9 packages pass.PATH=/tmp/gclv2:$PATH ./scripts/check.sh(clone-to-green: lint fuse + report, gitleaks, govulncheck, module token budgets — kernel 58351/58400,go test -race, CLI smoke) — gate passed.01313b3, no findings. Residual risks above (Sync/Get warning channels) remain follow-ups.