FAILURE MAP
← Case archive

FA-21976 / Autocomplete interactions / Open access

Completion debounce lifecycle: deduplication compares against pending rather than emitted text · case 01

The duplicate completion transition produces an incorrect observable state.

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

ROOT CAUSE

At debounce/duplicate, the implementation evaluates `d['query']==d['pending']` instead of preserving the specified completion transition.

VERIFIED REPAIR

Implement the duplicate contract using `d['query']==d['sent']`.

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

Case contract

A new draft replaces the pending autocomplete job and its deadline. A deadline emits only its exact draft epoch; flush emits pending text once; cancellation discards pending text. Leading search marks its own query, and composition suspends timers. Time values are integer ticks.

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 == 'replace': return d['query']
    if event == 'deadline': return d['now']+d['delay']
    if event == 'expired': return d['pending'] if d['job_epoch']==d['epoch'] and d['now']>=d['deadline'] else None
    if event == 'flush': return [d['pending']] if d['pending'] is not None else []
    if event == 'cancel': return {'pending':None,'deadline':None}
    if event == 'leading': return {'sent':d['query'],'epoch':d['epoch']}
    if event == 'suspend': return None if d['composing'] else d['deadline']
    if event == 'duplicate': return d['query']==d['pending']
    if event == 'after-flush': return {'pending':None,'sent':d['pending'] if d['pending'] is not None else d['sent']}
    if event == 'retag': return {'job_epoch':d['epoch'],'query':d['query']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'query':'pea','pending':'pe','epoch':N,'job_epoch':N-1,'now':N*10,'delay':4,'deadline':N*10-1,'sent':'p','composing':True}
boundary = {'query':'','pending':None,'epoch':N,'job_epoch':N,'now':N*10,'delay':0,'deadline':N*10,'sent':'','composing':False}
check('normal replace', solve('replace', normal), 'pea')
check('boundary replace', solve('replace', boundary), '')
check('normal deadline', solve('deadline', normal), N*10+4)
check('boundary deadline', solve('deadline', boundary), N*10)
check('normal expired', solve('expired', normal), None)
check('boundary expired', solve('expired', boundary), None)
check('normal flush', solve('flush', normal), ['pe'])
check('boundary flush', solve('flush', boundary), [])
check('normal cancel', solve('cancel', normal), {'pending':None,'deadline':None})
check('boundary cancel', solve('cancel', boundary), {'pending':None,'deadline':None})
check('normal leading', solve('leading', normal), {'sent':'pea','epoch':N})
check('boundary leading', solve('leading', boundary), {'sent':'','epoch':N})
check('normal suspend', solve('suspend', normal), None)
check('boundary suspend', solve('suspend', boundary), N*10)
check('normal duplicate', solve('duplicate', normal), False)
check('boundary duplicate', solve('duplicate', boundary), True)
check('normal after-flush', solve('after-flush', normal), {'pending':None,'sent':'pe'})
check('boundary after-flush', solve('after-flush', boundary), {'pending':None,'sent':''})
check('normal retag', solve('retag', normal), {'job_epoch':N,'query':'pea'})
check('boundary retag', solve('retag', boundary), {'job_epoch':N,'query':''})
variant = dict(normal, **{'query':'q'*N})
check('variant query or selection payload', solve('replace', variant), 'q'*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 replacepeapeaPassed
boundary replacePassed
normal deadline1414Passed
boundary deadline1010Passed
normal expiredNoneNonePassed
boundary expiredNoneNonePassed
normal flush['pe']['pe']Passed
boundary flush[][]Passed
normal cancel{'deadline': None, 'pending': None}{'deadline': None, 'pending': None}Passed
boundary cancel{'deadline': None, 'pending': None}{'deadline': None, 'pending': None}Passed
normal leading{'epoch': 1, 'sent': 'pea'}{'epoch': 1, 'sent': 'pea'}Passed
boundary leading{'epoch': 1, 'sent': ''}{'epoch': 1, 'sent': ''}Passed
normal suspendNoneNonePassed
boundary suspend1010Passed
normal duplicateFalseFalsePassed
boundary duplicateFalseTrueFailed
normal after-flush{'pending': None, 'sent': 'pe'}{'pending': None, 'sent': 'pe'}Passed
boundary after-flush{'pending': None, 'sent': ''}{'pending': None, 'sent': ''}Passed
normal retag{'job_epoch': 1, 'query': 'pea'}{'job_epoch': 1, 'query': 'pea'}Passed
boundary retag{'job_epoch': 1, 'query': ''}{'job_epoch': 1, 'query': ''}Passed
variant query or selection payloadqqPassed
unknown completion event{'unchanged': True}{'unchanged': True}Passed

SHA-256 / a325736a482b98095d067dff62f18afde8a359cb03dcd44ace147e869fe096f8

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 == 'replace': return d['query']
    if event == 'deadline': return d['now']+d['delay']
    if event == 'expired': return d['pending'] if d['job_epoch']==d['epoch'] and d['now']>=d['deadline'] else None
    if event == 'flush': return [d['pending']] if d['pending'] is not None else []
    if event == 'cancel': return {'pending':None,'deadline':None}
    if event == 'leading': return {'sent':d['query'],'epoch':d['epoch']}
    if event == 'suspend': return None if d['composing'] else d['deadline']
    if event == 'duplicate': return False
    if event == 'after-flush': return {'pending':None,'sent':d['pending'] if d['pending'] is not None else d['sent']}
    if event == 'retag': return {'job_epoch':d['epoch'],'query':d['query']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'query':'pea','pending':'pe','epoch':N,'job_epoch':N-1,'now':N*10,'delay':4,'deadline':N*10-1,'sent':'p','composing':True}
boundary = {'query':'','pending':None,'epoch':N,'job_epoch':N,'now':N*10,'delay':0,'deadline':N*10,'sent':'','composing':False}
check('normal replace', solve('replace', normal), 'pea')
check('boundary replace', solve('replace', boundary), '')
check('normal deadline', solve('deadline', normal), N*10+4)
check('boundary deadline', solve('deadline', boundary), N*10)
check('normal expired', solve('expired', normal), None)
check('boundary expired', solve('expired', boundary), None)
check('normal flush', solve('flush', normal), ['pe'])
check('boundary flush', solve('flush', boundary), [])
check('normal cancel', solve('cancel', normal), {'pending':None,'deadline':None})
check('boundary cancel', solve('cancel', boundary), {'pending':None,'deadline':None})
check('normal leading', solve('leading', normal), {'sent':'pea','epoch':N})
check('boundary leading', solve('leading', boundary), {'sent':'','epoch':N})
check('normal suspend', solve('suspend', normal), None)
check('boundary suspend', solve('suspend', boundary), N*10)
check('normal duplicate', solve('duplicate', normal), False)
check('boundary duplicate', solve('duplicate', boundary), True)
check('normal after-flush', solve('after-flush', normal), {'pending':None,'sent':'pe'})
check('boundary after-flush', solve('after-flush', boundary), {'pending':None,'sent':''})
check('normal retag', solve('retag', normal), {'job_epoch':N,'query':'pea'})
check('boundary retag', solve('retag', boundary), {'job_epoch':N,'query':''})
variant = dict(normal, **{'query':'q'*N})
check('variant query or selection payload', solve('replace', variant), 'q'*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 replacepeapeaPassed
boundary replacePassed
normal deadline1414Passed
boundary deadline1010Passed
normal expiredNoneNonePassed
boundary expiredNoneNonePassed
normal flush['pe']['pe']Passed
boundary flush[][]Passed
normal cancel{'deadline': None, 'pending': None}{'deadline': None, 'pending': None}Passed
boundary cancel{'deadline': None, 'pending': None}{'deadline': None, 'pending': None}Passed
normal leading{'epoch': 1, 'sent': 'pea'}{'epoch': 1, 'sent': 'pea'}Passed
boundary leading{'epoch': 1, 'sent': ''}{'epoch': 1, 'sent': ''}Passed
normal suspendNoneNonePassed
boundary suspend1010Passed
normal duplicateFalseFalsePassed
boundary duplicateFalseTrueFailed
normal after-flush{'pending': None, 'sent': 'pe'}{'pending': None, 'sent': 'pe'}Passed
boundary after-flush{'pending': None, 'sent': ''}{'pending': None, 'sent': ''}Passed
normal retag{'job_epoch': 1, 'query': 'pea'}{'job_epoch': 1, 'query': 'pea'}Passed
boundary retag{'job_epoch': 1, 'query': ''}{'job_epoch': 1, 'query': ''}Passed
variant query or selection payloadqqPassed
unknown completion event{'unchanged': True}{'unchanged': True}Passed

SHA-256 / a38f7688005f5f2ed248b3fa29afd2b552fc5249bfcbaeb85ebfeeaab231fde0

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 == 'replace': return d['query']
    if event == 'deadline': return d['now']+d['delay']
    if event == 'expired': return d['pending'] if d['job_epoch']==d['epoch'] and d['now']>=d['deadline'] else None
    if event == 'flush': return [d['pending']] if d['pending'] is not None else []
    if event == 'cancel': return {'pending':None,'deadline':None}
    if event == 'leading': return {'sent':d['query'],'epoch':d['epoch']}
    if event == 'suspend': return None if d['composing'] else d['deadline']
    if event == 'duplicate': return d['query']==d['sent']
    if event == 'after-flush': return {'pending':None,'sent':d['pending'] if d['pending'] is not None else d['sent']}
    if event == 'retag': return {'job_epoch':d['epoch'],'query':d['query']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'query':'pea','pending':'pe','epoch':N,'job_epoch':N-1,'now':N*10,'delay':4,'deadline':N*10-1,'sent':'p','composing':True}
boundary = {'query':'','pending':None,'epoch':N,'job_epoch':N,'now':N*10,'delay':0,'deadline':N*10,'sent':'','composing':False}
check('normal replace', solve('replace', normal), 'pea')
check('boundary replace', solve('replace', boundary), '')
check('normal deadline', solve('deadline', normal), N*10+4)
check('boundary deadline', solve('deadline', boundary), N*10)
check('normal expired', solve('expired', normal), None)
check('boundary expired', solve('expired', boundary), None)
check('normal flush', solve('flush', normal), ['pe'])
check('boundary flush', solve('flush', boundary), [])
check('normal cancel', solve('cancel', normal), {'pending':None,'deadline':None})
check('boundary cancel', solve('cancel', boundary), {'pending':None,'deadline':None})
check('normal leading', solve('leading', normal), {'sent':'pea','epoch':N})
check('boundary leading', solve('leading', boundary), {'sent':'','epoch':N})
check('normal suspend', solve('suspend', normal), None)
check('boundary suspend', solve('suspend', boundary), N*10)
check('normal duplicate', solve('duplicate', normal), False)
check('boundary duplicate', solve('duplicate', boundary), True)
check('normal after-flush', solve('after-flush', normal), {'pending':None,'sent':'pe'})
check('boundary after-flush', solve('after-flush', boundary), {'pending':None,'sent':''})
check('normal retag', solve('retag', normal), {'job_epoch':N,'query':'pea'})
check('boundary retag', solve('retag', boundary), {'job_epoch':N,'query':''})
variant = dict(normal, **{'query':'q'*N})
check('variant query or selection payload', solve('replace', variant), 'q'*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 replacepeapeaPassed
boundary replacePassed
normal deadline1414Passed
boundary deadline1010Passed
normal expiredNoneNonePassed
boundary expiredNoneNonePassed
normal flush['pe']['pe']Passed
boundary flush[][]Passed
normal cancel{'deadline': None, 'pending': None}{'deadline': None, 'pending': None}Passed
boundary cancel{'deadline': None, 'pending': None}{'deadline': None, 'pending': None}Passed
normal leading{'epoch': 1, 'sent': 'pea'}{'epoch': 1, 'sent': 'pea'}Passed
boundary leading{'epoch': 1, 'sent': ''}{'epoch': 1, 'sent': ''}Passed
normal suspendNoneNonePassed
boundary suspend1010Passed
normal duplicateFalseFalsePassed
boundary duplicateTrueTruePassed
normal after-flush{'pending': None, 'sent': 'pe'}{'pending': None, 'sent': 'pe'}Passed
boundary after-flush{'pending': None, 'sent': ''}{'pending': None, 'sent': ''}Passed
normal retag{'job_epoch': 1, 'query': 'pea'}{'job_epoch': 1, 'query': 'pea'}Passed
boundary retag{'job_epoch': 1, 'query': ''}{'job_epoch': 1, 'query': ''}Passed
variant query or selection payloadqqPassed
unknown completion event{'unchanged': True}{'unchanged': True}Passed

SHA-256 / e653766449d0be814f6322db30e4ffe3e4a0cc5717f3a27d73bea44ad79b09ab

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

Case digest / 8b3c45fe0ba86fba226dbe4e74a5bbd5fb9ebaa3400284eb4bb6a78362f63649