FAILURE MAP
← Case archive

FA-30911 / Keyboard interactions / Open access

Composition transaction ownership: Applied update count is confused with text length or latest state · case 01

The event trace violates the update count rule and produces incorrect keyboard state or command output.

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

ROOT CAUSE

Applied update count is confused with text length or latest state.

VERIFIED REPAIR

Use the contract transition `updates+=1` at the update count fault site; preserve the other state transitions.

Unsuccessful approach: The partial repair changes this transition to updates+=len(text), which still violates the model contract on the explicit regression traces.

Case contract

Events [kind,owner,text]. Start replaces active preedit, update applies only to active owner, commit appends supplied text once for active owner and closes, cancel closes matching owner without committing, focus switches cancel old owner. Return committed strings, active owner and preedit. 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):
        owner=None; preedit=''; committed=[]; updates=0
        for kind,target,text in c:
            if kind=='start':
                owner=target
                preedit=text
            elif kind=='update' and target==owner:
                preedit=text
                updates=1
            elif kind=='commit' and target==owner and owner is not None:
                committed.append(text)
                owner=None
                preedit=''
            elif kind=='cancel' and target==owner:
                owner=None; preedit=''
            elif kind=='focus' and target!=owner:
                owner=None; preedit=''
        return [committed,owner,preedit,updates]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('composition-transaction scenario 0', solve([[]] * N), [[[], None, '', 0]] * N)
check('composition-transaction scenario 1', solve([[['start', 'a', 'x'], ['update', 'a', 'xy'], ['update', 'a', 'xyz']]] * N), [[[], 'a', 'xyz', 2]] * N)
check('composition-transaction scenario 2', solve([[['start', 'a', 'x'], ['start', 'b', 'b']]] * N), [[[], 'b', 'b', 0]] * N)
check('composition-transaction scenario 3', solve([[['start', 'a', 'x'], ['update', 'b', 'oops']]] * N), [[[], 'a', 'x', 0]] * N)
check('composition-transaction scenario 4', solve([[['start', 'a', 'x'], ['commit', 'a', 'word'], ['commit', 'a', 'word']]] * N), [[['word'], None, '', 0]] * N)
check('composition-transaction scenario 5', solve([[['commit', 'x', 'orphan']]] * N), [[[], None, '', 0]] * N)
check('composition-transaction scenario 6', solve([[['start', 'a', 'x'], ['commit', 'b', 'bad']]] * N), [[[], 'a', 'x', 0]] * N)
check('composition-transaction scenario 7', solve([[['start', 'a', 'x'], ['cancel', 'b', '']]] * N), [[[], 'a', 'x', 0]] * N)
check('composition-transaction scenario 8', solve([[['start', 'a', 'x'], ['cancel', 'a', '']]] * N), [[[], None, '', 0]] * N)
check('composition-transaction scenario 9', solve([[['start', 'a', 'x'], ['focus', 'b', '']]] * N), [[[], None, '', 0]] * N)
check('composition-transaction scenario 10', solve([[['start', 'a', 'x'], ['focus', 'a', '']]] * N), [[[], 'a', 'x', 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
composition-transaction scenario 0[[[], None, '', 0]][[[], None, '', 0]]Passed
composition-transaction scenario 1[[[], 'a', 'xyz', 1]][[[], 'a', 'xyz', 2]]Failed
composition-transaction scenario 2[[[], 'b', 'b', 0]][[[], 'b', 'b', 0]]Passed
composition-transaction scenario 3[[[], 'a', 'x', 0]][[[], 'a', 'x', 0]]Passed
composition-transaction scenario 4[[['word'], None, '', 0]][[['word'], None, '', 0]]Passed
composition-transaction scenario 5[[[], None, '', 0]][[[], None, '', 0]]Passed
composition-transaction scenario 6[[[], 'a', 'x', 0]][[[], 'a', 'x', 0]]Passed
composition-transaction scenario 7[[[], 'a', 'x', 0]][[[], 'a', 'x', 0]]Passed
composition-transaction scenario 8[[[], None, '', 0]][[[], None, '', 0]]Passed
composition-transaction scenario 9[[[], None, '', 0]][[[], None, '', 0]]Passed
composition-transaction scenario 10[[[], 'a', 'x', 0]][[[], 'a', 'x', 0]]Passed

SHA-256 / 43eb6e52c391f34edae15156becbaf60f331b6b1895310235f3872f2ba2a238e

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):
        owner=None; preedit=''; committed=[]; updates=0
        for kind,target,text in c:
            if kind=='start':
                owner=target
                preedit=text
            elif kind=='update' and target==owner:
                preedit=text
                updates+=len(text)
            elif kind=='commit' and target==owner and owner is not None:
                committed.append(text)
                owner=None
                preedit=''
            elif kind=='cancel' and target==owner:
                owner=None; preedit=''
            elif kind=='focus' and target!=owner:
                owner=None; preedit=''
        return [committed,owner,preedit,updates]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('composition-transaction scenario 0', solve([[]] * N), [[[], None, '', 0]] * N)
check('composition-transaction scenario 1', solve([[['start', 'a', 'x'], ['update', 'a', 'xy'], ['update', 'a', 'xyz']]] * N), [[[], 'a', 'xyz', 2]] * N)
check('composition-transaction scenario 2', solve([[['start', 'a', 'x'], ['start', 'b', 'b']]] * N), [[[], 'b', 'b', 0]] * N)
check('composition-transaction scenario 3', solve([[['start', 'a', 'x'], ['update', 'b', 'oops']]] * N), [[[], 'a', 'x', 0]] * N)
check('composition-transaction scenario 4', solve([[['start', 'a', 'x'], ['commit', 'a', 'word'], ['commit', 'a', 'word']]] * N), [[['word'], None, '', 0]] * N)
check('composition-transaction scenario 5', solve([[['commit', 'x', 'orphan']]] * N), [[[], None, '', 0]] * N)
check('composition-transaction scenario 6', solve([[['start', 'a', 'x'], ['commit', 'b', 'bad']]] * N), [[[], 'a', 'x', 0]] * N)
check('composition-transaction scenario 7', solve([[['start', 'a', 'x'], ['cancel', 'b', '']]] * N), [[[], 'a', 'x', 0]] * N)
check('composition-transaction scenario 8', solve([[['start', 'a', 'x'], ['cancel', 'a', '']]] * N), [[[], None, '', 0]] * N)
check('composition-transaction scenario 9', solve([[['start', 'a', 'x'], ['focus', 'b', '']]] * N), [[[], None, '', 0]] * N)
check('composition-transaction scenario 10', solve([[['start', 'a', 'x'], ['focus', 'a', '']]] * N), [[[], 'a', 'x', 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
composition-transaction scenario 0[[[], None, '', 0]][[[], None, '', 0]]Passed
composition-transaction scenario 1[[[], 'a', 'xyz', 5]][[[], 'a', 'xyz', 2]]Failed
composition-transaction scenario 2[[[], 'b', 'b', 0]][[[], 'b', 'b', 0]]Passed
composition-transaction scenario 3[[[], 'a', 'x', 0]][[[], 'a', 'x', 0]]Passed
composition-transaction scenario 4[[['word'], None, '', 0]][[['word'], None, '', 0]]Passed
composition-transaction scenario 5[[[], None, '', 0]][[[], None, '', 0]]Passed
composition-transaction scenario 6[[[], 'a', 'x', 0]][[[], 'a', 'x', 0]]Passed
composition-transaction scenario 7[[[], 'a', 'x', 0]][[[], 'a', 'x', 0]]Passed
composition-transaction scenario 8[[[], None, '', 0]][[[], None, '', 0]]Passed
composition-transaction scenario 9[[[], None, '', 0]][[[], None, '', 0]]Passed
composition-transaction scenario 10[[[], 'a', 'x', 0]][[[], 'a', 'x', 0]]Passed

SHA-256 / 118da2179f2c2f66c02824012c9b49b1f1b1da096480bcc4e9c1d113734818fd

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):
        owner=None; preedit=''; committed=[]; updates=0
        for kind,target,text in c:
            if kind=='start':
                owner=target
                preedit=text
            elif kind=='update' and target==owner:
                preedit=text
                updates+=1
            elif kind=='commit' and target==owner and owner is not None:
                committed.append(text)
                owner=None
                preedit=''
            elif kind=='cancel' and target==owner:
                owner=None; preedit=''
            elif kind=='focus' and target!=owner:
                owner=None; preedit=''
        return [committed,owner,preedit,updates]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('composition-transaction scenario 0', solve([[]] * N), [[[], None, '', 0]] * N)
check('composition-transaction scenario 1', solve([[['start', 'a', 'x'], ['update', 'a', 'xy'], ['update', 'a', 'xyz']]] * N), [[[], 'a', 'xyz', 2]] * N)
check('composition-transaction scenario 2', solve([[['start', 'a', 'x'], ['start', 'b', 'b']]] * N), [[[], 'b', 'b', 0]] * N)
check('composition-transaction scenario 3', solve([[['start', 'a', 'x'], ['update', 'b', 'oops']]] * N), [[[], 'a', 'x', 0]] * N)
check('composition-transaction scenario 4', solve([[['start', 'a', 'x'], ['commit', 'a', 'word'], ['commit', 'a', 'word']]] * N), [[['word'], None, '', 0]] * N)
check('composition-transaction scenario 5', solve([[['commit', 'x', 'orphan']]] * N), [[[], None, '', 0]] * N)
check('composition-transaction scenario 6', solve([[['start', 'a', 'x'], ['commit', 'b', 'bad']]] * N), [[[], 'a', 'x', 0]] * N)
check('composition-transaction scenario 7', solve([[['start', 'a', 'x'], ['cancel', 'b', '']]] * N), [[[], 'a', 'x', 0]] * N)
check('composition-transaction scenario 8', solve([[['start', 'a', 'x'], ['cancel', 'a', '']]] * N), [[[], None, '', 0]] * N)
check('composition-transaction scenario 9', solve([[['start', 'a', 'x'], ['focus', 'b', '']]] * N), [[[], None, '', 0]] * N)
check('composition-transaction scenario 10', solve([[['start', 'a', 'x'], ['focus', 'a', '']]] * N), [[[], 'a', 'x', 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
composition-transaction scenario 0[[[], None, '', 0]][[[], None, '', 0]]Passed
composition-transaction scenario 1[[[], 'a', 'xyz', 2]][[[], 'a', 'xyz', 2]]Passed
composition-transaction scenario 2[[[], 'b', 'b', 0]][[[], 'b', 'b', 0]]Passed
composition-transaction scenario 3[[[], 'a', 'x', 0]][[[], 'a', 'x', 0]]Passed
composition-transaction scenario 4[[['word'], None, '', 0]][[['word'], None, '', 0]]Passed
composition-transaction scenario 5[[[], None, '', 0]][[[], None, '', 0]]Passed
composition-transaction scenario 6[[[], 'a', 'x', 0]][[[], 'a', 'x', 0]]Passed
composition-transaction scenario 7[[[], 'a', 'x', 0]][[[], 'a', 'x', 0]]Passed
composition-transaction scenario 8[[[], None, '', 0]][[[], None, '', 0]]Passed
composition-transaction scenario 9[[[], None, '', 0]][[[], None, '', 0]]Passed
composition-transaction scenario 10[[[], 'a', 'x', 0]][[[], 'a', 'x', 0]]Passed

SHA-256 / 77f68c9bfbe67ce241dc060af7eab8f8539940cd030f354deced08ac704351a0

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

Case digest / bf948b0a2359bcc139daabeae2d37ef4ab98c29cd4e298af72aa8656e14ce6d2