FAILURE MAP
← Case archive

FA-48836 / Delimited text / Open access

Header assembly combines each level row instead of each physical column · case 01

A structured table violates the declared record or column contract.

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

ROOT CAUSE

Header assembly combines each level row instead of each physical column.

THE FAILURE

Header assembly combines each level row instead of each physical column.

Unsuccessful approach: The alternate implementation still violates the same declared invariant: header assembly combines each level row instead of each physical column.

Case contract

Decode a table with an integer preamble giving the number of following physical header rows. Each header row is comma cells; combine corresponding column labels with /, omitting empty components. At least one header row is required, widths must agree, final names must be nonempty and unique. Remaining rows are body and must match width. Return header and body.

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):
    if not data or not data[0].isascii() or not data[0].isdecimal(): return None
    count=int(data[0])
    if count<1 or len(data)<count+1: return None
    levels=[line.split(',') for line in data[1:count+1]]
    width=len(levels[0])
    if any(len(level)!=width for level in levels): return None
    header=['/'.join(level) for level in levels]
    if any(not name for name in header) or len(set(header))!=width: return None
    rows=[line.split(',') for line in data[count+1:]]
    if any(len(row)!=width for row in rows): return None
    return {'header':header,'rows':rows}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('levels', solve(_vary(['2', 'group,group', 'a,b', '@,z'])), _vary({'header': ['group/a', 'group/b'], 'rows': [['@', 'z']]}))
check('empty components', solve(_vary(['2', 'group,', 'a,b', '@,z'])), _vary({'header': ['group/a', 'b'], 'rows': [['@', 'z']]}))
check('header only', solve(_vary(['1', '@'])), _vary({'header': ['@'], 'rows': []}))
check('bad count', solve(_vary(['0', 'a'])), _vary(None))
check('too few headers', solve(_vary(['2', 'a'])), _vary(None))
check('width mismatch', solve(_vary(['2', 'a,b', 'c'])), _vary(None))
check('duplicate', solve(_vary(['1', 'a,a'])), _vary(None))
check('empty final name', solve(_vary(['2', ',a', ',b'])), _vary(None))
check('body width', solve(_vary(['1', 'a,b', '@'])), _vary(None))
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
levels{'header': ['group/group', 'a/b'], 'rows': [['cell', 'z']]}{'header': ['group/a', 'group/b'], 'rows': [['cell', 'z']]}Failed
empty components{'header': ['group/', 'a/b'], 'rows': [['cell', 'z']]}{'header': ['group/a', 'b'], 'rows': [['cell', 'z']]}Failed
header only{'header': ['cell'], 'rows': []}{'header': ['cell'], 'rows': []}Passed
bad countNoneNonePassed
too few headersNoneNonePassed
width mismatchNoneNonePassed
duplicateNoneNonePassed
empty final name{'header': ['/a', '/b'], 'rows': []}NoneFailed
body widthNoneNonePassed

SHA-256 / 2af0ef44a410640bbb1c407a2a09c8efabb6804873e133ddf43e895873f67408

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):
    if not data or not data[0].isascii() or not data[0].isdecimal(): return None
    count=int(data[0])
    if count<1 or len(data)<count+1: return None
    levels=[line.split(',') for line in data[1:count+1]]
    width=len(levels[0])
    if any(len(level)!=width for level in levels): return None
    header=['/'.join(level) for level in levels][:width]
    if any(not name for name in header) or len(set(header))!=width: return None
    rows=[line.split(',') for line in data[count+1:]]
    if any(len(row)!=width for row in rows): return None
    return {'header':header,'rows':rows}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('levels', solve(_vary(['2', 'group,group', 'a,b', '@,z'])), _vary({'header': ['group/a', 'group/b'], 'rows': [['@', 'z']]}))
check('empty components', solve(_vary(['2', 'group,', 'a,b', '@,z'])), _vary({'header': ['group/a', 'b'], 'rows': [['@', 'z']]}))
check('header only', solve(_vary(['1', '@'])), _vary({'header': ['@'], 'rows': []}))
check('bad count', solve(_vary(['0', 'a'])), _vary(None))
check('too few headers', solve(_vary(['2', 'a'])), _vary(None))
check('width mismatch', solve(_vary(['2', 'a,b', 'c'])), _vary(None))
check('duplicate', solve(_vary(['1', 'a,a'])), _vary(None))
check('empty final name', solve(_vary(['2', ',a', ',b'])), _vary(None))
check('body width', solve(_vary(['1', 'a,b', '@'])), _vary(None))
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
levels{'header': ['group/group', 'a/b'], 'rows': [['cell', 'z']]}{'header': ['group/a', 'group/b'], 'rows': [['cell', 'z']]}Failed
empty components{'header': ['group/', 'a/b'], 'rows': [['cell', 'z']]}{'header': ['group/a', 'b'], 'rows': [['cell', 'z']]}Failed
header only{'header': ['cell'], 'rows': []}{'header': ['cell'], 'rows': []}Passed
bad countNoneNonePassed
too few headersNoneNonePassed
width mismatchNoneNonePassed
duplicateNoneNonePassed
empty final name{'header': ['/a', '/b'], 'rows': []}NoneFailed
body widthNoneNonePassed

SHA-256 / ac95d0b6672c8ca73c8349c14cbd35ad23c9759cf04909649bbba1e94d70a552

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 9 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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

Case digest / 7d87a4de3775fbe155bbce345dc9019bb4f88b5f3fd52ca081e62275f6e18b51