FAILURE MAP
← Case archive

FA-4071 / Binary formats / Open access

Front-coded strings ignore the previous decoded prefix · case 01

Front-coded strings ignore the previous decoded prefix.

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: Decode [prefix_length,suffix] records against the previous decoded string, starting with empty text; invalid prefix lengths return None.

VERIFIED REPAIR

Implement the complete stated contract, including the boundary fixtures: Decode [prefix_length,suffix] records against the previous decoded string, starting with empty text; invalid prefix lengths return None.

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

Case contract

Decode [prefix_length,suffix] records against the previous decoded string, starting with empty text; invalid prefix lengths return None.

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 [suffix for count,suffix 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([[0, 'car'], [3, 't'], [2, 't']]), ['car', 'cart', 'cat'])
check('boundary 2', solve([[1, 'x']]), None)
check('boundary 3', solve([[0, 'x'], [-1, 'y']]), None)
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 1['car', 't', 't']['car', 'cart', 'cat']Failed
boundary 2['x']NoneFailed
boundary 3['x', 'y']NoneFailed
boundary 4[][]Passed

SHA-256 / 8df5600e66c16a33cfa8f417a8dbab0e8b6ffe3ca204696a1c12dfc129de864a

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:
        out=[]
        previous=''
        for count,suffix in x:
            previous=previous[:count]+suffix
            out.append(previous)
        return out
    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([[0, 'car'], [3, 't'], [2, 't']]), ['car', 'cart', 'cat'])
check('boundary 2', solve([[1, 'x']]), None)
check('boundary 3', solve([[0, 'x'], [-1, 'y']]), None)
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 1['car', 'cart', 'cat']['car', 'cart', 'cat']Passed
boundary 2['x']NoneFailed
boundary 3['x', 'y']NoneFailed
boundary 4[][]Passed

SHA-256 / efc34c3cd49ad9084287d46c68beeac446f512f5db8a4018e18677d49c5c09a2

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:
        out=[]
        previous=''
        for count,suffix in x:
            if count<0 or count>len(previous): return None
            previous=previous[:count]+suffix
            out.append(previous)
        return out
    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([[0, 'car'], [3, 't'], [2, 't']]), ['car', 'cart', 'cat'])
check('boundary 2', solve([[1, 'x']]), None)
check('boundary 3', solve([[0, 'x'], [-1, 'y']]), None)
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 1['car', 'cart', 'cat']['car', 'cart', 'cat']Passed
boundary 2NoneNonePassed
boundary 3NoneNonePassed
boundary 4[][]Passed

SHA-256 / b18803479a144e5b0a0e39d7d6ed5bda24ec897f4132dd092e7e4a817e25dee8

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

Case digest / 16ffed0b66e4212e771bde38422027780fc0a60379468fd7422059d1da7d6ece