FAILURE MAP
← Case archive

FA-48641 / Delimited text / Open access

Fragment arrival order replaces physical field order · 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

Fragment arrival order replaces physical field order.

VERIFIED REPAIR

Preserve the named invariant at the faulty decision: return [slots[index] for index in range(data['width'])]

Unsuccessful approach: The alternate implementation still violates the same declared invariant: fragment arrival order replaces physical field order.

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+offset
            if index in slots: return None
            slots[index]=value
    if len(slots)!=data['width']: return None
    return list(slots.values())
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['x', 'z', 'cell', 'y']['cell', 'y', 'x', 'z']Failed
overlapNoneNonePassed
holeNoneNonePassed
overrunNoneNonePassed
empty supplied['', 'cell']['cell', '']Failed
zero width[][]Passed
single['cell']['cell']Passed

SHA-256 / 00c3a4a1d41a528d8317ed6693b9f3ac9d01b78270e7b92d112f468f9b73f34c

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=start+offset
            if index in slots: return None
            slots[index]=value
    if len(slots)!=data['width']: return None
    return list(reversed(list(slots.values())))
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['y', 'cell', 'z', 'x']['cell', 'y', 'x', 'z']Failed
overlapNoneNonePassed
holeNoneNonePassed
overrunNoneNonePassed
empty supplied['cell', '']['cell', '']Passed
zero width[][]Passed
single['cell']['cell']Passed

SHA-256 / d5df0b166092089d03928b1e9f60546fcfbc249227a70caef85a83120ff21c10

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

Case digest / c2d8cbb75affac726b59e473b4e80d60fe14643f10b7458a63d6df0467281c3c