FAILURE MAP
← Case archive

FA-22976 / Autocomplete interactions / Open access

Mention suggestion insertion: mention response can target a superseded trigger span · case 01

The stale completion transition produces an incorrect observable state.

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

ROOT CAUSE

At mention-completion/stale, the implementation evaluates `True` instead of preserving the specified completion transition.

THE FAILURE

At mention-completion/stale, the implementation evaluates `True` instead of preserving the specified completion transition.

Unsuccessful approach: The attempted repair uses `d['span_epoch']<=d['epoch']`, which still violates a normal or boundary completion fixture.

Case contract

A mention completion replaces only the active trigger span and stores a stable entity identifier separately from visible text. The trigger character is preserved exactly once, a trailing delimiter is added only when absent, and a stale mention query cannot replace a different trigger span. Offsets are code points.

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 == 'text': return d['text'][:d['start']]+d['trigger']+d['label']+d['text'][d['end']:]
    if event == 'identity': return d['id']
    if event == 'trigger': return d['trigger']+d['label']
    if event == 'query': return d['query']
    if event == 'delimiter': return '' if d['after'].startswith(' ') else ' '
    if event == 'caret': return d['start']+len(d['trigger'])+len(d['label'])
    if event == 'span': return [d['start'],d['start']+len(d['trigger'])+len(d['label'])]
    if event == 'stale': return True
    if event == 'tail': return d['text'][d['end']:]
    if event == 'descriptor': return [d['trigger'],d['query']]
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'text':'Hi @al now','start':3,'end':6,'label':'Alice','id':'u'+str(N),'trigger':'@','after':' now','query':'al','span_epoch':N-1,'epoch':N,'other':'#topic'}
boundary = {'text':'@','start':0,'end':1,'label':'','id':'','trigger':'@','after':'','query':'','span_epoch':N,'epoch':N,'other':''}
check('normal text', solve('text', normal), 'Hi @Alice now')
check('boundary text', solve('text', boundary), '@')
check('normal identity', solve('identity', normal), 'u'+str(N))
check('boundary identity', solve('identity', boundary), '')
check('normal trigger', solve('trigger', normal), '@Alice')
check('boundary trigger', solve('trigger', boundary), '@')
check('normal query', solve('query', normal), 'al')
check('boundary query', solve('query', boundary), '')
check('normal delimiter', solve('delimiter', normal), '')
check('boundary delimiter', solve('delimiter', boundary), ' ')
check('normal caret', solve('caret', normal), 9)
check('boundary caret', solve('caret', boundary), 1)
check('normal span', solve('span', normal), [3,9])
check('boundary span', solve('span', boundary), [0,1])
check('normal stale', solve('stale', normal), False)
check('boundary stale', solve('stale', boundary), True)
check('normal tail', solve('tail', normal), ' now')
check('boundary tail', solve('tail', boundary), '')
check('normal descriptor', solve('descriptor', normal), ['@','al'])
check('boundary descriptor', solve('descriptor', boundary), ['@',''])
variant = dict(normal, **{'id':'person'+str(N)})
check('variant query or selection payload', solve('identity', variant), 'person'+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 textHi @Alice nowHi @Alice nowPassed
boundary text@@Passed
normal identityu1u1Passed
boundary identityPassed
normal trigger@Alice@AlicePassed
boundary trigger@@Passed
normal queryalalPassed
boundary queryPassed
normal delimiterPassed
boundary delimiter Passed
normal caret99Passed
boundary caret11Passed
normal span[3, 9][3, 9]Passed
boundary span[0, 1][0, 1]Passed
normal staleTrueFalseFailed
boundary staleTrueTruePassed
normal tail now nowPassed
boundary tailPassed
normal descriptor['@', 'al']['@', 'al']Passed
boundary descriptor['@', '']['@', '']Passed
variant query or selection payloadperson1person1Passed
unknown completion event{'unchanged': True}{'unchanged': True}Passed

SHA-256 / b9722ecb5ae4fcb3ce42c7cec7b0c88fe9da2355ef083251a79d1c3c00156a1e

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 == 'text': return d['text'][:d['start']]+d['trigger']+d['label']+d['text'][d['end']:]
    if event == 'identity': return d['id']
    if event == 'trigger': return d['trigger']+d['label']
    if event == 'query': return d['query']
    if event == 'delimiter': return '' if d['after'].startswith(' ') else ' '
    if event == 'caret': return d['start']+len(d['trigger'])+len(d['label'])
    if event == 'span': return [d['start'],d['start']+len(d['trigger'])+len(d['label'])]
    if event == 'stale': return d['span_epoch']<=d['epoch']
    if event == 'tail': return d['text'][d['end']:]
    if event == 'descriptor': return [d['trigger'],d['query']]
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'text':'Hi @al now','start':3,'end':6,'label':'Alice','id':'u'+str(N),'trigger':'@','after':' now','query':'al','span_epoch':N-1,'epoch':N,'other':'#topic'}
boundary = {'text':'@','start':0,'end':1,'label':'','id':'','trigger':'@','after':'','query':'','span_epoch':N,'epoch':N,'other':''}
check('normal text', solve('text', normal), 'Hi @Alice now')
check('boundary text', solve('text', boundary), '@')
check('normal identity', solve('identity', normal), 'u'+str(N))
check('boundary identity', solve('identity', boundary), '')
check('normal trigger', solve('trigger', normal), '@Alice')
check('boundary trigger', solve('trigger', boundary), '@')
check('normal query', solve('query', normal), 'al')
check('boundary query', solve('query', boundary), '')
check('normal delimiter', solve('delimiter', normal), '')
check('boundary delimiter', solve('delimiter', boundary), ' ')
check('normal caret', solve('caret', normal), 9)
check('boundary caret', solve('caret', boundary), 1)
check('normal span', solve('span', normal), [3,9])
check('boundary span', solve('span', boundary), [0,1])
check('normal stale', solve('stale', normal), False)
check('boundary stale', solve('stale', boundary), True)
check('normal tail', solve('tail', normal), ' now')
check('boundary tail', solve('tail', boundary), '')
check('normal descriptor', solve('descriptor', normal), ['@','al'])
check('boundary descriptor', solve('descriptor', boundary), ['@',''])
variant = dict(normal, **{'id':'person'+str(N)})
check('variant query or selection payload', solve('identity', variant), 'person'+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 textHi @Alice nowHi @Alice nowPassed
boundary text@@Passed
normal identityu1u1Passed
boundary identityPassed
normal trigger@Alice@AlicePassed
boundary trigger@@Passed
normal queryalalPassed
boundary queryPassed
normal delimiterPassed
boundary delimiter Passed
normal caret99Passed
boundary caret11Passed
normal span[3, 9][3, 9]Passed
boundary span[0, 1][0, 1]Passed
normal staleTrueFalseFailed
boundary staleTrueTruePassed
normal tail now nowPassed
boundary tailPassed
normal descriptor['@', 'al']['@', 'al']Passed
boundary descriptor['@', '']['@', '']Passed
variant query or selection payloadperson1person1Passed
unknown completion event{'unchanged': True}{'unchanged': True}Passed

SHA-256 / 93c9642323be3ce96913593e38cc6eb9ced54a182581545ed6a9e157c4b8235c

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 22 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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

Case digest / 80c7c23caa9c5032da970bd2bf0c1a31b571707e30abfdf58759aa57b77b897e