gabriel / musehub public
feat mwp2 task/mwp-2-walk-fallback #5 / 6
AI Agent gabriel · 70 days ago · Jun 29, 2026 · Diff

feat(mwp2): Phase 1 — extract _walk_commit_delta_dag, remove if-True guard

MWP2_04: Promote the dead legacy walk (lines 159-184) to a top-level _walk_commit_delta_dag(session, starts, have_set) helper. Removes the 'if True:' dead-code guard from _walk_commit_delta; the fast-path body is now the direct function body (un-indented one level). The helper: - Walks MusehubCommit.parent_ids via walk_dag_async (authoritative DAG) - Bounded by max_nodes=100_000 with a WARNING log if the cap is hit - Kahn's topo-sort: returns parents-first so every commit precedes its children (BFS order is children-first; the sort is required for correct sequential client apply) - Returns _CommitDeltaMap of MusehubCommit rows (no extra bulk fetch)

MWP2_05 GREEN: _walk_commit_delta_dag returns complete closure {C1,C2,C3} with snapshot_id and parent_ids correctly populated from musehub_commits.

MWP2_06 GREEN: Kahn's sort produces parents-first dict order — idx[C1] < idx[C2] < idx[C3] in a linear C1<-C2<-C3 chain.

MWP2_01, MWP2_02 still RED — fallback is not yet wired into _walk_commit_delta (Phase 2 detection + dispatch).

musehub#107 / muse#58

sha256:d984bd63c5abb64309fc91547bb884fe8a7e08820bae6f2b13957cee07584221 sha
+4 ~2 symbols
sha256:5c2fa60af0097740aa8e5ac9c0ae6e07b0f298fe1ca709b200142da4a820197d snapshot
+4
symbols added
~2
symbols modified
0
dead code introduced
Semantic Changes 6 symbols
~ musehub/services/musehub_wire_fetch.py .py 1 symbol added, 1 symbol modified
+ _walk_commit_delta_dag function async_function _walk_commit_delta_dag L49–120
~ tests/test_mwp2_walk_fallback.py .py 3 symbols added, 1 symbol modified
+ _walk_commit_delta_dag import import _walk_commit_delta_dag L51–51
+ test_mwp2_05_dag_helper_returns_full_closure function async_function test_mwp2_05_dag_helper_returns_full_closure L307–346
+ test_mwp2_06_dag_helper_parents_first_order function async_function test_mwp2_06_dag_helper_parents_first_order L355–391

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