FA-48021 / Delimited text / Open access
Object fields leak across grouped record boundaries · case 01
A structured table violates the declared record or column contract.
ROOT CAUSE
Opening an object reuses the preceding object field map.
VERIFIED REPAIR
Preserve the named invariant at the faulty decision: active, fields = cells[1], {}
Unsuccessful approach: Copying the stale map still carries old fields into the new scope.
Case contract
Read pipe rows: B|id opens an object, V|key|value adds a unique field, E|id closes and emits it. Nested begins, values outside an object, mismatched closes and EOF-open objects reject. Closed objects may reuse field keys. Preserve object order and text including empty values.
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, active, fields = [], None, {}
for line in data:
cells = line.split('|')
tag = cells[0]
if tag == 'B' and len(cells) == 2:
if active is not None: return None
active = cells[1]
elif tag == 'V' and len(cells) == 3:
if active is None or cells[1] in fields: return None
fields[cells[1]] = cells[2]
elif tag == 'E' and len(cells) == 2:
if active is None or cells[1] != active: return None
out.append([active, fields])
active = None
else: return None
if active is not None: return None
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('groups', solve(_vary(['B|@', 'V|a|x', 'E|@', 'B|other', 'V|a|y', 'E|other'])), _vary([['@', {'a': 'x'}], ['other', {'a': 'y'}]]))
check('nested', solve(_vary(['B|a', 'B|b', 'E|b'])), _vary(None))
check('orphan', solve(_vary(['V|a|x'])), _vary(None))
check('mismatch', solve(_vary(['B|a', 'E|b'])), _vary(None))
check('unclosed', solve(_vary(['B|@', 'V|a|x'])), _vary(None))
check('duplicate', solve(_vary(['B|a', 'V|x|1', 'V|x|2', 'E|a'])), _vary(None))
check('empty object', solve(_vary(['B|a', 'E|a'])), _vary([['a', {}]]))
check('empty value', solve(_vary(['B|a', 'V|x|', 'E|a'])), _vary([['a', {'x': ''}]]))
check('zero', solve(_vary([])), _vary([]))
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 |
|---|---|---|---|
| groups | None | [['cell', {'a': 'x'}], ['other', {'a': 'y'}]] | Failed |
| nested | None | None | Passed |
| orphan | None | None | Passed |
| mismatch | None | None | Passed |
| unclosed | None | None | Passed |
| duplicate | None | None | Passed |
| empty object | [['a', {}]] | [['a', {}]] | Passed |
| empty value | [['a', {'x': ''}]] | [['a', {'x': ''}]] | Passed |
| zero | [] | [] | Passed |
SHA-256 / d0befe4ad3d807a04a5812747dd5c2242057c55c9e43c67b0c55f93e57287157
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, active, fields = [], None, {}
for line in data:
cells = line.split('|')
tag = cells[0]
if tag == 'B' and len(cells) == 2:
if active is not None: return None
active, fields = cells[1], dict(fields)
elif tag == 'V' and len(cells) == 3:
if active is None or cells[1] in fields: return None
fields[cells[1]] = cells[2]
elif tag == 'E' and len(cells) == 2:
if active is None or cells[1] != active: return None
out.append([active, fields])
active = None
else: return None
if active is not None: return None
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('groups', solve(_vary(['B|@', 'V|a|x', 'E|@', 'B|other', 'V|a|y', 'E|other'])), _vary([['@', {'a': 'x'}], ['other', {'a': 'y'}]]))
check('nested', solve(_vary(['B|a', 'B|b', 'E|b'])), _vary(None))
check('orphan', solve(_vary(['V|a|x'])), _vary(None))
check('mismatch', solve(_vary(['B|a', 'E|b'])), _vary(None))
check('unclosed', solve(_vary(['B|@', 'V|a|x'])), _vary(None))
check('duplicate', solve(_vary(['B|a', 'V|x|1', 'V|x|2', 'E|a'])), _vary(None))
check('empty object', solve(_vary(['B|a', 'E|a'])), _vary([['a', {}]]))
check('empty value', solve(_vary(['B|a', 'V|x|', 'E|a'])), _vary([['a', {'x': ''}]]))
check('zero', solve(_vary([])), _vary([]))
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 |
|---|---|---|---|
| groups | None | [['cell', {'a': 'x'}], ['other', {'a': 'y'}]] | Failed |
| nested | None | None | Passed |
| orphan | None | None | Passed |
| mismatch | None | None | Passed |
| unclosed | None | None | Passed |
| duplicate | None | None | Passed |
| empty object | [['a', {}]] | [['a', {}]] | Passed |
| empty value | [['a', {'x': ''}]] | [['a', {'x': ''}]] | Passed |
| zero | [] | [] | Passed |
SHA-256 / 34b185bc016ca689cb7ebca200942f32c7bea16ac5968200cc838719e427c90f
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, active, fields = [], None, {}
for line in data:
cells = line.split('|')
tag = cells[0]
if tag == 'B' and len(cells) == 2:
if active is not None: return None
active, fields = cells[1], {}
elif tag == 'V' and len(cells) == 3:
if active is None or cells[1] in fields: return None
fields[cells[1]] = cells[2]
elif tag == 'E' and len(cells) == 2:
if active is None or cells[1] != active: return None
out.append([active, fields])
active = None
else: return None
if active is not None: return None
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('groups', solve(_vary(['B|@', 'V|a|x', 'E|@', 'B|other', 'V|a|y', 'E|other'])), _vary([['@', {'a': 'x'}], ['other', {'a': 'y'}]]))
check('nested', solve(_vary(['B|a', 'B|b', 'E|b'])), _vary(None))
check('orphan', solve(_vary(['V|a|x'])), _vary(None))
check('mismatch', solve(_vary(['B|a', 'E|b'])), _vary(None))
check('unclosed', solve(_vary(['B|@', 'V|a|x'])), _vary(None))
check('duplicate', solve(_vary(['B|a', 'V|x|1', 'V|x|2', 'E|a'])), _vary(None))
check('empty object', solve(_vary(['B|a', 'E|a'])), _vary([['a', {}]]))
check('empty value', solve(_vary(['B|a', 'V|x|', 'E|a'])), _vary([['a', {'x': ''}]]))
check('zero', solve(_vary([])), _vary([]))
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 |
|---|---|---|---|
| groups | [['cell', {'a': 'x'}], ['other', {'a': 'y'}]] | [['cell', {'a': 'x'}], ['other', {'a': 'y'}]] | Passed |
| nested | None | None | Passed |
| orphan | None | None | Passed |
| mismatch | None | None | Passed |
| unclosed | None | None | Passed |
| duplicate | None | None | Passed |
| empty object | [['a', {}]] | [['a', {}]] | Passed |
| empty value | [['a', {'x': ''}]] | [['a', {'x': ''}]] | Passed |
| zero | [] | [] | Passed |
SHA-256 / a26c300d3511e4328896ad8713a0f7f784094aea0505e32417fcdcdb5a3d92e3
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:46.999034+00:00.
Case digest / 5ab3e272be3860baf4af090d1c5bb09ed909a08dde050816b31de142d7b6f86b