FAILURE MAP
← Case archive

FA-48191 / Delimited text / Open access

Transpose width is taken only from the first record · 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

Transpose width is taken only from the first record.

VERIFIED REPAIR

Preserve the named invariant at the faulty decision: width=max((len(row) for row in rows),default=0)

Unsuccessful approach: The alternate implementation still violates the same declared invariant: transpose width is taken only from the first record.

Case contract

Transpose comma records into physical columns. Pad missing trailing cells with null, preserving explicit empty strings. Width is the largest source row width; empty input has no columns. Output columns are in increasing physical position.

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=[line.split(',') for line in data]
    width=len(rows[0]) if rows else 0
    out=[]
    for col in range(width):
        out.append([row[col] if col<len(row) else None for row in rows])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ragged', solve(_vary(['@,a,b', 'x'])), _vary([['@', 'x'], ['a', None], ['b', None]]))
check('later wider', solve(_vary(['@', 'x,y'])), _vary([['@', 'x'], [None, 'y']]))
check('explicit empty', solve(_vary(['@,', 'x'])), _vary([['@', 'x'], ['', None]]))
check('empty input', solve(_vary([])), _vary([]))
check('one empty', solve(_vary([''])), _vary([['']]))
check('rectangular', solve(_vary(['a,b', 'c,d'])), _vary([['a', 'c'], ['b', 'd']]))
check('unsorted', solve(_vary(['z,1', 'a,2'])), _vary([['z', 'a'], ['1', '2']]))
check('three rows', solve(_vary(['@,x', 'y', 'z,w'])), _vary([['@', 'y', 'z'], ['x', None, 'w']]))
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
ragged[['cell', 'x'], ['a', None], ['b', None]][['cell', 'x'], ['a', None], ['b', None]]Passed
later wider[['cell', 'x']][['cell', 'x'], [None, 'y']]Failed
explicit empty[['cell', 'x'], ['', None]][['cell', 'x'], ['', None]]Passed
empty input[][]Passed
one empty[['']][['']]Passed
rectangular[['a', 'c'], ['b', 'd']][['a', 'c'], ['b', 'd']]Passed
unsorted[['z', 'a'], ['1', '2']][['z', 'a'], ['1', '2']]Passed
three rows[['cell', 'y', 'z'], ['x', None, 'w']][['cell', 'y', 'z'], ['x', None, 'w']]Passed

SHA-256 / 76051b70de8b7f9ceebcc7a2fbc22749fee267bef6e57b5b8681c30b66ef5611

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=[line.split(',') for line in data]
    width=min((len(row) for row in rows),default=0)
    out=[]
    for col in range(width):
        out.append([row[col] if col<len(row) else None for row in rows])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ragged', solve(_vary(['@,a,b', 'x'])), _vary([['@', 'x'], ['a', None], ['b', None]]))
check('later wider', solve(_vary(['@', 'x,y'])), _vary([['@', 'x'], [None, 'y']]))
check('explicit empty', solve(_vary(['@,', 'x'])), _vary([['@', 'x'], ['', None]]))
check('empty input', solve(_vary([])), _vary([]))
check('one empty', solve(_vary([''])), _vary([['']]))
check('rectangular', solve(_vary(['a,b', 'c,d'])), _vary([['a', 'c'], ['b', 'd']]))
check('unsorted', solve(_vary(['z,1', 'a,2'])), _vary([['z', 'a'], ['1', '2']]))
check('three rows', solve(_vary(['@,x', 'y', 'z,w'])), _vary([['@', 'y', 'z'], ['x', None, 'w']]))
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
ragged[['cell', 'x']][['cell', 'x'], ['a', None], ['b', None]]Failed
later wider[['cell', 'x']][['cell', 'x'], [None, 'y']]Failed
explicit empty[['cell', 'x']][['cell', 'x'], ['', None]]Failed
empty input[][]Passed
one empty[['']][['']]Passed
rectangular[['a', 'c'], ['b', 'd']][['a', 'c'], ['b', 'd']]Passed
unsorted[['z', 'a'], ['1', '2']][['z', 'a'], ['1', '2']]Passed
three rows[['cell', 'y', 'z']][['cell', 'y', 'z'], ['x', None, 'w']]Failed

SHA-256 / 88f5bb0a3186af14d2cc9f8d4a9ca0e4ed0a88c47cb2c56a9f79753ed1933ae4

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):
    rows=[line.split(',') for line in data]
    width=max((len(row) for row in rows),default=0)
    out=[]
    for col in range(width):
        out.append([row[col] if col<len(row) else None for row in rows])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ragged', solve(_vary(['@,a,b', 'x'])), _vary([['@', 'x'], ['a', None], ['b', None]]))
check('later wider', solve(_vary(['@', 'x,y'])), _vary([['@', 'x'], [None, 'y']]))
check('explicit empty', solve(_vary(['@,', 'x'])), _vary([['@', 'x'], ['', None]]))
check('empty input', solve(_vary([])), _vary([]))
check('one empty', solve(_vary([''])), _vary([['']]))
check('rectangular', solve(_vary(['a,b', 'c,d'])), _vary([['a', 'c'], ['b', 'd']]))
check('unsorted', solve(_vary(['z,1', 'a,2'])), _vary([['z', 'a'], ['1', '2']]))
check('three rows', solve(_vary(['@,x', 'y', 'z,w'])), _vary([['@', 'y', 'z'], ['x', None, 'w']]))
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
ragged[['cell', 'x'], ['a', None], ['b', None]][['cell', 'x'], ['a', None], ['b', None]]Passed
later wider[['cell', 'x'], [None, 'y']][['cell', 'x'], [None, 'y']]Passed
explicit empty[['cell', 'x'], ['', None]][['cell', 'x'], ['', None]]Passed
empty input[][]Passed
one empty[['']][['']]Passed
rectangular[['a', 'c'], ['b', 'd']][['a', 'c'], ['b', 'd']]Passed
unsorted[['z', 'a'], ['1', '2']][['z', 'a'], ['1', '2']]Passed
three rows[['cell', 'y', 'z'], ['x', None, 'w']][['cell', 'y', 'z'], ['x', None, 'w']]Passed

SHA-256 / 6296caec6a781f64e40df8dd2aeb6f8b323ee72696f392451e1d19df3db97602

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

Case digest / fb2262e8123aaa7e907b920e8255ae654ebc81c73f87b5275d84f2608bffb1ee