FA-47366 / Delimited text / Open access
Blank table separators become empty records · case 01
A structured table violates the declared record or column contract.
ROOT CAUSE
Physical blank records are retained before schema processing.
VERIFIED REPAIR
Preserve the named invariant at the faulty decision: [line for line in data.split('\n') if line != '']
Unsuccessful approach: Dropping only nonfinal blanks leaves a terminal blank record.
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 = data.split('\n')
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 | None | [['cell', 'z']] | Failed |
| duplicates | None | None | Passed |
| wide | None | None | Passed |
| narrow | None | None | Passed |
| header only | [] | [] | Passed |
| trailing blank | None | [['cell', 'z']] | Failed |
| permuted header cells | [['b', 'a']] | [['b', 'a']] | Passed |
SHA-256 / d8524d979003d6a74338ecefa839cbe8effae34d802532cc5540e4d9ef7033c6
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 != '' or line == data.split('\n')[-1]]
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 | None | [['cell', 'z']] | Failed |
| permuted header cells | [['b', 'a']] | [['b', 'a']] | Passed |
SHA-256 / 6faf5a4a6d7814c4909beef2eaf01fece788870ed397b19a577740e6b544ab7a
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.821353+00:00.
Case digest / 90f2b0a2695ad59c600f052378d0368657dfcca1202e852fa5a679ae1af37915