gabriel / musehub public
feat patch task/snapshot-diff-backfill #1 / 1
AI Agent gabriel · 45 days ago · May 4, 2026 · Diff

feat: backfill_history_from_snapshots — infer full op history from snapshot diffs

For commits never covered by structured_delta, diffs adjacent snapshot manifests to reconstruct insert/replace/delete/move ops for every file.

Algorithm: - Walk all commits oldest-first - Diff child manifest vs parent manifest (or empty for genesis) - Unambiguous rename: one removed + one added path share same object_id → move - Ambiguous (multiple candidates): fall back to insert + delete - Skip (repo_id, address, commit_id) pairs already in history table - Mark inferred entries: op_payload.inferred_from = 'snapshot_diff'

This recovers symbol history for files that predate structured_delta indexing (e.g. static/js/app.ts before the src/ts migration).

Tests (12 in TestBackfillHistoryFromSnapshots): genesis_all_inserts, new_file_is_insert, changed_content_is_replace, removed_file_is_delete, unambiguous_rename_is_move, ambiguous_rename_falls_back, skips_existing_entries, unchanged_files_no_entries, dry_run, idempotent, repo_id_filter, inferred_op_payload_marks_source

sha256:661a8359960bf93cb7bff10f15c16f8df25f666114518c982ca9ec2cb9c2099a sha
sha256:44cc00ff0a5c2b6e9a815a93b3c5933a29668f8ccf3bbeb9fdc587573d6d3972 snapshot
← Older Oldest on task/snapshot-diff-backfill
All commits
Newer → Latest on task/snapshot-diff-backfill

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