feat: muse#53 item 3 — muse code narrative uses symlog as commit index
`muse code narrative ADDRESS` reconstructed a symbol's biography by BFS-walking the full commit DAG and re-parsing every commit's structured_delta — O(commits) regardless of how many times the symbol actually changed.
Not a literal "read narrative data from symlog entries" swap: the journal's created/modified/deleted/renamed classification is coarser than the impl-vs-signature distinction this command's storytelling depends on (separate body-rewrite/signature-change counts, breaking-change detection via SemVer bump, detailed summary text) — none of which the journal carries. Instead the journal is used as an INDEX narrowing down which commits actually touched the symbol, replacing the full BFS walk; each relevant commit's real structured_delta is still read for full fidelity via a new _process_commit_for_address() helper, extracted from _collect_history's inner loop so both the original BFS path and the new _collect_history_via_symlog() path share identical event-classification logic — zero duplicated business logic between the two strategies.
--since has no equivalent against the flat journal (no "stop at an older commit" concept), so it forces the original full-history fallback — same gating muse code blame's --from already established (item 2).
Incidentally fixes a real latent bug, not just a performance win: the original BFS walk tracked one FIXED symbol address for the entire scan, so a renamed symbol's history silently stopped at the rename boundary (the rename op is recorded under the OLD address, which a fixed-address scan of the NEW address never matches). The journal's born_from chain crosses that boundary natively via the same mechanism `muse symlog --follow` already uses, so a renamed symbol's narrative now includes its pre-rename history for the first time.
Covered by tests/test_narrative_symlog_fast_path.py (5 cases, same mechanism-proving pattern as blame's equivalent after that file's own TDD correction: monkeypatching walk_commits_bfs to raise confirms the symlog path is used by default; confirms --since still calls through to BFS; 3 direct unit tests against _collect_history_via_symlog() covering no-journal fallback, impl-vs-sig fidelity preservation, and the rename-boundary fix itself). Confirmed genuine RED by reverting the fix file and re-running (4 of 5 failed; the --since fallback test passed incidentally since that's pre-existing untouched behavior), then GREEN with the fix restored plus the full narrative + blame + symlog regression suite (73 + 183 tests, zero regressions). Live-verified via muse-dev against a disposable /tmp sandbox: a two-commit rename case went from commits_analysed=1 (pre-fix, would have silently missed the creation event) to commits_analysed=2 with the creation event correctly surfaced under the pre-rename address.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Semantic Changes
32 symbols
Files Changed
+1
~2
1241 in snapshot
0 comments
muse hub commit comment sha256:2e1a0661bf0d9f094a07af068f630fed10499f58d69f969b689d9171112ab680 --body "your comment"
No comments yet. Be the first to start the discussion.