FAILURE MAP
← Case archive

FA-23211 / Autocomplete interactions / Open access

Search normalization versus displayed autocomplete text: result query is compared with unnormalized visible draft · case 01

The match-key completion transition produces an incorrect observable state.

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

ROOT CAUSE

At query-display/match-key, the implementation evaluates `d['result_query']==d['draft']` instead of preserving the specified completion transition.

VERIFIED REPAIR

Implement the match-key contract using `d['result_query']==d['normalized']`.

Unsuccessful approach: The attempted repair uses `False`, which still violates a normal or boundary completion fixture.

Case contract

This controlled ASCII picker normalizes lookup by stripping outer whitespace and lowercasing, while preserving exact user draft and canonical option labels for display and commit. Matching offsets apply to the normalized query only; a normalization-equivalent edit still advances the display epoch.

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 == 'lookup': return d['draft'].strip().lower()
    if event == 'display': return d['draft']
    if event == 'commit-label': return d['label']
    if event == 'commit-id': return d['id']
    if event == 'match-key': return d['result_query']==d['draft']
    if event == 'offset': return [d['prefix_space'],d['prefix_space']+len(d['normalized'])]
    if event == 'display-epoch': return d['epoch']+1
    if event == 'query-equivalent': return d['old']==d['normalized']
    if event == 'caret-display': return d['caret']
    if event == 'empty-query': return 'empty' if not d['normalized'] else 'typed'
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'draft':'  PeA  ','label':'Pear','id':'p1','normalized':'pea','prefix_space':2,'epoch':N,'old':'pea','result_query':'pea','caret':5}
boundary = {'draft':'','label':'','id':'','normalized':'','prefix_space':0,'epoch':N,'old':'','result_query':'','caret':0}
check('normal lookup', solve('lookup', normal), 'pea')
check('boundary lookup', solve('lookup', boundary), '')
check('normal display', solve('display', normal), '  PeA  ')
check('boundary display', solve('display', boundary), '')
check('normal commit-label', solve('commit-label', normal), 'Pear')
check('boundary commit-label', solve('commit-label', boundary), '')
check('normal commit-id', solve('commit-id', normal), 'p1')
check('boundary commit-id', solve('commit-id', boundary), '')
check('normal match-key', solve('match-key', normal), True)
check('boundary match-key', solve('match-key', boundary), True)
check('normal offset', solve('offset', normal), [2,5])
check('boundary offset', solve('offset', boundary), [0,0])
check('normal display-epoch', solve('display-epoch', normal), N+1)
check('boundary display-epoch', solve('display-epoch', boundary), N+1)
check('normal query-equivalent', solve('query-equivalent', normal), True)
check('boundary query-equivalent', solve('query-equivalent', boundary), True)
check('normal caret-display', solve('caret-display', normal), 5)
check('boundary caret-display', solve('caret-display', boundary), 0)
check('normal empty-query', solve('empty-query', normal), 'typed')
check('boundary empty-query', solve('empty-query', boundary), 'empty')
variant = dict(normal, **{'draft':' '*N+'PEAR'+' '*N})
check('variant query or selection payload', solve('lookup', variant), 'pear')
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 lookuppeapeaPassed
boundary lookupPassed
normal display PeA PeA Passed
boundary displayPassed
normal commit-labelPearPearPassed
boundary commit-labelPassed
normal commit-idp1p1Passed
boundary commit-idPassed
normal match-keyFalseTrueFailed
boundary match-keyTrueTruePassed
normal offset[2, 5][2, 5]Passed
boundary offset[0, 0][0, 0]Passed
normal display-epoch22Passed
boundary display-epoch22Passed
normal query-equivalentTrueTruePassed
boundary query-equivalentTrueTruePassed
normal caret-display55Passed
boundary caret-display00Passed
normal empty-querytypedtypedPassed
boundary empty-queryemptyemptyPassed
variant query or selection payloadpearpearPassed
unknown completion event{'unchanged': True}{'unchanged': True}Passed

SHA-256 / bde2f4b1d10a140e58b24a9606a022a8a3ae4c865726b3e45a29552c78d61ae2

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 == 'lookup': return d['draft'].strip().lower()
    if event == 'display': return d['draft']
    if event == 'commit-label': return d['label']
    if event == 'commit-id': return d['id']
    if event == 'match-key': return False
    if event == 'offset': return [d['prefix_space'],d['prefix_space']+len(d['normalized'])]
    if event == 'display-epoch': return d['epoch']+1
    if event == 'query-equivalent': return d['old']==d['normalized']
    if event == 'caret-display': return d['caret']
    if event == 'empty-query': return 'empty' if not d['normalized'] else 'typed'
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'draft':'  PeA  ','label':'Pear','id':'p1','normalized':'pea','prefix_space':2,'epoch':N,'old':'pea','result_query':'pea','caret':5}
boundary = {'draft':'','label':'','id':'','normalized':'','prefix_space':0,'epoch':N,'old':'','result_query':'','caret':0}
check('normal lookup', solve('lookup', normal), 'pea')
check('boundary lookup', solve('lookup', boundary), '')
check('normal display', solve('display', normal), '  PeA  ')
check('boundary display', solve('display', boundary), '')
check('normal commit-label', solve('commit-label', normal), 'Pear')
check('boundary commit-label', solve('commit-label', boundary), '')
check('normal commit-id', solve('commit-id', normal), 'p1')
check('boundary commit-id', solve('commit-id', boundary), '')
check('normal match-key', solve('match-key', normal), True)
check('boundary match-key', solve('match-key', boundary), True)
check('normal offset', solve('offset', normal), [2,5])
check('boundary offset', solve('offset', boundary), [0,0])
check('normal display-epoch', solve('display-epoch', normal), N+1)
check('boundary display-epoch', solve('display-epoch', boundary), N+1)
check('normal query-equivalent', solve('query-equivalent', normal), True)
check('boundary query-equivalent', solve('query-equivalent', boundary), True)
check('normal caret-display', solve('caret-display', normal), 5)
check('boundary caret-display', solve('caret-display', boundary), 0)
check('normal empty-query', solve('empty-query', normal), 'typed')
check('boundary empty-query', solve('empty-query', boundary), 'empty')
variant = dict(normal, **{'draft':' '*N+'PEAR'+' '*N})
check('variant query or selection payload', solve('lookup', variant), 'pear')
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 lookuppeapeaPassed
boundary lookupPassed
normal display PeA PeA Passed
boundary displayPassed
normal commit-labelPearPearPassed
boundary commit-labelPassed
normal commit-idp1p1Passed
boundary commit-idPassed
normal match-keyFalseTrueFailed
boundary match-keyFalseTrueFailed
normal offset[2, 5][2, 5]Passed
boundary offset[0, 0][0, 0]Passed
normal display-epoch22Passed
boundary display-epoch22Passed
normal query-equivalentTrueTruePassed
boundary query-equivalentTrueTruePassed
normal caret-display55Passed
boundary caret-display00Passed
normal empty-querytypedtypedPassed
boundary empty-queryemptyemptyPassed
variant query or selection payloadpearpearPassed
unknown completion event{'unchanged': True}{'unchanged': True}Passed

SHA-256 / 2209a7dfa272bea531ff34aa3449618e2cdee4b637f01052f6b7327d80922bac

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 == 'lookup': return d['draft'].strip().lower()
    if event == 'display': return d['draft']
    if event == 'commit-label': return d['label']
    if event == 'commit-id': return d['id']
    if event == 'match-key': return d['result_query']==d['normalized']
    if event == 'offset': return [d['prefix_space'],d['prefix_space']+len(d['normalized'])]
    if event == 'display-epoch': return d['epoch']+1
    if event == 'query-equivalent': return d['old']==d['normalized']
    if event == 'caret-display': return d['caret']
    if event == 'empty-query': return 'empty' if not d['normalized'] else 'typed'
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'draft':'  PeA  ','label':'Pear','id':'p1','normalized':'pea','prefix_space':2,'epoch':N,'old':'pea','result_query':'pea','caret':5}
boundary = {'draft':'','label':'','id':'','normalized':'','prefix_space':0,'epoch':N,'old':'','result_query':'','caret':0}
check('normal lookup', solve('lookup', normal), 'pea')
check('boundary lookup', solve('lookup', boundary), '')
check('normal display', solve('display', normal), '  PeA  ')
check('boundary display', solve('display', boundary), '')
check('normal commit-label', solve('commit-label', normal), 'Pear')
check('boundary commit-label', solve('commit-label', boundary), '')
check('normal commit-id', solve('commit-id', normal), 'p1')
check('boundary commit-id', solve('commit-id', boundary), '')
check('normal match-key', solve('match-key', normal), True)
check('boundary match-key', solve('match-key', boundary), True)
check('normal offset', solve('offset', normal), [2,5])
check('boundary offset', solve('offset', boundary), [0,0])
check('normal display-epoch', solve('display-epoch', normal), N+1)
check('boundary display-epoch', solve('display-epoch', boundary), N+1)
check('normal query-equivalent', solve('query-equivalent', normal), True)
check('boundary query-equivalent', solve('query-equivalent', boundary), True)
check('normal caret-display', solve('caret-display', normal), 5)
check('boundary caret-display', solve('caret-display', boundary), 0)
check('normal empty-query', solve('empty-query', normal), 'typed')
check('boundary empty-query', solve('empty-query', boundary), 'empty')
variant = dict(normal, **{'draft':' '*N+'PEAR'+' '*N})
check('variant query or selection payload', solve('lookup', variant), 'pear')
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 lookuppeapeaPassed
boundary lookupPassed
normal display PeA PeA Passed
boundary displayPassed
normal commit-labelPearPearPassed
boundary commit-labelPassed
normal commit-idp1p1Passed
boundary commit-idPassed
normal match-keyTrueTruePassed
boundary match-keyTrueTruePassed
normal offset[2, 5][2, 5]Passed
boundary offset[0, 0][0, 0]Passed
normal display-epoch22Passed
boundary display-epoch22Passed
normal query-equivalentTrueTruePassed
boundary query-equivalentTrueTruePassed
normal caret-display55Passed
boundary caret-display00Passed
normal empty-querytypedtypedPassed
boundary empty-queryemptyemptyPassed
variant query or selection payloadpearpearPassed
unknown completion event{'unchanged': True}{'unchanged': True}Passed

SHA-256 / e1011903c77a7f2dd23116983bb8581562c25d3d682a4fd7e477381fa5590de1

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

Case digest / c2c0e457b917e3b60ae2ff98fe1388ce60054b681b740644bd4d5a803d87c910