FAILURE MAP
← Case archive

FA-2981 / Text processing / Open access

Removing a suffix erases unrelated trailing characters · case 01

Removing a suffix erases unrelated trailing characters.

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: Remove the exact suffix .log once.

VERIFIED REPAIR

Implement the complete stated contract, including the boundary fixtures: Remove the exact suffix .log once.

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

Case contract

Remove the exact suffix .log once.

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.rstrip('.log')
    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('catalog'), 'catalog')
check('boundary 2', solve('a.log'), 'a')
check('boundary 3', solve('a.log.log'), 'a.log')
check('boundary 4', solve('.logx'), '.logx')
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 1catacatalogFailed
boundary 2aaPassed
boundary 3aa.logFailed
boundary 4.logx.logxPassed

SHA-256 / b34017eb3e7fc3a84ed0ae81232cc7b33544ea636a9e1ea37d7d29d3dfc25e8d

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.replace('.log','')
    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('catalog'), 'catalog')
check('boundary 2', solve('a.log'), 'a')
check('boundary 3', solve('a.log.log'), 'a.log')
check('boundary 4', solve('.logx'), '.logx')
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 1catalogcatalogPassed
boundary 2aaPassed
boundary 3aa.logFailed
boundary 4x.logxFailed

SHA-256 / 273adc1d2f2e27d4444703d89bbd28f61507fca7fa32861191bb2781e82f45f3

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.removesuffix('.log')
    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('catalog'), 'catalog')
check('boundary 2', solve('a.log'), 'a')
check('boundary 3', solve('a.log.log'), 'a.log')
check('boundary 4', solve('.logx'), '.logx')
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 1catalogcatalogPassed
boundary 2aaPassed
boundary 3a.loga.logPassed
boundary 4.logx.logxPassed

SHA-256 / 7676cdf425f369705555b55580eda061edf08482519324796e5e520795546b02

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

Case digest / 0726e86e52a6871f24c5532166374ff1eaa7949c71f915975b5f0ff1aeb0e129