FAILURE MAP
← Case archive

FA-22206 / Autocomplete interactions / Open access

Inline completion preview: ghost text overlays a noncollapsed input selection · case 01

The selected completion transition produces an incorrect observable state.

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

ROOT CAUSE

At inline-preview/selected, the implementation evaluates `True` instead of preserving the specified completion transition.

VERIFIED REPAIR

Implement the selected contract using `d['start']==d['end']`.

Unsuccessful approach: The attempted repair uses `d['start']==d['end'] and d['start']==0`, which still violates a normal or boundary completion fixture.

Case contract

An inline ghost suffix is presentation only: it must not alter submitted draft or committed identifier. Prefix-compatible candidates yield only their remaining suffix; preview acceptance materializes the candidate and rejection keeps the draft. A noncollapsed caret selection suppresses ghost text.

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 == 'suffix': return d['candidate'][len(d['draft']):] if d['candidate'].startswith(d['draft']) else ''
    if event == 'submit': return d['draft']
    if event == 'value': return d['value']
    if event == 'selected': return True
    if event == 'fresh': return d['preview_epoch']==d['epoch']
    if event == 'accept': return d['candidate'] if d['matching'] else d['draft']
    if event == 'reject': return {'draft':d['draft'],'ghost':''}
    if event == 'visible-end': return [len(d['draft']),len(d['draft'])+len(d['suffix'])]
    if event == 'edit': return {'ghost':'','preview_epoch':None}
    if event == 'copy': return d['draft'][d['start']:d['end']]
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'draft':'pea','candidate':'pear','value':'p1','start':3,'end':3,'epoch':N,'preview_epoch':N-1,'matching':True,'suffix':'r'}
boundary = {'draft':'x','candidate':'pear','value':None,'start':0,'end':1,'epoch':N,'preview_epoch':N,'matching':False,'suffix':''}
check('normal suffix', solve('suffix', normal), 'r')
check('boundary suffix', solve('suffix', boundary), '')
check('normal submit', solve('submit', normal), 'pea')
check('boundary submit', solve('submit', boundary), 'x')
check('normal value', solve('value', normal), 'p1')
check('boundary value', solve('value', boundary), None)
check('normal selected', solve('selected', normal), True)
check('boundary selected', solve('selected', boundary), False)
check('normal fresh', solve('fresh', normal), False)
check('boundary fresh', solve('fresh', boundary), True)
check('normal accept', solve('accept', normal), 'pear')
check('boundary accept', solve('accept', boundary), 'x')
check('normal reject', solve('reject', normal), {'draft':'pea','ghost':''})
check('boundary reject', solve('reject', boundary), {'draft':'x','ghost':''})
check('normal visible-end', solve('visible-end', normal), [3,4])
check('boundary visible-end', solve('visible-end', boundary), [1,1])
check('normal edit', solve('edit', normal), {'ghost':'','preview_epoch':None})
check('boundary edit', solve('edit', boundary), {'ghost':'','preview_epoch':None})
check('normal copy', solve('copy', normal), '')
check('boundary copy', solve('copy', boundary), 'x')
variant = dict(normal, **{'draft':'q'*N})
check('variant query or selection payload', solve('submit', 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 suffixrrPassed
boundary suffixPassed
normal submitpeapeaPassed
boundary submitxxPassed
normal valuep1p1Passed
boundary valueNoneNonePassed
normal selectedTrueTruePassed
boundary selectedTrueFalseFailed
normal freshFalseFalsePassed
boundary freshTrueTruePassed
normal acceptpearpearPassed
boundary acceptxxPassed
normal reject{'draft': 'pea', 'ghost': ''}{'draft': 'pea', 'ghost': ''}Passed
boundary reject{'draft': 'x', 'ghost': ''}{'draft': 'x', 'ghost': ''}Passed
normal visible-end[3, 4][3, 4]Passed
boundary visible-end[1, 1][1, 1]Passed
normal edit{'ghost': '', 'preview_epoch': None}{'ghost': '', 'preview_epoch': None}Passed
boundary edit{'ghost': '', 'preview_epoch': None}{'ghost': '', 'preview_epoch': None}Passed
normal copyPassed
boundary copyxxPassed
variant query or selection payloadqqPassed
unknown completion event{'unchanged': True}{'unchanged': True}Passed

SHA-256 / 692e910b0a54794ede28a2c663abb6cc6e8e67653c6bac2160e6b17c736a9d1c

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 == 'suffix': return d['candidate'][len(d['draft']):] if d['candidate'].startswith(d['draft']) else ''
    if event == 'submit': return d['draft']
    if event == 'value': return d['value']
    if event == 'selected': return d['start']==d['end'] and d['start']==0
    if event == 'fresh': return d['preview_epoch']==d['epoch']
    if event == 'accept': return d['candidate'] if d['matching'] else d['draft']
    if event == 'reject': return {'draft':d['draft'],'ghost':''}
    if event == 'visible-end': return [len(d['draft']),len(d['draft'])+len(d['suffix'])]
    if event == 'edit': return {'ghost':'','preview_epoch':None}
    if event == 'copy': return d['draft'][d['start']:d['end']]
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'draft':'pea','candidate':'pear','value':'p1','start':3,'end':3,'epoch':N,'preview_epoch':N-1,'matching':True,'suffix':'r'}
boundary = {'draft':'x','candidate':'pear','value':None,'start':0,'end':1,'epoch':N,'preview_epoch':N,'matching':False,'suffix':''}
check('normal suffix', solve('suffix', normal), 'r')
check('boundary suffix', solve('suffix', boundary), '')
check('normal submit', solve('submit', normal), 'pea')
check('boundary submit', solve('submit', boundary), 'x')
check('normal value', solve('value', normal), 'p1')
check('boundary value', solve('value', boundary), None)
check('normal selected', solve('selected', normal), True)
check('boundary selected', solve('selected', boundary), False)
check('normal fresh', solve('fresh', normal), False)
check('boundary fresh', solve('fresh', boundary), True)
check('normal accept', solve('accept', normal), 'pear')
check('boundary accept', solve('accept', boundary), 'x')
check('normal reject', solve('reject', normal), {'draft':'pea','ghost':''})
check('boundary reject', solve('reject', boundary), {'draft':'x','ghost':''})
check('normal visible-end', solve('visible-end', normal), [3,4])
check('boundary visible-end', solve('visible-end', boundary), [1,1])
check('normal edit', solve('edit', normal), {'ghost':'','preview_epoch':None})
check('boundary edit', solve('edit', boundary), {'ghost':'','preview_epoch':None})
check('normal copy', solve('copy', normal), '')
check('boundary copy', solve('copy', boundary), 'x')
variant = dict(normal, **{'draft':'q'*N})
check('variant query or selection payload', solve('submit', 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 suffixrrPassed
boundary suffixPassed
normal submitpeapeaPassed
boundary submitxxPassed
normal valuep1p1Passed
boundary valueNoneNonePassed
normal selectedFalseTrueFailed
boundary selectedFalseFalsePassed
normal freshFalseFalsePassed
boundary freshTrueTruePassed
normal acceptpearpearPassed
boundary acceptxxPassed
normal reject{'draft': 'pea', 'ghost': ''}{'draft': 'pea', 'ghost': ''}Passed
boundary reject{'draft': 'x', 'ghost': ''}{'draft': 'x', 'ghost': ''}Passed
normal visible-end[3, 4][3, 4]Passed
boundary visible-end[1, 1][1, 1]Passed
normal edit{'ghost': '', 'preview_epoch': None}{'ghost': '', 'preview_epoch': None}Passed
boundary edit{'ghost': '', 'preview_epoch': None}{'ghost': '', 'preview_epoch': None}Passed
normal copyPassed
boundary copyxxPassed
variant query or selection payloadqqPassed
unknown completion event{'unchanged': True}{'unchanged': True}Passed

SHA-256 / 1a069b6dc302ce924bc74184a2c7fbd27c3fa786e0866c76bd17828876f14223

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 == 'suffix': return d['candidate'][len(d['draft']):] if d['candidate'].startswith(d['draft']) else ''
    if event == 'submit': return d['draft']
    if event == 'value': return d['value']
    if event == 'selected': return d['start']==d['end']
    if event == 'fresh': return d['preview_epoch']==d['epoch']
    if event == 'accept': return d['candidate'] if d['matching'] else d['draft']
    if event == 'reject': return {'draft':d['draft'],'ghost':''}
    if event == 'visible-end': return [len(d['draft']),len(d['draft'])+len(d['suffix'])]
    if event == 'edit': return {'ghost':'','preview_epoch':None}
    if event == 'copy': return d['draft'][d['start']:d['end']]
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'draft':'pea','candidate':'pear','value':'p1','start':3,'end':3,'epoch':N,'preview_epoch':N-1,'matching':True,'suffix':'r'}
boundary = {'draft':'x','candidate':'pear','value':None,'start':0,'end':1,'epoch':N,'preview_epoch':N,'matching':False,'suffix':''}
check('normal suffix', solve('suffix', normal), 'r')
check('boundary suffix', solve('suffix', boundary), '')
check('normal submit', solve('submit', normal), 'pea')
check('boundary submit', solve('submit', boundary), 'x')
check('normal value', solve('value', normal), 'p1')
check('boundary value', solve('value', boundary), None)
check('normal selected', solve('selected', normal), True)
check('boundary selected', solve('selected', boundary), False)
check('normal fresh', solve('fresh', normal), False)
check('boundary fresh', solve('fresh', boundary), True)
check('normal accept', solve('accept', normal), 'pear')
check('boundary accept', solve('accept', boundary), 'x')
check('normal reject', solve('reject', normal), {'draft':'pea','ghost':''})
check('boundary reject', solve('reject', boundary), {'draft':'x','ghost':''})
check('normal visible-end', solve('visible-end', normal), [3,4])
check('boundary visible-end', solve('visible-end', boundary), [1,1])
check('normal edit', solve('edit', normal), {'ghost':'','preview_epoch':None})
check('boundary edit', solve('edit', boundary), {'ghost':'','preview_epoch':None})
check('normal copy', solve('copy', normal), '')
check('boundary copy', solve('copy', boundary), 'x')
variant = dict(normal, **{'draft':'q'*N})
check('variant query or selection payload', solve('submit', 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 suffixrrPassed
boundary suffixPassed
normal submitpeapeaPassed
boundary submitxxPassed
normal valuep1p1Passed
boundary valueNoneNonePassed
normal selectedTrueTruePassed
boundary selectedFalseFalsePassed
normal freshFalseFalsePassed
boundary freshTrueTruePassed
normal acceptpearpearPassed
boundary acceptxxPassed
normal reject{'draft': 'pea', 'ghost': ''}{'draft': 'pea', 'ghost': ''}Passed
boundary reject{'draft': 'x', 'ghost': ''}{'draft': 'x', 'ghost': ''}Passed
normal visible-end[3, 4][3, 4]Passed
boundary visible-end[1, 1][1, 1]Passed
normal edit{'ghost': '', 'preview_epoch': None}{'ghost': '', 'preview_epoch': None}Passed
boundary edit{'ghost': '', 'preview_epoch': None}{'ghost': '', 'preview_epoch': None}Passed
normal copyPassed
boundary copyxxPassed
variant query or selection payloadqqPassed
unknown completion event{'unchanged': True}{'unchanged': True}Passed

SHA-256 / 912a9d602a92d1312e5289590708ba0707a92cc3b5bf40a834e91d858b0ad947

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

Case digest / bbcb37002ec0642746c62722f11ea5a59a7a90d482c014d3cfd340ab11e7c2df