FAILURE MAP
← Case archive

FA-47596 / Delimited text / Open access

Sparse column assignments allow a repeated or backwards index · case 01

A structured table violates the declared record or column contract.

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

ROOT CAUSE

A repeated position overwrites an earlier cell.

VERIFIED REPAIR

Preserve the named invariant at the faulty decision: if index <= last or index >= data['width']: return None

Unsuccessful approach: Rejecting equality alone permits backwards assignments.

Case contract

Parse comma fields index=value into a fixed-width dense row. Indexes are unsigned decimal integers, zero based, strictly increasing and less than width; equal indexes reject. Missing positions remain null. Values may contain equals; empty values are retained.

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):
    out = [None] * data['width']
    last = -1
    for cell in data['row'].split(',') if data['row'] else []:
        parts = cell.split('=', 1)
        if len(parts) != 2: return None
        index, value = parts
        if not index.isascii() or not index.isdecimal(): return None
        index = int(index)
        if index < last or index >= data['width']: return None
        out[index] = value
        last = index
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('gaps', solve(_vary({'width': 4, 'row': '0=@,2=z'})), _vary(['@', None, 'z', None]))
check('equals value', solve(_vary({'width': 2, 'row': '1=a=b'})), _vary([None, 'a=b']))
check('empty value', solve(_vary({'width': 2, 'row': '0='})), _vary(['', None]))
check('duplicate', solve(_vary({'width': 2, 'row': '0=x,0=y'})), _vary(None))
check('decreasing', solve(_vary({'width': 3, 'row': '2=x,1=y'})), _vary(None))
check('out of bounds', solve(_vary({'width': 2, 'row': '2=x'})), _vary(None))
check('negative', solve(_vary({'width': 2, 'row': '-1=x'})), _vary(None))
check('Unicode digit', solve(_vary({'width': 2, 'row': '١=x'})), _vary(None))
check('empty row', solve(_vary({'width': 3, 'row': ''})), _vary([None, None, None]))
check('last slot', solve(_vary({'width': 2, 'row': '1=@'})), _vary([None, '@']))
check('malformed', solve(_vary({'width': 2, 'row': '0'})), _vary(None))
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
gaps['cell', None, 'z', None]['cell', None, 'z', None]Passed
equals value[None, 'a=b'][None, 'a=b']Passed
empty value['', None]['', None]Passed
duplicate['y', None]NoneFailed
decreasingNoneNonePassed
out of boundsNoneNonePassed
negativeNoneNonePassed
Unicode digitNoneNonePassed
empty row[None, None, None][None, None, None]Passed
last slot[None, 'cell'][None, 'cell']Passed
malformedNoneNonePassed

SHA-256 / 39c4459a3b2939408088f20439b6562cd4fb1c0f4d08edfe0ad01af10781ffbc

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):
    out = [None] * data['width']
    last = -1
    for cell in data['row'].split(',') if data['row'] else []:
        parts = cell.split('=', 1)
        if len(parts) != 2: return None
        index, value = parts
        if not index.isascii() or not index.isdecimal(): return None
        index = int(index)
        if index == last or index >= data['width']: return None
        out[index] = value
        last = index
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('gaps', solve(_vary({'width': 4, 'row': '0=@,2=z'})), _vary(['@', None, 'z', None]))
check('equals value', solve(_vary({'width': 2, 'row': '1=a=b'})), _vary([None, 'a=b']))
check('empty value', solve(_vary({'width': 2, 'row': '0='})), _vary(['', None]))
check('duplicate', solve(_vary({'width': 2, 'row': '0=x,0=y'})), _vary(None))
check('decreasing', solve(_vary({'width': 3, 'row': '2=x,1=y'})), _vary(None))
check('out of bounds', solve(_vary({'width': 2, 'row': '2=x'})), _vary(None))
check('negative', solve(_vary({'width': 2, 'row': '-1=x'})), _vary(None))
check('Unicode digit', solve(_vary({'width': 2, 'row': '١=x'})), _vary(None))
check('empty row', solve(_vary({'width': 3, 'row': ''})), _vary([None, None, None]))
check('last slot', solve(_vary({'width': 2, 'row': '1=@'})), _vary([None, '@']))
check('malformed', solve(_vary({'width': 2, 'row': '0'})), _vary(None))
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
gaps['cell', None, 'z', None]['cell', None, 'z', None]Passed
equals value[None, 'a=b'][None, 'a=b']Passed
empty value['', None]['', None]Passed
duplicateNoneNonePassed
decreasing[None, 'y', 'x']NoneFailed
out of boundsNoneNonePassed
negativeNoneNonePassed
Unicode digitNoneNonePassed
empty row[None, None, None][None, None, None]Passed
last slot[None, 'cell'][None, 'cell']Passed
malformedNoneNonePassed

SHA-256 / b2c6e8c4d1ccb0302c66e7663f8cdc3e329f23acdc47e1874ae8a409b77af42f

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):
    out = [None] * data['width']
    last = -1
    for cell in data['row'].split(',') if data['row'] else []:
        parts = cell.split('=', 1)
        if len(parts) != 2: return None
        index, value = parts
        if not index.isascii() or not index.isdecimal(): return None
        index = int(index)
        if index <= last or index >= data['width']: return None
        out[index] = value
        last = index
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('gaps', solve(_vary({'width': 4, 'row': '0=@,2=z'})), _vary(['@', None, 'z', None]))
check('equals value', solve(_vary({'width': 2, 'row': '1=a=b'})), _vary([None, 'a=b']))
check('empty value', solve(_vary({'width': 2, 'row': '0='})), _vary(['', None]))
check('duplicate', solve(_vary({'width': 2, 'row': '0=x,0=y'})), _vary(None))
check('decreasing', solve(_vary({'width': 3, 'row': '2=x,1=y'})), _vary(None))
check('out of bounds', solve(_vary({'width': 2, 'row': '2=x'})), _vary(None))
check('negative', solve(_vary({'width': 2, 'row': '-1=x'})), _vary(None))
check('Unicode digit', solve(_vary({'width': 2, 'row': '١=x'})), _vary(None))
check('empty row', solve(_vary({'width': 3, 'row': ''})), _vary([None, None, None]))
check('last slot', solve(_vary({'width': 2, 'row': '1=@'})), _vary([None, '@']))
check('malformed', solve(_vary({'width': 2, 'row': '0'})), _vary(None))
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
gaps['cell', None, 'z', None]['cell', None, 'z', None]Passed
equals value[None, 'a=b'][None, 'a=b']Passed
empty value['', None]['', None]Passed
duplicateNoneNonePassed
decreasingNoneNonePassed
out of boundsNoneNonePassed
negativeNoneNonePassed
Unicode digitNoneNonePassed
empty row[None, None, None][None, None, None]Passed
last slot[None, 'cell'][None, 'cell']Passed
malformedNoneNonePassed

SHA-256 / ebde7d9d18958d4e1cfacab840730be2957c345cf185ef26b808ebe1c3c3e9f0

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

Case digest / 0a0c2bb8ba60e8a392597fc50a3d0793470b9ffa542a109b85166e3ea5c74f86