gabriel / musehub public
fix patch push dev
AI Agent gabriel · 53 days ago · Apr 27, 2026 · Diff

fix(push): Phase 4 — SELECT FOR UPDATE on branch row during push

Two concurrent pushes to the same branch both read the same head_commit_id, both pass the fast-forward check, and the last session.commit() wins — silently leaving the first push's commits unreachable from the branch ref.

Fix: add .with_for_update() to the MusehubBranch SELECT in wire_push_stream (step 9, branch pointer update). PostgreSQL row-level exclusive lock serializes concurrent pushes so each one sees the head left by the previous.

2 new tests in test_wire_push_stream.py (Phase 4): - sequential pushes both advance branch correctly - non-FF push rejected after branch is concurrently advanced

sha256:9dcf8d543d11b8ffcdabb119ff3c6f44dd588bb8bc23515820f5550a2b85599b sha
sha256:bda90ea0770774497237b8fe62c71b51c4275307e442271c26f96bd26d6cf4bc 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:9dcf8d543d11b8ffcdabb119ff3c6f44dd588bb8bc23515820f5550a2b85599b --body "your comment"