FAILURE MAP
← Case archive

FA-47591 / Delimited text / Open access

Sparse indexes accept non-ASCII decimal spellings · 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

Unicode decimal characters enter an ASCII interchange grammar.

VERIFIED REPAIR

Preserve the named invariant at the faulty decision: if not index.isascii() or not index.isdecimal(): return None

Unsuccessful approach: Combining invalidity conditions with AND also admits invalid ASCII index tokens.

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.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 digit[None, 'x']NoneFailed
empty row[None, None, None][None, None, None]Passed
last slot[None, 'cell'][None, 'cell']Passed
malformedNoneNonePassed

SHA-256 / 028b957692033ff9ddb6c30e629a5c1bc069e638f6d707f7a119cf400c23c013

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.isdecimal() and not index.isascii(): 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 digit[None, 'x']NoneFailed
empty row[None, None, None][None, None, None]Passed
last slot[None, 'cell'][None, 'cell']Passed
malformedNoneNonePassed

SHA-256 / 08efe8c30cfbfae71d7cd2c11c661917ea8df275a877e31b7d5332889e1fe1d0

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

Case digest / f0d70500169dd955d239da3fe3e5ffa6ae3c27987fc0601478fd40e1f1d1d54e