FAILURE MAP
← Case archive

FA-48141 / Delimited text / Open access

A marker inside quoted data starts a trailing comment · case 01

A structured table violates the declared record or column contract.

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

ROOT CAUSE

A marker inside quoted data starts a trailing comment.

THE FAILURE

A marker inside quoted data starts a trailing comment.

Unsuccessful approach: The alternate implementation still violates the same declared invariant: a marker inside quoted data starts a trailing comment.

Case contract

Split a comma record with trailing comments. A # outside double quotes ends the record; inside quotes it is data. Quotes toggle quoted state and are removed; doubled quotes inside quotes emit one quote. Whitespace before a trailing comment is data. Unterminated quoting rejects.

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):
    out, buf, quoted, i = [], [], False, 0
    while i < len(data):
        ch=data[i]
        if ch == '"':
            if quoted and i+1 < len(data) and data[i+1] == '"':
                buf.append('"'); i += 2; continue
            quoted = not quoted
        elif ch == '#': break
        elif ch == ',' and not quoted:
            out.append(''.join(buf)); buf=[]
        else: buf.append(ch)
        i += 1
    if quoted: return None
    out.append(''.join(buf))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('comment', solve(_vary('@,x#note')), _vary(['@', 'x']))
check('quoted marker', solve(_vary('"#@",x')), _vary(['#@', 'x']))
check('escaped quote', solve(_vary('"a""#b",z')), _vary(['a"#b', 'z']))
check('spaces', solve(_vary('@  #x')), _vary(['@  ']))
check('only comment', solve(_vary('#note')), _vary(['']))
check('unclosed', solve(_vary('"@#note')), _vary(None))
check('normal', solve(_vary('@,x')), _vary(['@', 'x']))
check('comment commas', solve(_vary('@#x,y')), _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
comment['cell', 'x']['cell', 'x']Passed
quoted markerNone['#cell', 'x']Failed
escaped quoteNone['a"#b', 'z']Failed
spaces['cell ']['cell ']Passed
only comment['']['']Passed
unclosedNoneNonePassed
normal['cell', 'x']['cell', 'x']Passed
comment commas['cell']['cell']Passed

SHA-256 / cd79473a4912ef59d52657ae4e9047960c8d20e3f6fedecb6e7e21329d40a7af

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):
    out, buf, quoted, i = [], [], False, 0
    while i < len(data):
        ch=data[i]
        if ch == '"':
            if quoted and i+1 < len(data) and data[i+1] == '"':
                buf.append('"'); i += 2; continue
            quoted = not quoted
        elif ch == '#' and (not quoted or not buf): break
        elif ch == ',' and not quoted:
            out.append(''.join(buf)); buf=[]
        else: buf.append(ch)
        i += 1
    if quoted: return None
    out.append(''.join(buf))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('comment', solve(_vary('@,x#note')), _vary(['@', 'x']))
check('quoted marker', solve(_vary('"#@",x')), _vary(['#@', 'x']))
check('escaped quote', solve(_vary('"a""#b",z')), _vary(['a"#b', 'z']))
check('spaces', solve(_vary('@  #x')), _vary(['@  ']))
check('only comment', solve(_vary('#note')), _vary(['']))
check('unclosed', solve(_vary('"@#note')), _vary(None))
check('normal', solve(_vary('@,x')), _vary(['@', 'x']))
check('comment commas', solve(_vary('@#x,y')), _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
comment['cell', 'x']['cell', 'x']Passed
quoted markerNone['#cell', 'x']Failed
escaped quote['a"#b', 'z']['a"#b', 'z']Passed
spaces['cell ']['cell ']Passed
only comment['']['']Passed
unclosedNoneNonePassed
normal['cell', 'x']['cell', 'x']Passed
comment commas['cell']['cell']Passed

SHA-256 / 741a555ab63e87e07d910ab28065d80162ee847ae1f26adac3c95c20bb86a389

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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:48.280209+00:00.

Case digest / 545b54ec0f7284b631632fe43895cd7bde41bf833d0aaf4040317b5e3c406616