FAILURE MAP
← Case archive

FA-48586 / Delimited text / Open access

Unit labels are case-folded during header parsing · case 01

A structured table violates the declared record or column contract.

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

ROOT CAUSE

Unit labels are case-folded during header parsing.

THE FAILURE

Unit labels are case-folded during header parsing.

Unsuccessful approach: The alternate implementation still violates the same declared invariant: unit labels are case-folded during header parsing.

Case contract

Parse comma header cells with optional terminal [unit]. Return [name,unit-or-null]. Only one terminal bracket pair is allowed; name and unit must be nonempty. Bare header names are preserved including spaces; bracket text is not normalized. Duplicate full name/unit pairs reject, but one name with different units is allowed.

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.split(','):
        if '[' in cell:
            opening=cell.find('[')
            if not cell.endswith(']') or cell.count('[')!=1 or cell.count(']')!=1: return None
            name,unit=cell[:opening],cell[opening+1:-1]
            if not name or not unit: return None
        else:
            if not cell or ']' in cell: return None
            name,unit=cell,None
        pair=[name,unit.lower() if unit is not None else None]
        if pair in out: return None
        out.append(pair)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('units', solve(_vary('@ [kg],time[s]')), _vary([['@ ', 'kg'], ['time', 's']]))
check('bare', solve(_vary('@')), _vary([['@', None]]))
check('two units', solve(_vary('mass[kg],mass[g]')), _vary([['mass', 'kg'], ['mass', 'g']]))
check('duplicate', solve(_vary('a[x],a[x]')), _vary(None))
check('empty unit', solve(_vary('a[]')), _vary(None))
check('empty name', solve(_vary('[kg]')), _vary(None))
check('suffix', solve(_vary('a[x]tail')), _vary(None))
check('nested', solve(_vary('a[[x]]')), _vary(None))
check('bare space', solve(_vary(' name ')), _vary([[' name ', None]]))
check('unit exact spelling', solve(_vary('a[ Pa ],b[Pa]')), _vary([['a', ' Pa '], ['b', 'Pa']]))
check('shared unit', solve(_vary('a[x],b[x]')), _vary([['a', 'x'], ['b', 'x']]))
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
units[['cell ', 'kg'], ['time', 's']][['cell ', 'kg'], ['time', 's']]Passed
bare[['cell', None]][['cell', None]]Passed
two units[['mass', 'kg'], ['mass', 'g']][['mass', 'kg'], ['mass', 'g']]Passed
duplicateNoneNonePassed
empty unitNoneNonePassed
empty nameNoneNonePassed
suffixNoneNonePassed
nestedNoneNonePassed
bare space[[' name ', None]][[' name ', None]]Passed
unit exact spelling[['a', ' pa '], ['b', 'pa']][['a', ' Pa '], ['b', 'Pa']]Failed
shared unit[['a', 'x'], ['b', 'x']][['a', 'x'], ['b', 'x']]Passed

SHA-256 / 63830ec3452ff310a8c31cee3d5e2eed467c7b5dc93a98f997df57dfdaec44a1

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.split(','):
        if '[' in cell:
            opening=cell.find('[')
            if not cell.endswith(']') or cell.count('[')!=1 or cell.count(']')!=1: return None
            name,unit=cell[:opening],cell[opening+1:-1]
            if not name or not unit: return None
        else:
            if not cell or ']' in cell: return None
            name,unit=cell,None
        pair=[name,unit.strip() if unit is not None else None]
        if pair in out: return None
        out.append(pair)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('units', solve(_vary('@ [kg],time[s]')), _vary([['@ ', 'kg'], ['time', 's']]))
check('bare', solve(_vary('@')), _vary([['@', None]]))
check('two units', solve(_vary('mass[kg],mass[g]')), _vary([['mass', 'kg'], ['mass', 'g']]))
check('duplicate', solve(_vary('a[x],a[x]')), _vary(None))
check('empty unit', solve(_vary('a[]')), _vary(None))
check('empty name', solve(_vary('[kg]')), _vary(None))
check('suffix', solve(_vary('a[x]tail')), _vary(None))
check('nested', solve(_vary('a[[x]]')), _vary(None))
check('bare space', solve(_vary(' name ')), _vary([[' name ', None]]))
check('unit exact spelling', solve(_vary('a[ Pa ],b[Pa]')), _vary([['a', ' Pa '], ['b', 'Pa']]))
check('shared unit', solve(_vary('a[x],b[x]')), _vary([['a', 'x'], ['b', 'x']]))
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
units[['cell ', 'kg'], ['time', 's']][['cell ', 'kg'], ['time', 's']]Passed
bare[['cell', None]][['cell', None]]Passed
two units[['mass', 'kg'], ['mass', 'g']][['mass', 'kg'], ['mass', 'g']]Passed
duplicateNoneNonePassed
empty unitNoneNonePassed
empty nameNoneNonePassed
suffixNoneNonePassed
nestedNoneNonePassed
bare space[[' name ', None]][[' name ', None]]Passed
unit exact spelling[['a', 'Pa'], ['b', 'Pa']][['a', ' Pa '], ['b', 'Pa']]Failed
shared unit[['a', 'x'], ['b', 'x']][['a', 'x'], ['b', 'x']]Passed

SHA-256 / 8731963befdff5d325bd31d5626fef7b26e74f9275f3e13f1698919ba1e4e790

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 11 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:52.108592+00:00.

Case digest / 3365a2149bbb017dd8deb21f69dde52cbba7e27828844a6e63e51511fbc529ab