FAILURE MAP
← Case archive

FA-3951 / Text processing / Open access

A suffix comparison scans from the front · case 01

A suffix comparison scans from the front.

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: Find the longest character suffix shared by all inputs; empty input gives empty string.

VERIFIED REPAIR

Implement the complete stated contract, including the boundary fixtures: Find the longest character suffix shared by all inputs; empty input gives empty string.

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

Case contract

Find the longest character suffix shared by all inputs; empty input gives empty string.

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 min(x,key=len) if x else ''
    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(['walking', 'talking']), 'alking')
check('boundary 2', solve(['a.txt', 'b.txt']), '.txt')
check('boundary 3', solve([]), '')
check('boundary 4', solve(['x', 'abx']), '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 1walkingalkingFailed
boundary 2a.txt.txtFailed
boundary 3Passed
boundary 4xxPassed

SHA-256 / 857a153e798c2292cf20b01895c3cd1e3bd7e76189256cc24fa61fc2462fcebe

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[0] if x and all(v.endswith(x[0]) for v in x) else ''
    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(['walking', 'talking']), 'alking')
check('boundary 2', solve(['a.txt', 'b.txt']), '.txt')
check('boundary 3', solve([]), '')
check('boundary 4', solve(['x', 'abx']), '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 1alkingFailed
boundary 2.txtFailed
boundary 3Passed
boundary 4xxPassed

SHA-256 / 66413b05c413e7afd974e5715e2951896e72b97dad5bcff5f418ecce65098f28

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:
        if not x: return ''
        a,b=min(v[::-1] for v in x),max(v[::-1] for v in x)
        i=0
        while i<min(len(a),len(b)) and a[i]==b[i]: i+=1
        return a[:i][::-1]
    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(['walking', 'talking']), 'alking')
check('boundary 2', solve(['a.txt', 'b.txt']), '.txt')
check('boundary 3', solve([]), '')
check('boundary 4', solve(['x', 'abx']), '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 1alkingalkingPassed
boundary 2.txt.txtPassed
boundary 3Passed
boundary 4xxPassed

SHA-256 / 6867a85c66def8cb8c2a93e1b2ea1e547b9c6d0711a8da0316d51db4a9a02c24

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

Case digest / a46a7dbf462aabe0938a0daa82afae752f4a709b9dc05c2e58c4d19f6d4fe0e8