FAILURE MAP
← Case archive

FA-47861 / Delimited text / Open access

A separator preamble permits quote as a delimiter · case 01

A structured table violates the declared record or column contract.

Verified by executionVariant 1 · 9 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Dialect validation omits the quote/delimiter role conflict.

VERIFIED REPAIR

Preserve the named invariant at the faulty decision: or value in '\r\n"'

Unsuccessful approach: Further shrinking the forbidden set does not fix quote ambiguity.

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 = 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 fixtureActualExpectedOutcome
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 multiNoneNonePassed
bad quote['"', [['x']]]NoneFailed
empty markerNoneNonePassed
directive only[';', []][';', []]Passed
zero[',', []][',', []]Passed

SHA-256 / b7ff1db011e607eb2363529fb00dbd88ccae0ca2b982fcaf46c70bc464f0c960

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 '\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 fixtureActualExpectedOutcome
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 multiNoneNonePassed
bad quote['"', [['x']]]NoneFailed
empty markerNoneNonePassed
directive only[';', []][';', []]Passed
zero[',', []][',', []]Passed

SHA-256 / cf590dfccb7c638ba83a39eac8215d07cf75726019cd062e7be4cf72a4ac3d9c

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 fixtureActualExpectedOutcome
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 multiNoneNonePassed
bad quoteNoneNonePassed
empty markerNoneNonePassed
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.478995+00:00.

Case digest / 9997907443027bee93b6ce5637817d84cfe73a087d255c6593dcd09e93958e1c