FA-48676 / Delimited text / Open access
Filtered rows are labeled with their logical index · case 01
A structured table violates the declared record or column contract.
ROOT CAUSE
Filtered rows are labeled with their logical index.
VERIFIED REPAIR
Preserve the named invariant at the faulty decision: out.append([physical,line.split(',')])
Unsuccessful approach: The alternate implementation still violates the same declared invariant: filtered rows are labeled with their logical index.
Case contract
Select a half-open zero-based logical row window [start,stop) from physical comma lines. Column-zero # lines and completely empty physical lines are ignored before numbering; whitespace-only lines remain data. Return [one-based physical line number, split cells] for selected logical rows.
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=[]; logical=0
for physical,line in enumerate(data['lines'],1):
if line=='' or line.startswith('#'): continue
if data['start']<=logical<data['stop']: out.append([logical+1,line.split(',')])
logical+=1
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'lines': ['#note', 'a,b', '', '@,x', 'z,y'], 'start': 1, 'stop': 2})), _vary([[4, ['@', 'x']]]))
check('all', solve(_vary({'lines': ['@,x', 'z,y'], 'start': 0, 'stop': 2})), _vary([[1, ['@', 'x']], [2, ['z', 'y']]]))
check('space line', solve(_vary({'lines': [' ', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' ']]]))
check('empty window', solve(_vary({'lines': ['@'], 'start': 0, 'stop': 0})), _vary([]))
check('beyond', solve(_vary({'lines': ['@'], 'start': 2, 'stop': 4})), _vary([]))
check('indented comment', solve(_vary({'lines': [' #data', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' #data']]]))
check('zero lines', solve(_vary({'lines': [], 'start': 0, 'stop': 3})), _vary([]))
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 |
|---|---|---|---|
| window | [[2, ['cell', 'x']]] | [[4, ['cell', 'x']]] | Failed |
| all | [[1, ['cell', 'x']], [2, ['z', 'y']]] | [[1, ['cell', 'x']], [2, ['z', 'y']]] | Passed |
| space line | [[1, [' ']]] | [[1, [' ']]] | Passed |
| empty window | [] | [] | Passed |
| beyond | [] | [] | Passed |
| indented comment | [[1, [' #data']]] | [[1, [' #data']]] | Passed |
| zero lines | [] | [] | Passed |
SHA-256 / 76a958fd712a81a457fb89add99d0e596c0d164f5e73d3467e9ee87c5ec6abf7
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=[]; logical=0
for physical,line in enumerate(data['lines'],1):
if line=='' or line.startswith('#'): continue
if data['start']<=logical<data['stop']: out.append([len(out)+1,line.split(',')])
logical+=1
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'lines': ['#note', 'a,b', '', '@,x', 'z,y'], 'start': 1, 'stop': 2})), _vary([[4, ['@', 'x']]]))
check('all', solve(_vary({'lines': ['@,x', 'z,y'], 'start': 0, 'stop': 2})), _vary([[1, ['@', 'x']], [2, ['z', 'y']]]))
check('space line', solve(_vary({'lines': [' ', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' ']]]))
check('empty window', solve(_vary({'lines': ['@'], 'start': 0, 'stop': 0})), _vary([]))
check('beyond', solve(_vary({'lines': ['@'], 'start': 2, 'stop': 4})), _vary([]))
check('indented comment', solve(_vary({'lines': [' #data', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' #data']]]))
check('zero lines', solve(_vary({'lines': [], 'start': 0, 'stop': 3})), _vary([]))
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 |
|---|---|---|---|
| window | [[1, ['cell', 'x']]] | [[4, ['cell', 'x']]] | Failed |
| all | [[1, ['cell', 'x']], [2, ['z', 'y']]] | [[1, ['cell', 'x']], [2, ['z', 'y']]] | Passed |
| space line | [[1, [' ']]] | [[1, [' ']]] | Passed |
| empty window | [] | [] | Passed |
| beyond | [] | [] | Passed |
| indented comment | [[1, [' #data']]] | [[1, [' #data']]] | Passed |
| zero lines | [] | [] | Passed |
SHA-256 / 49e167f62f63305a9a65322f60674891b00343425fda0005e3f3de1b446f27f1
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=[]; logical=0
for physical,line in enumerate(data['lines'],1):
if line=='' or line.startswith('#'): continue
if data['start']<=logical<data['stop']: out.append([physical,line.split(',')])
logical+=1
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'lines': ['#note', 'a,b', '', '@,x', 'z,y'], 'start': 1, 'stop': 2})), _vary([[4, ['@', 'x']]]))
check('all', solve(_vary({'lines': ['@,x', 'z,y'], 'start': 0, 'stop': 2})), _vary([[1, ['@', 'x']], [2, ['z', 'y']]]))
check('space line', solve(_vary({'lines': [' ', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' ']]]))
check('empty window', solve(_vary({'lines': ['@'], 'start': 0, 'stop': 0})), _vary([]))
check('beyond', solve(_vary({'lines': ['@'], 'start': 2, 'stop': 4})), _vary([]))
check('indented comment', solve(_vary({'lines': [' #data', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' #data']]]))
check('zero lines', solve(_vary({'lines': [], 'start': 0, 'stop': 3})), _vary([]))
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 |
|---|---|---|---|
| window | [[4, ['cell', 'x']]] | [[4, ['cell', 'x']]] | Passed |
| all | [[1, ['cell', 'x']], [2, ['z', 'y']]] | [[1, ['cell', 'x']], [2, ['z', 'y']]] | Passed |
| space line | [[1, [' ']]] | [[1, [' ']]] | Passed |
| empty window | [] | [] | Passed |
| beyond | [] | [] | Passed |
| indented comment | [[1, [' #data']]] | [[1, [' #data']]] | Passed |
| zero lines | [] | [] | Passed |
SHA-256 / 7576fa0bf649b7cfb3210efe2fe14c053e61c6dcd92d4a5fb2b8e7bade5dbe37
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:52.880769+00:00.
Case digest / 3e79be81092f9c7d69982af3f895a6ef9f3f1726096c3ec4485fe216d00c4017