FAILURE MAP
← Case archive

FA-48651 / Delimited text / Open access

Overlapping fragments silently overwrite physical cells · 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

Overlapping fragments silently overwrite physical cells.

VERIFIED REPAIR

Preserve the named invariant at the faulty decision: if index in slots: return None

Unsuccessful approach: The alternate implementation still violates the same declared invariant: overlapping fragments silently overwrite physical cells.

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 False: 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
overlap['a', 'c', 'd']NoneFailed
holeNoneNonePassed
overrunNoneNonePassed
empty supplied['cell', '']['cell', '']Passed
zero width[][]Passed
single['cell']['cell']Passed

SHA-256 / 36bc204e76692d22a46c90ea5615eed7fbdddd3ac0656849b20b3b0d510f9cb8

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: continue
            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
overlap['a', 'b', 'd']NoneFailed
holeNoneNonePassed
overrunNoneNonePassed
empty supplied['cell', '']['cell', '']Passed
zero width[][]Passed
single['cell']['cell']Passed

SHA-256 / b185e81f23141891e9b7ca07e16994bf61b4ee860b0e4bf9dbcedd9d0d45663b

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

Case digest / 8e3c21da94dd4b39115979082b1d0b464f40eece8d21b4cab2388ab1175e389a