FAILURE MAP
← Case archive

FA-31996 / Keyboard interactions / Open access

Keyboard numeric character entry transaction: Hexadecimal digit admission loses the final digit or normalized letters · case 01

The event trace violates the digit alphabet rule and produces incorrect keyboard state or command output.

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

ROOT CAUSE

Hexadecimal digit admission loses the final digit or normalized letters.

VERIFIED REPAIR

Use the contract transition `char in '0123456789abcdef'` at the digit alphabet fault site; preserve the other state transitions.

Unsuccessful approach: The partial repair changes this transition to char in '0123456789ABCDEF', which still violates the model contract on the explicit regression traces.

Case contract

Events [kind,value]. Begin with radix 10 or16 resets digit buffer and activates. Digit is one ASCII hexadecimal character admitted only if below radix and fewer than6digits; rejection increments invalid count. Backspace removes last buffered digit. Commit with digits emits the integer Unicode scalar value if <=0x10ffff and outside surrogate range, else rejects; commit always closes and clears. Cancel closes without committing. Text outside mode appends as literal string. Return chunks, active radix or None, digits and invalid count. Inputs are finite ordered event traces; return the stated deterministic state. Batch entries are independent. N varies the number of independent input transactions.

Why this case matters

Controlled keyboard event processing model for debugging application event logic.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(cases):
    def run(c):
        radix=None; digits=''; out=[]; invalid=0
        for kind,value in c:
            if kind=='begin' and value in (10,16):
                radix=value; digits=''
            elif kind=='digit' and radix is not None:
                char=str(value).lower()
                valid=len(char)==1 and char in '0123456789abcde'
                if valid and int(char,16)<radix and len(digits)<6:
                    digits+=char
                else: invalid+=1
            elif kind=='backspace' and radix is not None: digits=digits[:-1]
            elif kind=='commit' and radix is not None:
                if digits:
                    number=int(digits,radix)
                    if number<=0x10ffff and not 0xd800<=number<=0xdfff: out.append(number)
                    else: invalid+=1
                radix=None; digits=''
            elif kind=='cancel': radix=None; digits=''
            elif kind=='text' and radix is None: out.append(value)
        return [out,radix,digits,invalid]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('numeric-character-entry scenario 0', solve([[]] * N), [[[], None, '', 0]] * N)
check('numeric-character-entry scenario 1', solve([[['begin', 16], ['digit', '4'], ['digit', '1'], ['commit', '']]] * N), [[[65], None, '', 0]] * N)
check('numeric-character-entry scenario 2', solve([[['begin', 10], ['digit', '6'], ['digit', '5'], ['commit', '']]] * N), [[[65], None, '', 0]] * N)
check('numeric-character-entry scenario 3', solve([[['begin', 16], ['digit', 'a'], ['digit', 'F']]] * N), [[[], 16, 'af', 0]] * N)
check('numeric-character-entry scenario 4', solve([[['begin', 10], ['digit', 'A']]] * N), [[[], 10, '', 1]] * N)
check('numeric-character-entry scenario 5', solve([[['begin', 16], ['digit', '1'], ['digit', '2'], ['digit', '3'], ['digit', '4'], ['digit', '5'], ['digit', '6'], ['digit', '7']]] * N), [[[], 16, '123456', 1]] * N)
check('numeric-character-entry scenario 6', solve([[['begin', 16], ['digit', '1'], ['digit', '2'], ['digit', '3'], ['backspace', '']]] * N), [[[], 16, '12', 0]] * N)
check('numeric-character-entry scenario 7', solve([[['begin', 16], ['digit', '1'], ['digit', '0'], ['digit', 'f'], ['digit', 'f'], ['digit', 'f'], ['digit', 'f'], ['commit', '']]] * N), [[[1114111], None, '', 0]] * N)
check('numeric-character-entry scenario 8', solve([[['begin', 16], ['digit', 'd'], ['digit', '8'], ['digit', '0'], ['digit', '0'], ['commit', '']]] * N), [[[], None, '', 1]] * N)
check('numeric-character-entry scenario 9', solve([[['begin', 16], ['digit', 'd'], ['digit', 'f'], ['digit', 'f'], ['digit', 'f'], ['commit', '']]] * N), [[[], None, '', 1]] * N)
check('numeric-character-entry scenario 10', solve([[['begin', 16], ['digit', '4'], ['begin', 10]]] * N), [[[], 10, '', 0]] * N)
check('numeric-character-entry scenario 11', solve([[['begin', 10], ['commit', ''], ['text', 'ok']]] * N), [[['ok'], None, '', 0]] * N)
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
numeric-character-entry scenario 0[[[], None, '', 0]][[[], None, '', 0]]Passed
numeric-character-entry scenario 1[[[65], None, '', 0]][[[65], None, '', 0]]Passed
numeric-character-entry scenario 2[[[65], None, '', 0]][[[65], None, '', 0]]Passed
numeric-character-entry scenario 3[[[], 16, 'a', 1]][[[], 16, 'af', 0]]Failed
numeric-character-entry scenario 4[[[], 10, '', 1]][[[], 10, '', 1]]Passed
numeric-character-entry scenario 5[[[], 16, '123456', 1]][[[], 16, '123456', 1]]Passed
numeric-character-entry scenario 6[[[], 16, '12', 0]][[[], 16, '12', 0]]Passed
numeric-character-entry scenario 7[[[16], None, '', 4]][[[1114111], None, '', 0]]Failed
numeric-character-entry scenario 8[[[], None, '', 1]][[[], None, '', 1]]Passed
numeric-character-entry scenario 9[[[13], None, '', 3]][[[], None, '', 1]]Failed
numeric-character-entry scenario 10[[[], 10, '', 0]][[[], 10, '', 0]]Passed
numeric-character-entry scenario 11[[['ok'], None, '', 0]][[['ok'], None, '', 0]]Passed

SHA-256 / fa73148722f6d4322aeff629040b220a2480f32439f423d32d00e203786c87c1

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(cases):
    def run(c):
        radix=None; digits=''; out=[]; invalid=0
        for kind,value in c:
            if kind=='begin' and value in (10,16):
                radix=value; digits=''
            elif kind=='digit' and radix is not None:
                char=str(value).lower()
                valid=len(char)==1 and char in '0123456789ABCDEF'
                if valid and int(char,16)<radix and len(digits)<6:
                    digits+=char
                else: invalid+=1
            elif kind=='backspace' and radix is not None: digits=digits[:-1]
            elif kind=='commit' and radix is not None:
                if digits:
                    number=int(digits,radix)
                    if number<=0x10ffff and not 0xd800<=number<=0xdfff: out.append(number)
                    else: invalid+=1
                radix=None; digits=''
            elif kind=='cancel': radix=None; digits=''
            elif kind=='text' and radix is None: out.append(value)
        return [out,radix,digits,invalid]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('numeric-character-entry scenario 0', solve([[]] * N), [[[], None, '', 0]] * N)
check('numeric-character-entry scenario 1', solve([[['begin', 16], ['digit', '4'], ['digit', '1'], ['commit', '']]] * N), [[[65], None, '', 0]] * N)
check('numeric-character-entry scenario 2', solve([[['begin', 10], ['digit', '6'], ['digit', '5'], ['commit', '']]] * N), [[[65], None, '', 0]] * N)
check('numeric-character-entry scenario 3', solve([[['begin', 16], ['digit', 'a'], ['digit', 'F']]] * N), [[[], 16, 'af', 0]] * N)
check('numeric-character-entry scenario 4', solve([[['begin', 10], ['digit', 'A']]] * N), [[[], 10, '', 1]] * N)
check('numeric-character-entry scenario 5', solve([[['begin', 16], ['digit', '1'], ['digit', '2'], ['digit', '3'], ['digit', '4'], ['digit', '5'], ['digit', '6'], ['digit', '7']]] * N), [[[], 16, '123456', 1]] * N)
check('numeric-character-entry scenario 6', solve([[['begin', 16], ['digit', '1'], ['digit', '2'], ['digit', '3'], ['backspace', '']]] * N), [[[], 16, '12', 0]] * N)
check('numeric-character-entry scenario 7', solve([[['begin', 16], ['digit', '1'], ['digit', '0'], ['digit', 'f'], ['digit', 'f'], ['digit', 'f'], ['digit', 'f'], ['commit', '']]] * N), [[[1114111], None, '', 0]] * N)
check('numeric-character-entry scenario 8', solve([[['begin', 16], ['digit', 'd'], ['digit', '8'], ['digit', '0'], ['digit', '0'], ['commit', '']]] * N), [[[], None, '', 1]] * N)
check('numeric-character-entry scenario 9', solve([[['begin', 16], ['digit', 'd'], ['digit', 'f'], ['digit', 'f'], ['digit', 'f'], ['commit', '']]] * N), [[[], None, '', 1]] * N)
check('numeric-character-entry scenario 10', solve([[['begin', 16], ['digit', '4'], ['begin', 10]]] * N), [[[], 10, '', 0]] * N)
check('numeric-character-entry scenario 11', solve([[['begin', 10], ['commit', ''], ['text', 'ok']]] * N), [[['ok'], None, '', 0]] * N)
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
numeric-character-entry scenario 0[[[], None, '', 0]][[[], None, '', 0]]Passed
numeric-character-entry scenario 1[[[65], None, '', 0]][[[65], None, '', 0]]Passed
numeric-character-entry scenario 2[[[65], None, '', 0]][[[65], None, '', 0]]Passed
numeric-character-entry scenario 3[[[], 16, '', 2]][[[], 16, 'af', 0]]Failed
numeric-character-entry scenario 4[[[], 10, '', 1]][[[], 10, '', 1]]Passed
numeric-character-entry scenario 5[[[], 16, '123456', 1]][[[], 16, '123456', 1]]Passed
numeric-character-entry scenario 6[[[], 16, '12', 0]][[[], 16, '12', 0]]Passed
numeric-character-entry scenario 7[[[16], None, '', 4]][[[1114111], None, '', 0]]Failed
numeric-character-entry scenario 8[[[2048], None, '', 1]][[[], None, '', 1]]Failed
numeric-character-entry scenario 9[[[], None, '', 4]][[[], None, '', 1]]Failed
numeric-character-entry scenario 10[[[], 10, '', 0]][[[], 10, '', 0]]Passed
numeric-character-entry scenario 11[[['ok'], None, '', 0]][[['ok'], None, '', 0]]Passed

SHA-256 / 71f895c0d87f312a8b5568c66e73ffee772b86467ac0c2ac800e954f307c1bfb

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(cases):
    def run(c):
        radix=None; digits=''; out=[]; invalid=0
        for kind,value in c:
            if kind=='begin' and value in (10,16):
                radix=value; digits=''
            elif kind=='digit' and radix is not None:
                char=str(value).lower()
                valid=len(char)==1 and char in '0123456789abcdef'
                if valid and int(char,16)<radix and len(digits)<6:
                    digits+=char
                else: invalid+=1
            elif kind=='backspace' and radix is not None: digits=digits[:-1]
            elif kind=='commit' and radix is not None:
                if digits:
                    number=int(digits,radix)
                    if number<=0x10ffff and not 0xd800<=number<=0xdfff: out.append(number)
                    else: invalid+=1
                radix=None; digits=''
            elif kind=='cancel': radix=None; digits=''
            elif kind=='text' and radix is None: out.append(value)
        return [out,radix,digits,invalid]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('numeric-character-entry scenario 0', solve([[]] * N), [[[], None, '', 0]] * N)
check('numeric-character-entry scenario 1', solve([[['begin', 16], ['digit', '4'], ['digit', '1'], ['commit', '']]] * N), [[[65], None, '', 0]] * N)
check('numeric-character-entry scenario 2', solve([[['begin', 10], ['digit', '6'], ['digit', '5'], ['commit', '']]] * N), [[[65], None, '', 0]] * N)
check('numeric-character-entry scenario 3', solve([[['begin', 16], ['digit', 'a'], ['digit', 'F']]] * N), [[[], 16, 'af', 0]] * N)
check('numeric-character-entry scenario 4', solve([[['begin', 10], ['digit', 'A']]] * N), [[[], 10, '', 1]] * N)
check('numeric-character-entry scenario 5', solve([[['begin', 16], ['digit', '1'], ['digit', '2'], ['digit', '3'], ['digit', '4'], ['digit', '5'], ['digit', '6'], ['digit', '7']]] * N), [[[], 16, '123456', 1]] * N)
check('numeric-character-entry scenario 6', solve([[['begin', 16], ['digit', '1'], ['digit', '2'], ['digit', '3'], ['backspace', '']]] * N), [[[], 16, '12', 0]] * N)
check('numeric-character-entry scenario 7', solve([[['begin', 16], ['digit', '1'], ['digit', '0'], ['digit', 'f'], ['digit', 'f'], ['digit', 'f'], ['digit', 'f'], ['commit', '']]] * N), [[[1114111], None, '', 0]] * N)
check('numeric-character-entry scenario 8', solve([[['begin', 16], ['digit', 'd'], ['digit', '8'], ['digit', '0'], ['digit', '0'], ['commit', '']]] * N), [[[], None, '', 1]] * N)
check('numeric-character-entry scenario 9', solve([[['begin', 16], ['digit', 'd'], ['digit', 'f'], ['digit', 'f'], ['digit', 'f'], ['commit', '']]] * N), [[[], None, '', 1]] * N)
check('numeric-character-entry scenario 10', solve([[['begin', 16], ['digit', '4'], ['begin', 10]]] * N), [[[], 10, '', 0]] * N)
check('numeric-character-entry scenario 11', solve([[['begin', 10], ['commit', ''], ['text', 'ok']]] * N), [[['ok'], None, '', 0]] * N)
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
numeric-character-entry scenario 0[[[], None, '', 0]][[[], None, '', 0]]Passed
numeric-character-entry scenario 1[[[65], None, '', 0]][[[65], None, '', 0]]Passed
numeric-character-entry scenario 2[[[65], None, '', 0]][[[65], None, '', 0]]Passed
numeric-character-entry scenario 3[[[], 16, 'af', 0]][[[], 16, 'af', 0]]Passed
numeric-character-entry scenario 4[[[], 10, '', 1]][[[], 10, '', 1]]Passed
numeric-character-entry scenario 5[[[], 16, '123456', 1]][[[], 16, '123456', 1]]Passed
numeric-character-entry scenario 6[[[], 16, '12', 0]][[[], 16, '12', 0]]Passed
numeric-character-entry scenario 7[[[1114111], None, '', 0]][[[1114111], None, '', 0]]Passed
numeric-character-entry scenario 8[[[], None, '', 1]][[[], None, '', 1]]Passed
numeric-character-entry scenario 9[[[], None, '', 1]][[[], None, '', 1]]Passed
numeric-character-entry scenario 10[[[], 10, '', 0]][[[], 10, '', 0]]Passed
numeric-character-entry scenario 11[[['ok'], None, '', 0]][[['ok'], None, '', 0]]Passed

SHA-256 / 4e191b4ca7f76a5e296cb6748c8c5e4480d3779964c45f7d9fa5d8345c4dc9ed

Verification & scope

Offline stipulated event model, not a browser implementation or web standard conformance claim. 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:42:07.655443+00:00.

Case digest / 18865eaf13775b5ad090492d466f1841e8165a3762a6365a63fac6fae628948d