FAILURE MAP
← Case archive

FA-3051 / Text processing / Open access

Protocol trimming erases significant Unicode whitespace · case 01

Protocol trimming erases significant Unicode whitespace.

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: Trim only ASCII space and horizontal tab from both ends.

VERIFIED REPAIR

Implement the complete stated contract, including the boundary fixtures: Trim only ASCII space and horizontal tab from both ends.

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

Case contract

Trim only ASCII space and horizontal tab from both ends.

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.strip()
    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('\xa0a\xa0'), '\xa0a\xa0')
check('boundary 2', solve('\ta\t'), 'a')
check('boundary 3', solve(' a '), 'a')
check('boundary 4', solve('\na\n'), '\na\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 fixtureActualExpectedOutcome
boundary 1a a Failed
boundary 2aaPassed
boundary 3aaPassed
boundary 4a a Failed

SHA-256 / 895b45c904ada85f0bc35b5dd9c0b71f283f48650dc705460c69a90cfcff04de

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 x.strip(' ')
    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('\xa0a\xa0'), '\xa0a\xa0')
check('boundary 2', solve('\ta\t'), 'a')
check('boundary 3', solve(' a '), 'a')
check('boundary 4', solve('\na\n'), '\na\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 fixtureActualExpectedOutcome
boundary 1 a  a Passed
boundary 2 a aFailed
boundary 3aaPassed
boundary 4 a a Passed

SHA-256 / 366084c7a907ae20e58482145b95879748854634f490e2f5260e79ddcd0554f1

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.strip(' \x09')
    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('\xa0a\xa0'), '\xa0a\xa0')
check('boundary 2', solve('\ta\t'), 'a')
check('boundary 3', solve(' a '), 'a')
check('boundary 4', solve('\na\n'), '\na\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 fixtureActualExpectedOutcome
boundary 1 a  a Passed
boundary 2aaPassed
boundary 3aaPassed
boundary 4 a a Passed

SHA-256 / dc4ead590edfa2e97b4832f9e71e3021f80c1786266418733409c898664e1c4e

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

Case digest / 4b7b2118ebece0271c9c02fb3e6c506195ec64ef6387ccc5ae40e4566ce4015f