FAILURE MAP
← Case archive

FA-22591 / Autocomplete interactions / Open access

Recent accepted suggestions: accepted suggestion is recorded behind older completions · case 01

The record completion transition produces an incorrect observable state.

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

ROOT CAUSE

At recent-completions/record, the implementation evaluates `[x for x in d['history'] if x!=d['accepted']]+[d['accepted']]` instead of preserving the specified completion transition.

VERIFIED REPAIR

Implement the record contract using `[d['accepted']]+[x for x in d['history'] if x!=d['accepted']]`.

Unsuccessful approach: The attempted repair uses `d['history']+[d['accepted']]`, which still violates a normal or boundary completion fixture.

Case contract

Recent completions record explicit accepted identities in most-recent-first order, scoped to a picker. Preview and typed drafts do not enter history. Reacceptance moves an identity to the front, removal is identity-specific, and labels refresh without changing identity order. An oldest-first export resolves labels in reverse history order.

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 == 'record': return [x for x in d['history'] if x!=d['accepted']]+[d['accepted']]
    if event == 'limit': return d['history'][:d['limit']]
    if event == 'scope': return d['history'] if d['scope']==d['entry_scope'] else []
    if event == 'preview': return d['history']
    if event == 'remove': return [x for x in d['history'] if x!=d['accepted']]
    if event == 'rename': return dict(d['labels'], **{d['accepted']:d['new_label']})
    if event == 'empty-id': return [d['accepted']]
    if event == 'query-source': return d['draft']
    if event == 'clear': return {'history':[],'draft':d['draft']}
    if event == 'oldest-first-export': return [d['labels'].get(x,x) for x in reversed(d['history'])]
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'history':['a','b','c'],'accepted':'b','draft':'be','preview':'p','scope':'fruit','entry_scope':'all','labels':{'a':'A','b':'Old B','c':'C'},'new_label':'Bee','limit':2,'epoch':N}
boundary = {'history':[],'accepted':'','draft':'','preview':None,'scope':'all','entry_scope':'all','labels':{},'new_label':'','limit':0,'epoch':N}
check('normal record', solve('record', normal), ['b','a','c'])
check('boundary record', solve('record', boundary), [''])
check('normal limit', solve('limit', normal), ['a','b'])
check('boundary limit', solve('limit', boundary), [])
check('normal scope', solve('scope', normal), [])
check('boundary scope', solve('scope', boundary), [])
check('normal preview', solve('preview', normal), ['a','b','c'])
check('boundary preview', solve('preview', boundary), [])
check('normal remove', solve('remove', normal), ['a','c'])
check('boundary remove', solve('remove', boundary), [])
check('normal rename', solve('rename', normal), {'a':'A','b':'Bee','c':'C'})
check('boundary rename', solve('rename', boundary), {'':''})
check('normal empty-id', solve('empty-id', normal), ['b'])
check('boundary empty-id', solve('empty-id', boundary), [''])
check('normal query-source', solve('query-source', normal), 'be')
check('boundary query-source', solve('query-source', boundary), '')
check('normal clear', solve('clear', normal), {'history':[],'draft':'be'})
check('boundary clear', solve('clear', boundary), {'history':[],'draft':''})
check('normal oldest-first-export', solve('oldest-first-export', normal), ['C','Old B','A'])
check('boundary oldest-first-export', solve('oldest-first-export', boundary), [])
variant = dict(normal, **{'accepted':'id'+str(N)})
check('variant query or selection payload', solve('empty-id', variant), ['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 fixtureActualExpectedOutcome
normal record['a', 'c', 'b']['b', 'a', 'c']Failed
boundary record['']['']Passed
normal limit['a', 'b']['a', 'b']Passed
boundary limit[][]Passed
normal scope[][]Passed
boundary scope[][]Passed
normal preview['a', 'b', 'c']['a', 'b', 'c']Passed
boundary preview[][]Passed
normal remove['a', 'c']['a', 'c']Passed
boundary remove[][]Passed
normal rename{'a': 'A', 'b': 'Bee', 'c': 'C'}{'a': 'A', 'b': 'Bee', 'c': 'C'}Passed
boundary rename{'': ''}{'': ''}Passed
normal empty-id['b']['b']Passed
boundary empty-id['']['']Passed
normal query-sourcebebePassed
boundary query-sourcePassed
normal clear{'draft': 'be', 'history': []}{'draft': 'be', 'history': []}Passed
boundary clear{'draft': '', 'history': []}{'draft': '', 'history': []}Passed
normal oldest-first-export['C', 'Old B', 'A']['C', 'Old B', 'A']Passed
boundary oldest-first-export[][]Passed
variant query or selection payload['id1']['id1']Passed
unknown completion event{'unchanged': True}{'unchanged': True}Passed

SHA-256 / c9e2a607b01cc7b4da6c25e60a8a5cd92a3ee2407c05ee42dff83f25005fab44

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 == 'record': return d['history']+[d['accepted']]
    if event == 'limit': return d['history'][:d['limit']]
    if event == 'scope': return d['history'] if d['scope']==d['entry_scope'] else []
    if event == 'preview': return d['history']
    if event == 'remove': return [x for x in d['history'] if x!=d['accepted']]
    if event == 'rename': return dict(d['labels'], **{d['accepted']:d['new_label']})
    if event == 'empty-id': return [d['accepted']]
    if event == 'query-source': return d['draft']
    if event == 'clear': return {'history':[],'draft':d['draft']}
    if event == 'oldest-first-export': return [d['labels'].get(x,x) for x in reversed(d['history'])]
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'history':['a','b','c'],'accepted':'b','draft':'be','preview':'p','scope':'fruit','entry_scope':'all','labels':{'a':'A','b':'Old B','c':'C'},'new_label':'Bee','limit':2,'epoch':N}
boundary = {'history':[],'accepted':'','draft':'','preview':None,'scope':'all','entry_scope':'all','labels':{},'new_label':'','limit':0,'epoch':N}
check('normal record', solve('record', normal), ['b','a','c'])
check('boundary record', solve('record', boundary), [''])
check('normal limit', solve('limit', normal), ['a','b'])
check('boundary limit', solve('limit', boundary), [])
check('normal scope', solve('scope', normal), [])
check('boundary scope', solve('scope', boundary), [])
check('normal preview', solve('preview', normal), ['a','b','c'])
check('boundary preview', solve('preview', boundary), [])
check('normal remove', solve('remove', normal), ['a','c'])
check('boundary remove', solve('remove', boundary), [])
check('normal rename', solve('rename', normal), {'a':'A','b':'Bee','c':'C'})
check('boundary rename', solve('rename', boundary), {'':''})
check('normal empty-id', solve('empty-id', normal), ['b'])
check('boundary empty-id', solve('empty-id', boundary), [''])
check('normal query-source', solve('query-source', normal), 'be')
check('boundary query-source', solve('query-source', boundary), '')
check('normal clear', solve('clear', normal), {'history':[],'draft':'be'})
check('boundary clear', solve('clear', boundary), {'history':[],'draft':''})
check('normal oldest-first-export', solve('oldest-first-export', normal), ['C','Old B','A'])
check('boundary oldest-first-export', solve('oldest-first-export', boundary), [])
variant = dict(normal, **{'accepted':'id'+str(N)})
check('variant query or selection payload', solve('empty-id', variant), ['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 fixtureActualExpectedOutcome
normal record['a', 'b', 'c', 'b']['b', 'a', 'c']Failed
boundary record['']['']Passed
normal limit['a', 'b']['a', 'b']Passed
boundary limit[][]Passed
normal scope[][]Passed
boundary scope[][]Passed
normal preview['a', 'b', 'c']['a', 'b', 'c']Passed
boundary preview[][]Passed
normal remove['a', 'c']['a', 'c']Passed
boundary remove[][]Passed
normal rename{'a': 'A', 'b': 'Bee', 'c': 'C'}{'a': 'A', 'b': 'Bee', 'c': 'C'}Passed
boundary rename{'': ''}{'': ''}Passed
normal empty-id['b']['b']Passed
boundary empty-id['']['']Passed
normal query-sourcebebePassed
boundary query-sourcePassed
normal clear{'draft': 'be', 'history': []}{'draft': 'be', 'history': []}Passed
boundary clear{'draft': '', 'history': []}{'draft': '', 'history': []}Passed
normal oldest-first-export['C', 'Old B', 'A']['C', 'Old B', 'A']Passed
boundary oldest-first-export[][]Passed
variant query or selection payload['id1']['id1']Passed
unknown completion event{'unchanged': True}{'unchanged': True}Passed

SHA-256 / 0a95df3b46b578a13a8276c5758d8ccc04d5b7bf0f248fcad8251b229d5a1a78

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 == 'record': return [d['accepted']]+[x for x in d['history'] if x!=d['accepted']]
    if event == 'limit': return d['history'][:d['limit']]
    if event == 'scope': return d['history'] if d['scope']==d['entry_scope'] else []
    if event == 'preview': return d['history']
    if event == 'remove': return [x for x in d['history'] if x!=d['accepted']]
    if event == 'rename': return dict(d['labels'], **{d['accepted']:d['new_label']})
    if event == 'empty-id': return [d['accepted']]
    if event == 'query-source': return d['draft']
    if event == 'clear': return {'history':[],'draft':d['draft']}
    if event == 'oldest-first-export': return [d['labels'].get(x,x) for x in reversed(d['history'])]
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'history':['a','b','c'],'accepted':'b','draft':'be','preview':'p','scope':'fruit','entry_scope':'all','labels':{'a':'A','b':'Old B','c':'C'},'new_label':'Bee','limit':2,'epoch':N}
boundary = {'history':[],'accepted':'','draft':'','preview':None,'scope':'all','entry_scope':'all','labels':{},'new_label':'','limit':0,'epoch':N}
check('normal record', solve('record', normal), ['b','a','c'])
check('boundary record', solve('record', boundary), [''])
check('normal limit', solve('limit', normal), ['a','b'])
check('boundary limit', solve('limit', boundary), [])
check('normal scope', solve('scope', normal), [])
check('boundary scope', solve('scope', boundary), [])
check('normal preview', solve('preview', normal), ['a','b','c'])
check('boundary preview', solve('preview', boundary), [])
check('normal remove', solve('remove', normal), ['a','c'])
check('boundary remove', solve('remove', boundary), [])
check('normal rename', solve('rename', normal), {'a':'A','b':'Bee','c':'C'})
check('boundary rename', solve('rename', boundary), {'':''})
check('normal empty-id', solve('empty-id', normal), ['b'])
check('boundary empty-id', solve('empty-id', boundary), [''])
check('normal query-source', solve('query-source', normal), 'be')
check('boundary query-source', solve('query-source', boundary), '')
check('normal clear', solve('clear', normal), {'history':[],'draft':'be'})
check('boundary clear', solve('clear', boundary), {'history':[],'draft':''})
check('normal oldest-first-export', solve('oldest-first-export', normal), ['C','Old B','A'])
check('boundary oldest-first-export', solve('oldest-first-export', boundary), [])
variant = dict(normal, **{'accepted':'id'+str(N)})
check('variant query or selection payload', solve('empty-id', variant), ['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 fixtureActualExpectedOutcome
normal record['b', 'a', 'c']['b', 'a', 'c']Passed
boundary record['']['']Passed
normal limit['a', 'b']['a', 'b']Passed
boundary limit[][]Passed
normal scope[][]Passed
boundary scope[][]Passed
normal preview['a', 'b', 'c']['a', 'b', 'c']Passed
boundary preview[][]Passed
normal remove['a', 'c']['a', 'c']Passed
boundary remove[][]Passed
normal rename{'a': 'A', 'b': 'Bee', 'c': 'C'}{'a': 'A', 'b': 'Bee', 'c': 'C'}Passed
boundary rename{'': ''}{'': ''}Passed
normal empty-id['b']['b']Passed
boundary empty-id['']['']Passed
normal query-sourcebebePassed
boundary query-sourcePassed
normal clear{'draft': 'be', 'history': []}{'draft': 'be', 'history': []}Passed
boundary clear{'draft': '', 'history': []}{'draft': '', 'history': []}Passed
normal oldest-first-export['C', 'Old B', 'A']['C', 'Old B', 'A']Passed
boundary oldest-first-export[][]Passed
variant query or selection payload['id1']['id1']Passed
unknown completion event{'unchanged': True}{'unchanged': True}Passed

SHA-256 / 9ac344a935f08a775a84e7a198e0d5ab8788025038c8d762283f46d706d12853

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

Case digest / 2f069bd091d70bfaa4915472480c1aa4c4695efc0ff6a42d5db205861ae3500e