FA-48811 / Delimited text / Open access
Blank physical CSV records disappear from the provenance stream · case 01
A structured table violates the declared record or column contract.
ROOT CAUSE
Blank physical CSV records disappear from the provenance stream.
VERIFIED REPAIR
Preserve the named invariant at the faulty decision: out.append([start,end,cells])
Unsuccessful approach: The alternate implementation still violates the same declared invariant: blank physical csv records disappear from the provenance stream.
Case contract
Parse bounded valid CSV text using Python csv.reader and report each logical row with inclusive one-based physical start/end line numbers. Quoted embedded newlines count as physical lines. Empty input gives no rows; blank physical lines are zero-cell rows. Return [start,end,cells].
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):
import csv,io
reader=csv.reader(io.StringIO(data,newline=''))
out=[]; start=1
for cells in reader:
end=reader.line_num
if cells: out.append([start,end,cells])
start=end+1
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('multiline', solve(_vary('a,"x\ny"\nz,@\n')), _vary([[1, 2, ['a', 'x\ny']], [3, 3, ['z', '@']]]))
check('blank middle', solve(_vary('a\n\nz\n')), _vary([[1, 1, ['a']], [2, 2, []], [3, 3, ['z']]]))
check('plain', solve(_vary('@,x\n')), _vary([[1, 1, ['@', 'x']]]))
check('CRLF', solve(_vary('"a\r\nb",z\r\n')), _vary([[1, 2, ['a\r\nb', 'z']]]))
check('empty', solve(_vary('')), _vary([]))
check('unterminated final', solve(_vary('@')), _vary([[1, 1, ['@']]]))
check('two multiline', solve(_vary('"a\nb"\n"c\nd"')), _vary([[1, 2, ['a\nb']], [3, 4, ['c\nd']]]))
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 |
|---|---|---|---|
| multiline | [[1, 2, ['a', 'x\ny']], [3, 3, ['z', 'cell']]] | [[1, 2, ['a', 'x\ny']], [3, 3, ['z', 'cell']]] | Passed |
| blank middle | [[1, 1, ['a']], [3, 3, ['z']]] | [[1, 1, ['a']], [2, 2, []], [3, 3, ['z']]] | Failed |
| plain | [[1, 1, ['cell', 'x']]] | [[1, 1, ['cell', 'x']]] | Passed |
| CRLF | [[1, 2, ['a\r\nb', 'z']]] | [[1, 2, ['a\r\nb', 'z']]] | Passed |
| empty | [] | [] | Passed |
| unterminated final | [[1, 1, ['cell']]] | [[1, 1, ['cell']]] | Passed |
| two multiline | [[1, 2, ['a\nb']], [3, 4, ['c\nd']]] | [[1, 2, ['a\nb']], [3, 4, ['c\nd']]] | Passed |
SHA-256 / 5e0bc289e73009907cc83627d5a0e11f86b903649f156835c773a0dd02abc986
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):
import csv,io
reader=csv.reader(io.StringIO(data,newline=''))
out=[]; start=1
for cells in reader:
end=reader.line_num
if any(cells): out.append([start,end,cells])
start=end+1
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('multiline', solve(_vary('a,"x\ny"\nz,@\n')), _vary([[1, 2, ['a', 'x\ny']], [3, 3, ['z', '@']]]))
check('blank middle', solve(_vary('a\n\nz\n')), _vary([[1, 1, ['a']], [2, 2, []], [3, 3, ['z']]]))
check('plain', solve(_vary('@,x\n')), _vary([[1, 1, ['@', 'x']]]))
check('CRLF', solve(_vary('"a\r\nb",z\r\n')), _vary([[1, 2, ['a\r\nb', 'z']]]))
check('empty', solve(_vary('')), _vary([]))
check('unterminated final', solve(_vary('@')), _vary([[1, 1, ['@']]]))
check('two multiline', solve(_vary('"a\nb"\n"c\nd"')), _vary([[1, 2, ['a\nb']], [3, 4, ['c\nd']]]))
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 |
|---|---|---|---|
| multiline | [[1, 2, ['a', 'x\ny']], [3, 3, ['z', 'cell']]] | [[1, 2, ['a', 'x\ny']], [3, 3, ['z', 'cell']]] | Passed |
| blank middle | [[1, 1, ['a']], [3, 3, ['z']]] | [[1, 1, ['a']], [2, 2, []], [3, 3, ['z']]] | Failed |
| plain | [[1, 1, ['cell', 'x']]] | [[1, 1, ['cell', 'x']]] | Passed |
| CRLF | [[1, 2, ['a\r\nb', 'z']]] | [[1, 2, ['a\r\nb', 'z']]] | Passed |
| empty | [] | [] | Passed |
| unterminated final | [[1, 1, ['cell']]] | [[1, 1, ['cell']]] | Passed |
| two multiline | [[1, 2, ['a\nb']], [3, 4, ['c\nd']]] | [[1, 2, ['a\nb']], [3, 4, ['c\nd']]] | Passed |
SHA-256 / 4edb9a9b5d4d24307f6447be8f60633e04166b17e3b29e7fac8fc28c23967497
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):
import csv,io
reader=csv.reader(io.StringIO(data,newline=''))
out=[]; start=1
for cells in reader:
end=reader.line_num
out.append([start,end,cells])
start=end+1
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('multiline', solve(_vary('a,"x\ny"\nz,@\n')), _vary([[1, 2, ['a', 'x\ny']], [3, 3, ['z', '@']]]))
check('blank middle', solve(_vary('a\n\nz\n')), _vary([[1, 1, ['a']], [2, 2, []], [3, 3, ['z']]]))
check('plain', solve(_vary('@,x\n')), _vary([[1, 1, ['@', 'x']]]))
check('CRLF', solve(_vary('"a\r\nb",z\r\n')), _vary([[1, 2, ['a\r\nb', 'z']]]))
check('empty', solve(_vary('')), _vary([]))
check('unterminated final', solve(_vary('@')), _vary([[1, 1, ['@']]]))
check('two multiline', solve(_vary('"a\nb"\n"c\nd"')), _vary([[1, 2, ['a\nb']], [3, 4, ['c\nd']]]))
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 |
|---|---|---|---|
| multiline | [[1, 2, ['a', 'x\ny']], [3, 3, ['z', 'cell']]] | [[1, 2, ['a', 'x\ny']], [3, 3, ['z', 'cell']]] | Passed |
| blank middle | [[1, 1, ['a']], [2, 2, []], [3, 3, ['z']]] | [[1, 1, ['a']], [2, 2, []], [3, 3, ['z']]] | Passed |
| plain | [[1, 1, ['cell', 'x']]] | [[1, 1, ['cell', 'x']]] | Passed |
| CRLF | [[1, 2, ['a\r\nb', 'z']]] | [[1, 2, ['a\r\nb', 'z']]] | Passed |
| empty | [] | [] | Passed |
| unterminated final | [[1, 1, ['cell']]] | [[1, 1, ['cell']]] | Passed |
| two multiline | [[1, 2, ['a\nb']], [3, 4, ['c\nd']]] | [[1, 2, ['a\nb']], [3, 4, ['c\nd']]] | Passed |
SHA-256 / c0dcd833e59189ee8c02f058ae4196f72cb98eb308059eff0a5c0abb27b2d4b0
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:54.069098+00:00.
Case digest / 132afe097a6dd92ec0f588fad71c94f137248c5cbbcdff4bec21fd719f66c639