FAILURE MAP
← Case archive

FA-2911 / Unicode / Open access

An uppercase expansion is truncated during case swap · case 01

An uppercase expansion is truncated during case swap.

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: Apply Unicode swapcase, retaining multi-character mappings.

VERIFIED REPAIR

Implement the complete stated contract, including the boundary fixtures: Apply Unicode swapcase, retaining multi-character mappings.

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

Case contract

Apply Unicode swapcase, retaining multi-character mappings.

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 ''.join(c.lower() if c.isupper() else c.upper()[:1] 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('ß'), 'SS')
check('boundary 2', solve('Dž'), 'Dž')
check('boundary 3', solve('Ab'), 'aB')
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 1SSSFailed
boundary 2DŽDžFailed
boundary 3aBaBPassed
boundary 4!!Passed

SHA-256 / 04e2171dcc7fc301166d3caa4f3bbbb9cd2eb0aaa9109c59597d2ba84753b49a

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(c.lower() if c.isupper() else c.upper() 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('ß'), 'SS')
check('boundary 2', solve('Dž'), 'Dž')
check('boundary 3', solve('Ab'), 'aB')
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 1SSSSPassed
boundary 2DŽDžFailed
boundary 3aBaBPassed
boundary 4!!Passed

SHA-256 / 2f421e2ba1def4b86f1ce2f5807ec1c9095e26303b7eac34ff79e7866946ccb7

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.swapcase()
    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('ß'), 'SS')
check('boundary 2', solve('Dž'), 'Dž')
check('boundary 3', solve('Ab'), 'aB')
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 1SSSSPassed
boundary 2DžDžPassed
boundary 3aBaBPassed
boundary 4!!Passed

SHA-256 / daa2f8be05610099361c1a8255c11e459f3191d8887b48024a8c1d715a179905

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

Case digest / 181e8c8a14ef52fa6642154eaacbc0b0233cc5c71e0564f120c5b29463a76ac2