FAILURE MAP
← Case archive

FA-3986 / Parsing / Open access

A trie prefix is reported as a complete word · case 01

A trie prefix is reported as a complete 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: Return whether query x[1] is an exact member of word list x[0], allowing a word that is also a prefix.

VERIFIED REPAIR

Implement the complete stated contract, including the boundary fixtures: Return whether query x[1] is an exact member of word list x[0], allowing a word that is also a prefix.

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

Case contract

Return whether query x[1] is an exact member of word list x[0], allowing a word that is also a prefix.

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 any(w.startswith(x[1]) for w in x[0])
    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([['car', 'cart'], 'ca']), False)
check('boundary 2', solve([['car', 'cart'], 'car']), True)
check('boundary 3', solve([['cart'], 'cart']), True)
check('boundary 4', solve([[], '']), False)
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 1TrueFalseFailed
boundary 2TrueTruePassed
boundary 3TrueTruePassed
boundary 4FalseFalsePassed

SHA-256 / 110ecbf0872e8221c6ab0ce4fefd16245d0c9f669803e951b36ce270014fb3db

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[1] in x[0] and not any(w!=x[1] and w.startswith(x[1]) for w in x[0])
    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([['car', 'cart'], 'ca']), False)
check('boundary 2', solve([['car', 'cart'], 'car']), True)
check('boundary 3', solve([['cart'], 'cart']), True)
check('boundary 4', solve([[], '']), False)
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 1FalseFalsePassed
boundary 2FalseTrueFailed
boundary 3TrueTruePassed
boundary 4FalseFalsePassed

SHA-256 / d0f59be03279dcf93f1ef91fd7862a51243f18f908a8d62fb98e738b48279264

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[1] in x[0]
    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([['car', 'cart'], 'ca']), False)
check('boundary 2', solve([['car', 'cart'], 'car']), True)
check('boundary 3', solve([['cart'], 'cart']), True)
check('boundary 4', solve([[], '']), False)
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 1FalseFalsePassed
boundary 2TrueTruePassed
boundary 3TrueTruePassed
boundary 4FalseFalsePassed

SHA-256 / ecb2702198aabb5b7a0da1cb013816076648d5fcb9da624507b6a3c80210067c

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

Case digest / 2b2e56d1e528d2d0418fe6f4c68335eb4aca6e2be470b4018a4feb1f3e41ad56