FA-47856 / Delimited text / Open access
A valid preamble is ignored by subsequent row splitting · case 01
A structured table violates the declared record or column contract.
ROOT CAUSE
The validated separator is never installed as active parser state.
VERIFIED REPAIR
Preserve the named invariant at the faulty decision: delimiter = value
Unsuccessful approach: Explicitly restoring the default still ignores the declared dialect.
Case contract
Read a table with optional exact first line sep=<single nonquote, nonnewline character>. A first-line BOM is removed before recognizing this directive. Without directive use comma. The directive is not data. Later sep= lines are ordinary records. Return delimiter and split records; empty input has no records.
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 = list(data)
if not lines: return [',', []]
if lines[0].startswith('\ufeff'): lines[0] = lines[0][1:]
delimiter = ','
if lines[0].startswith('sep='):
value = lines.pop(0)[4:]
if len(value) != 1 or value in '\r\n"': return None
delimiter = delimiter
return [delimiter, [line.split(delimiter) for line in lines]]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('custom', solve(_vary(['sep=;', '@;x'])), _vary([';', [['@', 'x']]]))
check('BOM directive', solve(_vary(['\ufeffsep=;', '@;x'])), _vary([';', [['@', 'x']]]))
check('default', solve(_vary(['@,x'])), _vary([',', [['@', 'x']]]))
check('later directive', solve(_vary(['a,b', 'sep=;'])), _vary([',', [['a', 'b'], ['sep=;']]]))
check('bad multi', solve(_vary(['sep=;;', 'x'])), _vary(None))
check('bad quote', solve(_vary(['sep="', 'x'])), _vary(None))
check('empty marker', solve(_vary(['sep=', 'x'])), _vary(None))
check('directive only', solve(_vary(['sep=;'])), _vary([';', []]))
check('zero', solve(_vary([])), _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 |
|---|---|---|---|
| custom | [',', [['cell;x']]] | [';', [['cell', 'x']]] | Failed |
| BOM directive | [',', [['cell;x']]] | [';', [['cell', 'x']]] | Failed |
| default | [',', [['cell', 'x']]] | [',', [['cell', 'x']]] | Passed |
| later directive | [',', [['a', 'b'], ['sep=;']]] | [',', [['a', 'b'], ['sep=;']]] | Passed |
| bad multi | None | None | Passed |
| bad quote | None | None | Passed |
| empty marker | None | None | Passed |
| directive only | [',', []] | [';', []] | Failed |
| zero | [',', []] | [',', []] | Passed |
SHA-256 / 0ca674ed12fa4d6d2849d716dac3093655da885acc232a9edc9bd1a7c89ba7a7
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 = list(data)
if not lines: return [',', []]
if lines[0].startswith('\ufeff'): lines[0] = lines[0][1:]
delimiter = ','
if lines[0].startswith('sep='):
value = lines.pop(0)[4:]
if len(value) != 1 or value in '\r\n"': return None
delimiter = ','
return [delimiter, [line.split(delimiter) for line in lines]]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('custom', solve(_vary(['sep=;', '@;x'])), _vary([';', [['@', 'x']]]))
check('BOM directive', solve(_vary(['\ufeffsep=;', '@;x'])), _vary([';', [['@', 'x']]]))
check('default', solve(_vary(['@,x'])), _vary([',', [['@', 'x']]]))
check('later directive', solve(_vary(['a,b', 'sep=;'])), _vary([',', [['a', 'b'], ['sep=;']]]))
check('bad multi', solve(_vary(['sep=;;', 'x'])), _vary(None))
check('bad quote', solve(_vary(['sep="', 'x'])), _vary(None))
check('empty marker', solve(_vary(['sep=', 'x'])), _vary(None))
check('directive only', solve(_vary(['sep=;'])), _vary([';', []]))
check('zero', solve(_vary([])), _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 |
|---|---|---|---|
| custom | [',', [['cell;x']]] | [';', [['cell', 'x']]] | Failed |
| BOM directive | [',', [['cell;x']]] | [';', [['cell', 'x']]] | Failed |
| default | [',', [['cell', 'x']]] | [',', [['cell', 'x']]] | Passed |
| later directive | [',', [['a', 'b'], ['sep=;']]] | [',', [['a', 'b'], ['sep=;']]] | Passed |
| bad multi | None | None | Passed |
| bad quote | None | None | Passed |
| empty marker | None | None | Passed |
| directive only | [',', []] | [';', []] | Failed |
| zero | [',', []] | [',', []] | Passed |
SHA-256 / bec15d0c254146ed73350c1817e62dddf01d38357b00a06758b302d585323227
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 = list(data)
if not lines: return [',', []]
if lines[0].startswith('\ufeff'): lines[0] = lines[0][1:]
delimiter = ','
if lines[0].startswith('sep='):
value = lines.pop(0)[4:]
if len(value) != 1 or value in '\r\n"': return None
delimiter = value
return [delimiter, [line.split(delimiter) for line in lines]]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('custom', solve(_vary(['sep=;', '@;x'])), _vary([';', [['@', 'x']]]))
check('BOM directive', solve(_vary(['\ufeffsep=;', '@;x'])), _vary([';', [['@', 'x']]]))
check('default', solve(_vary(['@,x'])), _vary([',', [['@', 'x']]]))
check('later directive', solve(_vary(['a,b', 'sep=;'])), _vary([',', [['a', 'b'], ['sep=;']]]))
check('bad multi', solve(_vary(['sep=;;', 'x'])), _vary(None))
check('bad quote', solve(_vary(['sep="', 'x'])), _vary(None))
check('empty marker', solve(_vary(['sep=', 'x'])), _vary(None))
check('directive only', solve(_vary(['sep=;'])), _vary([';', []]))
check('zero', solve(_vary([])), _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 |
|---|---|---|---|
| custom | [';', [['cell', 'x']]] | [';', [['cell', 'x']]] | Passed |
| BOM directive | [';', [['cell', 'x']]] | [';', [['cell', 'x']]] | Passed |
| default | [',', [['cell', 'x']]] | [',', [['cell', 'x']]] | Passed |
| later directive | [',', [['a', 'b'], ['sep=;']]] | [',', [['a', 'b'], ['sep=;']]] | Passed |
| bad multi | None | None | Passed |
| bad quote | None | None | Passed |
| empty marker | None | None | Passed |
| directive only | [';', []] | [';', []] | Passed |
| zero | [',', []] | [',', []] | Passed |
SHA-256 / 8fabc2b5931577e048a269d4a147f73b0a0137a2340e20dc50bf9d50bec13875
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:45.478484+00:00.
Case digest / a3051a7a56612fe2d25f3913d81cfeaf189cd1fb91aa4b426e62832c93ff2ccf