FA-48131 / Delimited text / Open access
An ordinary interior operator triggers formula neutralization · case 01
A structured table violates the declared record or column contract.
ROOT CAUSE
An ordinary interior operator triggers formula neutralization.
VERIFIED REPAIR
Preserve the named invariant at the faulty decision: probe[:1] in ('=', '+', '-', '@')
Unsuccessful approach: The alternate implementation still violates the same declared invariant: an ordinary interior operator triggers formula neutralization.
Case contract
Encode already textual comma cells for a spreadsheet-facing export. Prefix a single apostrophe if the first non-space/non-tab character is =,+,-, or @. An existing leading apostrophe is preserved without duplication. Then double embedded quotes and quote every cell. Return LF-terminated row. This is a stipulated conservative transport policy, not a universal spreadsheet security guarantee.
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:
probe = cell.lstrip(' \t')
if not cell.startswith("'") and any(x in probe for x in '=+-@'):
cell = "'" + cell
cell = cell.replace('"', '""')
out.append('"' + cell + '"')
return ','.join(out) + '\n'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('formula', solve(_vary(['=1+1'])), _vary('"\'=1+1"\n'))
check('leading space', solve(_vary([' \t+2'])), _vary('"\' \t+2"\n'))
check('existing prefix', solve(_vary(["'=3"])), _vary('"\'=3"\n'))
check('minus', solve(_vary(['-12'])), _vary('"\'-12"\n'))
check('ordinary', solve(_vary(['text', 'a"b'])), _vary('"text","a""b"\n'))
check('empty', solve(_vary([''])), _vary('""\n'))
check('interior', solve(_vary(['x=1'])), _vary('"x=1"\n'))
check('no cells', solve(_vary([])), _vary('\n'))
check('variant formula width', solve(['='+str(N)+'+1']), '"\'='+str(N)+'+1"\n')
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 |
|---|---|---|---|
| formula | "'=1+1"
| "'=1+1"
| Passed |
| leading space | "' +2"
| "' +2"
| Passed |
| existing prefix | "'=3"
| "'=3"
| Passed |
| minus | "'-12"
| "'-12"
| Passed |
| ordinary | "text","a""b"
| "text","a""b"
| Passed |
| empty | ""
| ""
| Passed |
| interior | "'x=1"
| "x=1"
| Failed |
| no cells |
|
| Passed |
| variant formula width | "'=1+1"
| "'=1+1"
| Passed |
SHA-256 / 419246d911d73fbfaf6c5a9eca3629d74401fc2386d3680aece3c116f4f03009
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:
probe = cell.lstrip(' \t')
if not cell.startswith("'") and any(x in probe for x in '=+'):
cell = "'" + cell
cell = cell.replace('"', '""')
out.append('"' + cell + '"')
return ','.join(out) + '\n'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('formula', solve(_vary(['=1+1'])), _vary('"\'=1+1"\n'))
check('leading space', solve(_vary([' \t+2'])), _vary('"\' \t+2"\n'))
check('existing prefix', solve(_vary(["'=3"])), _vary('"\'=3"\n'))
check('minus', solve(_vary(['-12'])), _vary('"\'-12"\n'))
check('ordinary', solve(_vary(['text', 'a"b'])), _vary('"text","a""b"\n'))
check('empty', solve(_vary([''])), _vary('""\n'))
check('interior', solve(_vary(['x=1'])), _vary('"x=1"\n'))
check('no cells', solve(_vary([])), _vary('\n'))
check('variant formula width', solve(['='+str(N)+'+1']), '"\'='+str(N)+'+1"\n')
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 |
|---|---|---|---|
| formula | "'=1+1"
| "'=1+1"
| Passed |
| leading space | "' +2"
| "' +2"
| Passed |
| existing prefix | "'=3"
| "'=3"
| Passed |
| minus | "-12"
| "'-12"
| Failed |
| ordinary | "text","a""b"
| "text","a""b"
| Passed |
| empty | ""
| ""
| Passed |
| interior | "'x=1"
| "x=1"
| Failed |
| no cells |
|
| Passed |
| variant formula width | "'=1+1"
| "'=1+1"
| Passed |
SHA-256 / 24e88183b151d9975cc42304a510cf42133226df726ebec218b04100fbda8305
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:
probe = cell.lstrip(' \t')
if not cell.startswith("'") and probe[:1] in ('=', '+', '-', '@'):
cell = "'" + cell
cell = cell.replace('"', '""')
out.append('"' + cell + '"')
return ','.join(out) + '\n'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('formula', solve(_vary(['=1+1'])), _vary('"\'=1+1"\n'))
check('leading space', solve(_vary([' \t+2'])), _vary('"\' \t+2"\n'))
check('existing prefix', solve(_vary(["'=3"])), _vary('"\'=3"\n'))
check('minus', solve(_vary(['-12'])), _vary('"\'-12"\n'))
check('ordinary', solve(_vary(['text', 'a"b'])), _vary('"text","a""b"\n'))
check('empty', solve(_vary([''])), _vary('""\n'))
check('interior', solve(_vary(['x=1'])), _vary('"x=1"\n'))
check('no cells', solve(_vary([])), _vary('\n'))
check('variant formula width', solve(['='+str(N)+'+1']), '"\'='+str(N)+'+1"\n')
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 |
|---|---|---|---|
| formula | "'=1+1"
| "'=1+1"
| Passed |
| leading space | "' +2"
| "' +2"
| Passed |
| existing prefix | "'=3"
| "'=3"
| Passed |
| minus | "'-12"
| "'-12"
| Passed |
| ordinary | "text","a""b"
| "text","a""b"
| Passed |
| empty | ""
| ""
| Passed |
| interior | "x=1"
| "x=1"
| Passed |
| no cells |
|
| Passed |
| variant formula width | "'=1+1"
| "'=1+1"
| Passed |
SHA-256 / 8348ff28c929a532c9792033b193a797fe6e2e3c5e5cd5409b1465525f8e21b4
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:47.986275+00:00.
Case digest / 1cdedb67a7532d910af843311a02eaa8230ed23e78c71d45126a8791b3657001