FA-47871 / Delimited text / Open access
Footer verification counts the header as a body record · case 01
A structured table violates the declared record or column contract.
ROOT CAUSE
The declared count is compared with a header-inclusive tally.
THE FAILURE
The declared count is compared with a header-inclusive tally.
Unsuccessful approach: Checking only undercounts accepts a footer claiming absent rows.
Case contract
Read a comma table with header H,<column names>, body D,<values>, and final F,<body count>. Reject missing or misplaced footer, count mismatch, malformed tags, unequal body width, and missing header. Count only body records. Return body arrays.
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):
if not data or not data[0].startswith('H,'): return None
width = len(data[0].split(',')) - 1
rows, closed = [], False
for line in data[1:]:
if closed: return None
cells = line.split(',')
if cells[0] == 'D':
if len(cells) - 1 != width: return None
rows.append(cells[1:])
elif cells[0] == 'F':
if len(cells) != 2 or not cells[1].isascii() or not cells[1].isdecimal(): return None
if int(cells[1]) != len(rows) + 1: return None
closed = True
else: return None
if not closed: return None
return rows
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('table', solve(_vary(['H,a,b', 'D,@,x', 'D,y,z', 'F,2'])), _vary([['@', 'x'], ['y', 'z']]))
check('count mismatch', solve(_vary(['H,a', 'D,@', 'F,2'])), _vary(None))
check('after footer', solve(_vary(['H,a', 'F,0', 'D,@'])), _vary(None))
check('missing footer', solve(_vary(['H,a', 'D,@'])), _vary(None))
check('empty body', solve(_vary(['H,a', 'F,0'])), _vary([]))
check('bad tag', solve(_vary(['H,a', 'X,@', 'F,1'])), _vary(None))
check('bad width', solve(_vary(['H,a,b', 'D,@', 'F,1'])), _vary(None))
check('missing header', solve(_vary(['D,@', 'F,1'])), _vary(None))
check('second footer', solve(_vary(['H,a', 'F,0', 'F,0'])), _vary(None))
check('bad count', solve(_vary(['H,a', 'F,-1'])), _vary(None))
check('unknown not counted', solve(_vary(['H,a', 'X,@', 'F,0'])), _vary(None))
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 |
|---|---|---|---|
| table | None | [['cell', 'x'], ['y', 'z']] | Failed |
| count mismatch | [['cell']] | None | Failed |
| after footer | None | None | Passed |
| missing footer | None | None | Passed |
| empty body | None | [] | Failed |
| bad tag | None | None | Passed |
| bad width | None | None | Passed |
| missing header | None | None | Passed |
| second footer | None | None | Passed |
| bad count | None | None | Passed |
| unknown not counted | None | None | Passed |
SHA-256 / dcce55ff67e4a66e4aea91e523a3bb6dff412dd42f258764f06b1a7962d90498
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):
if not data or not data[0].startswith('H,'): return None
width = len(data[0].split(',')) - 1
rows, closed = [], False
for line in data[1:]:
if closed: return None
cells = line.split(',')
if cells[0] == 'D':
if len(cells) - 1 != width: return None
rows.append(cells[1:])
elif cells[0] == 'F':
if len(cells) != 2 or not cells[1].isascii() or not cells[1].isdecimal(): return None
if int(cells[1]) < len(rows): return None
closed = True
else: return None
if not closed: return None
return rows
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('table', solve(_vary(['H,a,b', 'D,@,x', 'D,y,z', 'F,2'])), _vary([['@', 'x'], ['y', 'z']]))
check('count mismatch', solve(_vary(['H,a', 'D,@', 'F,2'])), _vary(None))
check('after footer', solve(_vary(['H,a', 'F,0', 'D,@'])), _vary(None))
check('missing footer', solve(_vary(['H,a', 'D,@'])), _vary(None))
check('empty body', solve(_vary(['H,a', 'F,0'])), _vary([]))
check('bad tag', solve(_vary(['H,a', 'X,@', 'F,1'])), _vary(None))
check('bad width', solve(_vary(['H,a,b', 'D,@', 'F,1'])), _vary(None))
check('missing header', solve(_vary(['D,@', 'F,1'])), _vary(None))
check('second footer', solve(_vary(['H,a', 'F,0', 'F,0'])), _vary(None))
check('bad count', solve(_vary(['H,a', 'F,-1'])), _vary(None))
check('unknown not counted', solve(_vary(['H,a', 'X,@', 'F,0'])), _vary(None))
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 |
|---|---|---|---|
| table | [['cell', 'x'], ['y', 'z']] | [['cell', 'x'], ['y', 'z']] | Passed |
| count mismatch | [['cell']] | None | Failed |
| after footer | None | None | Passed |
| missing footer | None | None | Passed |
| empty body | [] | [] | Passed |
| bad tag | None | None | Passed |
| bad width | None | None | Passed |
| missing header | None | None | Passed |
| second footer | None | None | Passed |
| bad count | None | None | Passed |
| unknown not counted | None | None | Passed |
SHA-256 / 1a6f2ab1d5b17047491b0dcc9be5fafc4b16eff886987325974b590696ab967d
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 11 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗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:45.722580+00:00.
Case digest / cb87faee42abf6d557dc10102eead2c485d6b3b32872fc4a097f612cb2b19d06