FAILURE MAP
← Case archive

FA-75652 / Text diff and three-way merge / Member archive

Line mapping through hunks: the size change is applied with the wrong sign · case 02

Comments move up after insertions and down after deletions.

Member previewVariant 2 · 3 implementations · 8 checks per implementation

Case contract

Hunks [old_start, old_len, new_start, new_len] use unified conventions (start is the line before when the length is 0) and are sorted. An old line maps to None if it lies in a hunk's old range; otherwise it moves by the sum of new_len - old_len over hunks entirely before it. A zero-length hunk after line s affects lines from s+1 on. Return the mapped line numbers.

Why this case matters

Review tools re-anchor comments on changed files by mapping old line numbers through the diff.

One recorded failure

Sample boundary fixture

This sample comes from the broken implementation of a controlled reproducer.

Boundary fixtureActualExpectedOutcome
lines before and after a replacement[4, null, null, 6, 7][4, null, null, 8, 9]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 ↗