FA-48086 / Delimited text / Open access
Span line numbers start at zero · case 01
A structured table violates the declared record or column contract.
ROOT CAUSE
Record diagnostics use an internal zero-based counter.
VERIFIED REPAIR
Preserve the named invariant at the faulty decision: out, start, line = [], 0, 1
Unsuccessful approach: Starting after an assumed header shifts positions even when no header exists.
Case contract
For UTF-8 text with LF-delimited physical records, report each record as [text,start_byte,end_byte,line_number]. LF is excluded from text and end offset; a final LF does not add a phantom record. Empty interior records remain. Leading BOM is ordinary text here.
Why this case matters
Delimited interchange needs explicit framing, schema and field semantics at ingestion and emission boundaries.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
if value == '@END': return 3 + 4*N
if isinstance(value, str): return value.replace('@', 'cell' * N)
if isinstance(value, list): return [_vary(x) for x in value]
if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
return value
N = 1
observations = []
def solve(data):
out, start, line = [], 0, 0
parts = data.split('\n')
if parts[-1] == '': parts.pop()
for text in parts:
size = len(text.encode('utf-8'))
out.append([text, start, start + size, line])
start += size + 1
line += 1
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unicode', solve(_vary('é\n@')), _vary([['é', 0, 2, 1], ['@', 3, '@END', 2]]))
check('empty middle', solve(_vary('a\n\nb')), _vary([['a', 0, 1, 1], ['', 2, 2, 2], ['b', 3, 4, 3]]))
check('final LF', solve(_vary('a\n')), _vary([['a', 0, 1, 1]]))
check('empty', solve(_vary('')), _vary([]))
check('only LF', solve(_vary('\n')), _vary([['', 0, 0, 1]]))
check('astral', solve(_vary('😀\nz')), _vary([['😀', 0, 4, 1], ['z', 5, 6, 2]]))
check('no LF', solve(_vary('x')), _vary([['x', 0, 1, 1]]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| unicode | [['é', 0, 2, 0], ['cell', 3, 7, 1]] | [['é', 0, 2, 1], ['cell', 3, 7, 2]] | Failed |
| empty middle | [['a', 0, 1, 0], ['', 2, 2, 1], ['b', 3, 4, 2]] | [['a', 0, 1, 1], ['', 2, 2, 2], ['b', 3, 4, 3]] | Failed |
| final LF | [['a', 0, 1, 0]] | [['a', 0, 1, 1]] | Failed |
| empty | [] | [] | Passed |
| only LF | [['', 0, 0, 0]] | [['', 0, 0, 1]] | Failed |
| astral | [['😀', 0, 4, 0], ['z', 5, 6, 1]] | [['😀', 0, 4, 1], ['z', 5, 6, 2]] | Failed |
| no LF | [['x', 0, 1, 0]] | [['x', 0, 1, 1]] | Failed |
SHA-256 / ba1b076ddc5772fb4866502aa7dda19de832bbadafed226c0fe89d383b167964
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
if value == '@END': return 3 + 4*N
if isinstance(value, str): return value.replace('@', 'cell' * N)
if isinstance(value, list): return [_vary(x) for x in value]
if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
return value
N = 1
observations = []
def solve(data):
out, start, line = [], 0, 2
parts = data.split('\n')
if parts[-1] == '': parts.pop()
for text in parts:
size = len(text.encode('utf-8'))
out.append([text, start, start + size, line])
start += size + 1
line += 1
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unicode', solve(_vary('é\n@')), _vary([['é', 0, 2, 1], ['@', 3, '@END', 2]]))
check('empty middle', solve(_vary('a\n\nb')), _vary([['a', 0, 1, 1], ['', 2, 2, 2], ['b', 3, 4, 3]]))
check('final LF', solve(_vary('a\n')), _vary([['a', 0, 1, 1]]))
check('empty', solve(_vary('')), _vary([]))
check('only LF', solve(_vary('\n')), _vary([['', 0, 0, 1]]))
check('astral', solve(_vary('😀\nz')), _vary([['😀', 0, 4, 1], ['z', 5, 6, 2]]))
check('no LF', solve(_vary('x')), _vary([['x', 0, 1, 1]]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| unicode | [['é', 0, 2, 2], ['cell', 3, 7, 3]] | [['é', 0, 2, 1], ['cell', 3, 7, 2]] | Failed |
| empty middle | [['a', 0, 1, 2], ['', 2, 2, 3], ['b', 3, 4, 4]] | [['a', 0, 1, 1], ['', 2, 2, 2], ['b', 3, 4, 3]] | Failed |
| final LF | [['a', 0, 1, 2]] | [['a', 0, 1, 1]] | Failed |
| empty | [] | [] | Passed |
| only LF | [['', 0, 0, 2]] | [['', 0, 0, 1]] | Failed |
| astral | [['😀', 0, 4, 2], ['z', 5, 6, 3]] | [['😀', 0, 4, 1], ['z', 5, 6, 2]] | Failed |
| no LF | [['x', 0, 1, 2]] | [['x', 0, 1, 1]] | Failed |
SHA-256 / 2186d57828cdb1683eca87bc50d281c264cb1a3f604f6808e16afa8f4233e475
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
if value == '@END': return 3 + 4*N
if isinstance(value, str): return value.replace('@', 'cell' * N)
if isinstance(value, list): return [_vary(x) for x in value]
if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
return value
N = 1
observations = []
def solve(data):
out, start, line = [], 0, 1
parts = data.split('\n')
if parts[-1] == '': parts.pop()
for text in parts:
size = len(text.encode('utf-8'))
out.append([text, start, start + size, line])
start += size + 1
line += 1
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unicode', solve(_vary('é\n@')), _vary([['é', 0, 2, 1], ['@', 3, '@END', 2]]))
check('empty middle', solve(_vary('a\n\nb')), _vary([['a', 0, 1, 1], ['', 2, 2, 2], ['b', 3, 4, 3]]))
check('final LF', solve(_vary('a\n')), _vary([['a', 0, 1, 1]]))
check('empty', solve(_vary('')), _vary([]))
check('only LF', solve(_vary('\n')), _vary([['', 0, 0, 1]]))
check('astral', solve(_vary('😀\nz')), _vary([['😀', 0, 4, 1], ['z', 5, 6, 2]]))
check('no LF', solve(_vary('x')), _vary([['x', 0, 1, 1]]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| unicode | [['é', 0, 2, 1], ['cell', 3, 7, 2]] | [['é', 0, 2, 1], ['cell', 3, 7, 2]] | Passed |
| empty middle | [['a', 0, 1, 1], ['', 2, 2, 2], ['b', 3, 4, 3]] | [['a', 0, 1, 1], ['', 2, 2, 2], ['b', 3, 4, 3]] | Passed |
| final LF | [['a', 0, 1, 1]] | [['a', 0, 1, 1]] | Passed |
| empty | [] | [] | Passed |
| only LF | [['', 0, 0, 1]] | [['', 0, 0, 1]] | Passed |
| astral | [['😀', 0, 4, 1], ['z', 5, 6, 2]] | [['😀', 0, 4, 1], ['z', 5, 6, 2]] | Passed |
| no LF | [['x', 0, 1, 1]] | [['x', 0, 1, 1]] | Passed |
SHA-256 / 5a6882ff32edfacc4f2d66200eb1f89df8b3f59bdc8b43ded53608af400d1d63
Verification & scope
Deterministic bounded in-memory model. No claim of complete CSV or external format conformance. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:44:47.545022+00:00.
Case digest / 820c86cd7e310abf7b16c9c2a0982235589057d88cf9acea302ea6e868c87878