FAILURE MAP
← Case archive

FA-22116 / Autocomplete interactions / Open access

Multi-value autocomplete tokens: capacity counts search characters rather than selected tokens · case 01

The capacity completion transition produces an incorrect observable state.

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

ROOT CAUSE

At multiple-values/capacity, the implementation evaluates `max(0,d['limit']-len(d['selected'])-bool(d['draft']))` instead of preserving the specified completion transition.

VERIFIED REPAIR

Implement the capacity contract using `max(0,d['limit']-len(d['selected']))`.

Unsuccessful approach: The attempted repair uses `d['limit']`, 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'])-bool(d['draft']))
    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 fixtureActualExpectedOutcome
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 capacity01Failed
boundary capacity00Passed
normal at-limitFalseFalsePassed
boundary at-limitTrueTruePassed
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 / 2e2b14315a4f0572b74e9081b2fc6936058427c28690852f111c65fdd211e035

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 d['limit']
    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 fixtureActualExpectedOutcome
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 capacity31Failed
boundary capacity00Passed
normal at-limitFalseFalsePassed
boundary at-limitTrueTruePassed
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 / fadd38fcc20e96178290f6397e4cbff5c5b8e735c80cb284039fc6903777df59

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 fixtureActualExpectedOutcome
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 capacity11Passed
boundary capacity00Passed
normal at-limitFalseFalsePassed
boundary at-limitTrueTruePassed
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.312748+00:00.

Case digest / 7acc7af4478566b495d96adbaac9f413fc302ef60c316a7f5cfd9e8fca5a8e14