FAILURE MAP
← Case archive

FA-48421 / Delimited text / Open access

A continuation fragment replaces the preceding field text · 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 continuation fragment replaces the preceding field text.

VERIFIED REPAIR

Preserve the named invariant at the faulty decision: cells[-1]+=text

Unsuccessful approach: The alternate implementation still violates the same declared invariant: a continuation fragment replaces the preceding field text.

Case contract

Process pipe records ROW|count, CELL|text, MORE|text, END|empty. CELL starts a new field; MORE concatenates to the most recent field without inserting characters. Each row declares a positive field count, completed at END. MORE without a field and excess fields reject. Multiple rows are allowed.

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=[]; cells=None; expected=0
    for line in data:
        tag,text=(line.split('|',1)+[''])[:2]
        if tag=='ROW':
            if cells is not None or not text.isascii() or not text.isdecimal() or int(text)<1: return None
            cells=[]; expected=int(text)
        elif tag=='CELL':
            if cells is None or len(cells)>=expected: return None
            cells.append(text)
        elif tag=='MORE':
            if not cells: return None
            cells[-1]=text
        elif tag=='END':
            if cells is None or text or len(cells)!=expected: return None
            rows.append(cells); cells=None
        else: return None
    if cells is not None: return None
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('continuation', solve(_vary(['ROW|2', 'CELL|@', 'MORE|x', 'CELL|y', 'MORE|z', 'END|'])), _vary([['@x', 'yz']]))
check('third-field continuation', solve(_vary(['ROW|3', 'CELL|a', 'CELL|b', 'CELL|@', 'MORE|z', 'END|'])), _vary([['a', 'b', '@z']]))
check('empty pieces', solve(_vary(['ROW|1', 'CELL|', 'MORE|@', 'MORE|', 'END|'])), _vary([['@']]))
check('orphan more', solve(_vary(['ROW|1', 'MORE|@'])), _vary(None))
check('excess', solve(_vary(['ROW|1', 'CELL|@', 'CELL|x'])), _vary(None))
check('too few', solve(_vary(['ROW|2', 'CELL|@', 'END|'])), _vary(None))
check('unfinished', solve(_vary(['ROW|1', 'CELL|@'])), _vary(None))
check('two rows', solve(_vary(['ROW|1', 'CELL|@', 'END|', 'ROW|1', 'CELL|z', 'END|'])), _vary([['@'], ['z']]))
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
continuation[['x', 'z']][['cellx', 'yz']]Failed
third-field continuation[['a', 'b', 'z']][['a', 'b', 'cellz']]Failed
empty pieces[['']][['cell']]Failed
orphan moreNoneNonePassed
excessNoneNonePassed
too fewNoneNonePassed
unfinishedNoneNonePassed
two rows[['cell'], ['z']][['cell'], ['z']]Passed

SHA-256 / 98fd1303280e1da702a638e2f5c8c30a12d8a8dd4bdb330e1497ba7c94346ba9

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=[]; cells=None; expected=0
    for line in data:
        tag,text=(line.split('|',1)+[''])[:2]
        if tag=='ROW':
            if cells is not None or not text.isascii() or not text.isdecimal() or int(text)<1: return None
            cells=[]; expected=int(text)
        elif tag=='CELL':
            if cells is None or len(cells)>=expected: return None
            cells.append(text)
        elif tag=='MORE':
            if not cells: return None
            cells[-1]=text+cells[-1]
        elif tag=='END':
            if cells is None or text or len(cells)!=expected: return None
            rows.append(cells); cells=None
        else: return None
    if cells is not None: return None
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('continuation', solve(_vary(['ROW|2', 'CELL|@', 'MORE|x', 'CELL|y', 'MORE|z', 'END|'])), _vary([['@x', 'yz']]))
check('third-field continuation', solve(_vary(['ROW|3', 'CELL|a', 'CELL|b', 'CELL|@', 'MORE|z', 'END|'])), _vary([['a', 'b', '@z']]))
check('empty pieces', solve(_vary(['ROW|1', 'CELL|', 'MORE|@', 'MORE|', 'END|'])), _vary([['@']]))
check('orphan more', solve(_vary(['ROW|1', 'MORE|@'])), _vary(None))
check('excess', solve(_vary(['ROW|1', 'CELL|@', 'CELL|x'])), _vary(None))
check('too few', solve(_vary(['ROW|2', 'CELL|@', 'END|'])), _vary(None))
check('unfinished', solve(_vary(['ROW|1', 'CELL|@'])), _vary(None))
check('two rows', solve(_vary(['ROW|1', 'CELL|@', 'END|', 'ROW|1', 'CELL|z', 'END|'])), _vary([['@'], ['z']]))
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
continuation[['xcell', 'zy']][['cellx', 'yz']]Failed
third-field continuation[['a', 'b', 'zcell']][['a', 'b', 'cellz']]Failed
empty pieces[['cell']][['cell']]Passed
orphan moreNoneNonePassed
excessNoneNonePassed
too fewNoneNonePassed
unfinishedNoneNonePassed
two rows[['cell'], ['z']][['cell'], ['z']]Passed

SHA-256 / f7f0f88508be82ed5bcd2495f179632f419b1d0b2e2e090f75df0a60b384545c

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=[]; cells=None; expected=0
    for line in data:
        tag,text=(line.split('|',1)+[''])[:2]
        if tag=='ROW':
            if cells is not None or not text.isascii() or not text.isdecimal() or int(text)<1: return None
            cells=[]; expected=int(text)
        elif tag=='CELL':
            if cells is None or len(cells)>=expected: return None
            cells.append(text)
        elif tag=='MORE':
            if not cells: return None
            cells[-1]+=text
        elif tag=='END':
            if cells is None or text or len(cells)!=expected: return None
            rows.append(cells); cells=None
        else: return None
    if cells is not None: return None
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('continuation', solve(_vary(['ROW|2', 'CELL|@', 'MORE|x', 'CELL|y', 'MORE|z', 'END|'])), _vary([['@x', 'yz']]))
check('third-field continuation', solve(_vary(['ROW|3', 'CELL|a', 'CELL|b', 'CELL|@', 'MORE|z', 'END|'])), _vary([['a', 'b', '@z']]))
check('empty pieces', solve(_vary(['ROW|1', 'CELL|', 'MORE|@', 'MORE|', 'END|'])), _vary([['@']]))
check('orphan more', solve(_vary(['ROW|1', 'MORE|@'])), _vary(None))
check('excess', solve(_vary(['ROW|1', 'CELL|@', 'CELL|x'])), _vary(None))
check('too few', solve(_vary(['ROW|2', 'CELL|@', 'END|'])), _vary(None))
check('unfinished', solve(_vary(['ROW|1', 'CELL|@'])), _vary(None))
check('two rows', solve(_vary(['ROW|1', 'CELL|@', 'END|', 'ROW|1', 'CELL|z', 'END|'])), _vary([['@'], ['z']]))
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
continuation[['cellx', 'yz']][['cellx', 'yz']]Passed
third-field continuation[['a', 'b', 'cellz']][['a', 'b', 'cellz']]Passed
empty pieces[['cell']][['cell']]Passed
orphan moreNoneNonePassed
excessNoneNonePassed
too fewNoneNonePassed
unfinishedNoneNonePassed
two rows[['cell'], ['z']][['cell'], ['z']]Passed

SHA-256 / a58210ce04bd5a80e57eb4adfc2b45455f46b917487d954b17eb90aa5857dc7f

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

Case digest / e7eef08dabd63955d80f4dcb42cdca2c9e6b8f133cfb28df58bb987d4d4b503e