Skip to content

Synapse merges changes to different parts of the same file (merge tier T1) - #115

Merged
aien-spark merged 8 commits into
mainfrom
synapse/39-merge-t1
Oct 31, 2026
Merged

aien-spark merged 8 commits into
mainfrom
synapse/39-merge-t1

Conversation

@drakestapleton

Copy link
Copy Markdown
Contributor

What this adds

Merge tier T1 (region), ADR 0003 D1. When revisions change the same file in separate places, Synapse now merges them line by line instead of refusing the whole file (T0 refused any two revisions touching one path).

  • synapse-core::merge::region_merge: a base line becomes an anchor when every minimal alignment, in every version, matches it to the same line. The anchors cut the file into segments, and a segment changed by two versions is a conflict. Binary files, files without a final newline, and files whose alignment would exceed 2^22 cells are refused.
  • The derivation rule records tier T1. Recompute refuses forged T1 output. Each attestation records the tier and the canonical merge order.

Evidence

  • Gate 4 conflict scenario: the 3 disjoint-hunk pairs merge, and they go red with T1 switched back to T0. All 253 pairs agree with git merge-tree: 245 merged, 0 differing trees, and 0 merges where Git reports a conflict.
  • 10,000 random cases against git merge-file: 3,947 merged, all identical to Git, and 0 merged where Git conflicts.
  • 10 of 10 mutations go red (evidence/d1-merge-tier-t1/red-green/).
  • Desk rerun on the Spark: cargo test --workspace --locked --no-fail-fast 408 passed, 0 failed; fmt clean; crumbs recompiled with the pinned tool.

Limits

  • T1 is conservative: 1,255 of the 10,000 random cases were refused although Git merges them cleanly (identical edits to one region count as a conflict).
  • The correctness argument covers minimal diffs only. Git's histogram diff and its cost-limited Myers diff are covered by the comparison tests.
  • Not measured: performance.
  • Needs Synapse conformance check finds its built program on the Spark #114 (the Spark conformance fix) merged first, then a main merge here.

Closes #39

🤖 Generated with Claude Code

drakestapleton and others added 4 commits October 18, 2026 13:00
Adds MergeTier::T1Region (tier tag 1) to the B5 derivation rule. region_merge
merges the versions of one file around anchors: base lines that every minimal
alignment matches the same way in every version. A segment changed by more than
one version is refused, so the rule never depends on which minimal diff is
chosen. The merged blob is produced by the rule, written with the derived
revision, and recomputed at admission and verification.

Gate 4 conflict scenario: the 3 disjoint-hunk pairs merge, all 253 pairs agree
with git merge-tree (0 merged Git conflicts, 0 differing trees), and every
attestation records tier T1 and the canonical order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r T1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copy link
Copy Markdown
Contributor Author

Dependency audit: prerequisite #114 is already merged as f29337527e9aac090741db276fc9d08c328ba3d3. Route #115 to a rebase/integration against current main and a fresh exact-head signed check, rather than waiting for #114 to merge again. Preserve the PR's bounded scope and final independent review requirements.

All-PR merge desk: aien-dev/aien-architecture-mv#190. Existing implementation ownership is retained; this is not a merge approval.

@aien-spark
aien-spark merged commit 5f9a638 into main Oct 31, 2026
6 checks passed
@aien-spark
aien-spark deleted the synapse/39-merge-t1 branch October 31, 2026 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ADR 0003 D1: Merge tier T1

2 participants