FAILURE MAP
← Case archive

FA-48661 / Delimited text / Open access

Every fragment cell is assigned to the fragment start · 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

Every fragment cell is assigned to the fragment start.

VERIFIED REPAIR

Preserve the named invariant at the faulty decision: index=start+offset

Unsuccessful approach: The alternate implementation still violates the same declared invariant: every fragment cell is assigned to the fragment start.

Case contract

Assemble one row from pipe fragments offset|comma-fields and a declared width. Offsets are zero-based unsigned ASCII integers. Fragments may arrive out of order, but overlap, overrun and holes reject. Empty fields are real supplied cells. Return the complete physical row.

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):
    slots={}
    for line in data['fragments']:
        parts=line.split('|',1)
        if len(parts)!=2 or not parts[0].isascii() or not parts[0].isdecimal(): return None
        start=int(parts[0]); fields=parts[1].split(',')
        if start+len(fields)>data['width']: return None
        for offset,value in enumerate(fields):
            index=start
            if index in slots: return None
            slots[index]=value
    if len(slots)!=data['width']: return None
    return [slots[index] for index in range(data['width'])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('out of order', solve(_vary({'width': 4, 'fragments': ['2|x,z', '0|@,y']})), _vary(['@', 'y', 'x', 'z']))
check('overlap', solve(_vary({'width': 3, 'fragments': ['0|a,b', '1|c,d']})), _vary(None))
check('hole', solve(_vary({'width': 3, 'fragments': ['0|@', '2|z']})), _vary(None))
check('overrun', solve(_vary({'width': 2, 'fragments': ['1|a,b']})), _vary(None))
check('empty supplied', solve(_vary({'width': 2, 'fragments': ['1|', '0|@']})), _vary(['@', '']))
check('zero width', solve(_vary({'width': 0, 'fragments': []})), _vary([]))
check('single', solve(_vary({'width': 1, 'fragments': ['0|@']})), _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
out of orderNone['cell', 'y', 'x', 'z']Failed
overlapNoneNonePassed
holeNoneNonePassed
overrunNoneNonePassed
empty supplied['cell', '']['cell', '']Passed
zero width[][]Passed
single['cell']['cell']Passed

SHA-256 / fd72044fda6899660a1f399bce8aa60d5a8c0fbf44c10531591e2ad619161346

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):
    slots={}
    for line in data['fragments']:
        parts=line.split('|',1)
        if len(parts)!=2 or not parts[0].isascii() or not parts[0].isdecimal(): return None
        start=int(parts[0]); fields=parts[1].split(',')
        if start+len(fields)>data['width']: return None
        for offset,value in enumerate(fields):
            index=offset
            if index in slots: return None
            slots[index]=value
    if len(slots)!=data['width']: return None
    return [slots[index] for index in range(data['width'])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('out of order', solve(_vary({'width': 4, 'fragments': ['2|x,z', '0|@,y']})), _vary(['@', 'y', 'x', 'z']))
check('overlap', solve(_vary({'width': 3, 'fragments': ['0|a,b', '1|c,d']})), _vary(None))
check('hole', solve(_vary({'width': 3, 'fragments': ['0|@', '2|z']})), _vary(None))
check('overrun', solve(_vary({'width': 2, 'fragments': ['1|a,b']})), _vary(None))
check('empty supplied', solve(_vary({'width': 2, 'fragments': ['1|', '0|@']})), _vary(['@', '']))
check('zero width', solve(_vary({'width': 0, 'fragments': []})), _vary([]))
check('single', solve(_vary({'width': 1, 'fragments': ['0|@']})), _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
out of orderNone['cell', 'y', 'x', 'z']Failed
overlapNoneNonePassed
holeNoneNonePassed
overrunNoneNonePassed
empty suppliedNone['cell', '']Failed
zero width[][]Passed
single['cell']['cell']Passed

SHA-256 / 2e6cd5c63587f7f90c0552f2088df59cf533bfc36f96254325276733ffdd7c2e

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):
    slots={}
    for line in data['fragments']:
        parts=line.split('|',1)
        if len(parts)!=2 or not parts[0].isascii() or not parts[0].isdecimal(): return None
        start=int(parts[0]); fields=parts[1].split(',')
        if start+len(fields)>data['width']: return None
        for offset,value in enumerate(fields):
            index=start+offset
            if index in slots: return None
            slots[index]=value
    if len(slots)!=data['width']: return None
    return [slots[index] for index in range(data['width'])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('out of order', solve(_vary({'width': 4, 'fragments': ['2|x,z', '0|@,y']})), _vary(['@', 'y', 'x', 'z']))
check('overlap', solve(_vary({'width': 3, 'fragments': ['0|a,b', '1|c,d']})), _vary(None))
check('hole', solve(_vary({'width': 3, 'fragments': ['0|@', '2|z']})), _vary(None))
check('overrun', solve(_vary({'width': 2, 'fragments': ['1|a,b']})), _vary(None))
check('empty supplied', solve(_vary({'width': 2, 'fragments': ['1|', '0|@']})), _vary(['@', '']))
check('zero width', solve(_vary({'width': 0, 'fragments': []})), _vary([]))
check('single', solve(_vary({'width': 1, 'fragments': ['0|@']})), _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
out of order['cell', 'y', 'x', 'z']['cell', 'y', 'x', 'z']Passed
overlapNoneNonePassed
holeNoneNonePassed
overrunNoneNonePassed
empty supplied['cell', '']['cell', '']Passed
zero width[][]Passed
single['cell']['cell']Passed

SHA-256 / e004e947c95e28dbc23749344fabcef6eee9a284a321b52fbab788418227e5db

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:52.791262+00:00.

Case digest / 4c6fedf624e082a653f463ae6f1fe9a5678dfad81ec327d6e6a4f7073d6b44ed