gabriel / muse public
feat BREAKING task/graph-traversal-abstraction #1 / 1
AI Agent gabriel · 61 days ago · Apr 18, 2026 · Diff

feat: extract canonical graph traversal into muse/core/graph.py

Add iter_ancestors(), ancestor_ids(), and find_merge_base() as the single source of truth for all commit DAG traversal in Muse. TDD with 26 tests in tests/test_core_graph.py covering BFS ordering, dedup, multi-source, first_parent_only, exclude boundaries, max_commits cap, missing commits, diamond DAGs, and LCA edge cases.

Replace inline BFS in 8 sites: - blame.py: _walk_ancestry → iter_ancestors - rev_list.py: _exclude_set → ancestor_ids; _walk_from → iter_ancestors - range_diff.py: _exclude_set → ancestor_ids; _walk_range → iter_ancestors - commit_graph.py: _ancestors_of → ancestor_ids; main run BFS → iter_ancestors - merge_engine.py: find_merge_base → delegates to graph.find_merge_base - query_engine.py: _walk_history_bfs → iter_ancestors - pack.py: walk_commits inner loop → iter_ancestors - count_objects.py: _collect_reachable_ids → iter_ancestors

gc.py intentionally retains its raw-msgpack walk for schema-evolution robustness — documented as the sole sanctioned exception.

sha256:b6bd084f73a3976352f97a4914e4fa1f0c0a108e04f417a8ea6d05147f4ede5d sha
sha256:b8fc304cca93c12b46031354249ef50aee9104ebab60f26d6e2096e2bc595d86 snapshot
← Older Oldest on task/graph-traversal-abstraction
All commits
Newer → Latest on task/graph-traversal-abstraction

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