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

test(mwp-1): Phase 0 — red reproduction of commit-graph gen-0 staleness bug

Reproduces RC-1 (clone-after-push staleness, musehub#106) at both generation sites that share the identical 'gen 0' fallback:

- MWP1_01 (RED): _build_commit_graph_from_raw assigns generation 0 to a commit whose parent is absent from both the mpack and the commit graph, instead of parent_generation + 1. assert 0 == 3. - MWP1_02 (GREEN guard): a genuine root commit (no parents) correctly stays at generation 0 — guards later phases against over-correction. - MWP1_03 (RED): wire_push_unpack_mpack step 9b assigns generation 0 to a newly pushed tip whose parent (the remote tip) has no graph row. Server logs confirm the bug path: 'external_parents=1 found=0' -> 'gen_max=0'.

Also adds the MWP-1 issue body as the local source of truth.

No production code changed — Phase 0 establishes the failing tests only.

sha256:bb4fa850f693e22ecdf6b4f3d12a4996f55972d50184da54b8561d5a52dc2fba sha
+56 symbols
sha256:00b72cb925d648fd195befcd39474b2049e0ccc076d956eee53182f5ae6b2bad snapshot
+56
symbols added
0
dead code introduced
Semantic Changes 56 symbols
+ MWP-1 — Make commit-graph generations authoritative (fixes clone-after-push staleness) section MWP-1 — Make commit-graph generations authoritative (fixes clone-after-push staleness) L1–201
+ Acceptance criteria section Acceptance criteria L166–177
+ Anchors section Anchors L196–201
+ Background section Background L7–73
+ The bug section The bug L15–45
+ code[python]@L21 variable variable code[python]@L21 L21–24
+ code[python]@L27 variable variable code[python]@L27 L27–30
+ Why it breaks clone section Why it breaks clone L45–73
+ code[python] variable variable code[python] L50–54
+ Design section Design L83–117
+ Distinguish root from unresolved (both sites) section Distinguish root from unresolved (both sites) L85–98
+ code[python] variable variable code[python] L87–97
+ Minimal fetch-side guard (full fallback = MWP-2) section Minimal fetch-side guard (full fallback = MWP-2) L109–117
+ _resolve_generation_with_backfill section _resolve_generation_with_backfill L98–109
+ Goal section Goal L73–83
+ Out of scope section Out of scope L187–196
+ Phases (load-bearing; each must be green before the next) section Phases (load-bearing; each must be green before the next) L117–166
+ Phase 0 — Reproduce (red) section Phase 0 — Reproduce (red) L119–129
+ Phase 1 — Distinguish root from unresolved section Phase 1 — Distinguish root from unresolved L129–136
+ Phase 2 — Authoritative backfill section Phase 2 — Authoritative backfill L136–147
+ Phase 3 — Repair existing corruption section Phase 3 — Repair existing corruption L147–154
+ Phase 4 — Invariant + guard section Phase 4 — Invariant + guard L154–161
+ Phase 5 — Regression proof section Phase 5 — Regression proof L161–166
+ Testing tiers section Testing tiers L177–187
+ table section table L179–186
+ _IDENTITY_ID variable variable _IDENTITY_ID L54–54
+ _OWNER variable variable _OWNER L53–53
+ _cid function function _cid L62–64
+ _graph_gen function async_function _graph_gen L136–139
+ _mock_backend function function _mock_backend L142–150
+ _now function function _now L67–68
+ _raw_commit function function _raw_commit L71–97
+ _seed_commit_row function async_function _seed_commit_row L100–116
+ _seed_graph_row function async_function _seed_graph_row L119–133
+ AsyncMock import import AsyncMock L32–32
+ AsyncSession import import AsyncSession L36–36
+ MagicMock import import MagicMock L32–32
+ MusehubBranch import import MusehubBranch L42–42
+ MusehubCommit import import MusehubCommit L42–42
+ MusehubCommitGraph import import MusehubCommitGraph L42–42
+ _build_commit_graph_from_raw import import _build_commit_graph_from_raw L48–48
+ annotations import import annotations L29–29
+ blob_id import import blob_id L40–40
+ build_wire_mpack import import build_wire_mpack L39–39
+ compute_branch_id import import compute_branch_id L41–41
+ compute_identity_id import import compute_identity_id L41–41
+ create_repo import import create_repo L47–47
+ datetime import import datetime L31–31
+ hash_snapshot import import hash_snapshot L38–38
+ patch import import patch L32–32
+ pytest import import pytest L34–34
+ select import import select L35–35
+ wire_push_unpack_mpack import import wire_push_unpack_mpack L48–48
+ test_mwp1_01_unresolved_parent_gets_correct_generation function async_function test_mwp1_01_unresolved_parent_gets_correct_generation L159–188
+ test_mwp1_02_root_commit_generation_zero function async_function test_mwp1_02_root_commit_generation_zero L197–212
+ test_mwp1_03_push_child_of_ungraphed_remote_tip function async_function test_mwp1_03_push_child_of_ungraphed_remote_tip L221–312

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