FAILURE MAP
← Case archive

FA-47826 / Delimited text / Open access

An inclusive row endpoint is treated as an exclusive count · 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

The inclusive external endpoint is decremented before an already-exclusive slice boundary.

VERIFIED REPAIR

Preserve the named invariant at the faulty decision: rows[rstart-1:rend]

Unsuccessful approach: Adding one instead includes an unwanted following record.

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-1:cend] for row in rows[rstart-1:rend-1]]
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']][['cell', 'f'], ['h', 'i']]Failed
full[][['cell', 'x']]Failed
zeroNoneNonePassed
reversedNoneNonePassed
row overflowNoneNonePassed
col overflowNoneNonePassed
raggedNoneNonePassed
empty[][]Passed
prefix window[][['cell']]Failed
empty explicitNoneNonePassed

SHA-256 / 81759398358e1952f8c09d1225d7ec67a0ac20e74580bb48405ee17a12e9da4d

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[cstart-1:cend] for row in rows[rstart-1:rend+1]]
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'], ['c']][['cell']]Failed
empty explicitNoneNonePassed

SHA-256 / e4582506479c352effafbfcfeecc9d5114cb8d3e3215a836ae6bea1b09477604

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

Case digest / 12f30a9ad72884254928b4676d2d8a51c73d60176056f65ab4a64967a7173149