FA-75343 / Text diff and three-way merge / Member archive
LCS edit script: a match extends the wrong neighbouring cell · case 03
Diffs contain more insertions and deletions than necessary around repeated lines.
Case contract
Given old and new line lists, fill a suffix LCS table L[i][j] for a[i:], b[j:], then walk from the start: equal lines are kept, otherwise delete when L[i+1][j] >= L[i][j+1] and insert otherwise; flush remaining old lines as deletions and new lines as insertions. Return [tag, line] ops with tags " ", "-", "+".
Why this case matters
Line diffs are built from a longest-common-subsequence table; the walk decides how edits are ordered and presented.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| repeated line after a replaced one | [["+", "q"], [" ", "r3"], ["-", "r3"]] | [["-", "r3"], ["+", "q"], [" ", "r3"]] | 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 ↗