gabriel / muse public
feat patch resolve feat/resolve-phase1 #1 / 1
AI Agent gabriel · 119 days ago · May 21, 2026 · Diff

feat(resolve): Phase 1 — resolve_path and resolve_symbol MERGE_STATE primitives (issue #8)

Add two mutation primitives to muse/core/merge_engine.py:

- resolve_path(root, path) -> list[str]: removes all conflict_paths entries whose file portion matches path (supports both plain paths and path::symbol entries); returns list of cleared addresses; idempotent - resolve_symbol(root, symbol_address) -> str: removes exactly one entry from conflict_paths by exact address match; returns True if found, False if already absent; idempotent

Both functions: - never mutate original_conflict_paths (Harmony reads it at commit time) - preserve all other MERGE_STATE fields (commit refs, branch name) - raise ValueError when no merge is in progress - use _write_conflict_paths() helper for atomic MERGE_STATE persistence

20 tests covering path resolution, symbol resolution, idempotency, original_conflict_paths immutability, field preservation, and edge cases (prefix collisions, last-entry resolution, multi-resolve sequences).

sha256:93031bac55d9d97f07057cc4effa857c2cb8b36bf7b4458affb85acd8bbd8ce3 sha
+43 symbols
sha256:9bbbcc798225767421fe74e673a94c6f90bff4d5412df97ce0f2dad08cddaa87 snapshot
+43
symbols added
0
dead code introduced
Semantic Changes 43 symbols
~ tests/test_resolve_phase1.py .py 40 symbols added
+ TestResolvePath class class TestResolvePath L72–144
+ test_clears_mixed_plain_and_symbol_entries method method test_clears_mixed_plain_and_symbol_entries L87–92
+ test_clears_plain_file_entry method method test_clears_plain_file_entry L73–78
+ test_clears_symbol_level_entries_for_file method method test_clears_symbol_level_entries_for_file L80–85
+ test_does_not_clear_entries_with_similar_prefix method method test_does_not_clear_entries_with_similar_prefix L136–144
+ test_does_not_mutate_original_conflict_paths method method test_does_not_mutate_original_conflict_paths L108–113
+ test_empties_conflict_paths_when_all_resolved method method test_empties_conflict_paths_when_all_resolved L115–119
+ test_idempotent_second_call_returns_empty method method test_idempotent_second_call_returns_empty L101–106
+ test_preserves_other_merge_state_fields method method test_preserves_other_merge_state_fields L126–134
+ test_raises_when_no_merge_in_progress method method test_raises_when_no_merge_in_progress L121–124
+ test_returns_empty_when_path_not_conflicted method method test_returns_empty_when_path_not_conflicted L94–99
+ TestResolveSymbol class class TestResolveSymbol L151–223
+ test_does_not_mutate_original_conflict_paths method method test_does_not_mutate_original_conflict_paths L180–185
+ test_empties_conflict_paths_when_last_entry_resolved method method test_empties_conflict_paths_when_last_entry_resolved L209–213
+ test_idempotent_second_call_returns_false method method test_idempotent_second_call_returns_false L173–178
+ test_original_paths_persisted_across_multiple_resolves method method test_original_paths_persisted_across_multiple_resolves L215–223
+ test_preserves_other_merge_state_fields method method test_preserves_other_merge_state_fields L199–207
+ test_raises_when_no_merge_in_progress method method test_raises_when_no_merge_in_progress L187–190
+ test_removes_only_exact_match method method test_removes_only_exact_match L192–197
+ test_removes_plain_path_entry method method test_removes_plain_path_entry L152–157
+ test_removes_symbol_address_entry method method test_removes_symbol_address_entry L159–164
+ test_returns_false_when_not_present method method test_returns_false_when_not_present L166–171
+ _BASE variable variable _BASE L41–41
+ _OURS variable variable _OURS L42–42
+ _THEIRS variable variable _THEIRS L43–43
+ _repo function function _repo L46–48
+ _state function function _state L62–65
+ _write function function _write L51–59
+ MUSE_DIR import import MUSE_DIR L34–34
+ MergeState import import MergeState L26–26
+ annotations import import annotations L19–19
+ clear_merge_state import import clear_merge_state L26–26
+ fake_id import import fake_id L34–34
+ json import import json L21–21
+ pathlib import import pathlib L22–22
+ pytest import import pytest L24–24
+ read_merge_state import import read_merge_state L26–26
+ resolve_path import import resolve_path L26–26
+ resolve_symbol import import resolve_symbol L26–26
+ write_merge_state import import write_merge_state L26–26
~ muse/core/merge_engine.py .py 3 symbols added
+ _write_conflict_paths function function _write_conflict_paths L226–246
+ resolve_path function function resolve_path L249–284
+ resolve_symbol function function resolve_symbol L287–313
← Older Oldest on feat/resolve-phase1
All commits
Newer → Latest on feat/resolve-phase1

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