FAILURE MAP
← Case archive

FA-3596 / Lexical grammars / Open access

An ISBN-like lexeme admits X outside its final position · case 01

An ISBN-like lexeme admits X outside its final position.

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

ROOT CAUSE

The recognizer uses '[0-9X]{10}', which admits or omits a token shape forbidden by the stated grammar.

VERIFIED REPAIR

Implement the complete stated contract, including the boundary fixtures: Accept nine ASCII digits and a final digit or uppercase X, without separators; no checksum assertion.

Unsuccessful approach: The candidate grammar '[0-9]{10}' still disagrees with the explicit boundary fixtures.

Case contract

Accept nine ASCII digits and a final digit or uppercase X, without separators; no checksum assertion.

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-9X]{10}',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('X123456789'), False)
check('boundary 2', solve('123456789X'), True)
check('boundary 3', solve('0123456789'), True)
check('boundary 4', solve('123'), 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 / 13b952813dbcc8b251a8b6d83e641d81bdf4caaf2b79e2ca2e65fb761fcc8211

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('[0-9]{10}',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('X123456789'), False)
check('boundary 2', solve('123456789X'), True)
check('boundary 3', solve('0123456789'), True)
check('boundary 4', solve('123'), 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 / 966b8d93b8d07b1d0c50b9710d85e009738ceae4fe31d716f45b73d36d17e0e5

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-9]{9}[0-9X]',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('X123456789'), False)
check('boundary 2', solve('123456789X'), True)
check('boundary 3', solve('0123456789'), True)
check('boundary 4', solve('123'), 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 / e226e0d5972bcf1e16f9d47683812dd8a959437a546c3df099296d46158f26ab

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

Case digest / 40dc362794b39ee684fda4a93dee5ff0f7d36026c560d6155d29ed8701064590