gabriel / muse public
fix merge dev
AI Agent gabriel · 143 days ago · Apr 27, 2026 · Diff

fix(merge): Phase 3 — apply_manifest before write_merge_state in conflict path

Swaps the order of apply_manifest and write_merge_state in the merge conflict path so the working tree is updated before the state file is written.

A crash after write_merge_state but before apply_manifest left MERGE_STATE.json claiming a conflict while the working tree was still at 'ours' — the user could not resolve anything (stuck state). With the new order, a crash after apply_manifest leaves a dirty tree with no MERGE_STATE.json, which is recoverable: re-run muse merge.

4-test suite in test_phase3_merge_state_ordering.py: call order assertion, integration (file + status), crash recovery.

sha256:33e25d81882e18becd7cc4d8dfe5b4ce008387961698d019f24065a7950f7be0 sha
+17 ~1 symbols
sha256:e308c93b6fb1d002b5342609e61f05638bcfde0b6064137df27c9270bfe787ec snapshot
+17
symbols added
~1
symbol modified
0
dead code introduced
Semantic Changes 18 symbols
+ TestCallOrder class class TestCallOrder L74–116
+ test_apply_manifest_called_before_write_merge_state method method test_apply_manifest_called_before_write_merge_state L75–116
+ TestCrashRecovery class class TestCrashRecovery L150–173
+ test_crash_after_apply_before_write_merge_leaves_no_merge_state method method test_crash_after_apply_before_write_merge_leaves_no_merge_state L151–173
+ TestMergeConflictIntegration class class TestMergeConflictIntegration L123–143
+ test_conflict_leaves_working_tree_dirty method method test_conflict_leaves_working_tree_dirty L132–143
+ test_conflict_produces_merge_state_file method method test_conflict_produces_merge_state_file L124–130
+ _run function function _run L41–45
+ _setup_conflict_scenario function function _setup_conflict_scenario L48–67
+ CliRunner import import CliRunner L36–36
+ MagicMock import import MagicMock L32–32
+ annotations import import annotations L29–29
+ call import import call L32–32
+ patch import import patch L32–32
+ pathlib import import pathlib L31–31
+ pytest import import pytest L34–34
+ runner variable variable runner L38–38
~ muse/cli/commands/merge.py .py 1 symbol modified
← 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:33e25d81882e18becd7cc4d8dfe5b4ce008387961698d019f24065a7950f7be0 --body "your comment"