FA-48576 / Delimited text / Open access
Different units under the same column name are treated as duplicate columns · case 01
A structured table violates the declared record or column contract.
ROOT CAUSE
Different units under the same column name are treated as duplicate columns.
VERIFIED REPAIR
Preserve the named invariant at the faulty decision: if pair in out: return None
Unsuccessful approach: The alternate implementation still violates the same declared invariant: different units under the same column name are treated as duplicate columns.
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]
if any(p[0]==name for p 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| units | [['cell ', 'kg'], ['time', 's']] | [['cell ', 'kg'], ['time', 's']] | Passed |
| bare | [['cell', None]] | [['cell', None]] | Passed |
| two units | None | [['mass', 'kg'], ['mass', 'g']] | Failed |
| duplicate | None | None | Passed |
| empty unit | None | None | Passed |
| empty name | None | None | Passed |
| suffix | None | None | Passed |
| nested | None | None | Passed |
| bare space | [[' name ', None]] | [[' name ', None]] | Passed |
| unit exact spelling | [['a', ' Pa '], ['b', 'Pa']] | [['a', ' Pa '], ['b', 'Pa']] | Passed |
| shared unit | [['a', 'x'], ['b', 'x']] | [['a', 'x'], ['b', 'x']] | Passed |
SHA-256 / aad58b2b753fbb0c7ba838577b65e76f70cc95ad7267402adc2840721839ffe6
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]
if any(p[1]==unit for p 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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 |
| duplicate | None | None | Passed |
| empty unit | None | None | Passed |
| empty name | None | None | Passed |
| suffix | None | None | Passed |
| nested | None | None | Passed |
| bare space | [[' name ', None]] | [[' name ', None]] | Passed |
| unit exact spelling | [['a', ' Pa '], ['b', 'Pa']] | [['a', ' Pa '], ['b', 'Pa']] | Passed |
| shared unit | None | [['a', 'x'], ['b', 'x']] | Failed |
SHA-256 / 1266079a0e5760baf9cc9c976e5e420b85b65ac96d221b99cbdeb0d37bde3aed
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):
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]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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 |
| duplicate | None | None | Passed |
| empty unit | None | None | Passed |
| empty name | None | None | Passed |
| suffix | None | None | Passed |
| nested | None | None | Passed |
| bare space | [[' name ', None]] | [[' name ', None]] | Passed |
| unit exact spelling | [['a', ' Pa '], ['b', 'Pa']] | [['a', ' Pa '], ['b', 'Pa']] | Passed |
| shared unit | [['a', 'x'], ['b', 'x']] | [['a', 'x'], ['b', 'x']] | Passed |
SHA-256 / 786974f621723854f9ce4e3b3e0e2114cb0c656819f95836b3b08a9f68113f80
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:51.969269+00:00.
Case digest / efdf0ac7f2ef4722a4a22d795958cfe9406239a45d8ff131841ebd4ca085d4b4