FAILURE MAP
← Case archive

FA-48206 / Delimited text / Open access

Transposed columns are emitted in reverse physical order · 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

Transposed columns are emitted in reverse physical order.

VERIFIED REPAIR

Preserve the named invariant at the faulty decision: for col in range(width):

Unsuccessful approach: The alternate implementation still violates the same declared invariant: transposed columns are emitted in reverse physical order.

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 reversed(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[['b', None], ['a', None], ['cell', 'x']][['cell', 'x'], ['a', None], ['b', None]]Failed
later wider[[None, 'y'], ['cell', 'x']][['cell', 'x'], [None, 'y']]Failed
explicit empty[['', None], ['cell', 'x']][['cell', 'x'], ['', None]]Failed
empty input[][]Passed
one empty[['']][['']]Passed
rectangular[['b', 'd'], ['a', 'c']][['a', 'c'], ['b', 'd']]Failed
unsorted[['1', '2'], ['z', 'a']][['z', 'a'], ['1', '2']]Failed
three rows[['x', None, 'w'], ['cell', 'y', 'z']][['cell', 'y', 'z'], ['x', None, 'w']]Failed

SHA-256 / f2020dcca914a731336923f7b13205888e18aab343ec403828d25bb5671418d4

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(max(width-1,0)):
        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]][['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[][['']]Failed
rectangular[['a', 'c']][['a', 'c'], ['b', 'd']]Failed
unsorted[['z', 'a']][['z', 'a'], ['1', '2']]Failed
three rows[['cell', 'y', 'z']][['cell', 'y', 'z'], ['x', None, 'w']]Failed

SHA-256 / 5b34349324a32b9440b39a52eb99307e1e37740b263e64adcd1ffe5507e2dfa0

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

Case digest / 48e4affd6af12095cb3ecba98562db08f036463e1f810c3cf1eecebb2d2ff8c1