FAILURE MAP
← Case archive

FA-3846 / Parsing / Open access

Unknown backslash escapes are silently discarded · case 01

Unknown backslash escapes are silently discarded.

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: Decode backslash-n, backslash-t and backslash-backslash only; unknown or dangling escapes return None.

VERIFIED REPAIR

Implement the complete stated contract, including the boundary fixtures: Decode backslash-n, backslash-t and backslash-backslash only; unknown or dangling escapes return None.

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

Case contract

Decode backslash-n, backslash-t and backslash-backslash only; unknown or dangling escapes return None.

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(chr(92)+'n',chr(10)).replace(chr(92)+'t',chr(9))
    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\\q'), None)
check('boundary 2', solve('a\\n'), 'a\n')
check('boundary 3', solve('\\\\n'), '\\n')
check('boundary 4', solve('x'), 'x')
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\qNoneFailed
boundary 2a a Passed
boundary 3\ \nFailed
boundary 4xxPassed

SHA-256 / ce13f796a471d8f7f23767caad632ee3484833d8d94b2cf99e0bdad3dfa7f694

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 re.sub(re.escape(chr(92))+'(.)',lambda m:{'n':chr(10),'t':chr(9),chr(92):chr(92)}.get(m[1],m[1]),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\\q'), None)
check('boundary 2', solve('a\\n'), 'a\n')
check('boundary 3', solve('\\\\n'), '\\n')
check('boundary 4', solve('x'), 'x')
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 1aqNoneFailed
boundary 2a a Passed
boundary 3\n\nPassed
boundary 4xxPassed

SHA-256 / 0098cb6cc959ff377ae1ddf791b504f36dd1c3b9cf8cc4c42faf55d16d332124

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:
        out=[]
        i=0
        while i<len(x):
            if x[i]=='\\':
                i+=1
                if i==len(x) or x[i] not in ('n','t','\\'): return None
                out.append({'n':'\n','t':'\x09','\\':'\\'}[x[i]])
            else: out.append(x[i])
            i+=1
        return ''.join(out)
    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\\q'), None)
check('boundary 2', solve('a\\n'), 'a\n')
check('boundary 3', solve('\\\\n'), '\\n')
check('boundary 4', solve('x'), 'x')
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 1NoneNonePassed
boundary 2a a Passed
boundary 3\n\nPassed
boundary 4xxPassed

SHA-256 / 015ee0627c540881147362d6fef6934cab7f7faf0186ffea5b9c6dc6a02ce3ac

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

Case digest / a343681ad863cfe6086225bed41af936b6d286c358988f04396ee60b127a9c4d