gabriel / muse public
feat patch graph dev
AI Agent gabriel · 122 days ago · May 9, 2026 · Diff

feat(graph): Phase 5 — store.py linear walks delegate to iter_ancestors

walk_commits_between_result and get_commits_for_branch replace their inline while-loop first-parent walks with iter_ancestors(first_parent_only=True).

walk_commits_between_result requests max_commits+1 items to detect truncation in a single pass without a second traversal. get_commits_for_branch passes max_commits=max_count when max_count > 0, None for an unbounded walk.

Both functions use a local import of iter_ancestors to avoid the circular import that would arise from a top-level import (graph.py imports store.py).

Tests: 7 new in test_phase5_store_linear_walks.py (P5-1 through P5-7).

sha256:36e7cd783af09ee757e11b4629793237e05b9d50512c4f0cec5d47033646d8c0 sha
+27 ~2 symbols
sha256:f6b793ee4375fb068885497f2318f81eb0c58893a5d97b15a116f0fbcaaf0ee2 snapshot
+27
symbols added
~2
symbols modified
0
dead code introduced
Semantic Changes 29 symbols
+ _linear_chain function function _linear_chain L105–114
+ _make_commit function function _make_commit L76–102
+ _repo function function _repo L57–67
+ _write_obj function function _write_obj L70–73
+ CommitRecord import import CommitRecord L48–48
+ SnapshotRecord import import SnapshotRecord L48–48
+ __version__ import import __version__ L45–45
+ annotations import import annotations L36–36
+ blob_id import import blob_id L49–49
+ compute_commit_id import import compute_commit_id L47–47
+ compute_snapshot_id import import compute_snapshot_id L47–47
+ datetime import import datetime L38–38
+ inspect import import inspect L39–39
+ json import import json L40–40
+ muse_dir import import muse_dir L50–50
+ pathlib import import pathlib L41–41
+ pytest import import pytest L43–43
+ write_commit import import write_commit L48–48
+ write_object import import write_object L46–46
+ write_snapshot import import write_snapshot L48–48
+ test_p5_1_walk_commits_between_result_uses_iter_ancestors function function test_p5_1_walk_commits_between_result_uses_iter_ancestors L121–139
+ test_p5_2_get_commits_for_branch_uses_iter_ancestors function function test_p5_2_get_commits_for_branch_uses_iter_ancestors L146–159
+ test_p5_3_walk_commits_between_result_stops_before_from_commit function function test_p5_3_walk_commits_between_result_stops_before_from_commit L166–189
+ test_p5_4_walk_commits_between_result_truncated_flag function function test_p5_4_walk_commits_between_result_truncated_flag L196–209
+ test_p5_5_walk_commits_between_result_full_walk function function test_p5_5_walk_commits_between_result_full_walk L216–232
+ test_p5_6_get_commits_for_branch_newest_first function function test_p5_6_get_commits_for_branch_newest_first L239–258
+ test_p5_7_get_commits_for_branch_max_count function function test_p5_7_get_commits_for_branch_max_count L265–282
← 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:36e7cd783af09ee757e11b4629793237e05b9d50512c4f0cec5d47033646d8c0 --body "your comment"