FA-48566 / Delimited text / Open access
A parsed unit retains its closing bracket · case 01
A structured table violates the declared record or column contract.
ROOT CAUSE
A parsed unit retains its closing bracket.
VERIFIED REPAIR
Preserve the named invariant at the faulty decision: cell[opening+1:-1]
Unsuccessful approach: The alternate implementation still violates the same declared invariant: a parsed unit retains its closing bracket.
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:]
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']] | Failed |
| bare | [['cell', None]] | [['cell', None]] | Passed |
| two units | [['mass', 'kg]'], ['mass', 'g]']] | [['mass', 'kg'], ['mass', 'g']] | Failed |
| duplicate | None | None | Passed |
| empty unit | [['a', ']']] | None | Failed |
| 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']] | Failed |
| shared unit | [['a', 'x]'], ['b', 'x]']] | [['a', 'x'], ['b', 'x']] | Failed |
SHA-256 / 94b52fe5d8d12aa3fd92c123d7ecd39c45ed0212a37e5549c93a7837480e5024
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]
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']] | Failed |
| bare | [['cell', None]] | [['cell', None]] | Passed |
| two units | [['mass', '[kg'], ['mass', '[g']] | [['mass', 'kg'], ['mass', 'g']] | Failed |
| duplicate | None | None | Passed |
| empty unit | [['a', '[']] | None | Failed |
| 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']] | Failed |
| shared unit | [['a', '[x'], ['b', '[x']] | [['a', 'x'], ['b', 'x']] | Failed |
SHA-256 / 21b49d89b8ae528d9e5185e3cc29f5d7f477df38985ef7a598e8d090d46ed82b
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.894691+00:00.
Case digest / 5fecb7128843f32a852575e22d5e0677ccba61977fe2dab016232a316fa87c4f