gabriel / musehub public
fix patch dev
AI Agent gabriel · 39 days ago · May 10, 2026 · Diff

fix: per-batch session.commit() for snapshot and commit writes in finalization

Phase 7 (snapshots) and phase 8 (commit rows) were INSERTing in STREAM_COMMIT_BATCH_SIZE chunks but never committing between batches, leaving a single open transaction across all rows. For a 992-commit push this means hundreds of rows held in-flight — the connection stays active but the transaction is unnecessarily large and any mid-write error loses all batches.

Fix: commit after each batch in both phases.

- Phase 7: await session.commit() after bulk_upsert_snapshot_entries per batch - Phase 8: await session.commit() after pg_insert(MusehubCommit) per batch

Phase 9 (branch pointer SELECT FOR UPDATE) and phase 10 (branch UPDATE + enqueue INSERT) remain in their own short final transaction — the branch pointer update is the last thing that makes commits reachable from the ref.

Restores P2-1 through P2-4 which verify per-batch durability and error recovery during large snapshot/commit pushes.

sha256:c53805285a0da87271220163a24f965d1a728eb9e3afb9f09940f4a905398d65 sha
sha256:b6a143fc80eed56edc9d0cdca2749aeae58fa3706291bd3dad8b4ac7893fbd2c 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:c53805285a0da87271220163a24f965d1a728eb9e3afb9f09940f4a905398d65 --body "your comment"