FAILURE MAP
← Case archive

FA-3066 / Text processing / Open access

A shortened label cuts through a word · case 01

A shortened label cuts through a word.

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: Collapse whitespace and shorten to width ten with ... at a word boundary.

VERIFIED REPAIR

Implement the complete stated contract, including the boundary fixtures: Collapse whitespace and shorten to width ten with ... at a word boundary.

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

Case contract

Collapse whitespace and shorten to width ten with ... at a word boundary.

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[:7]+'...' if len(x)>10 else 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('hello world'), 'hello...')
check('boundary 2', solve('  a   b  '), 'a b')
check('boundary 3', solve('abcdefghijk'), '...')
check('boundary 4', solve('one two three'), 'one two...')
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 1hello w...hello...Failed
boundary 2 a b a bFailed
boundary 3abcdefg......Failed
boundary 4one two...one two...Passed

SHA-256 / bfa9cfa88994b6022fdef12ea4d20f970afb242c6f0ebe1dd63b44ba7ef1f12f

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(x.split())[:7]+'...' if len(' '.join(x.split()))>10 else ' '.join(x.split())
    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('hello world'), 'hello...')
check('boundary 2', solve('  a   b  '), 'a b')
check('boundary 3', solve('abcdefghijk'), '...')
check('boundary 4', solve('one two three'), 'one two...')
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 1hello w...hello...Failed
boundary 2a ba bPassed
boundary 3abcdefg......Failed
boundary 4one two...one two...Passed

SHA-256 / 26a2674aa0d081c07847429b7607b86f21e91057acf088c725dcd1ee76485073

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 textwrap.shorten(x,10,placeholder='...')
    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('hello world'), 'hello...')
check('boundary 2', solve('  a   b  '), 'a b')
check('boundary 3', solve('abcdefghijk'), '...')
check('boundary 4', solve('one two three'), 'one two...')
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 1hello...hello...Passed
boundary 2a ba bPassed
boundary 3......Passed
boundary 4one two...one two...Passed

SHA-256 / 0894b6e2d7ea6c9079126c5f21217ad9c9313ffa85888750512c37947806f53c

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

Case digest / 8ad5b831516b5350197e04706ee85fed546dad0c91dabe69e801eff7b24c785b