FAILURE MAP
← Case archive

FA-48201 / Delimited text / Open access

Short records are omitted from a transposed column · 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

Short records are omitted from a transposed column.

VERIFIED REPAIR

Preserve the named invariant at the faulty decision: row[col] if col<len(row) else None for row in rows

Unsuccessful approach: The alternate implementation still violates the same declared invariant: short records are omitted from a transposed column.

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=max((len(row) for row in rows),default=0)
    out=[]
    for col in range(width):
        out.append([row[col] for row in rows if col<len(row)])
    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'], ['b']][['cell', 'x'], ['a', None], ['b', None]]Failed
later wider[['cell', 'x'], ['y']][['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'], ['x', 'w']][['cell', 'y', 'z'], ['x', None, 'w']]Failed

SHA-256 / 1870d0ed7683b436f08645533c90c88d21eed4580cb3dc3aefd3f20982d0274a

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=max((len(row) for row in rows),default=0)
    out=[]
    for col in range(width):
        out.append([row[col] for row in rows if col<len(row) and row[col]])
    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'], ['b']][['cell', 'x'], ['a', None], ['b', None]]Failed
later wider[['cell', 'x'], ['y']][['cell', 'x'], [None, 'y']]Failed
explicit empty[['cell', 'x'], []][['cell', 'x'], ['', None]]Failed
empty input[][]Passed
one empty[[]][['']]Failed
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', 'w']][['cell', 'y', 'z'], ['x', None, 'w']]Failed

SHA-256 / c8fd25b7d9744ade9e5bb41316e15bf2da423c5f72eb78fb82d84562794284c3

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

Case digest / 02cb0e40e443c211f30845fb6d0f52d69a0b104d13af234065c4b9b7a36d0671