FA-47971 / Delimited text / Open access
Quarantine stops at the first malformed record · case 01
A structured table violates the declared record or column contract.
ROOT CAUSE
A recoverable width error terminates the import loop.
VERIFIED REPAIR
Preserve the named invariant at the faulty decision: continue rows.append(cells)
Unsuccessful approach: Returning the partial report still loses subsequent valid and invalid records.
Case contract
Import three-column comma rows with exact modes strict, skip, or collect. Width failures are 1-based source record positions. Strict returns {error:position}; skip omits bad rows; collect returns valid rows and errors containing position and original cells. Header is supplied separately and not counted.
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):
rows, errors = [], []
for position,line in enumerate(data['lines'], 1):
cells = line.split(',')
if len(cells) != 3:
if data['mode'] == 'strict': return {'error':position}
if data['mode'] == 'collect': errors.append([position, cells])
break
rows.append(cells)
return {'rows':rows, 'errors':errors}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('collect', solve(_vary({'mode': 'collect', 'lines': ['@,a,b', 'x,y', 'c,d,e', 'z']})), _vary({'rows': [['@', 'a', 'b'], ['c', 'd', 'e']], 'errors': [[2, ['x', 'y']], [4, ['z']]]}))
check('strict', solve(_vary({'mode': 'strict', 'lines': ['@,a,b', 'x,y', 'c,d,e']})), _vary({'error': 2}))
check('skip', solve(_vary({'mode': 'skip', 'lines': ['x,y', '@,a,b', 'z']})), _vary({'rows': [['@', 'a', 'b']], 'errors': []}))
check('normal', solve(_vary({'mode': 'strict', 'lines': ['@,a,b']})), _vary({'rows': [['@', 'a', 'b']], 'errors': []}))
check('empty', solve(_vary({'mode': 'collect', 'lines': []})), _vary({'rows': [], 'errors': []}))
check('empty cells', solve(_vary({'mode': 'collect', 'lines': [',,']})), _vary({'rows': [['', '', '']], 'errors': []}))
check('wide', solve(_vary({'mode': 'collect', 'lines': ['a,b,c,d']})), _vary({'rows': [], 'errors': [[1, ['a', 'b', 'c', 'd']]]}))
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 |
|---|---|---|---|
| collect | {'errors': [[2, ['x', 'y']]], 'rows': [['cell', 'a', 'b']]} | {'errors': [[2, ['x', 'y']], [4, ['z']]], 'rows': [['cell', 'a', 'b'], ['c', 'd', 'e']]} | Failed |
| strict | {'error': 2} | {'error': 2} | Passed |
| skip | {'errors': [], 'rows': []} | {'errors': [], 'rows': [['cell', 'a', 'b']]} | Failed |
| normal | {'errors': [], 'rows': [['cell', 'a', 'b']]} | {'errors': [], 'rows': [['cell', 'a', 'b']]} | Passed |
| empty | {'errors': [], 'rows': []} | {'errors': [], 'rows': []} | Passed |
| empty cells | {'errors': [], 'rows': [['', '', '']]} | {'errors': [], 'rows': [['', '', '']]} | Passed |
| wide | {'errors': [[1, ['a', 'b', 'c', 'd']]], 'rows': []} | {'errors': [[1, ['a', 'b', 'c', 'd']]], 'rows': []} | Passed |
SHA-256 / 6e626511951780f3f193b3b88a2beb19385db223660700510cf64633189f673b
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):
rows, errors = [], []
for position,line in enumerate(data['lines'], 1):
cells = line.split(',')
if len(cells) != 3:
if data['mode'] == 'strict': return {'error':position}
if data['mode'] == 'collect': errors.append([position, cells])
return {'rows':rows, 'errors':errors}
rows.append(cells)
return {'rows':rows, 'errors':errors}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('collect', solve(_vary({'mode': 'collect', 'lines': ['@,a,b', 'x,y', 'c,d,e', 'z']})), _vary({'rows': [['@', 'a', 'b'], ['c', 'd', 'e']], 'errors': [[2, ['x', 'y']], [4, ['z']]]}))
check('strict', solve(_vary({'mode': 'strict', 'lines': ['@,a,b', 'x,y', 'c,d,e']})), _vary({'error': 2}))
check('skip', solve(_vary({'mode': 'skip', 'lines': ['x,y', '@,a,b', 'z']})), _vary({'rows': [['@', 'a', 'b']], 'errors': []}))
check('normal', solve(_vary({'mode': 'strict', 'lines': ['@,a,b']})), _vary({'rows': [['@', 'a', 'b']], 'errors': []}))
check('empty', solve(_vary({'mode': 'collect', 'lines': []})), _vary({'rows': [], 'errors': []}))
check('empty cells', solve(_vary({'mode': 'collect', 'lines': [',,']})), _vary({'rows': [['', '', '']], 'errors': []}))
check('wide', solve(_vary({'mode': 'collect', 'lines': ['a,b,c,d']})), _vary({'rows': [], 'errors': [[1, ['a', 'b', 'c', 'd']]]}))
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 |
|---|---|---|---|
| collect | {'errors': [[2, ['x', 'y']]], 'rows': [['cell', 'a', 'b']]} | {'errors': [[2, ['x', 'y']], [4, ['z']]], 'rows': [['cell', 'a', 'b'], ['c', 'd', 'e']]} | Failed |
| strict | {'error': 2} | {'error': 2} | Passed |
| skip | {'errors': [], 'rows': []} | {'errors': [], 'rows': [['cell', 'a', 'b']]} | Failed |
| normal | {'errors': [], 'rows': [['cell', 'a', 'b']]} | {'errors': [], 'rows': [['cell', 'a', 'b']]} | Passed |
| empty | {'errors': [], 'rows': []} | {'errors': [], 'rows': []} | Passed |
| empty cells | {'errors': [], 'rows': [['', '', '']]} | {'errors': [], 'rows': [['', '', '']]} | Passed |
| wide | {'errors': [[1, ['a', 'b', 'c', 'd']]], 'rows': []} | {'errors': [[1, ['a', 'b', 'c', 'd']]], 'rows': []} | Passed |
SHA-256 / 545f9691dc8511a42e23007147114cb8733cada1f40b8f8bde31bcd209442fe7
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):
rows, errors = [], []
for position,line in enumerate(data['lines'], 1):
cells = line.split(',')
if len(cells) != 3:
if data['mode'] == 'strict': return {'error':position}
if data['mode'] == 'collect': errors.append([position, cells])
continue
rows.append(cells)
return {'rows':rows, 'errors':errors}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('collect', solve(_vary({'mode': 'collect', 'lines': ['@,a,b', 'x,y', 'c,d,e', 'z']})), _vary({'rows': [['@', 'a', 'b'], ['c', 'd', 'e']], 'errors': [[2, ['x', 'y']], [4, ['z']]]}))
check('strict', solve(_vary({'mode': 'strict', 'lines': ['@,a,b', 'x,y', 'c,d,e']})), _vary({'error': 2}))
check('skip', solve(_vary({'mode': 'skip', 'lines': ['x,y', '@,a,b', 'z']})), _vary({'rows': [['@', 'a', 'b']], 'errors': []}))
check('normal', solve(_vary({'mode': 'strict', 'lines': ['@,a,b']})), _vary({'rows': [['@', 'a', 'b']], 'errors': []}))
check('empty', solve(_vary({'mode': 'collect', 'lines': []})), _vary({'rows': [], 'errors': []}))
check('empty cells', solve(_vary({'mode': 'collect', 'lines': [',,']})), _vary({'rows': [['', '', '']], 'errors': []}))
check('wide', solve(_vary({'mode': 'collect', 'lines': ['a,b,c,d']})), _vary({'rows': [], 'errors': [[1, ['a', 'b', 'c', 'd']]]}))
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 |
|---|---|---|---|
| collect | {'errors': [[2, ['x', 'y']], [4, ['z']]], 'rows': [['cell', 'a', 'b'], ['c', 'd', 'e']]} | {'errors': [[2, ['x', 'y']], [4, ['z']]], 'rows': [['cell', 'a', 'b'], ['c', 'd', 'e']]} | Passed |
| strict | {'error': 2} | {'error': 2} | Passed |
| skip | {'errors': [], 'rows': [['cell', 'a', 'b']]} | {'errors': [], 'rows': [['cell', 'a', 'b']]} | Passed |
| normal | {'errors': [], 'rows': [['cell', 'a', 'b']]} | {'errors': [], 'rows': [['cell', 'a', 'b']]} | Passed |
| empty | {'errors': [], 'rows': []} | {'errors': [], 'rows': []} | Passed |
| empty cells | {'errors': [], 'rows': [['', '', '']]} | {'errors': [], 'rows': [['', '', '']]} | Passed |
| wide | {'errors': [[1, ['a', 'b', 'c', 'd']]], 'rows': []} | {'errors': [[1, ['a', 'b', 'c', 'd']]], 'rows': []} | Passed |
SHA-256 / 7174d4ccd4148028e0bac6342bad2cdc7ca8bbc1aff2fedd176eeeaa8473631f
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:46.423492+00:00.
Case digest / b457222346c7fadc3de290df4f0e7c0c8abfc036606b52dd2d3a188933bd3290