FAILURE MAP
← Case archive

FA-48316 / Delimited text / Open access

An interleaved row is routed to the most recently opened table · 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 interleaved row is routed to the most recently opened table.

THE FAILURE

An interleaved row is routed to the most recently opened table.

Unsuccessful approach: The alternate implementation still violates the same declared invariant: an interleaved row is routed to the most recently opened table.

Case contract

Read pipe messages OPEN|id|header, ROW|id|comma-values, CLOSE|id|empty. Multiple table IDs may be open concurrently. IDs cannot reopen after close; rows require an active ID and matching width. Close emits [id, rows] in close order; EOF with open tables 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):
    active, closed, out = {},set(),[]
    for line in data:
        parts=line.split('|',2)
        if len(parts)!=3: return None
        tag,key,payload=parts
        if tag=='OPEN':
            if key in active or key in closed: return None
            active[key]=[payload.split(','),[]]
        elif tag=='ROW':
            if key not in active: return None
            row=payload.split(',')
            if len(row)!=len(active[key][0]): return None
            active[list(active)[-1]][1].append(row)
        elif tag=='CLOSE':
            if key not in active or payload!='': return None
            out.append([key,active.pop(key)[1]]); closed.add(key)
        else: return None
    if active: return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('interleaved', solve(_vary(['OPEN|a|x', 'OPEN|b|y', 'ROW|a|@', 'ROW|b|z', 'CLOSE|b|', 'CLOSE|a|'])), _vary([['b', [['z']]], ['a', [['@']]]]))
check('unclosed', solve(_vary(['OPEN|a|x'])), _vary(None))
check('unknown', solve(_vary(['ROW|a|@'])), _vary(None))
check('reopen', solve(_vary(['OPEN|a|x', 'CLOSE|a|', 'OPEN|a|x', 'CLOSE|a|'])), _vary(None))
check('close payload', solve(_vary(['OPEN|a|x', 'CLOSE|a|bad'])), _vary(None))
check('width', solve(_vary(['OPEN|a|x,y', 'ROW|a|@', 'CLOSE|a|'])), _vary(None))
check('normal', solve(_vary(['OPEN|@|x', 'CLOSE|@|'])), _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
interleaved[['b', [['cell'], ['z']]], ['a', []]][['b', [['z']]], ['a', [['cell']]]]Failed
unclosedNoneNonePassed
unknownNoneNonePassed
reopenNoneNonePassed
close payloadNoneNonePassed
widthNoneNonePassed
normal[['cell', []]][['cell', []]]Passed
zero[][]Passed

SHA-256 / 00fd4f0a659049430a90f6fe331f1a7939a23a0477f2b7d5664fdec64974c654

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):
    active, closed, out = {},set(),[]
    for line in data:
        parts=line.split('|',2)
        if len(parts)!=3: return None
        tag,key,payload=parts
        if tag=='OPEN':
            if key in active or key in closed: return None
            active[key]=[payload.split(','),[]]
        elif tag=='ROW':
            if key not in active: return None
            row=payload.split(',')
            if len(row)!=len(active[key][0]): return None
            active[list(active)[0]][1].append(row)
        elif tag=='CLOSE':
            if key not in active or payload!='': return None
            out.append([key,active.pop(key)[1]]); closed.add(key)
        else: return None
    if active: return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('interleaved', solve(_vary(['OPEN|a|x', 'OPEN|b|y', 'ROW|a|@', 'ROW|b|z', 'CLOSE|b|', 'CLOSE|a|'])), _vary([['b', [['z']]], ['a', [['@']]]]))
check('unclosed', solve(_vary(['OPEN|a|x'])), _vary(None))
check('unknown', solve(_vary(['ROW|a|@'])), _vary(None))
check('reopen', solve(_vary(['OPEN|a|x', 'CLOSE|a|', 'OPEN|a|x', 'CLOSE|a|'])), _vary(None))
check('close payload', solve(_vary(['OPEN|a|x', 'CLOSE|a|bad'])), _vary(None))
check('width', solve(_vary(['OPEN|a|x,y', 'ROW|a|@', 'CLOSE|a|'])), _vary(None))
check('normal', solve(_vary(['OPEN|@|x', 'CLOSE|@|'])), _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
interleaved[['b', []], ['a', [['cell'], ['z']]]][['b', [['z']]], ['a', [['cell']]]]Failed
unclosedNoneNonePassed
unknownNoneNonePassed
reopenNoneNonePassed
close payloadNoneNonePassed
widthNoneNonePassed
normal[['cell', []]][['cell', []]]Passed
zero[][]Passed

SHA-256 / b1d9300b502d889d284c23015530626dbb12f4df74c4006ec42e8260f66dcec0

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

Case digest / e9def4f855684d4c58c83b5c4e5a267def72c63759adcba8d5b0e91b4cd3e817