FA-47746 / Delimited text / Open access
Dialect ranking ignores the number of supporting records · case 01
A structured table violates the declared record or column contract.
ROOT CAUSE
A single wide row outweighs stronger multirow support.
VERIFIED REPAIR
Preserve the named invariant at the faulty decision: candidate_score = len(counts) * counts[0]
Unsuccessful approach: Taking the maximum width has the same unsupported preference.
Case contract
Choose comma, tab, or semicolon from precomputed per-record field counts. Ignore blank physical records marked null. A candidate must have >=2 fields on every sampled record and constant width. Score is record count times width; greatest score wins, ties use candidate order. No valid candidate returns null.
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):
best, score = None, -1
for name, counts in data:
counts = [c for c in counts if c is not None]
if not counts: continue
if min(counts) < 2: continue
if len(set(counts)) != 1: continue
candidate_score = counts[0]
if candidate_score > score:
best, score = name, candidate_score
return best
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('stable', solve(_vary([['comma', [2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ragged distractor', solve(_vary([['comma', [2, 3]], ['tab', [2, 2]]])), _vary('tab'))
check('blank ignored', solve(_vary([['comma', [None, 2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ties', solve(_vary([['comma', [2, 2]], ['tab', [2, 2]]])), _vary('comma'))
check('score', solve(_vary([['comma', [3]], ['tab', [2, 2]]])), _vary('tab'))
check('none', solve(_vary([['comma', [1, 1]], ['tab', []]])), _vary(None))
check('large width', solve(_vary([['@', [4, 4]], ['tab', [2, 2]]])), _vary('@'))
check('singleton row distractor', solve(_vary([['comma', [2, 1]], ['tab', [2, 2]]])), _vary('tab'))
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 |
|---|---|---|---|
| stable | comma | comma | Passed |
| ragged distractor | tab | tab | Passed |
| blank ignored | comma | comma | Passed |
| ties | comma | comma | Passed |
| score | comma | tab | Failed |
| none | None | None | Passed |
| large width | cell | cell | Passed |
| singleton row distractor | tab | tab | Passed |
SHA-256 / 1fadc0fab7262abdd9c5b59ceb817f6406b33ee4f5486bde961529b65415afe9
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):
best, score = None, -1
for name, counts in data:
counts = [c for c in counts if c is not None]
if not counts: continue
if min(counts) < 2: continue
if len(set(counts)) != 1: continue
candidate_score = max(counts)
if candidate_score > score:
best, score = name, candidate_score
return best
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('stable', solve(_vary([['comma', [2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ragged distractor', solve(_vary([['comma', [2, 3]], ['tab', [2, 2]]])), _vary('tab'))
check('blank ignored', solve(_vary([['comma', [None, 2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ties', solve(_vary([['comma', [2, 2]], ['tab', [2, 2]]])), _vary('comma'))
check('score', solve(_vary([['comma', [3]], ['tab', [2, 2]]])), _vary('tab'))
check('none', solve(_vary([['comma', [1, 1]], ['tab', []]])), _vary(None))
check('large width', solve(_vary([['@', [4, 4]], ['tab', [2, 2]]])), _vary('@'))
check('singleton row distractor', solve(_vary([['comma', [2, 1]], ['tab', [2, 2]]])), _vary('tab'))
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 |
|---|---|---|---|
| stable | comma | comma | Passed |
| ragged distractor | tab | tab | Passed |
| blank ignored | comma | comma | Passed |
| ties | comma | comma | Passed |
| score | comma | tab | Failed |
| none | None | None | Passed |
| large width | cell | cell | Passed |
| singleton row distractor | tab | tab | Passed |
SHA-256 / 8ab1f672947195f4e530a7d1be92c8b7f849368417765998fb1a9b7f66d99934
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):
best, score = None, -1
for name, counts in data:
counts = [c for c in counts if c is not None]
if not counts: continue
if min(counts) < 2: continue
if len(set(counts)) != 1: continue
candidate_score = len(counts) * counts[0]
if candidate_score > score:
best, score = name, candidate_score
return best
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('stable', solve(_vary([['comma', [2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ragged distractor', solve(_vary([['comma', [2, 3]], ['tab', [2, 2]]])), _vary('tab'))
check('blank ignored', solve(_vary([['comma', [None, 2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ties', solve(_vary([['comma', [2, 2]], ['tab', [2, 2]]])), _vary('comma'))
check('score', solve(_vary([['comma', [3]], ['tab', [2, 2]]])), _vary('tab'))
check('none', solve(_vary([['comma', [1, 1]], ['tab', []]])), _vary(None))
check('large width', solve(_vary([['@', [4, 4]], ['tab', [2, 2]]])), _vary('@'))
check('singleton row distractor', solve(_vary([['comma', [2, 1]], ['tab', [2, 2]]])), _vary('tab'))
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 |
|---|---|---|---|
| stable | comma | comma | Passed |
| ragged distractor | tab | tab | Passed |
| blank ignored | comma | comma | Passed |
| ties | comma | comma | Passed |
| score | tab | tab | Passed |
| none | None | None | Passed |
| large width | cell | cell | Passed |
| singleton row distractor | tab | tab | Passed |
SHA-256 / 80639751816c2aa1c07cc6278a002624f22205ab1a0853c70536a411e2802b0d
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:44.423387+00:00.
Case digest / 3d3c53c906f41913c8d3c511486a522ddc78e70b758a0f88202150e24624fee8