FAILURE MAP
← Case archive

FA-48296 / Delimited text / Open access

Counted blocks reuse the previous block payload list · 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

Counted blocks reuse the previous block payload list.

VERIFIED REPAIR

Preserve the named invariant at the faulty decision: current=[]; blocks.append(current)

Unsuccessful approach: The alternate implementation still violates the same declared invariant: counted blocks reuse the previous block payload list.

Case contract

Decode pipe records arranged as C|count followed by exactly count R|value rows. Multiple blocks may follow. Counts are ASCII nonnegative decimals; values contain no pipe in this bounded grammar. Empty blocks are emitted as empty lists. Missing, unexpected, and surplus R records reject.

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):
    blocks=[]; current=None; remaining=0
    for line in data:
        cells=line.split('|')
        if len(cells)!=2: return None
        tag,value=cells
        if tag=='C':
            if remaining: return None
            if not value.isascii() or not value.isdecimal(): return None
            remaining=int(value); current=current if current is not None else []; blocks.append(current)
        elif tag=='R':
            if remaining==0: return None
            current.append(value); remaining-=1
        else: return None
    if remaining: return None
    return blocks
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('blocks', solve(_vary(['C|2', 'R|@', 'R|x', 'C|1', 'R|z'])), _vary([['@', 'x'], ['z']]))
check('empty block', solve(_vary(['C|0', 'C|1', 'R|@'])), _vary([[], ['@']]))
check('short', solve(_vary(['C|2', 'R|@'])), _vary(None))
check('extra', solve(_vary(['C|1', 'R|@', 'R|x'])), _vary(None))
check('orphan', solve(_vary(['R|@'])), _vary(None))
check('premature block', solve(_vary(['C|2', 'R|@', 'C|0'])), _vary(None))
check('bad tag', solve(_vary(['X|0'])), _vary(None))
check('zero stream', 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
blocks[['cell', 'x', 'z'], ['cell', 'x', 'z']][['cell', 'x'], ['z']]Failed
empty block[['cell'], ['cell']][[], ['cell']]Failed
shortNoneNonePassed
extraNoneNonePassed
orphanNoneNonePassed
premature blockNoneNonePassed
bad tagNoneNonePassed
zero stream[][]Passed

SHA-256 / 488befab7853ce1244b829519501f26c9aa234231219a4f78cb2339058589976

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):
    blocks=[]; current=None; remaining=0
    for line in data:
        cells=line.split('|')
        if len(cells)!=2: return None
        tag,value=cells
        if tag=='C':
            if remaining: return None
            if not value.isascii() or not value.isdecimal(): return None
            remaining=int(value); current=list(current) if current is not None else []; blocks.append(current)
        elif tag=='R':
            if remaining==0: return None
            current.append(value); remaining-=1
        else: return None
    if remaining: return None
    return blocks
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('blocks', solve(_vary(['C|2', 'R|@', 'R|x', 'C|1', 'R|z'])), _vary([['@', 'x'], ['z']]))
check('empty block', solve(_vary(['C|0', 'C|1', 'R|@'])), _vary([[], ['@']]))
check('short', solve(_vary(['C|2', 'R|@'])), _vary(None))
check('extra', solve(_vary(['C|1', 'R|@', 'R|x'])), _vary(None))
check('orphan', solve(_vary(['R|@'])), _vary(None))
check('premature block', solve(_vary(['C|2', 'R|@', 'C|0'])), _vary(None))
check('bad tag', solve(_vary(['X|0'])), _vary(None))
check('zero stream', 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
blocks[['cell', 'x'], ['cell', 'x', 'z']][['cell', 'x'], ['z']]Failed
empty block[[], ['cell']][[], ['cell']]Passed
shortNoneNonePassed
extraNoneNonePassed
orphanNoneNonePassed
premature blockNoneNonePassed
bad tagNoneNonePassed
zero stream[][]Passed

SHA-256 / 2061ebfb811de78906f428c39799255531de1597e3b6f33c31e47e469833b286

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):
    blocks=[]; current=None; remaining=0
    for line in data:
        cells=line.split('|')
        if len(cells)!=2: return None
        tag,value=cells
        if tag=='C':
            if remaining: return None
            if not value.isascii() or not value.isdecimal(): return None
            remaining=int(value); current=[]; blocks.append(current)
        elif tag=='R':
            if remaining==0: return None
            current.append(value); remaining-=1
        else: return None
    if remaining: return None
    return blocks
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('blocks', solve(_vary(['C|2', 'R|@', 'R|x', 'C|1', 'R|z'])), _vary([['@', 'x'], ['z']]))
check('empty block', solve(_vary(['C|0', 'C|1', 'R|@'])), _vary([[], ['@']]))
check('short', solve(_vary(['C|2', 'R|@'])), _vary(None))
check('extra', solve(_vary(['C|1', 'R|@', 'R|x'])), _vary(None))
check('orphan', solve(_vary(['R|@'])), _vary(None))
check('premature block', solve(_vary(['C|2', 'R|@', 'C|0'])), _vary(None))
check('bad tag', solve(_vary(['X|0'])), _vary(None))
check('zero stream', 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
blocks[['cell', 'x'], ['z']][['cell', 'x'], ['z']]Passed
empty block[[], ['cell']][[], ['cell']]Passed
shortNoneNonePassed
extraNoneNonePassed
orphanNoneNonePassed
premature blockNoneNonePassed
bad tagNoneNonePassed
zero stream[][]Passed

SHA-256 / 147fb34ed9c6b113b4f94c510f8b31c66039ee91e86ffc77c9729190bb72dfa9

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

Case digest / 8aa1a03d358a5fd01e8ea08e4a5954f902256b5bcf9e4557739a2a762b85ade4