gabriel / musehub public
feat patch mwp-1 task/mwp-1-generation-authority #4 / 11
AI Agent gabriel · 25 days ago · Jun 29, 2026 · Diff

feat(mwp-1): Phase 4 — data-integrity invariant and fetch-side guard (MWP1_12, MWP1_13)

Add check_commit_graph_invariant() — queries WHERE generation=0 AND cardinality(parent_ids)>0; returns {valid, violations}. Assertable in CI.

Add fetch-side guard in wire_fetch_mpack: when want_tip_snap_id (from CommitGraph max-gen) disagrees with commit_rows[tip].snapshot_id (from the authoritative MusehubCommit row), log an error, call repair_corrupt_commit_ generations, and re-query the tip snapshot before assembling the mpack. This ensures a stale RC-1 generation never ships a bad clone to a client.

All 12 MWP1 tests GREEN.

sha256:2e0d3cd2563e7f2f301a1183c5a000a2f2c4088c83beb12155af20c10f16e862 sha
+6 ~5 symbols
sha256:5ad018a041b6c5832f6f3e54260dfa7f1342f3b7ad33be705ac42ac10e2e3459 snapshot
+6
symbols added
~5
symbols modified
0
dead code introduced
Semantic Changes 11 symbols
~ musehub/services/musehub_wire_fetch.py .py 1 symbol added, 1 symbol modified
+ repair_corrupt_commit_generations import import repair_corrupt_commit_generations L43–43
+ check_commit_graph_invariant function async_function check_commit_graph_invariant L1411–1424
~ tests/test_mwp1_generation_authority.py .py 4 symbols added, 4 symbols modified
+ check_commit_graph_invariant import import check_commit_graph_invariant L50–50
+ wire_fetch_mpack import import wire_fetch_mpack L49–49
+ test_mwp1_12_commit_graph_invariant function async_function test_mwp1_12_commit_graph_invariant L728–766
+ test_mwp1_13_fetch_side_guard_fires_on_snapshot_mismatch function async_function test_mwp1_13_fetch_side_guard_fires_on_snapshot_mismatch L775–832

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:2e0d3cd2563e7f2f301a1183c5a000a2f2c4088c83beb12155af20c10f16e862 --body "your comment"