FA-22136 / Autocomplete interactions / Open access
Multi-value autocomplete tokens: restoring a removed token discards surviving selections · case 01
The undo-remove completion transition produces an incorrect observable state.
ROOT CAUSE
At multiple-values/undo-remove, the implementation evaluates `[d['remove']]` instead of preserving the specified completion transition.
VERIFIED REPAIR
Implement the undo-remove contract using `[d['remove']]+[x for x in d['selected'] if x!=d['remove']] if d['remove'] in d['selected'] else d['selected']`.
Unsuccessful approach: The attempted repair uses `d['selected']+[d['remove']]`, which still violates a normal or boundary completion fixture.
Case contract
Accepting a suggestion appends its identifier once, preserving selection order and independent duplicate labels. Removing a token removes that identity only. Already-selected results are excluded, pending query text is separate from selected values, and capacity is measured in committed identities.
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 == 'repeat': return d['selected'] if d['candidate'] in d['selected'] else d['selected']+[d['candidate']]
if event == 'append': return d['selected']+[d['new']]
if event == 'remove': return [x for x in d['selected'] if x!=d['remove']]
if event == 'filter': return [x for x in d['results'] if x not in d['selected']]
if event == 'labels': return list(zip(d['selected'],d['labels']))
if event == 'capacity': return max(0,d['limit']-len(d['selected']))
if event == 'at-limit': return len(d['selected'])>=d['limit']
if event == 'submit': return d['selected']
if event == 'after-accept': return {'draft':'','epoch':d['epoch']+1}
if event == 'undo-remove': return [d['remove']]
return {'unchanged': True}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'selected':['a','b'],'labels':['Same','Same'],'candidate':'b','new':'c','remove':'a','results':['a','c','d'],'draft':'ca','limit':3,'epoch':N}
boundary = {'selected':[],'labels':[],'candidate':'','new':'','remove':'missing','results':[''],'draft':'','limit':0,'epoch':N}
check('normal repeat', solve('repeat', normal), ['a','b'])
check('boundary repeat', solve('repeat', boundary), [''])
check('normal append', solve('append', normal), ['a','b','c'])
check('boundary append', solve('append', boundary), [''])
check('normal remove', solve('remove', normal), ['b'])
check('boundary remove', solve('remove', boundary), [])
check('normal filter', solve('filter', normal), ['c','d'])
check('boundary filter', solve('filter', boundary), [''])
check('normal labels', solve('labels', normal), [('a','Same'),('b','Same')])
check('boundary labels', solve('labels', boundary), [])
check('normal capacity', solve('capacity', normal), 1)
check('boundary capacity', solve('capacity', boundary), 0)
check('normal at-limit', solve('at-limit', normal), False)
check('boundary at-limit', solve('at-limit', boundary), True)
check('normal submit', solve('submit', normal), ['a','b'])
check('boundary submit', solve('submit', boundary), [])
check('normal after-accept', solve('after-accept', normal), {'draft':'','epoch':N+1})
check('boundary after-accept', solve('after-accept', boundary), {'draft':'','epoch':N+1})
check('normal undo-remove', solve('undo-remove', normal), ['a','b'])
check('boundary undo-remove', solve('undo-remove', boundary), [])
variant = dict(normal, **{'new':'id'+str(N)})
check('variant query or selection payload', solve('append', variant), ['a','b','id'+str(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 repeat | ['a', 'b'] | ['a', 'b'] | Passed |
| boundary repeat | [''] | [''] | Passed |
| normal append | ['a', 'b', 'c'] | ['a', 'b', 'c'] | Passed |
| boundary append | [''] | [''] | Passed |
| normal remove | ['b'] | ['b'] | Passed |
| boundary remove | [] | [] | Passed |
| normal filter | ['c', 'd'] | ['c', 'd'] | Passed |
| boundary filter | [''] | [''] | Passed |
| normal labels | [['a', 'Same'], ['b', 'Same']] | [['a', 'Same'], ['b', 'Same']] | Passed |
| boundary labels | [] | [] | Passed |
| normal capacity | 1 | 1 | Passed |
| boundary capacity | 0 | 0 | Passed |
| normal at-limit | False | False | Passed |
| boundary at-limit | True | True | Passed |
| normal submit | ['a', 'b'] | ['a', 'b'] | Passed |
| boundary submit | [] | [] | Passed |
| normal after-accept | {'draft': '', 'epoch': 2} | {'draft': '', 'epoch': 2} | Passed |
| boundary after-accept | {'draft': '', 'epoch': 2} | {'draft': '', 'epoch': 2} | Passed |
| normal undo-remove | ['a'] | ['a', 'b'] | Failed |
| boundary undo-remove | ['missing'] | [] | Failed |
| variant query or selection payload | ['a', 'b', 'id1'] | ['a', 'b', 'id1'] | Passed |
| unknown completion event | {'unchanged': True} | {'unchanged': True} | Passed |
SHA-256 / 78ac6f0e2e4428b504ac7ceabb1915814303788b0a5cc35d8e107e842d35629e
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 == 'repeat': return d['selected'] if d['candidate'] in d['selected'] else d['selected']+[d['candidate']]
if event == 'append': return d['selected']+[d['new']]
if event == 'remove': return [x for x in d['selected'] if x!=d['remove']]
if event == 'filter': return [x for x in d['results'] if x not in d['selected']]
if event == 'labels': return list(zip(d['selected'],d['labels']))
if event == 'capacity': return max(0,d['limit']-len(d['selected']))
if event == 'at-limit': return len(d['selected'])>=d['limit']
if event == 'submit': return d['selected']
if event == 'after-accept': return {'draft':'','epoch':d['epoch']+1}
if event == 'undo-remove': return d['selected']+[d['remove']]
return {'unchanged': True}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'selected':['a','b'],'labels':['Same','Same'],'candidate':'b','new':'c','remove':'a','results':['a','c','d'],'draft':'ca','limit':3,'epoch':N}
boundary = {'selected':[],'labels':[],'candidate':'','new':'','remove':'missing','results':[''],'draft':'','limit':0,'epoch':N}
check('normal repeat', solve('repeat', normal), ['a','b'])
check('boundary repeat', solve('repeat', boundary), [''])
check('normal append', solve('append', normal), ['a','b','c'])
check('boundary append', solve('append', boundary), [''])
check('normal remove', solve('remove', normal), ['b'])
check('boundary remove', solve('remove', boundary), [])
check('normal filter', solve('filter', normal), ['c','d'])
check('boundary filter', solve('filter', boundary), [''])
check('normal labels', solve('labels', normal), [('a','Same'),('b','Same')])
check('boundary labels', solve('labels', boundary), [])
check('normal capacity', solve('capacity', normal), 1)
check('boundary capacity', solve('capacity', boundary), 0)
check('normal at-limit', solve('at-limit', normal), False)
check('boundary at-limit', solve('at-limit', boundary), True)
check('normal submit', solve('submit', normal), ['a','b'])
check('boundary submit', solve('submit', boundary), [])
check('normal after-accept', solve('after-accept', normal), {'draft':'','epoch':N+1})
check('boundary after-accept', solve('after-accept', boundary), {'draft':'','epoch':N+1})
check('normal undo-remove', solve('undo-remove', normal), ['a','b'])
check('boundary undo-remove', solve('undo-remove', boundary), [])
variant = dict(normal, **{'new':'id'+str(N)})
check('variant query or selection payload', solve('append', variant), ['a','b','id'+str(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 repeat | ['a', 'b'] | ['a', 'b'] | Passed |
| boundary repeat | [''] | [''] | Passed |
| normal append | ['a', 'b', 'c'] | ['a', 'b', 'c'] | Passed |
| boundary append | [''] | [''] | Passed |
| normal remove | ['b'] | ['b'] | Passed |
| boundary remove | [] | [] | Passed |
| normal filter | ['c', 'd'] | ['c', 'd'] | Passed |
| boundary filter | [''] | [''] | Passed |
| normal labels | [['a', 'Same'], ['b', 'Same']] | [['a', 'Same'], ['b', 'Same']] | Passed |
| boundary labels | [] | [] | Passed |
| normal capacity | 1 | 1 | Passed |
| boundary capacity | 0 | 0 | Passed |
| normal at-limit | False | False | Passed |
| boundary at-limit | True | True | Passed |
| normal submit | ['a', 'b'] | ['a', 'b'] | Passed |
| boundary submit | [] | [] | Passed |
| normal after-accept | {'draft': '', 'epoch': 2} | {'draft': '', 'epoch': 2} | Passed |
| boundary after-accept | {'draft': '', 'epoch': 2} | {'draft': '', 'epoch': 2} | Passed |
| normal undo-remove | ['a', 'b', 'a'] | ['a', 'b'] | Failed |
| boundary undo-remove | ['missing'] | [] | Failed |
| variant query or selection payload | ['a', 'b', 'id1'] | ['a', 'b', 'id1'] | Passed |
| unknown completion event | {'unchanged': True} | {'unchanged': True} | Passed |
SHA-256 / dbcd3a5b80ea5dd4c85dfa67f99ff7fd0121c6bbc0689b3e10cb88c44fa74328
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 == 'repeat': return d['selected'] if d['candidate'] in d['selected'] else d['selected']+[d['candidate']]
if event == 'append': return d['selected']+[d['new']]
if event == 'remove': return [x for x in d['selected'] if x!=d['remove']]
if event == 'filter': return [x for x in d['results'] if x not in d['selected']]
if event == 'labels': return list(zip(d['selected'],d['labels']))
if event == 'capacity': return max(0,d['limit']-len(d['selected']))
if event == 'at-limit': return len(d['selected'])>=d['limit']
if event == 'submit': return d['selected']
if event == 'after-accept': return {'draft':'','epoch':d['epoch']+1}
if event == 'undo-remove': return [d['remove']]+[x for x in d['selected'] if x!=d['remove']] if d['remove'] in d['selected'] else d['selected']
return {'unchanged': True}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'selected':['a','b'],'labels':['Same','Same'],'candidate':'b','new':'c','remove':'a','results':['a','c','d'],'draft':'ca','limit':3,'epoch':N}
boundary = {'selected':[],'labels':[],'candidate':'','new':'','remove':'missing','results':[''],'draft':'','limit':0,'epoch':N}
check('normal repeat', solve('repeat', normal), ['a','b'])
check('boundary repeat', solve('repeat', boundary), [''])
check('normal append', solve('append', normal), ['a','b','c'])
check('boundary append', solve('append', boundary), [''])
check('normal remove', solve('remove', normal), ['b'])
check('boundary remove', solve('remove', boundary), [])
check('normal filter', solve('filter', normal), ['c','d'])
check('boundary filter', solve('filter', boundary), [''])
check('normal labels', solve('labels', normal), [('a','Same'),('b','Same')])
check('boundary labels', solve('labels', boundary), [])
check('normal capacity', solve('capacity', normal), 1)
check('boundary capacity', solve('capacity', boundary), 0)
check('normal at-limit', solve('at-limit', normal), False)
check('boundary at-limit', solve('at-limit', boundary), True)
check('normal submit', solve('submit', normal), ['a','b'])
check('boundary submit', solve('submit', boundary), [])
check('normal after-accept', solve('after-accept', normal), {'draft':'','epoch':N+1})
check('boundary after-accept', solve('after-accept', boundary), {'draft':'','epoch':N+1})
check('normal undo-remove', solve('undo-remove', normal), ['a','b'])
check('boundary undo-remove', solve('undo-remove', boundary), [])
variant = dict(normal, **{'new':'id'+str(N)})
check('variant query or selection payload', solve('append', variant), ['a','b','id'+str(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 repeat | ['a', 'b'] | ['a', 'b'] | Passed |
| boundary repeat | [''] | [''] | Passed |
| normal append | ['a', 'b', 'c'] | ['a', 'b', 'c'] | Passed |
| boundary append | [''] | [''] | Passed |
| normal remove | ['b'] | ['b'] | Passed |
| boundary remove | [] | [] | Passed |
| normal filter | ['c', 'd'] | ['c', 'd'] | Passed |
| boundary filter | [''] | [''] | Passed |
| normal labels | [['a', 'Same'], ['b', 'Same']] | [['a', 'Same'], ['b', 'Same']] | Passed |
| boundary labels | [] | [] | Passed |
| normal capacity | 1 | 1 | Passed |
| boundary capacity | 0 | 0 | Passed |
| normal at-limit | False | False | Passed |
| boundary at-limit | True | True | Passed |
| normal submit | ['a', 'b'] | ['a', 'b'] | Passed |
| boundary submit | [] | [] | Passed |
| normal after-accept | {'draft': '', 'epoch': 2} | {'draft': '', 'epoch': 2} | Passed |
| boundary after-accept | {'draft': '', 'epoch': 2} | {'draft': '', 'epoch': 2} | Passed |
| normal undo-remove | ['a', 'b'] | ['a', 'b'] | Passed |
| boundary undo-remove | [] | [] | Passed |
| variant query or selection payload | ['a', 'b', 'id1'] | ['a', 'b', 'id1'] | Passed |
| unknown completion event | {'unchanged': True} | {'unchanged': True} | Passed |
SHA-256 / 4f3572f023c9b5cf00708c55677e9e6d697b07b2b31f98cc581f09635f2cebf2
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:35.625999+00:00.
Case digest / 53ba48e65da5b81a5eedd468339b841cfaef0d8f729b6143e3176792626028c0