FAILURE MAP
← Case archive

FA-8986 / Text editing / Open access

Composition-aware keyboard commands: Legacy composition key events bypass the IME guard · case 01

Legacy composition key events bypass the IME guard.

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

ROOT CAUSE

The legacy code operation uses `composing` where the contract requires `composing or code == 229`.

VERIFIED REPAIR

Implement the legacy code operation as `composing or code == 229`.

Unsuccessful approach: Requiring both indicators misses legacy-only composition events.

Case contract

Composition state or legacy code 229 delegates to native input; plain multiline Enter inserts newline; other Enter submits; Escape preserves draft; Tab honors Shift.

Why this case matters

A deterministic model of composition-aware keyboard commands; this isolates one interface invariant without requiring a browser.

1 / The failure

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

N = 1
observations = []
def solve(key, composing, code, shift, multiline, value):
    if composing: return ('native', value)
    if key == 'Enter':
        if multiline and not shift: return ('insert', value + '\n')
        return ('submit', value)
    if key == 'Escape': return ('cancel', value)
    if key == 'Tab': return ('previous' if shift else 'next', value)
    return ('native', value)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('composition', solve('Enter', True, 13, False, False, 'draft'), ('native', 'draft'))
check('legacy', solve('Enter', False, 229, False, False, 'draft'), ('native', 'draft'))
check('single', solve('Enter', False, 13, False, False, 'draft'), ('submit', 'draft'))
check('multiline', solve('Enter', False, 13, False, True, 'draft'), ('insert', 'draft\n'))
check('shift submit', solve('Enter', False, 13, True, True, 'draft'), ('submit', 'draft'))
check('escape', solve('Escape', False, 27, False, False, 'draft'), ('cancel', 'draft'))
check('shift tab', solve('Tab', False, 9, True, False, 'draft'), ('previous', 'draft'))
check('tab', solve('Tab', False, 9, False, False, 'draft'), ('next', 'draft'))
check('parameterized composition text', solve('Enter',True,13,False,False,'draft'+str(N)), ('native','draft'+str(N)))
for repetition in range(N):
    check('repeat tab', solve('Tab', False, 9, False, False, 'draft'), ('next', 'draft'))
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
composition['native', 'draft']['native', 'draft']Passed
legacy['submit', 'draft']['native', 'draft']Failed
single['submit', 'draft']['submit', 'draft']Passed
multiline['insert', 'draft\n']['insert', 'draft\n']Passed
shift submit['submit', 'draft']['submit', 'draft']Passed
escape['cancel', 'draft']['cancel', 'draft']Passed
shift tab['previous', 'draft']['previous', 'draft']Passed
tab['next', 'draft']['next', 'draft']Passed
parameterized composition text['native', 'draft1']['native', 'draft1']Passed
repeat tab['next', 'draft']['next', 'draft']Passed

SHA-256 / a5020f64aff365510f5abaec3ef32af4ff2a65be0c537f32bb2cce291b4df6c7

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(key, composing, code, shift, multiline, value):
    if composing and code == 229: return ('native', value)
    if key == 'Enter':
        if multiline and not shift: return ('insert', value + '\n')
        return ('submit', value)
    if key == 'Escape': return ('cancel', value)
    if key == 'Tab': return ('previous' if shift else 'next', value)
    return ('native', value)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('composition', solve('Enter', True, 13, False, False, 'draft'), ('native', 'draft'))
check('legacy', solve('Enter', False, 229, False, False, 'draft'), ('native', 'draft'))
check('single', solve('Enter', False, 13, False, False, 'draft'), ('submit', 'draft'))
check('multiline', solve('Enter', False, 13, False, True, 'draft'), ('insert', 'draft\n'))
check('shift submit', solve('Enter', False, 13, True, True, 'draft'), ('submit', 'draft'))
check('escape', solve('Escape', False, 27, False, False, 'draft'), ('cancel', 'draft'))
check('shift tab', solve('Tab', False, 9, True, False, 'draft'), ('previous', 'draft'))
check('tab', solve('Tab', False, 9, False, False, 'draft'), ('next', 'draft'))
check('parameterized composition text', solve('Enter',True,13,False,False,'draft'+str(N)), ('native','draft'+str(N)))
for repetition in range(N):
    check('repeat tab', solve('Tab', False, 9, False, False, 'draft'), ('next', 'draft'))
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
composition['submit', 'draft']['native', 'draft']Failed
legacy['submit', 'draft']['native', 'draft']Failed
single['submit', 'draft']['submit', 'draft']Passed
multiline['insert', 'draft\n']['insert', 'draft\n']Passed
shift submit['submit', 'draft']['submit', 'draft']Passed
escape['cancel', 'draft']['cancel', 'draft']Passed
shift tab['previous', 'draft']['previous', 'draft']Passed
tab['next', 'draft']['next', 'draft']Passed
parameterized composition text['submit', 'draft1']['native', 'draft1']Failed
repeat tab['next', 'draft']['next', 'draft']Passed

SHA-256 / dc5c9224f3c7e07d20e5e496629283148e167df141cc6f1a94899280a921eced

3 / The verified repair

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

N = 1
observations = []
def solve(key, composing, code, shift, multiline, value):
    if composing or code == 229: return ('native', value)
    if key == 'Enter':
        if multiline and not shift: return ('insert', value + '\n')
        return ('submit', value)
    if key == 'Escape': return ('cancel', value)
    if key == 'Tab': return ('previous' if shift else 'next', value)
    return ('native', value)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('composition', solve('Enter', True, 13, False, False, 'draft'), ('native', 'draft'))
check('legacy', solve('Enter', False, 229, False, False, 'draft'), ('native', 'draft'))
check('single', solve('Enter', False, 13, False, False, 'draft'), ('submit', 'draft'))
check('multiline', solve('Enter', False, 13, False, True, 'draft'), ('insert', 'draft\n'))
check('shift submit', solve('Enter', False, 13, True, True, 'draft'), ('submit', 'draft'))
check('escape', solve('Escape', False, 27, False, False, 'draft'), ('cancel', 'draft'))
check('shift tab', solve('Tab', False, 9, True, False, 'draft'), ('previous', 'draft'))
check('tab', solve('Tab', False, 9, False, False, 'draft'), ('next', 'draft'))
check('parameterized composition text', solve('Enter',True,13,False,False,'draft'+str(N)), ('native','draft'+str(N)))
for repetition in range(N):
    check('repeat tab', solve('Tab', False, 9, False, False, 'draft'), ('next', 'draft'))
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
composition['native', 'draft']['native', 'draft']Passed
legacy['native', 'draft']['native', 'draft']Passed
single['submit', 'draft']['submit', 'draft']Passed
multiline['insert', 'draft\n']['insert', 'draft\n']Passed
shift submit['submit', 'draft']['submit', 'draft']Passed
escape['cancel', 'draft']['cancel', 'draft']Passed
shift tab['previous', 'draft']['previous', 'draft']Passed
tab['next', 'draft']['next', 'draft']Passed
parameterized composition text['native', 'draft1']['native', 'draft1']Passed
repeat tab['next', 'draft']['next', 'draft']Passed

SHA-256 / ea291435c849164eabbf63da7f76ca4e3bbbb91381ca534736a97dfccb6a5d51

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

Case digest / af59fc4f63cbfa8146747aba18dad99c3ed74da7849cf369c92845ee00883b8f