FA-75585 / Text diff and three-way merge / Member archive
Character diff cleanup merge: insertions are emitted before deletions · case 05
The same replacement normalizes to insertion-first output, unlike the canonical form.
Case contract
Normalize a character diff of [op, text] (op -1 delete, 0 equal, 1 insert): drop empty texts, merge adjacent equalities, collect each run of edits into one deletion and one insertion (deletion first), move their common prefix into the preceding equality (creating one at the start if needed) and their common suffix into the following equality (appending one at the end if needed).
Why this case matters
Character-level diff engines normalize raw edit scripts so that the same change always renders the same way.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| common prefix moves into the previous equality | [[0, "xab"], [1, "d"], [-1, "c"], [0, "y"]] | [[0, "xab"], [-1, "c"], [1, "d"], [0, "y"]] | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗