FAILURE MAP
← Case archive

FA-3036 / Text processing / Open access

Character translation cannot expand or delete · case 01

Character translation cannot expand or delete.

Verified by executionVariant 1 · 4 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The implementation applies an operation whose text or grammar semantics violate this contract: Translate ampersand to and, delete asterisk, and preserve other code points.

VERIFIED REPAIR

Implement the complete stated contract, including the boundary fixtures: Translate ampersand to and, delete asterisk, and preserve other code points.

Unsuccessful approach: The attempted repair handles the primary example but still violates a separate boundary of the same contract.

Case contract

Translate ampersand to and, delete asterisk, and preserve other code points.

Why this case matters

A local executable model for consumers of structured text; oracle values are authored literals, not outputs copied from the repaired implementation.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return x.replace('&','and')
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve('a*b'), 'ab')
check('boundary 2', solve('a & b'), 'a and b')
check('boundary 3', solve('&&'), 'andand')
check('boundary 4', solve(''), '')
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 fixtureActualExpectedOutcome
boundary 1a*babFailed
boundary 2a and ba and bPassed
boundary 3andandandandPassed
boundary 4Passed

SHA-256 / 55c9a3b1382528a2c449af500715a10dd6188e42d43f8ad7910129fc8ade5cbf

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return ''.join('and' if c=='&' else '' if c in '* ' else c for c in x)
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve('a*b'), 'ab')
check('boundary 2', solve('a & b'), 'a and b')
check('boundary 3', solve('&&'), 'andand')
check('boundary 4', solve(''), '')
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 fixtureActualExpectedOutcome
boundary 1ababPassed
boundary 2aandba and bFailed
boundary 3andandandandPassed
boundary 4Passed

SHA-256 / 1954d0aff3d73cbe04c12deef267e1cac27022cc1b9cee21c9fcff2cb2b54a43

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return x.translate({ord('&'):'and',ord('*'):None})
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve('a*b'), 'ab')
check('boundary 2', solve('a & b'), 'a and b')
check('boundary 3', solve('&&'), 'andand')
check('boundary 4', solve(''), '')
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 fixtureActualExpectedOutcome
boundary 1ababPassed
boundary 2a and ba and bPassed
boundary 3andandandandPassed
boundary 4Passed

SHA-256 / a34f6db94e3ef13cbf62e92562e2ead7b51eefb01655847c3d5f0c05ae300e74

Verification & scope

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:37:20.525558+00:00.

Case digest / e311e5bfb5fcfccb58cdf811bf1459475b0931e7b79468f6f2543588099849be