FAILURE MAP
← Case archive

FA-32031 / Keyboard interactions / Open access

Keyboard numeric character entry transaction: Surrogate exclusion leaks a boundary or low-surrogate code point · case 01

The event trace violates the scalar surrogates rule and produces incorrect keyboard state or command output.

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

ROOT CAUSE

Surrogate exclusion leaks a boundary or low-surrogate code point.

THE FAILURE

Surrogate exclusion leaks a boundary or low-surrogate code point.

Unsuccessful approach: The partial repair changes this transition to not 0xd800<=number<=0xdbff, 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 '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[[[55296], None, '', 0]][[[], None, '', 1]]Failed
numeric-character-entry scenario 9[[[57343], None, '', 0]][[[], 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 / 1b8af8520a171e2958058ee1abeeb80ac3e2985f5977e6b3bccf4f7fc756a9c1

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<=0xdbff: 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[[[57343], None, '', 0]][[[], 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 / e48430a50c6d86e47b41f0855835f688f001fa397d7292b05e9aa236223c2647

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 12 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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

Case digest / 6f156c3df32b795e268504cff0be94f287b0eca4e1bca563583df6a414a29c4b