FA-47376 / Delimited text / Open access
A data row sharing the first header cell disappears · case 01
A structured table violates the declared record or column contract.
ROOT CAUSE
A prefix comparison substitutes for full repeated-header identity.
VERIFIED REPAIR
Preserve the named invariant at the faulty decision: if row == header: continue
Unsuccessful approach: Set comparison ignores header column order.
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[1:]:
row = line.split(',')
if row[0] == header[0]: 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']] | Failed |
| 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 / a6c64b6ff9d369e6b8e66984be2dbe26db764949953a86d5a2294d919e48e9c5
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:]:
row = line.split(',')
if set(row) == set(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']] | Failed |
SHA-256 / a1af9da39ef744159dbf9bb2ce64790d8ec5d2451c0c9e7615ebf03682fc0eed
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.911926+00:00.
Case digest / 51af7c06e747ea6ab07a13506529911e245ed3fd9a3d11c1f1c94f4a0d4f5041