FA-21841 / Autocomplete interactions / Open access
Composition-aware suggestion lifecycle: composition start loses the pre-composition draft · case 01
The start completion transition produces an incorrect observable state.
ROOT CAUSE
At composition/start, the implementation evaluates `{'saved':d['preedit'],'composing':True}` instead of preserving the specified completion transition.
VERIFIED REPAIR
Implement the start contract using `{'saved':d['query'],'composing':True}`.
Unsuccessful approach: The attempted repair uses `{'saved':'','composing':True}`, which still violates a normal or boundary completion fixture.
Case contract
During IME composition, preedit is visible but never searched or committed. Starting composition saves the query snapshot; cancellation restores it; finalization schedules one final query. Candidate acceptance belongs to the IME, and result visibility is suspended until final text is available.
Why this case matters
Autocomplete couples draft text, suggestion identity and asynchronous presentation; this bounded lifecycle model isolates one observable interaction defect.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(event, d):
if event == 'start': return {'saved':d['preedit'],'composing':True}
if event == 'preedit': return {'display':d['preedit'],'query':d['query']}
if event == 'schedule': return [] if d['composing'] else [d['query']]
if event == 'finalize': return {'query':d['final'],'revision':d['revision']+1}
if event == 'cancel': return {'query':d['saved'],'composing':False}
if event == 'candidate': return None if d['composing'] else d['active']
if event == 'visibility': return [] if d['composing'] else d['results']
if event == 'invalidate': return {'pending':[],'revision':d['revision']+1}
if event == 'display-end': return d['final']
if event == 'rebase': return {'active':None,'query':d['final']}
return {'unchanged': True}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'query':'ca','preedit':'猫','final':'猫咪','saved':'cat','revision':N,'active':'cat-id','pending':['ca'],'results':['cat-id'],'composing':True}
boundary = {'query':'','preedit':'','final':'','saved':'','revision':N,'active':None,'pending':[],'results':[],'composing':False}
check('normal start', solve('start', normal), {'saved':'ca','composing':True})
check('boundary start', solve('start', boundary), {'saved':'','composing':True})
check('normal preedit', solve('preedit', normal), {'display':'猫','query':'ca'})
check('boundary preedit', solve('preedit', boundary), {'display':'','query':''})
check('normal schedule', solve('schedule', normal), [])
check('boundary schedule', solve('schedule', boundary), [''])
check('normal finalize', solve('finalize', normal), {'query':'猫咪','revision':N+1})
check('boundary finalize', solve('finalize', boundary), {'query':'','revision':N+1})
check('normal cancel', solve('cancel', normal), {'query':'cat','composing':False})
check('boundary cancel', solve('cancel', boundary), {'query':'','composing':False})
check('normal candidate', solve('candidate', normal), None)
check('boundary candidate', solve('candidate', boundary), None)
check('normal visibility', solve('visibility', normal), [])
check('boundary visibility', solve('visibility', boundary), [])
check('normal invalidate', solve('invalidate', normal), {'pending':[],'revision':N+1})
check('boundary invalidate', solve('invalidate', boundary), {'pending':[],'revision':N+1})
check('normal display-end', solve('display-end', normal), '猫咪')
check('boundary display-end', solve('display-end', boundary), '')
check('normal rebase', solve('rebase', normal), {'active':None,'query':'猫咪'})
check('boundary rebase', solve('rebase', boundary), {'active':None,'query':''})
variant = dict(normal, **{'final':'猫'*N})
check('variant query or selection payload', solve('display-end', variant), '猫'*N)
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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 |
|---|---|---|---|
| normal start | {'composing': True, 'saved': '猫'} | {'composing': True, 'saved': 'ca'} | Failed |
| boundary start | {'composing': True, 'saved': ''} | {'composing': True, 'saved': ''} | Passed |
| normal preedit | {'display': '猫', 'query': 'ca'} | {'display': '猫', 'query': 'ca'} | Passed |
| boundary preedit | {'display': '', 'query': ''} | {'display': '', 'query': ''} | Passed |
| normal schedule | [] | [] | Passed |
| boundary schedule | [''] | [''] | Passed |
| normal finalize | {'query': '猫咪', 'revision': 2} | {'query': '猫咪', 'revision': 2} | Passed |
| boundary finalize | {'query': '', 'revision': 2} | {'query': '', 'revision': 2} | Passed |
| normal cancel | {'composing': False, 'query': 'cat'} | {'composing': False, 'query': 'cat'} | Passed |
| boundary cancel | {'composing': False, 'query': ''} | {'composing': False, 'query': ''} | Passed |
| normal candidate | None | None | Passed |
| boundary candidate | None | None | Passed |
| normal visibility | [] | [] | Passed |
| boundary visibility | [] | [] | Passed |
| normal invalidate | {'pending': [], 'revision': 2} | {'pending': [], 'revision': 2} | Passed |
| boundary invalidate | {'pending': [], 'revision': 2} | {'pending': [], 'revision': 2} | Passed |
| normal display-end | 猫咪 | 猫咪 | Passed |
| boundary display-end | | | Passed |
| normal rebase | {'active': None, 'query': '猫咪'} | {'active': None, 'query': '猫咪'} | Passed |
| boundary rebase | {'active': None, 'query': ''} | {'active': None, 'query': ''} | Passed |
| variant query or selection payload | 猫 | 猫 | Passed |
| unknown completion event | {'unchanged': True} | {'unchanged': True} | Passed |
SHA-256 / f8cdb453e971a8a64e2bf00d8dca157900afdbf331344099ad523841ecc499cd
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(event, d):
if event == 'start': return {'saved':'','composing':True}
if event == 'preedit': return {'display':d['preedit'],'query':d['query']}
if event == 'schedule': return [] if d['composing'] else [d['query']]
if event == 'finalize': return {'query':d['final'],'revision':d['revision']+1}
if event == 'cancel': return {'query':d['saved'],'composing':False}
if event == 'candidate': return None if d['composing'] else d['active']
if event == 'visibility': return [] if d['composing'] else d['results']
if event == 'invalidate': return {'pending':[],'revision':d['revision']+1}
if event == 'display-end': return d['final']
if event == 'rebase': return {'active':None,'query':d['final']}
return {'unchanged': True}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'query':'ca','preedit':'猫','final':'猫咪','saved':'cat','revision':N,'active':'cat-id','pending':['ca'],'results':['cat-id'],'composing':True}
boundary = {'query':'','preedit':'','final':'','saved':'','revision':N,'active':None,'pending':[],'results':[],'composing':False}
check('normal start', solve('start', normal), {'saved':'ca','composing':True})
check('boundary start', solve('start', boundary), {'saved':'','composing':True})
check('normal preedit', solve('preedit', normal), {'display':'猫','query':'ca'})
check('boundary preedit', solve('preedit', boundary), {'display':'','query':''})
check('normal schedule', solve('schedule', normal), [])
check('boundary schedule', solve('schedule', boundary), [''])
check('normal finalize', solve('finalize', normal), {'query':'猫咪','revision':N+1})
check('boundary finalize', solve('finalize', boundary), {'query':'','revision':N+1})
check('normal cancel', solve('cancel', normal), {'query':'cat','composing':False})
check('boundary cancel', solve('cancel', boundary), {'query':'','composing':False})
check('normal candidate', solve('candidate', normal), None)
check('boundary candidate', solve('candidate', boundary), None)
check('normal visibility', solve('visibility', normal), [])
check('boundary visibility', solve('visibility', boundary), [])
check('normal invalidate', solve('invalidate', normal), {'pending':[],'revision':N+1})
check('boundary invalidate', solve('invalidate', boundary), {'pending':[],'revision':N+1})
check('normal display-end', solve('display-end', normal), '猫咪')
check('boundary display-end', solve('display-end', boundary), '')
check('normal rebase', solve('rebase', normal), {'active':None,'query':'猫咪'})
check('boundary rebase', solve('rebase', boundary), {'active':None,'query':''})
variant = dict(normal, **{'final':'猫'*N})
check('variant query or selection payload', solve('display-end', variant), '猫'*N)
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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 |
|---|---|---|---|
| normal start | {'composing': True, 'saved': ''} | {'composing': True, 'saved': 'ca'} | Failed |
| boundary start | {'composing': True, 'saved': ''} | {'composing': True, 'saved': ''} | Passed |
| normal preedit | {'display': '猫', 'query': 'ca'} | {'display': '猫', 'query': 'ca'} | Passed |
| boundary preedit | {'display': '', 'query': ''} | {'display': '', 'query': ''} | Passed |
| normal schedule | [] | [] | Passed |
| boundary schedule | [''] | [''] | Passed |
| normal finalize | {'query': '猫咪', 'revision': 2} | {'query': '猫咪', 'revision': 2} | Passed |
| boundary finalize | {'query': '', 'revision': 2} | {'query': '', 'revision': 2} | Passed |
| normal cancel | {'composing': False, 'query': 'cat'} | {'composing': False, 'query': 'cat'} | Passed |
| boundary cancel | {'composing': False, 'query': ''} | {'composing': False, 'query': ''} | Passed |
| normal candidate | None | None | Passed |
| boundary candidate | None | None | Passed |
| normal visibility | [] | [] | Passed |
| boundary visibility | [] | [] | Passed |
| normal invalidate | {'pending': [], 'revision': 2} | {'pending': [], 'revision': 2} | Passed |
| boundary invalidate | {'pending': [], 'revision': 2} | {'pending': [], 'revision': 2} | Passed |
| normal display-end | 猫咪 | 猫咪 | Passed |
| boundary display-end | | | Passed |
| normal rebase | {'active': None, 'query': '猫咪'} | {'active': None, 'query': '猫咪'} | Passed |
| boundary rebase | {'active': None, 'query': ''} | {'active': None, 'query': ''} | Passed |
| variant query or selection payload | 猫 | 猫 | Passed |
| unknown completion event | {'unchanged': True} | {'unchanged': True} | Passed |
SHA-256 / e79492aa66d548fdb7f7768ca9d7d370fe87f161cf2b52c332528da2458f27fd
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(event, d):
if event == 'start': return {'saved':d['query'],'composing':True}
if event == 'preedit': return {'display':d['preedit'],'query':d['query']}
if event == 'schedule': return [] if d['composing'] else [d['query']]
if event == 'finalize': return {'query':d['final'],'revision':d['revision']+1}
if event == 'cancel': return {'query':d['saved'],'composing':False}
if event == 'candidate': return None if d['composing'] else d['active']
if event == 'visibility': return [] if d['composing'] else d['results']
if event == 'invalidate': return {'pending':[],'revision':d['revision']+1}
if event == 'display-end': return d['final']
if event == 'rebase': return {'active':None,'query':d['final']}
return {'unchanged': True}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'query':'ca','preedit':'猫','final':'猫咪','saved':'cat','revision':N,'active':'cat-id','pending':['ca'],'results':['cat-id'],'composing':True}
boundary = {'query':'','preedit':'','final':'','saved':'','revision':N,'active':None,'pending':[],'results':[],'composing':False}
check('normal start', solve('start', normal), {'saved':'ca','composing':True})
check('boundary start', solve('start', boundary), {'saved':'','composing':True})
check('normal preedit', solve('preedit', normal), {'display':'猫','query':'ca'})
check('boundary preedit', solve('preedit', boundary), {'display':'','query':''})
check('normal schedule', solve('schedule', normal), [])
check('boundary schedule', solve('schedule', boundary), [''])
check('normal finalize', solve('finalize', normal), {'query':'猫咪','revision':N+1})
check('boundary finalize', solve('finalize', boundary), {'query':'','revision':N+1})
check('normal cancel', solve('cancel', normal), {'query':'cat','composing':False})
check('boundary cancel', solve('cancel', boundary), {'query':'','composing':False})
check('normal candidate', solve('candidate', normal), None)
check('boundary candidate', solve('candidate', boundary), None)
check('normal visibility', solve('visibility', normal), [])
check('boundary visibility', solve('visibility', boundary), [])
check('normal invalidate', solve('invalidate', normal), {'pending':[],'revision':N+1})
check('boundary invalidate', solve('invalidate', boundary), {'pending':[],'revision':N+1})
check('normal display-end', solve('display-end', normal), '猫咪')
check('boundary display-end', solve('display-end', boundary), '')
check('normal rebase', solve('rebase', normal), {'active':None,'query':'猫咪'})
check('boundary rebase', solve('rebase', boundary), {'active':None,'query':''})
variant = dict(normal, **{'final':'猫'*N})
check('variant query or selection payload', solve('display-end', variant), '猫'*N)
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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 |
|---|---|---|---|
| normal start | {'composing': True, 'saved': 'ca'} | {'composing': True, 'saved': 'ca'} | Passed |
| boundary start | {'composing': True, 'saved': ''} | {'composing': True, 'saved': ''} | Passed |
| normal preedit | {'display': '猫', 'query': 'ca'} | {'display': '猫', 'query': 'ca'} | Passed |
| boundary preedit | {'display': '', 'query': ''} | {'display': '', 'query': ''} | Passed |
| normal schedule | [] | [] | Passed |
| boundary schedule | [''] | [''] | Passed |
| normal finalize | {'query': '猫咪', 'revision': 2} | {'query': '猫咪', 'revision': 2} | Passed |
| boundary finalize | {'query': '', 'revision': 2} | {'query': '', 'revision': 2} | Passed |
| normal cancel | {'composing': False, 'query': 'cat'} | {'composing': False, 'query': 'cat'} | Passed |
| boundary cancel | {'composing': False, 'query': ''} | {'composing': False, 'query': ''} | Passed |
| normal candidate | None | None | Passed |
| boundary candidate | None | None | Passed |
| normal visibility | [] | [] | Passed |
| boundary visibility | [] | [] | Passed |
| normal invalidate | {'pending': [], 'revision': 2} | {'pending': [], 'revision': 2} | Passed |
| boundary invalidate | {'pending': [], 'revision': 2} | {'pending': [], 'revision': 2} | Passed |
| normal display-end | 猫咪 | 猫咪 | Passed |
| boundary display-end | | | Passed |
| normal rebase | {'active': None, 'query': '猫咪'} | {'active': None, 'query': '猫咪'} | Passed |
| boundary rebase | {'active': None, 'query': ''} | {'active': None, 'query': ''} | Passed |
| variant query or selection payload | 猫 | 猫 | Passed |
| unknown completion event | {'unchanged': True} | {'unchanged': True} | Passed |
SHA-256 / 6f31ef14522eb7101d5bada1f9149f312d1abb5fbc9e775a6f3acd059f4c0b53
Verification & scope
Stipulated deterministic widget transition model; inputs are validated snapshots. It does not model browser event dispatch, network transport, or linguistic standards. 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:40:32.682306+00:00.
Case digest / eac27600617c71c27fa3afab0370cd5a3d2cb5bdc37ffcb89e81d20f3de4ca56