FAILURE MAP
← Case archive

FA-48486 / Delimited text / Open access

A new data row does not replace the repeat source · case 01

A structured table violates the declared record or column contract.

Verified by executionVariant 1 · 7 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

A new data row does not replace the repeat source.

VERIFIED REPAIR

Preserve the named invariant at the faulty decision: previous=line.split(',')

Unsuccessful approach: The alternate implementation still violates the same declared invariant: a new data row does not replace the repeat source.

Case contract

Read comma rows, with an R|count control line repeating the most recent data row count additional times. Count must be positive ASCII decimal; controls cannot precede data. Repeated rows do not become a distinct source row. Return independent row values in order; ordinary payloads contain no pipe.

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):
    out=[]; previous=None
    for line in data:
        if line.startswith('R|'):
            token=line[2:]
            if previous is None or not token.isascii() or not token.isdecimal() or int(token)<1: return None
            out.extend([list(previous) for _ in range(int(token))])
        else:
            if '|' in line: return None
            previous=line.split(',') if previous is None else previous
            out.append(previous)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeat', solve(_vary(['@,x', 'R|2'])), _vary([['@', 'x'], ['@', 'x'], ['@', 'x']]))
check('new source', solve(_vary(['a,b', 'R|1', '@,z', 'R|1'])), _vary([['a', 'b'], ['a', 'b'], ['@', 'z'], ['@', 'z']]))
check('orphan', solve(_vary(['R|2'])), _vary(None))
check('zero', solve(_vary(['a', 'R|0'])), _vary(None))
check('negative', solve(_vary(['a', 'R|-1'])), _vary(None))
check('empty row', solve(_vary(['', 'R|1'])), _vary([[''], ['']]))
check('chained', solve(_vary(['@', 'R|1', 'R|1'])), _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
repeat[['cell', 'x'], ['cell', 'x'], ['cell', 'x']][['cell', 'x'], ['cell', 'x'], ['cell', 'x']]Passed
new source[['a', 'b'], ['a', 'b'], ['a', 'b'], ['a', 'b']][['a', 'b'], ['a', 'b'], ['cell', 'z'], ['cell', 'z']]Failed
orphanNoneNonePassed
zeroNoneNonePassed
negativeNoneNonePassed
empty row[[''], ['']][[''], ['']]Passed
chained[['cell'], ['cell'], ['cell']][['cell'], ['cell'], ['cell']]Passed

SHA-256 / 8bb15cd52f9fd9440232575575e33b9beb83d54e93a061cb5ca495d34d268dd7

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):
    out=[]; previous=None
    for line in data:
        if line.startswith('R|'):
            token=line[2:]
            if previous is None or not token.isascii() or not token.isdecimal() or int(token)<1: return None
            out.extend([list(previous) for _ in range(int(token))])
        else:
            if '|' in line: return None
            previous=out[0] if out else line.split(',')
            out.append(previous)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeat', solve(_vary(['@,x', 'R|2'])), _vary([['@', 'x'], ['@', 'x'], ['@', 'x']]))
check('new source', solve(_vary(['a,b', 'R|1', '@,z', 'R|1'])), _vary([['a', 'b'], ['a', 'b'], ['@', 'z'], ['@', 'z']]))
check('orphan', solve(_vary(['R|2'])), _vary(None))
check('zero', solve(_vary(['a', 'R|0'])), _vary(None))
check('negative', solve(_vary(['a', 'R|-1'])), _vary(None))
check('empty row', solve(_vary(['', 'R|1'])), _vary([[''], ['']]))
check('chained', solve(_vary(['@', 'R|1', 'R|1'])), _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
repeat[['cell', 'x'], ['cell', 'x'], ['cell', 'x']][['cell', 'x'], ['cell', 'x'], ['cell', 'x']]Passed
new source[['a', 'b'], ['a', 'b'], ['a', 'b'], ['a', 'b']][['a', 'b'], ['a', 'b'], ['cell', 'z'], ['cell', 'z']]Failed
orphanNoneNonePassed
zeroNoneNonePassed
negativeNoneNonePassed
empty row[[''], ['']][[''], ['']]Passed
chained[['cell'], ['cell'], ['cell']][['cell'], ['cell'], ['cell']]Passed

SHA-256 / e9a87332eb25b05a2ae9ec50c6d045f47c36cac5d42588fbe5181d1b6b4cf5ea

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):
    out=[]; previous=None
    for line in data:
        if line.startswith('R|'):
            token=line[2:]
            if previous is None or not token.isascii() or not token.isdecimal() or int(token)<1: return None
            out.extend([list(previous) for _ in range(int(token))])
        else:
            if '|' in line: return None
            previous=line.split(',')
            out.append(previous)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeat', solve(_vary(['@,x', 'R|2'])), _vary([['@', 'x'], ['@', 'x'], ['@', 'x']]))
check('new source', solve(_vary(['a,b', 'R|1', '@,z', 'R|1'])), _vary([['a', 'b'], ['a', 'b'], ['@', 'z'], ['@', 'z']]))
check('orphan', solve(_vary(['R|2'])), _vary(None))
check('zero', solve(_vary(['a', 'R|0'])), _vary(None))
check('negative', solve(_vary(['a', 'R|-1'])), _vary(None))
check('empty row', solve(_vary(['', 'R|1'])), _vary([[''], ['']]))
check('chained', solve(_vary(['@', 'R|1', 'R|1'])), _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
repeat[['cell', 'x'], ['cell', 'x'], ['cell', 'x']][['cell', 'x'], ['cell', 'x'], ['cell', 'x']]Passed
new source[['a', 'b'], ['a', 'b'], ['cell', 'z'], ['cell', 'z']][['a', 'b'], ['a', 'b'], ['cell', 'z'], ['cell', 'z']]Passed
orphanNoneNonePassed
zeroNoneNonePassed
negativeNoneNonePassed
empty row[[''], ['']][[''], ['']]Passed
chained[['cell'], ['cell'], ['cell']][['cell'], ['cell'], ['cell']]Passed

SHA-256 / 0404f6f8095c5adfbca880b90dfe3b84c3c8f87c21e7d0bc82d0f215d4412c9b

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

Case digest / e9683f03f5f0e130d0ed33b288a9e028483ec1853a9911531eb66c74c90e1fbf