FA-48181 / Delimited text / Open access
The trailing fixed field uses a schema index instead of the final physical index · case 01
A structured table violates the declared record or column contract.
ROOT CAUSE
The trailing fixed field uses a schema index instead of the final physical index.
VERIFIED REPAIR
Preserve the named invariant at the faulty decision: tail=cells[-1]
Unsuccessful approach: The alternate implementation still violates the same declared invariant: the trailing fixed field uses a schema index instead of the final physical index.
Case contract
Bind a parsed comma row to an exact schema [head, ..., tail] where the middle ... captures zero or more fields as a list. The first and last physical cells bind head and tail; at least two cells are required. The rest list preserves empty cells and order.
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):
cells=data.split(',')
if len(cells)<2: return None
head=cells[0]
tail=cells[1]
rest=cells[1:-1]
return {'head':head,'rest':rest,'tail':tail}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rest', solve(_vary('a,@,x,z')), _vary({'head': 'a', 'rest': ['@', 'x'], 'tail': 'z'}))
check('none', solve(_vary('a,z')), _vary({'head': 'a', 'rest': [], 'tail': 'z'}))
check('empty rest', solve(_vary('a,,z')), _vary({'head': 'a', 'rest': [''], 'tail': 'z'}))
check('two empties', solve(_vary(',')), _vary({'head': '', 'rest': [], 'tail': ''}))
check('short', solve(_vary('@')), _vary(None))
check('one rest', solve(_vary('a,@,z')), _vary({'head': 'a', 'rest': ['@'], 'tail': 'z'}))
check('trailing', solve(_vary('a,@,')), _vary({'head': 'a', 'rest': ['@'], 'tail': ''}))
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 |
|---|---|---|---|
| rest | {'head': 'a', 'rest': ['cell', 'x'], 'tail': 'cell'} | {'head': 'a', 'rest': ['cell', 'x'], 'tail': 'z'} | Failed |
| none | {'head': 'a', 'rest': [], 'tail': 'z'} | {'head': 'a', 'rest': [], 'tail': 'z'} | Passed |
| empty rest | {'head': 'a', 'rest': [''], 'tail': ''} | {'head': 'a', 'rest': [''], 'tail': 'z'} | Failed |
| two empties | {'head': '', 'rest': [], 'tail': ''} | {'head': '', 'rest': [], 'tail': ''} | Passed |
| short | None | None | Passed |
| one rest | {'head': 'a', 'rest': ['cell'], 'tail': 'cell'} | {'head': 'a', 'rest': ['cell'], 'tail': 'z'} | Failed |
| trailing | {'head': 'a', 'rest': ['cell'], 'tail': 'cell'} | {'head': 'a', 'rest': ['cell'], 'tail': ''} | Failed |
SHA-256 / 1357adc70d4ec662569e1abe61d49154590ed2196965baa19c64c08bebbbb68e
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):
cells=data.split(',')
if len(cells)<2: return None
head=cells[0]
tail=cells[min(2,len(cells)-1)]
rest=cells[1:-1]
return {'head':head,'rest':rest,'tail':tail}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rest', solve(_vary('a,@,x,z')), _vary({'head': 'a', 'rest': ['@', 'x'], 'tail': 'z'}))
check('none', solve(_vary('a,z')), _vary({'head': 'a', 'rest': [], 'tail': 'z'}))
check('empty rest', solve(_vary('a,,z')), _vary({'head': 'a', 'rest': [''], 'tail': 'z'}))
check('two empties', solve(_vary(',')), _vary({'head': '', 'rest': [], 'tail': ''}))
check('short', solve(_vary('@')), _vary(None))
check('one rest', solve(_vary('a,@,z')), _vary({'head': 'a', 'rest': ['@'], 'tail': 'z'}))
check('trailing', solve(_vary('a,@,')), _vary({'head': 'a', 'rest': ['@'], 'tail': ''}))
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 |
|---|---|---|---|
| rest | {'head': 'a', 'rest': ['cell', 'x'], 'tail': 'x'} | {'head': 'a', 'rest': ['cell', 'x'], 'tail': 'z'} | Failed |
| none | {'head': 'a', 'rest': [], 'tail': 'z'} | {'head': 'a', 'rest': [], 'tail': 'z'} | Passed |
| empty rest | {'head': 'a', 'rest': [''], 'tail': 'z'} | {'head': 'a', 'rest': [''], 'tail': 'z'} | Passed |
| two empties | {'head': '', 'rest': [], 'tail': ''} | {'head': '', 'rest': [], 'tail': ''} | Passed |
| short | None | None | Passed |
| one rest | {'head': 'a', 'rest': ['cell'], 'tail': 'z'} | {'head': 'a', 'rest': ['cell'], 'tail': 'z'} | Passed |
| trailing | {'head': 'a', 'rest': ['cell'], 'tail': ''} | {'head': 'a', 'rest': ['cell'], 'tail': ''} | Passed |
SHA-256 / dd157635e9c76cf77a2e5a367b7a4a48c4309e4b04ffeed6a2d9966af78f9e67
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):
cells=data.split(',')
if len(cells)<2: return None
head=cells[0]
tail=cells[-1]
rest=cells[1:-1]
return {'head':head,'rest':rest,'tail':tail}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rest', solve(_vary('a,@,x,z')), _vary({'head': 'a', 'rest': ['@', 'x'], 'tail': 'z'}))
check('none', solve(_vary('a,z')), _vary({'head': 'a', 'rest': [], 'tail': 'z'}))
check('empty rest', solve(_vary('a,,z')), _vary({'head': 'a', 'rest': [''], 'tail': 'z'}))
check('two empties', solve(_vary(',')), _vary({'head': '', 'rest': [], 'tail': ''}))
check('short', solve(_vary('@')), _vary(None))
check('one rest', solve(_vary('a,@,z')), _vary({'head': 'a', 'rest': ['@'], 'tail': 'z'}))
check('trailing', solve(_vary('a,@,')), _vary({'head': 'a', 'rest': ['@'], 'tail': ''}))
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 |
|---|---|---|---|
| rest | {'head': 'a', 'rest': ['cell', 'x'], 'tail': 'z'} | {'head': 'a', 'rest': ['cell', 'x'], 'tail': 'z'} | Passed |
| none | {'head': 'a', 'rest': [], 'tail': 'z'} | {'head': 'a', 'rest': [], 'tail': 'z'} | Passed |
| empty rest | {'head': 'a', 'rest': [''], 'tail': 'z'} | {'head': 'a', 'rest': [''], 'tail': 'z'} | Passed |
| two empties | {'head': '', 'rest': [], 'tail': ''} | {'head': '', 'rest': [], 'tail': ''} | Passed |
| short | None | None | Passed |
| one rest | {'head': 'a', 'rest': ['cell'], 'tail': 'z'} | {'head': 'a', 'rest': ['cell'], 'tail': 'z'} | Passed |
| trailing | {'head': 'a', 'rest': ['cell'], 'tail': ''} | {'head': 'a', 'rest': ['cell'], 'tail': ''} | Passed |
SHA-256 / 72ec4b83818c5a5d3f4770f7b3f760949a17f915394c3c185f1cbaf239a86f5d
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:48.342856+00:00.
Case digest / ea0060d726578603f8f497cb1de6b6aa6de06ae3b3e7e6384b6138b9d069e285