gabriel / musehub public
fix patch musehub#198 fix/198-proposal-files-changed-panel #1 / 1
AI Agent gabriel · 1 day ago · Sep 11, 2026 · Diff

fix(musehub#198): anchor merged-proposal Files Changed panel to merge commit lineage

Root cause: proposal_detail_page resolved the file-diff snapshot IDs via live MusehubBranch name lookups. Once a proposal's source branch is deleted (routine post-merge cleanup), that lookup returns None, the 'new' manifest is empty, and get_snapshot_diff misreports the entire base manifest as removed with a denominator of 0 ('X of 0') -- looking like the merge wiped the repo.

Fix: for a merged proposal, anchor the diff to proposal.merge_commit_id's own recorded lineage (merge commit's snapshot vs its parent's snapshot) instead of re-resolving branch names -- same pattern ui_commits.py's diff_page already uses for ordinary commits, immune to branch deletion. Falls back to the original live-branch lookup for open/unmerged proposals.

Tests: new TestFilesChangedPanelAfterMerge in tests/test_musehub_ui_proposal_ssr.py -- confirmed RED before the fix (real HTTP GET on a merged proposal with deleted source branch asserts '1 of 3' in body, failed pre-fix) and GREEN after. Full regression sweep across proposal/merge/repo/wire-fetch suites: 236 passed, no regressions.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

sha256:553c8ce398144d0b061f6686995491c66bbcbe7884935ac6c407601026442af1 sha
+5 ~1 symbols
2 changed · 1075 in snapshot files
sha256:f6db4eaaeb89b48f0ca2c83a817a002daa90f3f6f57eb990c3b0b4effad77c0b snapshot
+5
symbols added
~1
symbol modified
2
files changed
1075
files in snapshot
0
dead code introduced
Semantic Changes 6 symbols
+ TestFilesChangedPanelAfterMerge class class TestFilesChangedPanelAfterMerge L290–390
+ test_files_changed_panel_correct_for_merged_proposal_after_fix method async_method test_files_changed_panel_correct_for_merged_proposal_after_fix L335–390
+ test_reproduces_x_of_0_when_source_branch_deleted_post_merge method async_method test_reproduces_x_of_0_when_source_branch_deleted_post_merge L291–333
+ _make_commit_on_branch function async_function _make_commit_on_branch L247–287
+ _make_snapshot function async_function _make_snapshot L227–244
Files Changed
~2
1075 in snapshot
← Older Oldest on fix/198-proposal-files-changed-panel
All commits
Newer → Latest on fix/198-proposal-files-changed-panel

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