FAILURE MAP
← Case archive

FA-48431 / Delimited text / Open access

An END marker emits a row with fewer fields than declared · 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

An END marker emits a row with fewer fields than declared.

THE FAILURE

An END marker emits a row with fewer fields than declared.

Unsuccessful approach: The alternate implementation still violates the same declared invariant: an end marker emits a row with fewer fields than declared.

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: 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 few[['cell']]NoneFailed
unfinishedNoneNonePassed
two rows[['cell'], ['z']][['cell'], ['z']]Passed

SHA-256 / a167f7c7edfb5ec8cda5c525a428d42985bc91840745f3e2d0a680585d835e6c

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=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 few[['cell']]NoneFailed
unfinishedNoneNonePassed
two rows[['cell'], ['z']][['cell'], ['z']]Passed

SHA-256 / 1bbfbf7f260b13c5985720c4a2148cc675fdac892d1e2a0cf5550cb2eeeb2cad

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

Case digest / f8d0e8f3070a8bf33b823a7fcf3e77f6012de5d5f9230fa24d0c3730acb64da9