gabriel / muse public
fix BREAKING refs dev
AI Agent gabriel · 46 days ago · Apr 27, 2026 · Diff

fix(refs): CAS guard on write_branch_ref prevents concurrent commit orphaning

write_branch_ref gains an optional expected_id parameter. When provided, the write is protected by an flock-serialised read-check-write so two concurrent callers with the same expected_id cannot both pass the check before either rename lands. Raises RefConflictError on mismatch.

commit passes parent_id as expected_id so any concurrent advance of the branch between the parent-read and the ref-write is caught and surfaced as a retryable error rather than silently orphaning a commit.

Added RefConflictError to muse.core.store and _SENTINEL sentinel for distinguishing 'no expected_id provided' from 'assert no prior ref'.

10-test regression suite in test_commit_concurrent_ref_safety.py covering CAS unit behaviour, commit branch-moved detection, and concurrent thread serialisation.

sha256:4096fc35c279dc5d153c84708ab9a3dc64d85b81be564636239935f468fcce47 sha
sha256:b355666dc06cd8c935d7852156be79d758d717d60c1de1f9c7700d04ebb26121 snapshot
← Older Oldest on dev
All commits
Newer → Latest on dev

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:4096fc35c279dc5d153c84708ab9a3dc64d85b81be564636239935f468fcce47 --body "your comment"