FAILURE MAP
← Case archive

FA-3376 / Lexical grammars / Open access

A hexadecimal prefix is accepted without a body · case 01

A hexadecimal prefix is accepted without a body.

Verified by executionVariant 1 · 4 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The recognizer uses '0[xX][0-9a-fA-F]*', which admits or omits a token shape forbidden by the stated grammar.

VERIFIED REPAIR

Implement the complete stated contract, including the boundary fixtures: Accept 0x or 0X followed by at least one ASCII hex digit.

Unsuccessful approach: The candidate grammar '0x[0-9a-fA-F]+' still disagrees with the explicit boundary fixtures.

Case contract

Accept 0x or 0X followed by at least one ASCII hex digit.

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 bool(re.fullmatch('0[xX][0-9a-fA-F]*',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('0x'), False)
check('boundary 2', solve('0XFF'), True)
check('boundary 3', solve('0x1a'), True)
check('boundary 4', solve('ff'), 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 / 75ebb9fac1c196f20d8cc67c8946ba85acca64d35c730cebabb5df59653f855a

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 bool(re.fullmatch('0x[0-9a-fA-F]+',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('0x'), False)
check('boundary 2', solve('0XFF'), True)
check('boundary 3', solve('0x1a'), True)
check('boundary 4', solve('ff'), 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 / f7ee05e3447b84adb2c86f0111b55aa92d8e500742698862d99ea7d77dac3267

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 bool(re.fullmatch('0[xX][0-9a-fA-F]+',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('0x'), False)
check('boundary 2', solve('0XFF'), True)
check('boundary 3', solve('0x1a'), True)
check('boundary 4', solve('ff'), 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 / 045a30228e45234060307074c328abc3562a61f394fb0da9a97033c8d6d9a5d1

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

Case digest / 2cb1089adc8950779f8b38f9b7409e82fe843103575d99e5c6b47b6dcca9f14b