FAILURE MAP
← Case archive

FA-47616 / Delimited text / Open access

A zero-length run silently removes a specified column · case 01

A structured table violates the declared record or column contract.

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

ROOT CAUSE

Zero runs are accepted despite requiring at least one represented cell.

VERIFIED REPAIR

Preserve the named invariant at the faulty decision: if count <= 0: return None

Unsuccessful approach: Clamping to one changes an invalid encoding into invented data.

Case contract

Parse a bounded compact comma row. A field count*value expands value count times; fields lacking star occur once. Count is positive ASCII decimal and cumulative width cannot exceed budget. Split at first star; an empty value is valid. Return expanded cells.

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 = []
    for cell in data['row'].split(','):
        if '*' in cell:
            count, value = cell.split('*', 1)
            if not count.isascii() or not count.isdecimal(): return None
            count = int(count)
            if count < 0: return None
        else: count, value = 1, cell
        if len(out) + count > data['budget']: return None
        out.extend([value] * count)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expanded', solve(_vary({'row': '2*@,x', 'budget': 3})), _vary(['@', '@', 'x']))
check('star value', solve(_vary({'row': '2*a*b', 'budget': 2})), _vary(['a*b', 'a*b']))
check('empty repeated', solve(_vary({'row': '2*', 'budget': 2})), _vary(['', '']))
check('zero', solve(_vary({'row': '0*x', 'budget': 2})), _vary(None))
check('negative', solve(_vary({'row': '-1*x', 'budget': 2})), _vary(None))
check('aggregate limit', solve(_vary({'row': '2*x,2*y', 'budget': 3})), _vary(None))
check('exact limit', solve(_vary({'row': '3*@', 'budget': 3})), _vary(['@', '@', '@']))
check('ordinary', solve(_vary({'row': '@,z', 'budget': 2})), _vary(['@', 'z']))
check('space value', solve(_vary({'row': ' @ ', 'budget': 1})), _vary([' @ ']))
check('empty field', solve(_vary({'row': '', 'budget': 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
expanded['cell', 'cell', 'x']['cell', 'cell', 'x']Passed
star value['a*b', 'a*b']['a*b', 'a*b']Passed
empty repeated['', '']['', '']Passed
zero[]NoneFailed
negativeNoneNonePassed
aggregate limitNoneNonePassed
exact limit['cell', 'cell', 'cell']['cell', 'cell', 'cell']Passed
ordinary['cell', 'z']['cell', 'z']Passed
space value[' cell '][' cell ']Passed
empty field['']['']Passed

SHA-256 / c4c6dba4b0c009129f05032cdf484a260580755d445d593794dc70ac4b48d9a5

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 = []
    for cell in data['row'].split(','):
        if '*' in cell:
            count, value = cell.split('*', 1)
            if not count.isascii() or not count.isdecimal(): return None
            count = int(count)
            if count <= 0: count = 1
        else: count, value = 1, cell
        if len(out) + count > data['budget']: return None
        out.extend([value] * count)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expanded', solve(_vary({'row': '2*@,x', 'budget': 3})), _vary(['@', '@', 'x']))
check('star value', solve(_vary({'row': '2*a*b', 'budget': 2})), _vary(['a*b', 'a*b']))
check('empty repeated', solve(_vary({'row': '2*', 'budget': 2})), _vary(['', '']))
check('zero', solve(_vary({'row': '0*x', 'budget': 2})), _vary(None))
check('negative', solve(_vary({'row': '-1*x', 'budget': 2})), _vary(None))
check('aggregate limit', solve(_vary({'row': '2*x,2*y', 'budget': 3})), _vary(None))
check('exact limit', solve(_vary({'row': '3*@', 'budget': 3})), _vary(['@', '@', '@']))
check('ordinary', solve(_vary({'row': '@,z', 'budget': 2})), _vary(['@', 'z']))
check('space value', solve(_vary({'row': ' @ ', 'budget': 1})), _vary([' @ ']))
check('empty field', solve(_vary({'row': '', 'budget': 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
expanded['cell', 'cell', 'x']['cell', 'cell', 'x']Passed
star value['a*b', 'a*b']['a*b', 'a*b']Passed
empty repeated['', '']['', '']Passed
zero['x']NoneFailed
negativeNoneNonePassed
aggregate limitNoneNonePassed
exact limit['cell', 'cell', 'cell']['cell', 'cell', 'cell']Passed
ordinary['cell', 'z']['cell', 'z']Passed
space value[' cell '][' cell ']Passed
empty field['']['']Passed

SHA-256 / d68e2f33922465b514c75549e8185e4cde772ca341e223cdc9d8493421a7bf1e

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 = []
    for cell in data['row'].split(','):
        if '*' in cell:
            count, value = cell.split('*', 1)
            if not count.isascii() or not count.isdecimal(): return None
            count = int(count)
            if count <= 0: return None
        else: count, value = 1, cell
        if len(out) + count > data['budget']: return None
        out.extend([value] * count)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expanded', solve(_vary({'row': '2*@,x', 'budget': 3})), _vary(['@', '@', 'x']))
check('star value', solve(_vary({'row': '2*a*b', 'budget': 2})), _vary(['a*b', 'a*b']))
check('empty repeated', solve(_vary({'row': '2*', 'budget': 2})), _vary(['', '']))
check('zero', solve(_vary({'row': '0*x', 'budget': 2})), _vary(None))
check('negative', solve(_vary({'row': '-1*x', 'budget': 2})), _vary(None))
check('aggregate limit', solve(_vary({'row': '2*x,2*y', 'budget': 3})), _vary(None))
check('exact limit', solve(_vary({'row': '3*@', 'budget': 3})), _vary(['@', '@', '@']))
check('ordinary', solve(_vary({'row': '@,z', 'budget': 2})), _vary(['@', 'z']))
check('space value', solve(_vary({'row': ' @ ', 'budget': 1})), _vary([' @ ']))
check('empty field', solve(_vary({'row': '', 'budget': 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
expanded['cell', 'cell', 'x']['cell', 'cell', 'x']Passed
star value['a*b', 'a*b']['a*b', 'a*b']Passed
empty repeated['', '']['', '']Passed
zeroNoneNonePassed
negativeNoneNonePassed
aggregate limitNoneNonePassed
exact limit['cell', 'cell', 'cell']['cell', 'cell', 'cell']Passed
ordinary['cell', 'z']['cell', 'z']Passed
space value[' cell '][' cell ']Passed
empty field['']['']Passed

SHA-256 / 63773b057cc3b84576a3f7026468a14689432628cf8fb8f96357624fb853bab5

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

Case digest / b00d7bcb031d4fa45ae28dfc279723e459c46d3b5c3830a2859871e19fd80c98