FA-48536 / Delimited text / Open access
Later map entries silently replace an earlier named value · case 01
A structured table violates the declared record or column contract.
ROOT CAUSE
Later map entries silently replace an earlier named value.
VERIFIED REPAIR
Preserve the named invariant at the faulty decision: or parts[0] in mapping
Unsuccessful approach: The alternate implementation still violates the same declared invariant: later map entries silently replace an earlier named value.
Case contract
Decode a semicolon-delimited row of map cells enclosed in braces. Inside a map, comma separates entries and first equals separates key and value. Empty braces represent an empty map; empty values are legal, empty or duplicate keys reject. Ordinary scalar cells remain text, even with equals.
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 cell.startswith('{'):
if not cell.endswith('}'): return None
inner=cell[1:-1]; mapping={}
for pair in inner.split(',') if inner else []:
parts=pair.split('=',1)
if len(parts)!=2 or not parts[0] : return None
mapping[parts[0]]=parts[1]
out.append(mapping)
else:
if '{' in cell or '}' in cell: return None
out.append(cell)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary('@;{a=x,b=y}')), _vary(['@', {'a': 'x', 'b': 'y'}]))
check('empty', solve(_vary('{}')), _vary([{}]))
check('equals value', solve(_vary('{a=x=y}')), _vary([{'a': 'x=y'}]))
check('empty value', solve(_vary('{a=}')), _vary([{'a': ''}]))
check('duplicate', solve(_vary('{a=x,a=y}')), _vary(None))
check('empty key', solve(_vary('{=x}')), _vary(None))
check('scalar equals', solve(_vary('a=x')), _vary(['a=x']))
check('two maps', solve(_vary('{a=@};{a=z}')), _vary([{'a': '@'}, {'a': 'z'}]))
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 |
|---|---|---|---|
| mixed | ['cell', {'a': 'x', 'b': 'y'}] | ['cell', {'a': 'x', 'b': 'y'}] | Passed |
| empty | [{}] | [{}] | Passed |
| equals value | [{'a': 'x=y'}] | [{'a': 'x=y'}] | Passed |
| empty value | [{'a': ''}] | [{'a': ''}] | Passed |
| duplicate | [{'a': 'y'}] | None | Failed |
| empty key | None | None | Passed |
| scalar equals | ['a=x'] | ['a=x'] | Passed |
| two maps | [{'a': 'cell'}, {'a': 'z'}] | [{'a': 'cell'}, {'a': 'z'}] | Passed |
SHA-256 / 21004511cc577aaa4ec4dc956a37c09b3bdba0aef274250dd267656dc7ecc665
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 cell.startswith('{'):
if not cell.endswith('}'): return None
inner=cell[1:-1]; mapping={}
for pair in inner.split(',') if inner else []:
parts=pair.split('=',1)
if len(parts)!=2 or not parts[0] or (parts[0] in mapping and mapping[parts[0]]==parts[1]): return None
mapping[parts[0]]=parts[1]
out.append(mapping)
else:
if '{' in cell or '}' in cell: return None
out.append(cell)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary('@;{a=x,b=y}')), _vary(['@', {'a': 'x', 'b': 'y'}]))
check('empty', solve(_vary('{}')), _vary([{}]))
check('equals value', solve(_vary('{a=x=y}')), _vary([{'a': 'x=y'}]))
check('empty value', solve(_vary('{a=}')), _vary([{'a': ''}]))
check('duplicate', solve(_vary('{a=x,a=y}')), _vary(None))
check('empty key', solve(_vary('{=x}')), _vary(None))
check('scalar equals', solve(_vary('a=x')), _vary(['a=x']))
check('two maps', solve(_vary('{a=@};{a=z}')), _vary([{'a': '@'}, {'a': 'z'}]))
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 |
|---|---|---|---|
| mixed | ['cell', {'a': 'x', 'b': 'y'}] | ['cell', {'a': 'x', 'b': 'y'}] | Passed |
| empty | [{}] | [{}] | Passed |
| equals value | [{'a': 'x=y'}] | [{'a': 'x=y'}] | Passed |
| empty value | [{'a': ''}] | [{'a': ''}] | Passed |
| duplicate | [{'a': 'y'}] | None | Failed |
| empty key | None | None | Passed |
| scalar equals | ['a=x'] | ['a=x'] | Passed |
| two maps | [{'a': 'cell'}, {'a': 'z'}] | [{'a': 'cell'}, {'a': 'z'}] | Passed |
SHA-256 / feca63a2c597622ae04a7ada3ec5eeaae97e2fff2b1d83f078b58a68b449ec32
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 cell.startswith('{'):
if not cell.endswith('}'): return None
inner=cell[1:-1]; mapping={}
for pair in inner.split(',') if inner else []:
parts=pair.split('=',1)
if len(parts)!=2 or not parts[0] or parts[0] in mapping: return None
mapping[parts[0]]=parts[1]
out.append(mapping)
else:
if '{' in cell or '}' in cell: return None
out.append(cell)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary('@;{a=x,b=y}')), _vary(['@', {'a': 'x', 'b': 'y'}]))
check('empty', solve(_vary('{}')), _vary([{}]))
check('equals value', solve(_vary('{a=x=y}')), _vary([{'a': 'x=y'}]))
check('empty value', solve(_vary('{a=}')), _vary([{'a': ''}]))
check('duplicate', solve(_vary('{a=x,a=y}')), _vary(None))
check('empty key', solve(_vary('{=x}')), _vary(None))
check('scalar equals', solve(_vary('a=x')), _vary(['a=x']))
check('two maps', solve(_vary('{a=@};{a=z}')), _vary([{'a': '@'}, {'a': 'z'}]))
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 |
|---|---|---|---|
| mixed | ['cell', {'a': 'x', 'b': 'y'}] | ['cell', {'a': 'x', 'b': 'y'}] | Passed |
| empty | [{}] | [{}] | Passed |
| equals value | [{'a': 'x=y'}] | [{'a': 'x=y'}] | Passed |
| empty value | [{'a': ''}] | [{'a': ''}] | Passed |
| duplicate | None | None | Passed |
| empty key | None | None | Passed |
| scalar equals | ['a=x'] | ['a=x'] | Passed |
| two maps | [{'a': 'cell'}, {'a': 'z'}] | [{'a': 'cell'}, {'a': 'z'}] | Passed |
SHA-256 / 8c44ae1fdb3dae1cb9afe1c90d4a8d6e4a548a595041ee0b39d61c5e4f1131d1
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.598319+00:00.
Case digest / 0ce796993c8d7c51d49059cb4a81c1c3aea42d1dc465dea93f46476aa7c0179a