FA-47926 / Delimited text / Open access
Column-selector ranges retain one-based array offsets · case 01
A structured table violates the declared record or column contract.
ROOT CAUSE
The selector parser fails to convert the lower endpoint origin.
VERIFIED REPAIR
Preserve the named invariant at the faulty decision: out.extend(range(start-1, end))
Unsuccessful approach: An extra subtraction includes the preceding physical column.
Case contract
Resolve an ordered comma column selector against width. Decimal selectors are one based, ranges a-b include both endpoints, and * adds every column not selected earlier. Explicit duplicate selections are retained. Reject malformed, reversed or out-of-bound numeric ranges. Return zero-based physical indexes.
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 = []
for token in data['selector'].split(','):
if token == '*':
out.extend(i for i in range(data['width']) if i not in out)
continue
parts = token.split('-')
if len(parts) not in (1,2) or any(not p.isascii() or not p.isdecimal() for p in parts): return None
start, end = int(parts[0]), int(parts[-1])
if not 1 <= start <= end <= data['width']: return None
out.extend(range(start, end))
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered', solve(_vary({'selector': '3,1', 'width': 3})), _vary([2, 0]))
check('range', solve(_vary({'selector': '2-4', 'width': 4})), _vary([1, 2, 3]))
check('wildcard', solve(_vary({'selector': '2,*', 'width': 3})), _vary([1, 0, 2]))
check('duplicate', solve(_vary({'selector': '2,2', 'width': 3})), _vary([1, 1]))
check('reversed', solve(_vary({'selector': '3-1', 'width': 3})), _vary(None))
check('zero', solve(_vary({'selector': '0', 'width': 3})), _vary(None))
check('outside', solve(_vary({'selector': '4', 'width': 3})), _vary(None))
check('bad range', solve(_vary({'selector': '1-2-3', 'width': 3})), _vary(None))
check('empty', solve(_vary({'selector': '', 'width': 3})), _vary(None))
check('variable width', solve(_vary({'selector': '1,*', 'width': 4})), _vary([0, 1, 2, 3]))
check('variant selector width', solve({'selector':'1,*','width':N+2}), list(range(N+2)))
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| ordered | [] | [2, 0] | Failed |
| range | [2, 3] | [1, 2, 3] | Failed |
| wildcard | [0, 1, 2] | [1, 0, 2] | Failed |
| duplicate | [] | [1, 1] | Failed |
| reversed | None | None | Passed |
| zero | None | None | Passed |
| outside | None | None | Passed |
| bad range | None | None | Passed |
| empty | None | None | Passed |
| variable width | [0, 1, 2, 3] | [0, 1, 2, 3] | Passed |
| variant selector width | [0, 1, 2] | [0, 1, 2] | Passed |
SHA-256 / e2ef4c63a039b8ad0cdabe5d7bc8006748640faf3c1daf8beb9f47749226dbe4
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 = []
for token in data['selector'].split(','):
if token == '*':
out.extend(i for i in range(data['width']) if i not in out)
continue
parts = token.split('-')
if len(parts) not in (1,2) or any(not p.isascii() or not p.isdecimal() for p in parts): return None
start, end = int(parts[0]), int(parts[-1])
if not 1 <= start <= end <= data['width']: return None
out.extend(range(max(start-2,0), end))
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered', solve(_vary({'selector': '3,1', 'width': 3})), _vary([2, 0]))
check('range', solve(_vary({'selector': '2-4', 'width': 4})), _vary([1, 2, 3]))
check('wildcard', solve(_vary({'selector': '2,*', 'width': 3})), _vary([1, 0, 2]))
check('duplicate', solve(_vary({'selector': '2,2', 'width': 3})), _vary([1, 1]))
check('reversed', solve(_vary({'selector': '3-1', 'width': 3})), _vary(None))
check('zero', solve(_vary({'selector': '0', 'width': 3})), _vary(None))
check('outside', solve(_vary({'selector': '4', 'width': 3})), _vary(None))
check('bad range', solve(_vary({'selector': '1-2-3', 'width': 3})), _vary(None))
check('empty', solve(_vary({'selector': '', 'width': 3})), _vary(None))
check('variable width', solve(_vary({'selector': '1,*', 'width': 4})), _vary([0, 1, 2, 3]))
check('variant selector width', solve({'selector':'1,*','width':N+2}), list(range(N+2)))
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| ordered | [1, 2, 0] | [2, 0] | Failed |
| range | [0, 1, 2, 3] | [1, 2, 3] | Failed |
| wildcard | [0, 1, 2] | [1, 0, 2] | Failed |
| duplicate | [0, 1, 0, 1] | [1, 1] | Failed |
| reversed | None | None | Passed |
| zero | None | None | Passed |
| outside | None | None | Passed |
| bad range | None | None | Passed |
| empty | None | None | Passed |
| variable width | [0, 1, 2, 3] | [0, 1, 2, 3] | Passed |
| variant selector width | [0, 1, 2] | [0, 1, 2] | Passed |
SHA-256 / e9ed5abf3a8a3c01b3093096b0cb7db972daed21479cccbae4c95c5c1cf201da
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 = []
for token in data['selector'].split(','):
if token == '*':
out.extend(i for i in range(data['width']) if i not in out)
continue
parts = token.split('-')
if len(parts) not in (1,2) or any(not p.isascii() or not p.isdecimal() for p in parts): return None
start, end = int(parts[0]), int(parts[-1])
if not 1 <= start <= end <= data['width']: return None
out.extend(range(start-1, end))
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered', solve(_vary({'selector': '3,1', 'width': 3})), _vary([2, 0]))
check('range', solve(_vary({'selector': '2-4', 'width': 4})), _vary([1, 2, 3]))
check('wildcard', solve(_vary({'selector': '2,*', 'width': 3})), _vary([1, 0, 2]))
check('duplicate', solve(_vary({'selector': '2,2', 'width': 3})), _vary([1, 1]))
check('reversed', solve(_vary({'selector': '3-1', 'width': 3})), _vary(None))
check('zero', solve(_vary({'selector': '0', 'width': 3})), _vary(None))
check('outside', solve(_vary({'selector': '4', 'width': 3})), _vary(None))
check('bad range', solve(_vary({'selector': '1-2-3', 'width': 3})), _vary(None))
check('empty', solve(_vary({'selector': '', 'width': 3})), _vary(None))
check('variable width', solve(_vary({'selector': '1,*', 'width': 4})), _vary([0, 1, 2, 3]))
check('variant selector width', solve({'selector':'1,*','width':N+2}), list(range(N+2)))
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| ordered | [2, 0] | [2, 0] | Passed |
| range | [1, 2, 3] | [1, 2, 3] | Passed |
| wildcard | [1, 0, 2] | [1, 0, 2] | Passed |
| duplicate | [1, 1] | [1, 1] | Passed |
| reversed | None | None | Passed |
| zero | None | None | Passed |
| outside | None | None | Passed |
| bad range | None | None | Passed |
| empty | None | None | Passed |
| variable width | [0, 1, 2, 3] | [0, 1, 2, 3] | Passed |
| variant selector width | [0, 1, 2] | [0, 1, 2] | Passed |
SHA-256 / 74afbb7e06e63c43d3bbd867097175cfafa89b4a57bf8a1323f72da59acdf1c5
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:46.147261+00:00.
Case digest / 9e22aca4f6bb2e361804d8627ea851feee7f0d2fee63a29db3299b6ee15efbd4