gabriel / muse public
fix BREAKING push dev
gabriel · 172 days ago · Apr 7, 2026 · Diff

fix(push): stop merge-commit BFS at nearest already-remote ancestor

When pushing a merge commit, branch_have previously contained only the target branch's remote HEAD. The BFS in walk_commits followed parent2's chain with no stop anchor, walking the merged branch's entire history and sending thousands of already-remote commits to the server.

Fix: when the local HEAD is a merge commit, append all known remote branch heads to branch_have. The BFS then stops at the nearest already-remote commit on parent2's chain — sending only the merge commit plus the N new commits between the remote's stale branch tip and parent2, not the full ancestry.

Using all remote heads is safe for merge commits: parent1 is the target branch's remote HEAD (one direct hop), so there is no intermediate branch between remote_head and local_head to trigger the fast-forward verification problem on parent1's chain.

Adds three regression tests covering: - merge where both branch HEADs are exact remote heads (sends 1 commit) - merge where merged branch is N commits ahead of remote (sends N+1) - merge push exits 0 (smoke)

sha256:02b055a39cb0a0976db28c18a8372bf12b43303cdb8711cf38236d8af0b799b2 sha
+2 ~2 −1 symbols
sha256:40bd7f9500f98245d128233a5187c0be338ddad78ac0cec157d8687a091d2eed snapshot
+2
symbols added
~2
symbols modified
−1
symbol removed
0
dead code introduced
Semantic Changes 5 symbols
~ muse/cli/commands/push.py .py 1 symbol modified
~ run
~ tests/test_cmd_push_hardening.py .py 2 symbols added, 1 symbol removed, 1 symbol modified
− test_merge_push_sends_one_commit method method test_merge_push_sends_one_commit L870–894
+ test_merge_push_sends_one_commit_exact_heads method method test_merge_push_sends_one_commit_exact_heads L870–895
+ test_merge_push_sends_only_new_commits_when_branch_is_ahead method method test_merge_push_sends_only_new_commits_when_branch_is_ahead L897–939
← 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:02b055a39cb0a0976db28c18a8372bf12b43303cdb8711cf38236d8af0b799b2 --body "your comment"