gabriel / musehub public
feat patch task/lineage-walk #1 / 1
AI Agent gabriel · 134 days ago · May 4, 2026 · Diff

feat: load_symbol_history follows from_address chains for full symbol lineage

When a symbol's oldest history entry carries op_payload.from_address (written by move/patch ops), load_symbol_history now walks the chain recursively and returns a merged oldest-first timeline keyed on the current (final) address.

This means Epoch 0 on the symbol detail page will show the true insert at the origin path, not a PATCH at the address the symbol was renamed to.

Implementation: - _resolve_lineage: recursive walk with cycle guard (visited set) and an in-memory cache; falls back to a targeted DB query only when a lineage hop points to an address not in the initial loaded set (the file_path-filtered case). - Origin addresses (pointed to by a successor's from_address) are folded into the successor's merged timeline and excluded as top-level keys.

Tests (7 new in TestLoadSymbolHistoryLineage): no_from_address_unchanged, single_rename_prepends_origin_history, origin_address_excluded_from_top_level_keys, multi_hop_rename_walks_full_chain, lineage_walk_is_bounded_on_missing_origin, file_path_filter_includes_lineage, lineage_entries_carry_original_address

sha256:b66efde8f7a4e81d2a93aaeeacda3000ed136ac8e72874357ac19448d099a565 sha
+13 ~1 symbols
sha256:e9c25eab89c99b40060654656fd01c930446f021aad47acb7b70d3f252c84888 snapshot
+13
symbols added
~1
symbol modified
0
dead code introduced
Semantic Changes 14 symbols
~ musehub/services/musehub_symbol_indexer.py .py 3 symbols added, 1 symbol modified
+ _RowCache variable variable _RowCache L975–975
+ _resolve_lineage function async_function _resolve_lineage L978–1015
+ _row_to_entry function function _row_to_entry L963–972
~ tests/test_snapshot_symbol_indexer.py .py 10 symbols added
+ TestLoadSymbolHistoryLineage class class TestLoadSymbolHistoryLineage L1937–2117
+ test_file_path_filter_includes_lineage method async_method test_file_path_filter_includes_lineage L2066–2090
+ test_lineage_entries_carry_original_address method async_method test_lineage_entries_carry_original_address L2093–2117
+ test_lineage_walk_is_bounded_on_missing_origin method async_method test_lineage_walk_is_bounded_on_missing_origin L2045–2063
+ test_multi_hop_rename_walks_full_chain method async_method test_multi_hop_rename_walks_full_chain L2013–2042
+ test_no_from_address_unchanged method async_method test_no_from_address_unchanged L1942–1956
+ test_origin_address_excluded_from_top_level_keys method async_method test_origin_address_excluded_from_top_level_keys L1989–2010
+ test_single_rename_prepends_origin_history method async_method test_single_rename_prepends_origin_history L1959–1986
+ _move_op function function _move_op L87–88
+ _seed_history_entry function async_function _seed_history_entry L1911–1934
← Older Oldest on task/lineage-walk
All commits
Newer → Latest on task/lineage-walk

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