FA-47936 / Delimited text / Open access
A reversed column range is normalized instead of rejected · case 01
A structured table violates the declared record or column contract.
ROOT CAUSE
Sorting range endpoints silently changes invalid selector syntax.
VERIFIED REPAIR
Preserve the named invariant at the faulty decision: start, end = int(parts[0]), int(parts[-1])
Unsuccessful approach: Computing min and max produces the same unauthorized normalization.
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 = sorted([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 | [0, 1, 2] | None | Failed |
| 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 / 91c5939b05c7ca0687b51ae83516efb1685d901b950fcaf46c53925d129d9637
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 = min(int(parts[0]), int(parts[-1])), max(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 | [0, 1, 2] | None | Failed |
| 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 / 31675f7f8130c3c9e62a2c6bc893a5aecdd5ea933eb915fd7c65a583914e76a8
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.186850+00:00.
Case digest / 9900f4982a6a1ffb45a3c3a11b8bebcb5885683d463a4782b3cf264e1a0543e9