FAILURE MAP
← Case archive

FA-48166 / Delimited text / Open access

A variadic column consumes the trailing fixed field · case 01

A structured table violates the declared record or column contract.

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

ROOT CAUSE

A variadic column consumes the trailing fixed field.

VERIFIED REPAIR

Preserve the named invariant at the faulty decision: rest=cells[1:-1]

Unsuccessful approach: The alternate implementation still violates the same declared invariant: a variadic column consumes the trailing fixed field.

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:]
    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 fixtureActualExpectedOutcome
rest{'head': 'a', 'rest': ['cell', 'x', 'z'], 'tail': 'z'}{'head': 'a', 'rest': ['cell', 'x'], 'tail': 'z'}Failed
none{'head': 'a', 'rest': ['z'], 'tail': 'z'}{'head': 'a', 'rest': [], 'tail': 'z'}Failed
empty rest{'head': 'a', 'rest': ['', 'z'], 'tail': 'z'}{'head': 'a', 'rest': [''], 'tail': 'z'}Failed
two empties{'head': '', 'rest': [''], 'tail': ''}{'head': '', 'rest': [], 'tail': ''}Failed
shortNoneNonePassed
one rest{'head': 'a', 'rest': ['cell', 'z'], 'tail': 'z'}{'head': 'a', 'rest': ['cell'], 'tail': 'z'}Failed
trailing{'head': 'a', 'rest': ['cell', ''], 'tail': ''}{'head': 'a', 'rest': ['cell'], 'tail': ''}Failed

SHA-256 / bc6b8f1e1053cfbdd78bccdf6546310ed30d0a784dd56df21eb88da9808b8c94

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[-1]
    rest=cells[:-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 fixtureActualExpectedOutcome
rest{'head': 'a', 'rest': ['a', 'cell', 'x'], 'tail': 'z'}{'head': 'a', 'rest': ['cell', 'x'], 'tail': 'z'}Failed
none{'head': 'a', 'rest': ['a'], 'tail': 'z'}{'head': 'a', 'rest': [], 'tail': 'z'}Failed
empty rest{'head': 'a', 'rest': ['a', ''], 'tail': 'z'}{'head': 'a', 'rest': [''], 'tail': 'z'}Failed
two empties{'head': '', 'rest': [''], 'tail': ''}{'head': '', 'rest': [], 'tail': ''}Failed
shortNoneNonePassed
one rest{'head': 'a', 'rest': ['a', 'cell'], 'tail': 'z'}{'head': 'a', 'rest': ['cell'], 'tail': 'z'}Failed
trailing{'head': 'a', 'rest': ['a', 'cell'], 'tail': ''}{'head': 'a', 'rest': ['cell'], 'tail': ''}Failed

SHA-256 / 095d09f819a9c9a80725d932747e203a1b05ab5932ebcf978ae271e366b36160

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 fixtureActualExpectedOutcome
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
shortNoneNonePassed
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.298074+00:00.

Case digest / 0818de234dba69ed0be401bb4110790d70cd5e7445e3678a4a947d052be43789