FA-75750 / Text diff and three-way merge / Member archive
Unified hunk parser: an omitted old count is read as zero · case 05
Single-line hunks are rejected as truncated or misread.
Case contract
Parse "@@ -a[,b] +c[,d] @@" hunks (omitted counts are 1) and consume body lines until both remaining counts reach zero: " " (or a completely empty line) counts for both sides, "-" for old, "+" for new, "\\" marker lines are skipped and not counted, anything else ends the body. Remaining counts other than zero yield {"error": "hunk k truncated"}. Return [a, b, c, d, body_lines] per hunk.
Why this case matters
Patch tools must validate hunk bodies against their headers before applying anything.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| omitted counts mean one | {"error": "hunk 0 truncated"} | {"hunks": [[4, 1, 4, 1, 2]]} | 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 ↗