gabriel / muse public
feat BREAKING task/phase3-weave-union-docs #1 / 1
AI Agent gabriel · 163 days ago · Apr 17, 2026 · Diff

feat: Phase 3 — weave-based union for docs/markdown + _find_sync_regions bugfix

Phase 3: union strategy now performs real line-level merge using _independence_merge_blob() instead of silently discarding theirs' content. Both sides' prose additions survive in the merged blob with no conflict markers.

Bonus fix: _find_sync_regions in cohen_transform.py had a sentinel bug — prev_bp initialised to -1 caused the first stable element (bp=0) to falsely enter the 'extend run' branch via 0 == -1+1, leaving run_bp=-1 and flushing nothing. Fixed by initialising prev_bp to -2. This caused all three-way merges where stable content starts at line 0 to treat the entire file as a single conflict region rather than finding the common prefix.

- cohen_transform._find_sync_regions: prev sentinel -1 → -2 (bugfix) - CodePlugin.merge() union branch: read blobs and call _independence_merge_blob - 11 new TDD tests in test_phase3_weave_union_docs.py

sha256:f582f125162c55629f2b03172f73293585bc5ac6b598ce4ed1b5a6f4635f5da9 sha
+28 ~3 symbols
sha256:61233f30828794a3e1dec581f07d212f7aefe07893a7d7a0a8da6bb8625ff857 snapshot
+28
symbols added
~3
symbols modified
0
dead code introduced
Semantic Changes 31 symbols
~ tests/test_phase3_weave_union_docs.py .py 28 symbols added
+ TestUnionStrategyCorrectness class class TestUnionStrategyCorrectness L110–190
+ test_union_md_glob_rule_works method method test_union_md_glob_rule_works L160–174
+ test_union_merged_blob_has_no_conflict_markers method method test_union_merged_blob_has_no_conflict_markers L176–190
+ test_union_merges_both_sides_additions_no_conflict method method test_union_merges_both_sides_additions_no_conflict L113–128
+ test_union_ours_additions_present_in_merged method method test_union_ours_additions_present_in_merged L130–143
+ test_union_theirs_additions_present_in_merged method method test_union_theirs_additions_present_in_merged L145–158
+ TestUnionStrategyEdgeCases class class TestUnionStrategyEdgeCases L236–284
+ test_identical_both_sides_no_conflict method method test_identical_both_sides_no_conflict L270–284
+ test_ours_only_change_preserved method method test_ours_only_change_preserved L239–253
+ test_theirs_only_change_preserved method method test_theirs_only_change_preserved L255–268
+ TestUnionStrategyFallback class class TestUnionStrategyFallback L291–305
+ test_no_repo_root_does_not_crash method method test_no_repo_root_does_not_crash L294–305
+ TestUnionStrategyNoDuplication class class TestUnionStrategyNoDuplication L197–229
+ test_base_content_not_duplicated method method test_base_content_not_duplicated L200–214
+ test_same_addition_on_both_sides_deduplicated method method test_same_addition_on_both_sides_deduplicated L216–229
+ _DOCS_BASE variable variable _DOCS_BASE L78–83
+ _DOCS_OURS variable variable _DOCS_OURS L85–93
+ _DOCS_THEIRS variable variable _DOCS_THEIRS L95–103
+ _attrs function function _attrs L64–75
+ _oid function function _oid L37–38
+ _read_blob function function _read_blob L56–61
+ _snap function function _snap L48–53
+ _write_blob function function _write_blob L41–45
+ CodePlugin import import CodePlugin L30–30
+ annotations import import annotations L23–23
+ hashlib import import hashlib L25–25
+ pathlib import import pathlib L26–26
+ pytest import import pytest L28–28
~ muse/plugins/code/plugin.py .py 2 symbols modified
← Older Oldest on task/phase3-weave-union-docs
All commits
Newer → Latest on task/phase3-weave-union-docs

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