FA-21991 / Autocomplete interactions / Open access
Suggestion identity reconciliation: duplicate result identifiers render duplicate suggestions · case 01
The dedupe completion transition produces an incorrect observable state.
ROOT CAUSE
At result-reconcile/dedupe, the implementation evaluates `d['ids']` instead of preserving the specified completion transition.
VERIFIED REPAIR
Implement the dedupe contract using `list(dict.fromkeys(d['ids']))`.
Unsuccessful approach: The attempted repair uses `sorted(set(d['ids']),reverse=True)`, which still violates a normal or boundary completion fixture.
Case contract
On a new result snapshot, option identifiers determine continuity; labels are presentation only. Duplicate identifiers collapse at their first occurrence. Active and selected identities survive only where specified, and a query replacement clears transient result state.
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 == 'dedupe': return d['ids']
if event == 'active-index': return d['ids'].index(d['active']) if d['active'] in d['ids'] else None
if event == 'added': return [x for x in dict.fromkeys(d['ids']) if x not in d['old']]
if event == 'removed': return [x for x in d['old'] if x not in d['ids']]
if event == 'committed': return d['selected']
if event == 'active-label': return d['labels'][d['ids'].index(d['active'])] if d['active'] in d['ids'] else ''
if event == 'render-query': return d['ids'] if d['query']==d['result_query'] else []
if event == 'replacement': return {'active':None,'epoch':d['epoch']+1}
if event == 'row-key': return [[x,i] for i,x in enumerate(d['ids'])]
if event == 'selection-visible': return {'has_value':d['selected'] is not None,'in_results':d['selected'] in d['ids']}
return {'unchanged': True}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'old':['a','b'],'ids':['b','c','b'],'labels':['Bee','See','Bee'],'active':'b','selected':'z','old_label':'Old Bee','query':'be','result_query':'b','epoch':N}
boundary = {'old':[],'ids':[],'labels':[],'active':None,'selected':None,'old_label':'','query':'','result_query':'','epoch':N}
check('normal dedupe', solve('dedupe', normal), ['b','c'])
check('boundary dedupe', solve('dedupe', boundary), [])
check('normal active-index', solve('active-index', normal), 0)
check('boundary active-index', solve('active-index', boundary), None)
check('normal added', solve('added', normal), ['c'])
check('boundary added', solve('added', boundary), [])
check('normal removed', solve('removed', normal), ['a'])
check('boundary removed', solve('removed', boundary), [])
check('normal committed', solve('committed', normal), 'z')
check('boundary committed', solve('committed', boundary), None)
check('normal active-label', solve('active-label', normal), 'Bee')
check('boundary active-label', solve('active-label', boundary), '')
check('normal render-query', solve('render-query', normal), [])
check('boundary render-query', solve('render-query', boundary), [])
check('normal replacement', solve('replacement', normal), {'active':None,'epoch':N+1})
check('boundary replacement', solve('replacement', boundary), {'active':None,'epoch':N+1})
check('normal row-key', solve('row-key', normal), [['b',0],['c',1],['b',2]])
check('boundary row-key', solve('row-key', boundary), [])
check('normal selection-visible', solve('selection-visible', normal), {'has_value':True,'in_results':False})
check('boundary selection-visible', solve('selection-visible', boundary), {'has_value':False,'in_results':False})
variant = dict(normal, **{'selected':'id'+str(N)})
check('variant query or selection payload', solve('committed', 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| normal dedupe | ['b', 'c', 'b'] | ['b', 'c'] | Failed |
| boundary dedupe | [] | [] | Passed |
| normal active-index | 0 | 0 | Passed |
| boundary active-index | None | None | Passed |
| normal added | ['c'] | ['c'] | Passed |
| boundary added | [] | [] | Passed |
| normal removed | ['a'] | ['a'] | Passed |
| boundary removed | [] | [] | Passed |
| normal committed | z | z | Passed |
| boundary committed | None | None | Passed |
| normal active-label | Bee | Bee | Passed |
| boundary active-label | | | Passed |
| normal render-query | [] | [] | Passed |
| boundary render-query | [] | [] | Passed |
| normal replacement | {'active': None, 'epoch': 2} | {'active': None, 'epoch': 2} | Passed |
| boundary replacement | {'active': None, 'epoch': 2} | {'active': None, 'epoch': 2} | Passed |
| normal row-key | [['b', 0], ['c', 1], ['b', 2]] | [['b', 0], ['c', 1], ['b', 2]] | Passed |
| boundary row-key | [] | [] | Passed |
| normal selection-visible | {'has_value': True, 'in_results': False} | {'has_value': True, 'in_results': False} | Passed |
| boundary selection-visible | {'has_value': False, 'in_results': False} | {'has_value': False, 'in_results': False} | Passed |
| variant query or selection payload | id1 | id1 | Passed |
| unknown completion event | {'unchanged': True} | {'unchanged': True} | Passed |
SHA-256 / e484e3e9a6a69d4164200cc7d346e0142d6458ec5f158a979587a0c4261ec669
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 == 'dedupe': return sorted(set(d['ids']),reverse=True)
if event == 'active-index': return d['ids'].index(d['active']) if d['active'] in d['ids'] else None
if event == 'added': return [x for x in dict.fromkeys(d['ids']) if x not in d['old']]
if event == 'removed': return [x for x in d['old'] if x not in d['ids']]
if event == 'committed': return d['selected']
if event == 'active-label': return d['labels'][d['ids'].index(d['active'])] if d['active'] in d['ids'] else ''
if event == 'render-query': return d['ids'] if d['query']==d['result_query'] else []
if event == 'replacement': return {'active':None,'epoch':d['epoch']+1}
if event == 'row-key': return [[x,i] for i,x in enumerate(d['ids'])]
if event == 'selection-visible': return {'has_value':d['selected'] is not None,'in_results':d['selected'] in d['ids']}
return {'unchanged': True}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'old':['a','b'],'ids':['b','c','b'],'labels':['Bee','See','Bee'],'active':'b','selected':'z','old_label':'Old Bee','query':'be','result_query':'b','epoch':N}
boundary = {'old':[],'ids':[],'labels':[],'active':None,'selected':None,'old_label':'','query':'','result_query':'','epoch':N}
check('normal dedupe', solve('dedupe', normal), ['b','c'])
check('boundary dedupe', solve('dedupe', boundary), [])
check('normal active-index', solve('active-index', normal), 0)
check('boundary active-index', solve('active-index', boundary), None)
check('normal added', solve('added', normal), ['c'])
check('boundary added', solve('added', boundary), [])
check('normal removed', solve('removed', normal), ['a'])
check('boundary removed', solve('removed', boundary), [])
check('normal committed', solve('committed', normal), 'z')
check('boundary committed', solve('committed', boundary), None)
check('normal active-label', solve('active-label', normal), 'Bee')
check('boundary active-label', solve('active-label', boundary), '')
check('normal render-query', solve('render-query', normal), [])
check('boundary render-query', solve('render-query', boundary), [])
check('normal replacement', solve('replacement', normal), {'active':None,'epoch':N+1})
check('boundary replacement', solve('replacement', boundary), {'active':None,'epoch':N+1})
check('normal row-key', solve('row-key', normal), [['b',0],['c',1],['b',2]])
check('boundary row-key', solve('row-key', boundary), [])
check('normal selection-visible', solve('selection-visible', normal), {'has_value':True,'in_results':False})
check('boundary selection-visible', solve('selection-visible', boundary), {'has_value':False,'in_results':False})
variant = dict(normal, **{'selected':'id'+str(N)})
check('variant query or selection payload', solve('committed', 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| normal dedupe | ['c', 'b'] | ['b', 'c'] | Failed |
| boundary dedupe | [] | [] | Passed |
| normal active-index | 0 | 0 | Passed |
| boundary active-index | None | None | Passed |
| normal added | ['c'] | ['c'] | Passed |
| boundary added | [] | [] | Passed |
| normal removed | ['a'] | ['a'] | Passed |
| boundary removed | [] | [] | Passed |
| normal committed | z | z | Passed |
| boundary committed | None | None | Passed |
| normal active-label | Bee | Bee | Passed |
| boundary active-label | | | Passed |
| normal render-query | [] | [] | Passed |
| boundary render-query | [] | [] | Passed |
| normal replacement | {'active': None, 'epoch': 2} | {'active': None, 'epoch': 2} | Passed |
| boundary replacement | {'active': None, 'epoch': 2} | {'active': None, 'epoch': 2} | Passed |
| normal row-key | [['b', 0], ['c', 1], ['b', 2]] | [['b', 0], ['c', 1], ['b', 2]] | Passed |
| boundary row-key | [] | [] | Passed |
| normal selection-visible | {'has_value': True, 'in_results': False} | {'has_value': True, 'in_results': False} | Passed |
| boundary selection-visible | {'has_value': False, 'in_results': False} | {'has_value': False, 'in_results': False} | Passed |
| variant query or selection payload | id1 | id1 | Passed |
| unknown completion event | {'unchanged': True} | {'unchanged': True} | Passed |
SHA-256 / 5fee1e307e21ade807449401b895eb21cdffd0f9541c58fcb93e5401b7b0d9ff
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 == 'dedupe': return list(dict.fromkeys(d['ids']))
if event == 'active-index': return d['ids'].index(d['active']) if d['active'] in d['ids'] else None
if event == 'added': return [x for x in dict.fromkeys(d['ids']) if x not in d['old']]
if event == 'removed': return [x for x in d['old'] if x not in d['ids']]
if event == 'committed': return d['selected']
if event == 'active-label': return d['labels'][d['ids'].index(d['active'])] if d['active'] in d['ids'] else ''
if event == 'render-query': return d['ids'] if d['query']==d['result_query'] else []
if event == 'replacement': return {'active':None,'epoch':d['epoch']+1}
if event == 'row-key': return [[x,i] for i,x in enumerate(d['ids'])]
if event == 'selection-visible': return {'has_value':d['selected'] is not None,'in_results':d['selected'] in d['ids']}
return {'unchanged': True}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'old':['a','b'],'ids':['b','c','b'],'labels':['Bee','See','Bee'],'active':'b','selected':'z','old_label':'Old Bee','query':'be','result_query':'b','epoch':N}
boundary = {'old':[],'ids':[],'labels':[],'active':None,'selected':None,'old_label':'','query':'','result_query':'','epoch':N}
check('normal dedupe', solve('dedupe', normal), ['b','c'])
check('boundary dedupe', solve('dedupe', boundary), [])
check('normal active-index', solve('active-index', normal), 0)
check('boundary active-index', solve('active-index', boundary), None)
check('normal added', solve('added', normal), ['c'])
check('boundary added', solve('added', boundary), [])
check('normal removed', solve('removed', normal), ['a'])
check('boundary removed', solve('removed', boundary), [])
check('normal committed', solve('committed', normal), 'z')
check('boundary committed', solve('committed', boundary), None)
check('normal active-label', solve('active-label', normal), 'Bee')
check('boundary active-label', solve('active-label', boundary), '')
check('normal render-query', solve('render-query', normal), [])
check('boundary render-query', solve('render-query', boundary), [])
check('normal replacement', solve('replacement', normal), {'active':None,'epoch':N+1})
check('boundary replacement', solve('replacement', boundary), {'active':None,'epoch':N+1})
check('normal row-key', solve('row-key', normal), [['b',0],['c',1],['b',2]])
check('boundary row-key', solve('row-key', boundary), [])
check('normal selection-visible', solve('selection-visible', normal), {'has_value':True,'in_results':False})
check('boundary selection-visible', solve('selection-visible', boundary), {'has_value':False,'in_results':False})
variant = dict(normal, **{'selected':'id'+str(N)})
check('variant query or selection payload', solve('committed', 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| normal dedupe | ['b', 'c'] | ['b', 'c'] | Passed |
| boundary dedupe | [] | [] | Passed |
| normal active-index | 0 | 0 | Passed |
| boundary active-index | None | None | Passed |
| normal added | ['c'] | ['c'] | Passed |
| boundary added | [] | [] | Passed |
| normal removed | ['a'] | ['a'] | Passed |
| boundary removed | [] | [] | Passed |
| normal committed | z | z | Passed |
| boundary committed | None | None | Passed |
| normal active-label | Bee | Bee | Passed |
| boundary active-label | | | Passed |
| normal render-query | [] | [] | Passed |
| boundary render-query | [] | [] | Passed |
| normal replacement | {'active': None, 'epoch': 2} | {'active': None, 'epoch': 2} | Passed |
| boundary replacement | {'active': None, 'epoch': 2} | {'active': None, 'epoch': 2} | Passed |
| normal row-key | [['b', 0], ['c', 1], ['b', 2]] | [['b', 0], ['c', 1], ['b', 2]] | Passed |
| boundary row-key | [] | [] | Passed |
| normal selection-visible | {'has_value': True, 'in_results': False} | {'has_value': True, 'in_results': False} | Passed |
| boundary selection-visible | {'has_value': False, 'in_results': False} | {'has_value': False, 'in_results': False} | Passed |
| variant query or selection payload | id1 | id1 | Passed |
| unknown completion event | {'unchanged': True} | {'unchanged': True} | Passed |
SHA-256 / 8bf1369d87654a9b61623b929942827f9f5acc99815f1652f51067242a827d7b
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:34.241984+00:00.
Case digest / 0fc455a319d63cc4f72eba7934bc98553cfe9480669598db01991c981e0ac511