FA-3561 / Lexical grammars / Open access
A hex color accepts unsupported digit counts · case 01
A hex color accepts unsupported digit counts.
ROOT CAUSE
The recognizer uses '#[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 # followed by exactly 3, 4, 6 or 8 ASCII hex digits.
Unsuccessful approach: The candidate grammar '#(?:[0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})' still disagrees with the explicit boundary fixtures.
Case contract
Accept # followed by exactly 3, 4, 6 or 8 ASCII hex digits.
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-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('#12345'), False)
check('boundary 2', solve('#1234'), True)
check('boundary 3', solve('#aabbccdd'), True)
check('boundary 4', solve('#abc'), 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| boundary 1 | True | False | Failed |
| boundary 2 | True | True | Passed |
| boundary 3 | True | True | Passed |
| boundary 4 | True | True | Passed |
SHA-256 / 5935ba700253f4b5210f6b78fe010d1ab82b4a975941b8435a959afa4393d004
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-9A-Fa-f]{3}|[0-9A-Fa-f]{6})',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('#12345'), False)
check('boundary 2', solve('#1234'), True)
check('boundary 3', solve('#aabbccdd'), True)
check('boundary 4', solve('#abc'), 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| boundary 1 | False | False | Passed |
| boundary 2 | False | True | Failed |
| boundary 3 | False | True | Failed |
| boundary 4 | True | True | Passed |
SHA-256 / 4436d2aa552f6dc563d526340502accca6c701f894910354a2c536ad5a11561d
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-9A-Fa-f]{3}|[0-9A-Fa-f]{4}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})',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('#12345'), False)
check('boundary 2', solve('#1234'), True)
check('boundary 3', solve('#aabbccdd'), True)
check('boundary 4', solve('#abc'), 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| boundary 1 | False | False | Passed |
| boundary 2 | True | True | Passed |
| boundary 3 | True | True | Passed |
| boundary 4 | True | True | Passed |
SHA-256 / 5429c21e9aa6836a2262052be2323de0beb8af7311e4b36f75c7014afbc85a27
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:27.553021+00:00.
Case digest / 80f32c94bc477bd00c60a8e4f138a3adaf41f3716ba9d2449b7e23500da223cc