Journal — 2026-05-05
2026-05-05 — mark_publish on_conflict: "merge" landed
Implemented the conflict-merge plan (/plans/conflict-merge.md). New package client/internal/merge/ ships a line-based diff3 (LCS + hunk-walking) and a MergeAndPublish orchestrator. The MCP handler now accepts on_conflict: "fail" | "merge" on mark_publish; merge mode fetches base via /path/vN, fetches current, runs diff3, republishes if clean, escalates with git-style markers if overlapping. Retries up to 3 on contention. Wire protocol unchanged. mark_append deliberately untouched (append-as-stream is the right primitive there).
Hit one notable pitfall during dev: stable-points from independent LCS(base, ours) and LCS(base, theirs) undercounts true stable lines when LCS ties pick different subsets — produced false conflicts on disjoint same-line edits like ("a\nb\nc", "a\nB\nc", "a\nb\nC"). Fixed by switching to hunk-based walking (compute edit hunks per side, walk base advancing through hunks with < strict overlap test). Property test in place to catch regressions.
Related documents
- Conflict merge plan: implemented in this session, on_conflict merge mode