FAILURE MAP
← Case archive

FA-48036 / Delimited text / Open access

EOF silently drops an open grouped record · case 01

A structured table violates the declared record or column contract.

Verified by executionVariant 1 · 9 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The final open-scope obligation is omitted.

VERIFIED REPAIR

Preserve the named invariant at the faulty decision: if active is not None: return None return out

Unsuccessful approach: Emitting the partial object makes a missing close look valid.

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, 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
    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 fixtureActualExpectedOutcome
groups[['cell', {'a': 'x'}], ['other', {'a': 'y'}]][['cell', {'a': 'x'}], ['other', {'a': 'y'}]]Passed
nestedNoneNonePassed
orphanNoneNonePassed
mismatchNoneNonePassed
unclosed[]NoneFailed
duplicateNoneNonePassed
empty object[['a', {}]][['a', {}]]Passed
empty value[['a', {'x': ''}]][['a', {'x': ''}]]Passed
zero[][]Passed

SHA-256 / 9c501177289551f164ef64fdabf3c600ded801bcd3b17c3384abb0b1e2766a8e

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], {}
        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: out.append([active,fields])
    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 fixtureActualExpectedOutcome
groups[['cell', {'a': 'x'}], ['other', {'a': 'y'}]][['cell', {'a': 'x'}], ['other', {'a': 'y'}]]Passed
nestedNoneNonePassed
orphanNoneNonePassed
mismatchNoneNonePassed
unclosed[['cell', {'a': 'x'}]]NoneFailed
duplicateNoneNonePassed
empty object[['a', {}]][['a', {}]]Passed
empty value[['a', {'x': ''}]][['a', {'x': ''}]]Passed
zero[][]Passed

SHA-256 / d8ab650c187ca6f2813e57f2f8b3a1d43befe4f8d2cf0535aa1749bd4e7380cd

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 fixtureActualExpectedOutcome
groups[['cell', {'a': 'x'}], ['other', {'a': 'y'}]][['cell', {'a': 'x'}], ['other', {'a': 'y'}]]Passed
nestedNoneNonePassed
orphanNoneNonePassed
mismatchNoneNonePassed
unclosedNoneNonePassed
duplicateNoneNonePassed
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:47.048654+00:00.

Case digest / 842d21efc4ad4e76a54f49f35077b03dbde54487164a529642aa40ab433b00bb