FA-47611 / Delimited text / Open access
Compact-row expansion emits one copy regardless of run length · case 01
A structured table violates the declared record or column contract.
ROOT CAUSE
The parsed repetition count is ignored at emission.
VERIFIED REPAIR
Preserve the named invariant at the faulty decision: out.extend([value] * count)
Unsuccessful approach: Subtracting one misreads counts as last indexes.
Case contract
Parse a bounded compact comma row. A field count*value expands value count times; fields lacking star occur once. Count is positive ASCII decimal and cumulative width cannot exceed budget. Split at first star; an empty value is valid. Return expanded cells.
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 cell in data['row'].split(','):
if '*' in cell:
count, value = cell.split('*', 1)
if not count.isascii() or not count.isdecimal(): return None
count = int(count)
if count <= 0: return None
else: count, value = 1, cell
if len(out) + count > data['budget']: return None
out.append(value)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expanded', solve(_vary({'row': '2*@,x', 'budget': 3})), _vary(['@', '@', 'x']))
check('star value', solve(_vary({'row': '2*a*b', 'budget': 2})), _vary(['a*b', 'a*b']))
check('empty repeated', solve(_vary({'row': '2*', 'budget': 2})), _vary(['', '']))
check('zero', solve(_vary({'row': '0*x', 'budget': 2})), _vary(None))
check('negative', solve(_vary({'row': '-1*x', 'budget': 2})), _vary(None))
check('aggregate limit', solve(_vary({'row': '2*x,2*y', 'budget': 3})), _vary(None))
check('exact limit', solve(_vary({'row': '3*@', 'budget': 3})), _vary(['@', '@', '@']))
check('ordinary', solve(_vary({'row': '@,z', 'budget': 2})), _vary(['@', 'z']))
check('space value', solve(_vary({'row': ' @ ', 'budget': 1})), _vary([' @ ']))
check('empty field', solve(_vary({'row': '', 'budget': 1})), _vary(['']))
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 |
|---|---|---|---|
| expanded | ['cell', 'x'] | ['cell', 'cell', 'x'] | Failed |
| star value | ['a*b'] | ['a*b', 'a*b'] | Failed |
| empty repeated | [''] | ['', ''] | Failed |
| zero | None | None | Passed |
| negative | None | None | Passed |
| aggregate limit | ['x', 'y'] | None | Failed |
| exact limit | ['cell'] | ['cell', 'cell', 'cell'] | Failed |
| ordinary | ['cell', 'z'] | ['cell', 'z'] | Passed |
| space value | [' cell '] | [' cell '] | Passed |
| empty field | [''] | [''] | Passed |
SHA-256 / 325ef419a67fce23cf6c80f735cf6685086d550f2d25824bff5a43ca22fe6a8c
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 cell in data['row'].split(','):
if '*' in cell:
count, value = cell.split('*', 1)
if not count.isascii() or not count.isdecimal(): return None
count = int(count)
if count <= 0: return None
else: count, value = 1, cell
if len(out) + count > data['budget']: return None
out.extend([value] * max(1, count - 1))
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expanded', solve(_vary({'row': '2*@,x', 'budget': 3})), _vary(['@', '@', 'x']))
check('star value', solve(_vary({'row': '2*a*b', 'budget': 2})), _vary(['a*b', 'a*b']))
check('empty repeated', solve(_vary({'row': '2*', 'budget': 2})), _vary(['', '']))
check('zero', solve(_vary({'row': '0*x', 'budget': 2})), _vary(None))
check('negative', solve(_vary({'row': '-1*x', 'budget': 2})), _vary(None))
check('aggregate limit', solve(_vary({'row': '2*x,2*y', 'budget': 3})), _vary(None))
check('exact limit', solve(_vary({'row': '3*@', 'budget': 3})), _vary(['@', '@', '@']))
check('ordinary', solve(_vary({'row': '@,z', 'budget': 2})), _vary(['@', 'z']))
check('space value', solve(_vary({'row': ' @ ', 'budget': 1})), _vary([' @ ']))
check('empty field', solve(_vary({'row': '', 'budget': 1})), _vary(['']))
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 |
|---|---|---|---|
| expanded | ['cell', 'x'] | ['cell', 'cell', 'x'] | Failed |
| star value | ['a*b'] | ['a*b', 'a*b'] | Failed |
| empty repeated | [''] | ['', ''] | Failed |
| zero | None | None | Passed |
| negative | None | None | Passed |
| aggregate limit | ['x', 'y'] | None | Failed |
| exact limit | ['cell', 'cell'] | ['cell', 'cell', 'cell'] | Failed |
| ordinary | ['cell', 'z'] | ['cell', 'z'] | Passed |
| space value | [' cell '] | [' cell '] | Passed |
| empty field | [''] | [''] | Passed |
SHA-256 / fc008c38a913f47cab3fb4665ee545f2bd6bae6b50d9bc367fdfb092a5440e94
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 cell in data['row'].split(','):
if '*' in cell:
count, value = cell.split('*', 1)
if not count.isascii() or not count.isdecimal(): return None
count = int(count)
if count <= 0: return None
else: count, value = 1, cell
if len(out) + count > data['budget']: return None
out.extend([value] * count)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expanded', solve(_vary({'row': '2*@,x', 'budget': 3})), _vary(['@', '@', 'x']))
check('star value', solve(_vary({'row': '2*a*b', 'budget': 2})), _vary(['a*b', 'a*b']))
check('empty repeated', solve(_vary({'row': '2*', 'budget': 2})), _vary(['', '']))
check('zero', solve(_vary({'row': '0*x', 'budget': 2})), _vary(None))
check('negative', solve(_vary({'row': '-1*x', 'budget': 2})), _vary(None))
check('aggregate limit', solve(_vary({'row': '2*x,2*y', 'budget': 3})), _vary(None))
check('exact limit', solve(_vary({'row': '3*@', 'budget': 3})), _vary(['@', '@', '@']))
check('ordinary', solve(_vary({'row': '@,z', 'budget': 2})), _vary(['@', 'z']))
check('space value', solve(_vary({'row': ' @ ', 'budget': 1})), _vary([' @ ']))
check('empty field', solve(_vary({'row': '', 'budget': 1})), _vary(['']))
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 |
|---|---|---|---|
| expanded | ['cell', 'cell', 'x'] | ['cell', 'cell', 'x'] | Passed |
| star value | ['a*b', 'a*b'] | ['a*b', 'a*b'] | Passed |
| empty repeated | ['', ''] | ['', ''] | Passed |
| zero | None | None | Passed |
| negative | None | None | Passed |
| aggregate limit | None | None | Passed |
| exact limit | ['cell', 'cell', 'cell'] | ['cell', 'cell', 'cell'] | Passed |
| ordinary | ['cell', 'z'] | ['cell', 'z'] | Passed |
| space value | [' cell '] | [' cell '] | Passed |
| empty field | [''] | [''] | Passed |
SHA-256 / 63773b057cc3b84576a3f7026468a14689432628cf8fb8f96357624fb853bab5
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:43.137928+00:00.
Case digest / b7b1cabff904974a237e7f61465c11b521c6c4863927e7366909bf4ac05e63a7