FA-48306 / Delimited text / Open access
An incomplete counted block is accepted at EOF · case 01
A structured table violates the declared record or column contract.
ROOT CAUSE
An incomplete counted block is accepted at EOF.
VERIFIED REPAIR
Preserve the named invariant at the faulty decision: if remaining: return None return blocks
Unsuccessful approach: The alternate implementation still violates the same declared invariant: an incomplete counted block is accepted at eof.
Case contract
Decode pipe records arranged as C|count followed by exactly count R|value rows. Multiple blocks may follow. Counts are ASCII nonnegative decimals; values contain no pipe in this bounded grammar. Empty blocks are emitted as empty lists. Missing, unexpected, and surplus R records reject.
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):
blocks=[]; current=None; remaining=0
for line in data:
cells=line.split('|')
if len(cells)!=2: return None
tag,value=cells
if tag=='C':
if remaining: return None
if not value.isascii() or not value.isdecimal(): return None
remaining=int(value); current=[]; blocks.append(current)
elif tag=='R':
if remaining==0: return None
current.append(value); remaining-=1
else: return None
return blocks
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('blocks', solve(_vary(['C|2', 'R|@', 'R|x', 'C|1', 'R|z'])), _vary([['@', 'x'], ['z']]))
check('empty block', solve(_vary(['C|0', 'C|1', 'R|@'])), _vary([[], ['@']]))
check('short', solve(_vary(['C|2', 'R|@'])), _vary(None))
check('extra', solve(_vary(['C|1', 'R|@', 'R|x'])), _vary(None))
check('orphan', solve(_vary(['R|@'])), _vary(None))
check('premature block', solve(_vary(['C|2', 'R|@', 'C|0'])), _vary(None))
check('bad tag', solve(_vary(['X|0'])), _vary(None))
check('zero stream', 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 |
|---|---|---|---|
| blocks | [['cell', 'x'], ['z']] | [['cell', 'x'], ['z']] | Passed |
| empty block | [[], ['cell']] | [[], ['cell']] | Passed |
| short | [['cell']] | None | Failed |
| extra | None | None | Passed |
| orphan | None | None | Passed |
| premature block | None | None | Passed |
| bad tag | None | None | Passed |
| zero stream | [] | [] | Passed |
SHA-256 / 77e911e4dd7d36385b5206723c56ebdb160ac53ad6c32f022bc656c4c40326ac
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):
blocks=[]; current=None; remaining=0
for line in data:
cells=line.split('|')
if len(cells)!=2: return None
tag,value=cells
if tag=='C':
if remaining: return None
if not value.isascii() or not value.isdecimal(): return None
remaining=int(value); current=[]; blocks.append(current)
elif tag=='R':
if remaining==0: return None
current.append(value); remaining-=1
else: return None
if remaining and current==[]: return None
return blocks
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('blocks', solve(_vary(['C|2', 'R|@', 'R|x', 'C|1', 'R|z'])), _vary([['@', 'x'], ['z']]))
check('empty block', solve(_vary(['C|0', 'C|1', 'R|@'])), _vary([[], ['@']]))
check('short', solve(_vary(['C|2', 'R|@'])), _vary(None))
check('extra', solve(_vary(['C|1', 'R|@', 'R|x'])), _vary(None))
check('orphan', solve(_vary(['R|@'])), _vary(None))
check('premature block', solve(_vary(['C|2', 'R|@', 'C|0'])), _vary(None))
check('bad tag', solve(_vary(['X|0'])), _vary(None))
check('zero stream', 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 |
|---|---|---|---|
| blocks | [['cell', 'x'], ['z']] | [['cell', 'x'], ['z']] | Passed |
| empty block | [[], ['cell']] | [[], ['cell']] | Passed |
| short | [['cell']] | None | Failed |
| extra | None | None | Passed |
| orphan | None | None | Passed |
| premature block | None | None | Passed |
| bad tag | None | None | Passed |
| zero stream | [] | [] | Passed |
SHA-256 / 58495ea2dd0c63a03ebf69cafbf2395f18b6e770ebfe7451b5ab54163b94eaed
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):
blocks=[]; current=None; remaining=0
for line in data:
cells=line.split('|')
if len(cells)!=2: return None
tag,value=cells
if tag=='C':
if remaining: return None
if not value.isascii() or not value.isdecimal(): return None
remaining=int(value); current=[]; blocks.append(current)
elif tag=='R':
if remaining==0: return None
current.append(value); remaining-=1
else: return None
if remaining: return None
return blocks
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('blocks', solve(_vary(['C|2', 'R|@', 'R|x', 'C|1', 'R|z'])), _vary([['@', 'x'], ['z']]))
check('empty block', solve(_vary(['C|0', 'C|1', 'R|@'])), _vary([[], ['@']]))
check('short', solve(_vary(['C|2', 'R|@'])), _vary(None))
check('extra', solve(_vary(['C|1', 'R|@', 'R|x'])), _vary(None))
check('orphan', solve(_vary(['R|@'])), _vary(None))
check('premature block', solve(_vary(['C|2', 'R|@', 'C|0'])), _vary(None))
check('bad tag', solve(_vary(['X|0'])), _vary(None))
check('zero stream', 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 |
|---|---|---|---|
| blocks | [['cell', 'x'], ['z']] | [['cell', 'x'], ['z']] | Passed |
| empty block | [[], ['cell']] | [[], ['cell']] | Passed |
| short | None | None | Passed |
| extra | None | None | Passed |
| orphan | None | None | Passed |
| premature block | None | None | Passed |
| bad tag | None | None | Passed |
| zero stream | [] | [] | Passed |
SHA-256 / 147fb34ed9c6b113b4f94c510f8b31c66039ee91e86ffc77c9729190bb72dfa9
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:49.573553+00:00.
Case digest / 774ea8541f88a303dc5a90ec386adf40bf5fdcdadb32ecad3932507d05f1481a