FAILURE MAP
← Case archive

FA-31991 / Keyboard interactions / Open access

Keyboard numeric character entry transaction: Starting numeric entry preserves stale digits or discards hexadecimal mode · case 01

The event trace violates the begin reset rule and produces incorrect keyboard state or command output.

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

ROOT CAUSE

Starting numeric entry preserves stale digits or discards hexadecimal mode.

VERIFIED REPAIR

Use the contract transition `radix=value; digits=''` at the begin reset fault site; preserve the other state transitions.

Unsuccessful approach: The partial repair changes this transition to radix=10; digits='', 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
            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, '4', 0]][[[], 10, '', 0]]Failed
numeric-character-entry scenario 11[[['ok'], None, '', 0]][[['ok'], None, '', 0]]Passed

SHA-256 / 0967d9e878a1c3143f1f078065a593aea452b91938932ab8ea1ff46a0dd38357

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=10; 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[[[41], None, '', 0]][[[65], None, '', 0]]Failed
numeric-character-entry scenario 2[[[65], None, '', 0]][[[65], None, '', 0]]Passed
numeric-character-entry scenario 3[[[], 10, '', 2]][[[], 16, 'af', 0]]Failed
numeric-character-entry scenario 4[[[], 10, '', 1]][[[], 10, '', 1]]Passed
numeric-character-entry scenario 5[[[], 10, '123456', 1]][[[], 16, '123456', 1]]Failed
numeric-character-entry scenario 6[[[], 10, '12', 0]][[[], 16, '12', 0]]Failed
numeric-character-entry scenario 7[[[10], None, '', 4]][[[1114111], None, '', 0]]Failed
numeric-character-entry scenario 8[[[800], 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 / 571cccc995fb26fe205142c8abb7f3a281295db9d4ff569b0acc9c3ccca4fb29

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

Case digest / 350981277c6d6a566586dfffc11222cff9dbc803a6afd2cb32d0d266eaf20655