FAILURE MAP
← Case archive

FA-8991 / Text editing / Open access

Composition-aware keyboard commands: Single-line Enter inserts a newline instead of submitting · case 01

Single-line Enter inserts a newline instead of submitting.

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

ROOT CAUSE

The multiline operation uses `not shift` where the contract requires `multiline and not shift`.

VERIFIED REPAIR

Implement the multiline operation as `multiline and not shift`.

Unsuccessful approach: Ignoring Shift prevents the explicit submit gesture in multiline mode.

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 or code == 229: return ('native', value)
    if key == 'Enter':
        if 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['insert', 'draft\n']['submit', 'draft']Failed
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 / 9d4795ce20e730981b19f80a400db6f295315e0179560f235921aed462e2e681

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 or code == 229: return ('native', value)
    if key == 'Enter':
        if multiline: 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['insert', 'draft\n']['submit', 'draft']Failed
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 / b9bfbabc49182089d949ba9c3ba8a8f1e0592f97246096c0708ccdcf471afab9

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

Case digest / 20694c11838dea5116c0185595cd8f5b8bff9e34d7b625f5e6571eaf0d2b8bc2