FA-48561 / Delimited text / Open access
A leaf assignment overwrites an existing nested object · case 01
A structured table violates the declared record or column contract.
ROOT CAUSE
A leaf assignment overwrites an existing nested object.
VERIFIED REPAIR
Preserve the named invariant at the faulty decision: if path[-1] in node: return None
Unsuccessful approach: The alternate implementation still violates the same declared invariant: a leaf assignment overwrites an existing nested object.
Case contract
Bind comma values to comma headers whose dots denote object paths. Empty path components, duplicate complete paths, or a path that is both leaf and parent reject. Scalar leaves remain text. Header and value counts must match. Return nested dictionaries.
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):
headers=data['header'].split(','); values=data['row'].split(',')
if len(headers)!=len(values): return None
out={}
for header,value in zip(headers,values):
path=header.split('.')
if any(not part for part in path): return None
node=out
for part in path[:-1]:
if part not in node: node[part]={}
if not isinstance(node[part],dict): return None
node=node[part]
if path[-1] in node and not isinstance(node[path[-1]],dict): return None
node[path[-1]]=value
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested', solve(_vary({'header': 'user.name,user.city', 'row': '@,x'})), _vary({'user': {'name': '@', 'city': 'x'}}))
check('two roots', solve(_vary({'header': 'a.x,b.x', 'row': '@,z'})), _vary({'a': {'x': '@'}, 'b': {'x': 'z'}}))
check('scalar conflict', solve(_vary({'header': 'a,a.b', 'row': '@,z'})), _vary(None))
check('parent conflict', solve(_vary({'header': 'a.b,a', 'row': '@,z'})), _vary(None))
check('duplicate', solve(_vary({'header': 'a.b,a.b', 'row': '@,z'})), _vary(None))
check('empty component', solve(_vary({'header': 'a..b', 'row': '@'})), _vary(None))
check('deep', solve(_vary({'header': 'a.b.c', 'row': '@'})), _vary({'a': {'b': {'c': '@'}}}))
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 |
|---|---|---|---|
| nested | {'user': {'city': 'x', 'name': 'cell'}} | {'user': {'city': 'x', 'name': 'cell'}} | Passed |
| two roots | {'a': {'x': 'cell'}, 'b': {'x': 'z'}} | {'a': {'x': 'cell'}, 'b': {'x': 'z'}} | Passed |
| scalar conflict | None | None | Passed |
| parent conflict | {'a': 'z'} | None | Failed |
| duplicate | None | None | Passed |
| empty component | None | None | Passed |
| deep | {'a': {'b': {'c': 'cell'}}} | {'a': {'b': {'c': 'cell'}}} | Passed |
SHA-256 / 62d0c13ffff6e743af4e42cec8acf3b884fccf8a13805ae799ed44c61d98ced9
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):
headers=data['header'].split(','); values=data['row'].split(',')
if len(headers)!=len(values): return None
out={}
for header,value in zip(headers,values):
path=header.split('.')
if any(not part for part in path): return None
node=out
for part in path[:-1]:
if part not in node: node[part]={}
if not isinstance(node[part],dict): return None
node=node[part]
if path[-1] in node and isinstance(node[path[-1]],dict): node.pop(path[-1])
node[path[-1]]=value
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested', solve(_vary({'header': 'user.name,user.city', 'row': '@,x'})), _vary({'user': {'name': '@', 'city': 'x'}}))
check('two roots', solve(_vary({'header': 'a.x,b.x', 'row': '@,z'})), _vary({'a': {'x': '@'}, 'b': {'x': 'z'}}))
check('scalar conflict', solve(_vary({'header': 'a,a.b', 'row': '@,z'})), _vary(None))
check('parent conflict', solve(_vary({'header': 'a.b,a', 'row': '@,z'})), _vary(None))
check('duplicate', solve(_vary({'header': 'a.b,a.b', 'row': '@,z'})), _vary(None))
check('empty component', solve(_vary({'header': 'a..b', 'row': '@'})), _vary(None))
check('deep', solve(_vary({'header': 'a.b.c', 'row': '@'})), _vary({'a': {'b': {'c': '@'}}}))
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 |
|---|---|---|---|
| nested | {'user': {'city': 'x', 'name': 'cell'}} | {'user': {'city': 'x', 'name': 'cell'}} | Passed |
| two roots | {'a': {'x': 'cell'}, 'b': {'x': 'z'}} | {'a': {'x': 'cell'}, 'b': {'x': 'z'}} | Passed |
| scalar conflict | None | None | Passed |
| parent conflict | {'a': 'z'} | None | Failed |
| duplicate | {'a': {'b': 'z'}} | None | Failed |
| empty component | None | None | Passed |
| deep | {'a': {'b': {'c': 'cell'}}} | {'a': {'b': {'c': 'cell'}}} | Passed |
SHA-256 / 4a9f62b4addb1315fd241cff2b11d4b569dca70d2010019650b16b5c3211232a
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):
headers=data['header'].split(','); values=data['row'].split(',')
if len(headers)!=len(values): return None
out={}
for header,value in zip(headers,values):
path=header.split('.')
if any(not part for part in path): return None
node=out
for part in path[:-1]:
if part not in node: node[part]={}
if not isinstance(node[part],dict): return None
node=node[part]
if path[-1] in node: return None
node[path[-1]]=value
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested', solve(_vary({'header': 'user.name,user.city', 'row': '@,x'})), _vary({'user': {'name': '@', 'city': 'x'}}))
check('two roots', solve(_vary({'header': 'a.x,b.x', 'row': '@,z'})), _vary({'a': {'x': '@'}, 'b': {'x': 'z'}}))
check('scalar conflict', solve(_vary({'header': 'a,a.b', 'row': '@,z'})), _vary(None))
check('parent conflict', solve(_vary({'header': 'a.b,a', 'row': '@,z'})), _vary(None))
check('duplicate', solve(_vary({'header': 'a.b,a.b', 'row': '@,z'})), _vary(None))
check('empty component', solve(_vary({'header': 'a..b', 'row': '@'})), _vary(None))
check('deep', solve(_vary({'header': 'a.b.c', 'row': '@'})), _vary({'a': {'b': {'c': '@'}}}))
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 |
|---|---|---|---|
| nested | {'user': {'city': 'x', 'name': 'cell'}} | {'user': {'city': 'x', 'name': 'cell'}} | Passed |
| two roots | {'a': {'x': 'cell'}, 'b': {'x': 'z'}} | {'a': {'x': 'cell'}, 'b': {'x': 'z'}} | Passed |
| scalar conflict | None | None | Passed |
| parent conflict | None | None | Passed |
| duplicate | None | None | Passed |
| empty component | None | None | Passed |
| deep | {'a': {'b': {'c': 'cell'}}} | {'a': {'b': {'c': 'cell'}}} | Passed |
SHA-256 / 1b72868517f36b228412356ab318231643c392854e8373ccc7153fdb2fa32d9d
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.894414+00:00.
Case digest / 260566a7e0859c46675e3fc3d529aa20fefb96f9b5cef3274c0d57b077c00875