FAILURE MAP
← Case archive

FA-3391 / Lexical grammars / Open access

Digit separators occur at token edges · case 01

Digit separators occur at token edges.

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

ROOT CAUSE

The recognizer uses '[0-9_]+', which admits or omits a token shape forbidden by the stated grammar.

VERIFIED REPAIR

Implement the complete stated contract, including the boundary fixtures: Accept decimal digit groups separated by single underscores.

Unsuccessful approach: The candidate grammar '[0-9][0-9_]*[0-9]|[0-9]' still disagrees with the explicit boundary fixtures.

Case contract

Accept decimal digit groups separated by single underscores.

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-9_]+',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('_1'), False)
check('boundary 2', solve('1__2'), False)
check('boundary 3', solve('1_000'), True)
check('boundary 4', solve('7'), True)
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 2TrueFalseFailed
boundary 3TrueTruePassed
boundary 4TrueTruePassed

SHA-256 / c16d69f4dd58127241687b99f4aa3db9086110ecea94370cdf413119fcdaa243

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][0-9_]*[0-9]|[0-9]',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('_1'), False)
check('boundary 2', solve('1__2'), False)
check('boundary 3', solve('1_000'), True)
check('boundary 4', solve('7'), True)
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 2TrueFalseFailed
boundary 3TrueTruePassed
boundary 4TrueTruePassed

SHA-256 / 6f99538e2e6fa986e933b32aad9ad0ad4e91a379fe416f41c3f63885596a9512

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]+(?:_[0-9]+)*',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('_1'), False)
check('boundary 2', solve('1__2'), False)
check('boundary 3', solve('1_000'), True)
check('boundary 4', solve('7'), True)
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 2FalseFalsePassed
boundary 3TrueTruePassed
boundary 4TrueTruePassed

SHA-256 / 9d031e24336e53f07fc877936d53ab6037abadfb825acf1c2b05c3c9c28078ac

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

Case digest / dcd1882fee52cb4f42d7cb9100eaed02e952c39b3326ee2b937fb20513286f4e