FA-48686 / Delimited text / Open access
Window numbering starts from logical row one · case 01
A structured table violates the declared record or column contract.
ROOT CAUSE
Window numbering starts from logical row one.
VERIFIED REPAIR
Preserve the named invariant at the faulty decision: out=[]; logical=0
Unsuccessful approach: The alternate implementation still violates the same declared invariant: window numbering starts from logical row one.
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=1
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 | [[2, ['a', 'b']]] | [[4, ['cell', 'x']]] | Failed |
| all | [[1, ['cell', 'x']]] | [[1, ['cell', 'x']], [2, ['z', 'y']]] | Failed |
| space line | [] | [[1, [' ']]] | Failed |
| empty window | [] | [] | Passed |
| beyond | [] | [] | Passed |
| indented comment | [] | [[1, [' #data']]] | Failed |
| zero lines | [] | [] | Passed |
SHA-256 / 8844fe45aa7914878809d41f126a998d5ae50c070b78b3b97403cc7574fe726e
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=-1
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 | [[5, ['z', 'y']]] | [[4, ['cell', 'x']]] | Failed |
| all | [[2, ['z', 'y']]] | [[1, ['cell', 'x']], [2, ['z', 'y']]] | Failed |
| space line | [[2, ['cell']]] | [[1, [' ']]] | Failed |
| empty window | [] | [] | Passed |
| beyond | [] | [] | Passed |
| indented comment | [[2, ['cell']]] | [[1, [' #data']]] | Failed |
| zero lines | [] | [] | Passed |
SHA-256 / 13cae447476d1baef02345e908688748e2dcda0ee0e5bacb4b982216f03b3864
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:53.096510+00:00.
Case digest / 4b803513109035c12de777c2516570c9517e76c2be28ba6f6c22609058b44734