Repository navigation
fix: publish complete cross-process write locks - #121
Conversation
Prepare each PID payload before publishing the lock with an exclusive hard link. This prevents concurrent writers from reclaiming a partially written lock and corrupting shard counts. Add deterministic regression tests, bounded Windows publication retries, and TDR-039.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (5)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe cross-process write lock now writes a complete PID payload to a unique temporary file and publishes it with a hard link. The change retains stale-lock recovery and the contention deadline, adds Windows publication retries, and includes tests and a proposed TDR. ChangesCross-process write-lock publication
Priority: ⬆️ High Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium Sequence Diagram(s)sequenceDiagram
participant WriterProcess
participant LockFileSystem
participant ContenderProcess
WriterProcess->>LockFileSystem: Write complete payload to unique temporary file
WriterProcess->>LockFileSystem: Publish lock path with linkSync
ContenderProcess->>LockFileSystem: Attempt lock publication
LockFileSystem-->>ContenderProcess: Return EEXIST
ContenderProcess->>LockFileSystem: Check holder PID and poll
WriterProcess->>WriterProcess: Run callback while holding lock
WriterProcess->>LockFileSystem: Remove acquired lock and temporary file
Merge Risk: ⚪ Minimal · up to No actionable issue is established for this change. The planned platform smoke test remains a before-merge validation step. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. (3 skipped: 3 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 |
Summary
Release 4.13.2 failed its macOS 26 storage check: all 50 memory rows survived, but shard metadata counted 48. The other five platforms passed, and npm publishing was skipped.
Exclusive file creation exposed an empty lock before its process ID was written. A contender could delete that file as corrupt and enter alongside the original writer. The deterministic regression reproduced two active writer callbacks before the fix.
This fix prepares a complete payload in a unique temporary file, then publishes it with an exclusive hard link. It keeps the existing lock path and JSON fields. Windows hard-link refusals use the bounded retry policy from TDR-034. Added regression tests and TDR-039.
The existing stale-owner takeover logic stays unchanged. This restores the shared-store safety requirement; no new OpenSpec behaviour change is introduced.
Validation
bun run ci:local, rerun after commit and before push (295 test files).git diff --check.openspec validate host-neutral-memory-core --type spec --strict.Bun emitted its existing web tsconfig directory warnings; every test file passed.
Before merge
Failed release run: https://github.com/cmdaltctr/omms/actions/runs/37684125173
Summary by CodeRabbit
Bug Fixes
Documentation