FAILURE MAP
← Case archive

FA-47821 / Delimited text / Open access

A one-based column selector begins at the wrong field · case 01

A structured table violates the declared record or column contract.

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

ROOT CAUSE

Column offsets retain their external one-based origin.

VERIFIED REPAIR

Preserve the named invariant at the faulty decision: row[cstart-1:cend]

Unsuccessful approach: An extra decrement introduces the preceding column.

Case contract

Select physical cells from a rectangular table using one-based inclusive row and column intervals. Omitted end means last; zero and reversed or out-of-range bounds reject. An empty table accepts only both default [1,null] selectors and produces empty output. Preserve selected order.

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):
    rows = data['rows']
    rstart, rend = data['r']
    cstart, cend = data['c']
    if not rows: return [] if data['r'] == [1, None] and data['c'] == [1, None] else None
    height, width = len(rows), len(rows[0])
    if any(len(row) != width for row in rows): return None
    rend = height if rend is None else rend
    cend = width if cend is None else cend
    if not 1 <= rstart <= rend <= height: return None
    if not 1 <= cstart <= cend <= width: return None
    return [row[cstart:cend] for row in rows[rstart-1:rend]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'rows': [['a', 'b', 'c'], ['d', '@', 'f'], ['g', 'h', 'i']], 'r': [2, 3], 'c': [2, 3]})), _vary([['@', 'f'], ['h', 'i']]))
check('full', solve(_vary({'rows': [['@', 'x']], 'r': [1, None], 'c': [1, None]})), _vary([['@', 'x']]))
check('zero', solve(_vary({'rows': [['x']], 'r': [0, 1], 'c': [1, 1]})), _vary(None))
check('reversed', solve(_vary({'rows': [['a'], ['b']], 'r': [2, 1], 'c': [1, 1]})), _vary(None))
check('row overflow', solve(_vary({'rows': [['a']], 'r': [1, 2], 'c': [1, 1]})), _vary(None))
check('col overflow', solve(_vary({'rows': [['a']], 'r': [1, 1], 'c': [1, 2]})), _vary(None))
check('ragged', solve(_vary({'rows': [['a', 'b'], ['c']], 'r': [1, 1], 'c': [1, 1]})), _vary(None))
check('empty', solve(_vary({'rows': [], 'r': [1, None], 'c': [1, None]})), _vary([]))
check('prefix window', solve(_vary({'rows': [['@', 'b'], ['c', 'd']], 'r': [1, 1], 'c': [1, 1]})), _vary([['@']]))
check('empty explicit', solve(_vary({'rows': [], 'r': [1, 1], 'c': [1, 1]})), _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
window[['f'], ['i']][['cell', 'f'], ['h', 'i']]Failed
full[['x']][['cell', 'x']]Failed
zeroNoneNonePassed
reversedNoneNonePassed
row overflowNoneNonePassed
col overflowNoneNonePassed
raggedNoneNonePassed
empty[][]Passed
prefix window[[]][['cell']]Failed
empty explicitNoneNonePassed

SHA-256 / c5113de8581efc64341129653e56c34db432f598713ed4aa3e10ce12bf9673c9

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):
    rows = data['rows']
    rstart, rend = data['r']
    cstart, cend = data['c']
    if not rows: return [] if data['r'] == [1, None] and data['c'] == [1, None] else None
    height, width = len(rows), len(rows[0])
    if any(len(row) != width for row in rows): return None
    rend = height if rend is None else rend
    cend = width if cend is None else cend
    if not 1 <= rstart <= rend <= height: return None
    if not 1 <= cstart <= cend <= width: return None
    return [row[max(0,cstart-2):cend] for row in rows[rstart-1:rend]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'rows': [['a', 'b', 'c'], ['d', '@', 'f'], ['g', 'h', 'i']], 'r': [2, 3], 'c': [2, 3]})), _vary([['@', 'f'], ['h', 'i']]))
check('full', solve(_vary({'rows': [['@', 'x']], 'r': [1, None], 'c': [1, None]})), _vary([['@', 'x']]))
check('zero', solve(_vary({'rows': [['x']], 'r': [0, 1], 'c': [1, 1]})), _vary(None))
check('reversed', solve(_vary({'rows': [['a'], ['b']], 'r': [2, 1], 'c': [1, 1]})), _vary(None))
check('row overflow', solve(_vary({'rows': [['a']], 'r': [1, 2], 'c': [1, 1]})), _vary(None))
check('col overflow', solve(_vary({'rows': [['a']], 'r': [1, 1], 'c': [1, 2]})), _vary(None))
check('ragged', solve(_vary({'rows': [['a', 'b'], ['c']], 'r': [1, 1], 'c': [1, 1]})), _vary(None))
check('empty', solve(_vary({'rows': [], 'r': [1, None], 'c': [1, None]})), _vary([]))
check('prefix window', solve(_vary({'rows': [['@', 'b'], ['c', 'd']], 'r': [1, 1], 'c': [1, 1]})), _vary([['@']]))
check('empty explicit', solve(_vary({'rows': [], 'r': [1, 1], 'c': [1, 1]})), _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
window[['d', 'cell', 'f'], ['g', 'h', 'i']][['cell', 'f'], ['h', 'i']]Failed
full[['cell', 'x']][['cell', 'x']]Passed
zeroNoneNonePassed
reversedNoneNonePassed
row overflowNoneNonePassed
col overflowNoneNonePassed
raggedNoneNonePassed
empty[][]Passed
prefix window[['cell']][['cell']]Passed
empty explicitNoneNonePassed

SHA-256 / 359d5a70ebfc04c87de40508787f91724bd2acc69c098747b3e5f822e0b6727a

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):
    rows = data['rows']
    rstart, rend = data['r']
    cstart, cend = data['c']
    if not rows: return [] if data['r'] == [1, None] and data['c'] == [1, None] else None
    height, width = len(rows), len(rows[0])
    if any(len(row) != width for row in rows): return None
    rend = height if rend is None else rend
    cend = width if cend is None else cend
    if not 1 <= rstart <= rend <= height: return None
    if not 1 <= cstart <= cend <= width: return None
    return [row[cstart-1:cend] for row in rows[rstart-1:rend]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'rows': [['a', 'b', 'c'], ['d', '@', 'f'], ['g', 'h', 'i']], 'r': [2, 3], 'c': [2, 3]})), _vary([['@', 'f'], ['h', 'i']]))
check('full', solve(_vary({'rows': [['@', 'x']], 'r': [1, None], 'c': [1, None]})), _vary([['@', 'x']]))
check('zero', solve(_vary({'rows': [['x']], 'r': [0, 1], 'c': [1, 1]})), _vary(None))
check('reversed', solve(_vary({'rows': [['a'], ['b']], 'r': [2, 1], 'c': [1, 1]})), _vary(None))
check('row overflow', solve(_vary({'rows': [['a']], 'r': [1, 2], 'c': [1, 1]})), _vary(None))
check('col overflow', solve(_vary({'rows': [['a']], 'r': [1, 1], 'c': [1, 2]})), _vary(None))
check('ragged', solve(_vary({'rows': [['a', 'b'], ['c']], 'r': [1, 1], 'c': [1, 1]})), _vary(None))
check('empty', solve(_vary({'rows': [], 'r': [1, None], 'c': [1, None]})), _vary([]))
check('prefix window', solve(_vary({'rows': [['@', 'b'], ['c', 'd']], 'r': [1, 1], 'c': [1, 1]})), _vary([['@']]))
check('empty explicit', solve(_vary({'rows': [], 'r': [1, 1], 'c': [1, 1]})), _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
window[['cell', 'f'], ['h', 'i']][['cell', 'f'], ['h', 'i']]Passed
full[['cell', 'x']][['cell', 'x']]Passed
zeroNoneNonePassed
reversedNoneNonePassed
row overflowNoneNonePassed
col overflowNoneNonePassed
raggedNoneNonePassed
empty[][]Passed
prefix window[['cell']][['cell']]Passed
empty explicitNoneNonePassed

SHA-256 / a5c13c6bf67800b4ee3502baddd9b32ff615fc78e9537a4d56017170d9f1aed0

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

Case digest / 75ed3e14cf1b371f2d5368d18b371953d49df7a992876c9e879659cae6adf2af