FA-32066 / Keyboard interactions / Open access
Composition replacement against document revisions: Stale composition replacement overwrites a newer document revision · case 01
The event trace violates the conflict compare rule and produces incorrect keyboard state or command output.
ROOT CAUSE
Stale composition replacement overwrites a newer document revision.
THE FAILURE
Stale composition replacement overwrites a newer document revision.
Unsuccessful approach: The partial repair changes this transition to if base!=revision:, which still violates the model contract on the explicit regression traces.
Case contract
Case [document,revision,events]. Events [kind,a,b,text]. Begin captures valid range [a,b) and current revision with preedit text; update replaces pending preedit; external replaces entire document and increments revision. Commit applies pending replacement only if captured revision still equals current, otherwise counts stale conflict; either path closes pending. Cancel discards pending. Return document, revision, pending [lo,hi,base,text] or None, conflicts. 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):
document,revision,events=c
pending=None; conflicts=0
for kind,a,b,text in events:
if kind=='begin': pending=[a,b,revision,text]
elif kind=='update' and pending is not None: pending[3]=text
elif kind=='external': document=text; revision+=1
elif kind=='commit' and pending is not None:
lo,hi,base,preedit=pending
if base<=revision:
document=document[:lo]+preedit+document[hi:]
revision+=1
else: conflicts+=1
pending=None
elif kind=='cancel': pending=None
return [document,revision,pending,conflicts]
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-revision scenario 0', solve([['abcd', 4, []]] * N), [['abcd', 4, None, 0]] * N)
check('composition-revision scenario 1', solve([['abcd', 4, [['begin', 1, 3, 'X'], ['commit', 0, 0, '']]]] * N), [['aXd', 5, None, 0]] * N)
check('composition-revision scenario 2', solve([['abcd', 4, [['begin', 1, 3, 'X'], ['update', 0, 0, 'YZ'], ['commit', 0, 0, '']]]] * N), [['aYZd', 5, None, 0]] * N)
check('composition-revision scenario 3', solve([['abcd', 4, [['begin', 1, 3, 'X'], ['external', 0, 0, 'new'], ['commit', 0, 0, '']]]] * N), [['new', 5, None, 1]] * N)
check('composition-revision scenario 4', solve([['abcd', 4, [['external', 0, 0, 'one'], ['external', 0, 0, 'two']]]] * N), [['two', 6, None, 0]] * N)
check('composition-revision scenario 5', solve([['abcd', 4, [['begin', 1, 3, 'X'], ['external', 0, 0, 'one'], ['external', 0, 0, 'two'], ['commit', 0, 0, ''], ['begin', 0, 1, 'Z'], ['external', 0, 0, 'three'], ['commit', 0, 0, '']]]] * N), [['three', 7, None, 2]] * N)
check('composition-revision scenario 6', solve([['abcd', 4, [['begin', 0, 0, ''], ['cancel', 0, 0, '']]]] * N), [['abcd', 4, None, 0]] * N)
check('composition-revision scenario 7', solve([['abcd', 0, [['begin', 1, 3, 'X'], ['commit', 0, 0, ''], ['commit', 0, 0, '']]]] * N), [['aXd', 1, 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| composition-revision scenario 0 | [['abcd', 4, None, 0]] | [['abcd', 4, None, 0]] | Passed |
| composition-revision scenario 1 | [['aXd', 5, None, 0]] | [['aXd', 5, None, 0]] | Passed |
| composition-revision scenario 2 | [['aYZd', 5, None, 0]] | [['aYZd', 5, None, 0]] | Passed |
| composition-revision scenario 3 | [['nX', 6, None, 0]] | [['new', 5, None, 1]] | Failed |
| composition-revision scenario 4 | [['two', 6, None, 0]] | [['two', 6, None, 0]] | Passed |
| composition-revision scenario 5 | [['Zhree', 9, None, 0]] | [['three', 7, None, 2]] | Failed |
| composition-revision scenario 6 | [['abcd', 4, None, 0]] | [['abcd', 4, None, 0]] | Passed |
| composition-revision scenario 7 | [['aXd', 1, None, 0]] | [['aXd', 1, None, 0]] | Passed |
SHA-256 / 29127ca78f31788dfb061311e90ce8ffe38cc23cdb996c2f60093eb1b5fad2c7
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):
document,revision,events=c
pending=None; conflicts=0
for kind,a,b,text in events:
if kind=='begin': pending=[a,b,revision,text]
elif kind=='update' and pending is not None: pending[3]=text
elif kind=='external': document=text; revision+=1
elif kind=='commit' and pending is not None:
lo,hi,base,preedit=pending
if base!=revision:
document=document[:lo]+preedit+document[hi:]
revision+=1
else: conflicts+=1
pending=None
elif kind=='cancel': pending=None
return [document,revision,pending,conflicts]
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-revision scenario 0', solve([['abcd', 4, []]] * N), [['abcd', 4, None, 0]] * N)
check('composition-revision scenario 1', solve([['abcd', 4, [['begin', 1, 3, 'X'], ['commit', 0, 0, '']]]] * N), [['aXd', 5, None, 0]] * N)
check('composition-revision scenario 2', solve([['abcd', 4, [['begin', 1, 3, 'X'], ['update', 0, 0, 'YZ'], ['commit', 0, 0, '']]]] * N), [['aYZd', 5, None, 0]] * N)
check('composition-revision scenario 3', solve([['abcd', 4, [['begin', 1, 3, 'X'], ['external', 0, 0, 'new'], ['commit', 0, 0, '']]]] * N), [['new', 5, None, 1]] * N)
check('composition-revision scenario 4', solve([['abcd', 4, [['external', 0, 0, 'one'], ['external', 0, 0, 'two']]]] * N), [['two', 6, None, 0]] * N)
check('composition-revision scenario 5', solve([['abcd', 4, [['begin', 1, 3, 'X'], ['external', 0, 0, 'one'], ['external', 0, 0, 'two'], ['commit', 0, 0, ''], ['begin', 0, 1, 'Z'], ['external', 0, 0, 'three'], ['commit', 0, 0, '']]]] * N), [['three', 7, None, 2]] * N)
check('composition-revision scenario 6', solve([['abcd', 4, [['begin', 0, 0, ''], ['cancel', 0, 0, '']]]] * N), [['abcd', 4, None, 0]] * N)
check('composition-revision scenario 7', solve([['abcd', 0, [['begin', 1, 3, 'X'], ['commit', 0, 0, ''], ['commit', 0, 0, '']]]] * N), [['aXd', 1, 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| composition-revision scenario 0 | [['abcd', 4, None, 0]] | [['abcd', 4, None, 0]] | Passed |
| composition-revision scenario 1 | [['abcd', 4, None, 1]] | [['aXd', 5, None, 0]] | Failed |
| composition-revision scenario 2 | [['abcd', 4, None, 1]] | [['aYZd', 5, None, 0]] | Failed |
| composition-revision scenario 3 | [['nX', 6, None, 0]] | [['new', 5, None, 1]] | Failed |
| composition-revision scenario 4 | [['two', 6, None, 0]] | [['two', 6, None, 0]] | Passed |
| composition-revision scenario 5 | [['Zhree', 9, None, 0]] | [['three', 7, None, 2]] | Failed |
| composition-revision scenario 6 | [['abcd', 4, None, 0]] | [['abcd', 4, None, 0]] | Passed |
| composition-revision scenario 7 | [['abcd', 0, None, 1]] | [['aXd', 1, None, 0]] | Failed |
SHA-256 / aae8a84459d3c7c50742f2d1bec5eb589f26a323d83b1d4932d23700bf0774b7
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 8 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.541593+00:00.
Case digest / 8db5a56d0c9bc4ec6b7d717450161aef4148aa8d9cb96a385702366645aa4174