FAILURE MAP
← Case archive

FA-48436 / Delimited text / Open access

A completed continued-field row remains the active destination · 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 completed continued-field row remains the active destination.

VERIFIED REPAIR

Preserve the named invariant at the faulty decision: rows.append(cells); cells=None

Unsuccessful approach: The alternate implementation still violates the same declared invariant: a completed continued-field row remains the active destination.

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)
        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
continuationNone[['cellx', 'yz']]Failed
third-field continuationNone[['a', 'b', 'cellz']]Failed
empty piecesNone[['cell']]Failed
orphan moreNoneNonePassed
excessNoneNonePassed
too fewNoneNonePassed
unfinishedNoneNonePassed
two rowsNone[['cell'], ['z']]Failed

SHA-256 / 9fea034bb27334e5068f576e80622d856195e77a8a685372cd32d06697e4d87d

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
        elif tag=='END':
            if cells is None or text or len(cells)!=expected: return None
            rows.append(cells); cells=[]
        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
continuationNone[['cellx', 'yz']]Failed
third-field continuationNone[['a', 'b', 'cellz']]Failed
empty piecesNone[['cell']]Failed
orphan moreNoneNonePassed
excessNoneNonePassed
too fewNoneNonePassed
unfinishedNoneNonePassed
two rowsNone[['cell'], ['z']]Failed

SHA-256 / 3321bf176b77b9b5210e997dee02d37f45220f4ca66b65f63fda4fa6273a1bee

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

Case digest / 71f98c631579a6fd25dd64d908fd8e28be5290cd873bbb3ce62781a0546a682e