FA-47371 / Delimited text / Open access
The first data row is skipped as another header · case 01
A structured table violates the declared record or column contract.
ROOT CAUSE
The body cursor advances one record too far.
VERIFIED REPAIR
Preserve the named invariant at the faulty decision: for line in lines[1:]:
Unsuccessful approach: Clipping the last record changes which legitimate row disappears.
Case contract
Parse nonempty comma records with a first header. Skip later records only when the complete row equals the initial header; reject duplicate first header names, data before a header, and data width mismatches. Blank physical lines are ignored.
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):
lines = [line for line in data.split('\n') if line != '']
if not lines: return []
header = lines[0].split(',')
if len(set(header)) != len(header): return None
out = []
for line in lines[2:]:
row = line.split(',')
if row == header: continue
if len(row) != len(header): return None
out.append(row)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated', solve(_vary('a,b\n@,z\na,b\nx,y')), _vary([['@', 'z'], ['x', 'y']]))
check('partial', solve(_vary('a,b\na,y')), _vary([['a', 'y']]))
check('empty', solve(_vary('')), _vary([]))
check('blank', solve(_vary('a,b\n\n@,z')), _vary([['@', 'z']]))
check('duplicates', solve(_vary('a,a\nx,y')), _vary(None))
check('wide', solve(_vary('a,b\nx,y,z')), _vary(None))
check('narrow', solve(_vary('a,b\nx')), _vary(None))
check('header only', solve(_vary('a,b')), _vary([]))
check('trailing blank', solve(_vary('a,b\n@,z\n')), _vary([['@', 'z']]))
check('permuted header cells', solve(_vary('a,b\nb,a')), _vary([['b', 'a']]))
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 |
|---|---|---|---|
| repeated | [['x', 'y']] | [['cell', 'z'], ['x', 'y']] | Failed |
| partial | [] | [['a', 'y']] | Failed |
| empty | [] | [] | Passed |
| blank | [] | [['cell', 'z']] | Failed |
| duplicates | None | None | Passed |
| wide | [] | None | Failed |
| narrow | [] | None | Failed |
| header only | [] | [] | Passed |
| trailing blank | [] | [['cell', 'z']] | Failed |
| permuted header cells | [] | [['b', 'a']] | Failed |
SHA-256 / f83ecc7a6ba2abca632995a91beead76a0d3be66fa56fcf3563cb889fa6b607e
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):
lines = [line for line in data.split('\n') if line != '']
if not lines: return []
header = lines[0].split(',')
if len(set(header)) != len(header): return None
out = []
for line in lines[1:-1]:
row = line.split(',')
if row == header: continue
if len(row) != len(header): return None
out.append(row)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated', solve(_vary('a,b\n@,z\na,b\nx,y')), _vary([['@', 'z'], ['x', 'y']]))
check('partial', solve(_vary('a,b\na,y')), _vary([['a', 'y']]))
check('empty', solve(_vary('')), _vary([]))
check('blank', solve(_vary('a,b\n\n@,z')), _vary([['@', 'z']]))
check('duplicates', solve(_vary('a,a\nx,y')), _vary(None))
check('wide', solve(_vary('a,b\nx,y,z')), _vary(None))
check('narrow', solve(_vary('a,b\nx')), _vary(None))
check('header only', solve(_vary('a,b')), _vary([]))
check('trailing blank', solve(_vary('a,b\n@,z\n')), _vary([['@', 'z']]))
check('permuted header cells', solve(_vary('a,b\nb,a')), _vary([['b', 'a']]))
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 |
|---|---|---|---|
| repeated | [['cell', 'z']] | [['cell', 'z'], ['x', 'y']] | Failed |
| partial | [] | [['a', 'y']] | Failed |
| empty | [] | [] | Passed |
| blank | [] | [['cell', 'z']] | Failed |
| duplicates | None | None | Passed |
| wide | [] | None | Failed |
| narrow | [] | None | Failed |
| header only | [] | [] | Passed |
| trailing blank | [] | [['cell', 'z']] | Failed |
| permuted header cells | [] | [['b', 'a']] | Failed |
SHA-256 / 629e7160da9e2d6b9d44f575485bde3b61ad68ad60c674dc3e958f661c9af62b
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):
lines = [line for line in data.split('\n') if line != '']
if not lines: return []
header = lines[0].split(',')
if len(set(header)) != len(header): return None
out = []
for line in lines[1:]:
row = line.split(',')
if row == header: continue
if len(row) != len(header): return None
out.append(row)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated', solve(_vary('a,b\n@,z\na,b\nx,y')), _vary([['@', 'z'], ['x', 'y']]))
check('partial', solve(_vary('a,b\na,y')), _vary([['a', 'y']]))
check('empty', solve(_vary('')), _vary([]))
check('blank', solve(_vary('a,b\n\n@,z')), _vary([['@', 'z']]))
check('duplicates', solve(_vary('a,a\nx,y')), _vary(None))
check('wide', solve(_vary('a,b\nx,y,z')), _vary(None))
check('narrow', solve(_vary('a,b\nx')), _vary(None))
check('header only', solve(_vary('a,b')), _vary([]))
check('trailing blank', solve(_vary('a,b\n@,z\n')), _vary([['@', 'z']]))
check('permuted header cells', solve(_vary('a,b\nb,a')), _vary([['b', 'a']]))
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 |
|---|---|---|---|
| repeated | [['cell', 'z'], ['x', 'y']] | [['cell', 'z'], ['x', 'y']] | Passed |
| partial | [['a', 'y']] | [['a', 'y']] | Passed |
| empty | [] | [] | Passed |
| blank | [['cell', 'z']] | [['cell', 'z']] | Passed |
| duplicates | None | None | Passed |
| wide | None | None | Passed |
| narrow | None | None | Passed |
| header only | [] | [] | Passed |
| trailing blank | [['cell', 'z']] | [['cell', 'z']] | Passed |
| permuted header cells | [['b', 'a']] | [['b', 'a']] | Passed |
SHA-256 / f360b808b146bdee2cc1bd3528e596ddccba1f079f2fff0159ca59855ba9ae6d
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:40.863165+00:00.
Case digest / f27f80c7a6cb32f5b87bb6ff5e6b0f75aeead6e3c2926cce7c99a849bd3cc0d2