{"abstract":"The delimiter completion transition produces an incorrect observable state.","category":"Autocomplete interactions","checks":22,"contract":"Suggestion insertion replaces the half-open token span [start,end), preserving surrounding text. Caret moves after inserted text, explicit selection takes precedence over token fallback, and a stale text epoch rejects replacement. These spans count Python code points, not browser UTF-16 units.","evaluation_group":"s3-autocomplete-replacement-range","failed_approach":"The attempted repair uses `d['insert']`, which still violates a normal or boundary completion fixture.","family":"s3-autocomplete-interactions-replacement-range-delimiter","id":"FA-22176","implementations":{"attempt":{"sha256":"0daa767a757330e0a23438a833439b5308ab97f1a252153b4879ea91040d8bae","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(event, d):\n    if event == 'replace': return d['text'][:d['start']]+d['insert']+d['text'][d['end']:]\n    if event == 'prefix': return d['text'][:d['start']]\n    if event == 'suffix': return d['text'][d['end']:]\n    if event == 'caret': return d['start']+len(d['insert'])\n    if event == 'selection': return d['selection'] if d['selection'][0]!=d['selection'][1] else [d['start'],d['end']]\n    if event == 'stale-span': return d['span_epoch']==d['epoch']\n    if event == 'collapse': return [d['start']+len(d['insert'])]*2\n    if event == 'delimiter': return d['insert']\n    if event == 'delta': return len(d['insert'])-(d['end']-d['start'])\n    if event == 'capture': return d['text'][d['start']:d['end']]\n    return {'unchanged': True}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nnormal = {'text':'red pea blue','start':4,'end':7,'insert':'pear','caret':6,'selection':[5,7],'epoch':N,'span_epoch':N-1,'suffix':' '}\nboundary = {'text':'','start':0,'end':0,'insert':'x','caret':0,'selection':[0,0],'epoch':N,'span_epoch':N,'suffix':''}\ncheck('normal replace', solve('replace', normal), 'red pear blue')\ncheck('boundary replace', solve('replace', boundary), 'x')\ncheck('normal prefix', solve('prefix', normal), 'red ')\ncheck('boundary prefix', solve('prefix', boundary), '')\ncheck('normal suffix', solve('suffix', normal), ' blue')\ncheck('boundary suffix', solve('suffix', boundary), '')\ncheck('normal caret', solve('caret', normal), 8)\ncheck('boundary caret', solve('caret', boundary), 1)\ncheck('normal selection', solve('selection', normal), [5,7])\ncheck('boundary selection', solve('selection', boundary), [0,0])\ncheck('normal stale-span', solve('stale-span', normal), False)\ncheck('boundary stale-span', solve('stale-span', boundary), True)\ncheck('normal collapse', solve('collapse', normal), [8,8])\ncheck('boundary collapse', solve('collapse', boundary), [1,1])\ncheck('normal delimiter', solve('delimiter', normal), 'pear ')\ncheck('boundary delimiter', solve('delimiter', boundary), 'x')\ncheck('normal delta', solve('delta', normal), 1)\ncheck('boundary delta', solve('delta', boundary), 1)\ncheck('normal capture', solve('capture', normal), 'pea')\ncheck('boundary capture', solve('capture', boundary), '')\nvariant = dict(normal, **{'text':'x'*N,'start':0,'end':N})\ncheck('variant query or selection payload', solve('capture', variant), 'x'*N)\ncheck('unknown completion event', solve('unrecognized', normal), {'unchanged': True})\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"f0cd194d31476f9bc2a70fa17a6dc6c20af646383f0330ddd2c90c073305a573","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(event, d):\n    if event == 'replace': return d['text'][:d['start']]+d['insert']+d['text'][d['end']:]\n    if event == 'prefix': return d['text'][:d['start']]\n    if event == 'suffix': return d['text'][d['end']:]\n    if event == 'caret': return d['start']+len(d['insert'])\n    if event == 'selection': return d['selection'] if d['selection'][0]!=d['selection'][1] else [d['start'],d['end']]\n    if event == 'stale-span': return d['span_epoch']==d['epoch']\n    if event == 'collapse': return [d['start']+len(d['insert'])]*2\n    if event == 'delimiter': return d['suffix']+d['insert']\n    if event == 'delta': return len(d['insert'])-(d['end']-d['start'])\n    if event == 'capture': return d['text'][d['start']:d['end']]\n    return {'unchanged': True}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nnormal = {'text':'red pea blue','start':4,'end':7,'insert':'pear','caret':6,'selection':[5,7],'epoch':N,'span_epoch':N-1,'suffix':' '}\nboundary = {'text':'','start':0,'end':0,'insert':'x','caret':0,'selection':[0,0],'epoch':N,'span_epoch':N,'suffix':''}\ncheck('normal replace', solve('replace', normal), 'red pear blue')\ncheck('boundary replace', solve('replace', boundary), 'x')\ncheck('normal prefix', solve('prefix', normal), 'red ')\ncheck('boundary prefix', solve('prefix', boundary), '')\ncheck('normal suffix', solve('suffix', normal), ' blue')\ncheck('boundary suffix', solve('suffix', boundary), '')\ncheck('normal caret', solve('caret', normal), 8)\ncheck('boundary caret', solve('caret', boundary), 1)\ncheck('normal selection', solve('selection', normal), [5,7])\ncheck('boundary selection', solve('selection', boundary), [0,0])\ncheck('normal stale-span', solve('stale-span', normal), False)\ncheck('boundary stale-span', solve('stale-span', boundary), True)\ncheck('normal collapse', solve('collapse', normal), [8,8])\ncheck('boundary collapse', solve('collapse', boundary), [1,1])\ncheck('normal delimiter', solve('delimiter', normal), 'pear ')\ncheck('boundary delimiter', solve('delimiter', boundary), 'x')\ncheck('normal delta', solve('delta', normal), 1)\ncheck('boundary delta', solve('delta', boundary), 1)\ncheck('normal capture', solve('capture', normal), 'pea')\ncheck('boundary capture', solve('capture', boundary), '')\nvariant = dict(normal, **{'text':'x'*N,'start':0,'end':N})\ncheck('variant query or selection payload', solve('capture', variant), 'x'*N)\ncheck('unknown completion event', solve('unrecognized', normal), {'unchanged': True})\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"a486206721239e530d05ea6db2f429ed4e23ce9930d42829b0c2387ec99508ed","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(event, d):\n    if event == 'replace': return d['text'][:d['start']]+d['insert']+d['text'][d['end']:]\n    if event == 'prefix': return d['text'][:d['start']]\n    if event == 'suffix': return d['text'][d['end']:]\n    if event == 'caret': return d['start']+len(d['insert'])\n    if event == 'selection': return d['selection'] if d['selection'][0]!=d['selection'][1] else [d['start'],d['end']]\n    if event == 'stale-span': return d['span_epoch']==d['epoch']\n    if event == 'collapse': return [d['start']+len(d['insert'])]*2\n    if event == 'delimiter': return d['insert']+d['suffix']\n    if event == 'delta': return len(d['insert'])-(d['end']-d['start'])\n    if event == 'capture': return d['text'][d['start']:d['end']]\n    return {'unchanged': True}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nnormal = {'text':'red pea blue','start':4,'end':7,'insert':'pear','caret':6,'selection':[5,7],'epoch':N,'span_epoch':N-1,'suffix':' '}\nboundary = {'text':'','start':0,'end':0,'insert':'x','caret':0,'selection':[0,0],'epoch':N,'span_epoch':N,'suffix':''}\ncheck('normal replace', solve('replace', normal), 'red pear blue')\ncheck('boundary replace', solve('replace', boundary), 'x')\ncheck('normal prefix', solve('prefix', normal), 'red ')\ncheck('boundary prefix', solve('prefix', boundary), '')\ncheck('normal suffix', solve('suffix', normal), ' blue')\ncheck('boundary suffix', solve('suffix', boundary), '')\ncheck('normal caret', solve('caret', normal), 8)\ncheck('boundary caret', solve('caret', boundary), 1)\ncheck('normal selection', solve('selection', normal), [5,7])\ncheck('boundary selection', solve('selection', boundary), [0,0])\ncheck('normal stale-span', solve('stale-span', normal), False)\ncheck('boundary stale-span', solve('stale-span', boundary), True)\ncheck('normal collapse', solve('collapse', normal), [8,8])\ncheck('boundary collapse', solve('collapse', boundary), [1,1])\ncheck('normal delimiter', solve('delimiter', normal), 'pear ')\ncheck('boundary delimiter', solve('delimiter', boundary), 'x')\ncheck('normal delta', solve('delta', normal), 1)\ncheck('boundary delta', solve('delta', boundary), 1)\ncheck('normal capture', solve('capture', normal), 'pea')\ncheck('boundary capture', solve('capture', boundary), '')\nvariant = dict(normal, **{'text':'x'*N,'start':0,'end':N})\ncheck('variant query or selection payload', solve('capture', variant), 'x'*N)\ncheck('unknown completion event', solve('unrecognized', normal), {'unchanged': True})\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"s3-autocomplete-interactions-replacement-range-delimiter","generated_at":"2026-09-29T14:40:35.953283+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Autocomplete couples draft text, suggestion identity and asynchronous presentation; this bounded lifecycle model isolates one observable interaction defect.","repair":"Implement the delimiter contract using `d['insert']+d['suffix']`.","root_cause":"At replacement-range/delimiter, the implementation evaluates `d['suffix']+d['insert']` instead of preserving the specified completion transition.","sha256":"414669e9865cffbfb212ad9d3994f0065556500e71ffba4198486bda5f8eaddd","title":"Completion replacement spans: completion delimiter is inserted before the completed token · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":44.767,"exit_code":1,"observations":[{"actual":"red pear blue","check":"normal replace","expected":"red pear blue","passed":true},{"actual":"x","check":"boundary replace","expected":"x","passed":true},{"actual":"red ","check":"normal prefix","expected":"red ","passed":true},{"actual":"","check":"boundary prefix","expected":"","passed":true},{"actual":" blue","check":"normal suffix","expected":" blue","passed":true},{"actual":"","check":"boundary suffix","expected":"","passed":true},{"actual":8,"check":"normal caret","expected":8,"passed":true},{"actual":1,"check":"boundary caret","expected":1,"passed":true},{"actual":[5,7],"check":"normal selection","expected":[5,7],"passed":true},{"actual":[0,0],"check":"boundary selection","expected":[0,0],"passed":true},{"actual":false,"check":"normal stale-span","expected":false,"passed":true},{"actual":true,"check":"boundary stale-span","expected":true,"passed":true},{"actual":[8,8],"check":"normal collapse","expected":[8,8],"passed":true},{"actual":[1,1],"check":"boundary collapse","expected":[1,1],"passed":true},{"actual":"pear","check":"normal delimiter","expected":"pear ","passed":false},{"actual":"x","check":"boundary delimiter","expected":"x","passed":true},{"actual":1,"check":"normal delta","expected":1,"passed":true},{"actual":1,"check":"boundary delta","expected":1,"passed":true},{"actual":"pea","check":"normal capture","expected":"pea","passed":true},{"actual":"","check":"boundary capture","expected":"","passed":true},{"actual":"x","check":"variant query or selection payload","expected":"x","passed":true},{"actual":{"unchanged":true},"check":"unknown completion event","expected":{"unchanged":true},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"normal replace\", \"actual\": \"red pear blue\", \"expected\": \"red pear blue\", \"passed\": true}, {\"check\": \"boundary replace\", \"actual\": \"x\", \"expected\": \"x\", \"passed\": true}, {\"check\": \"normal prefix\", \"actual\": \"red \", \"expected\": \"red \", \"passed\": true}, {\"check\": \"boundary prefix\", \"actual\": \"\", \"expected\": \"\", \"passed\": true}, {\"check\": \"normal suffix\", \"actual\": \" blue\", \"expected\": \" blue\", \"passed\": true}, {\"check\": \"boundary suffix\", \"actual\": \"\", \"expected\": \"\", \"passed\": true}, {\"check\": \"normal caret\", \"actual\": 8, \"expected\": 8, \"passed\": true}, {\"check\": \"boundary caret\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"normal selection\", \"actual\": [5, 7], \"expected\": [5, 7], \"passed\": true}, {\"check\": \"boundary selection\", \"actual\": [0, 0], \"expected\": [0, 0], \"passed\": true}, {\"check\": \"normal stale-span\", \"actual\": false, \"expected\": false, \"passed\": true}, {\"check\": \"boundary stale-span\", \"actual\": true, \"expected\": true, \"passed\": true}, {\"check\": \"normal collapse\", \"actual\": [8, 8], \"expected\": [8, 8], \"passed\": true}, {\"check\": \"boundary collapse\", \"actual\": [1, 1], \"expected\": [1, 1], \"passed\": true}, {\"check\": \"normal delimiter\", \"actual\": \"pear\", \"expected\": \"pear \", \"passed\": false}, {\"check\": \"boundary delimiter\", \"actual\": \"x\", \"expected\": \"x\", \"passed\": true}, {\"check\": \"normal delta\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"boundary delta\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"normal capture\", \"actual\": \"pea\", \"expected\": \"pea\", \"passed\": true}, {\"check\": \"boundary capture\", \"actual\": \"\", \"expected\": \"\", \"passed\": true}, {\"check\": \"variant query or selection payload\", \"actual\": \"x\", \"expected\": \"x\", \"passed\": true}, {\"check\": \"unknown completion event\", \"actual\": {\"unchanged\": true}, \"expected\": {\"unchanged\": true}, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.543,"exit_code":1,"observations":[{"actual":"red pear blue","check":"normal replace","expected":"red pear blue","passed":true},{"actual":"x","check":"boundary replace","expected":"x","passed":true},{"actual":"red ","check":"normal prefix","expected":"red ","passed":true},{"actual":"","check":"boundary prefix","expected":"","passed":true},{"actual":" blue","check":"normal suffix","expected":" blue","passed":true},{"actual":"","check":"boundary suffix","expected":"","passed":true},{"actual":8,"check":"normal caret","expected":8,"passed":true},{"actual":1,"check":"boundary caret","expected":1,"passed":true},{"actual":[5,7],"check":"normal selection","expected":[5,7],"passed":true},{"actual":[0,0],"check":"boundary selection","expected":[0,0],"passed":true},{"actual":false,"check":"normal stale-span","expected":false,"passed":true},{"actual":true,"check":"boundary stale-span","expected":true,"passed":true},{"actual":[8,8],"check":"normal collapse","expected":[8,8],"passed":true},{"actual":[1,1],"check":"boundary collapse","expected":[1,1],"passed":true},{"actual":" pear","check":"normal delimiter","expected":"pear ","passed":false},{"actual":"x","check":"boundary delimiter","expected":"x","passed":true},{"actual":1,"check":"normal delta","expected":1,"passed":true},{"actual":1,"check":"boundary delta","expected":1,"passed":true},{"actual":"pea","check":"normal capture","expected":"pea","passed":true},{"actual":"","check":"boundary capture","expected":"","passed":true},{"actual":"x","check":"variant query or selection payload","expected":"x","passed":true},{"actual":{"unchanged":true},"check":"unknown completion event","expected":{"unchanged":true},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"normal replace\", \"actual\": \"red pear blue\", \"expected\": \"red pear blue\", \"passed\": true}, {\"check\": \"boundary replace\", \"actual\": \"x\", \"expected\": \"x\", \"passed\": true}, {\"check\": \"normal prefix\", \"actual\": \"red \", \"expected\": \"red \", \"passed\": true}, {\"check\": \"boundary prefix\", \"actual\": \"\", \"expected\": \"\", \"passed\": true}, {\"check\": \"normal suffix\", \"actual\": \" blue\", \"expected\": \" blue\", \"passed\": true}, {\"check\": \"boundary suffix\", \"actual\": \"\", \"expected\": \"\", \"passed\": true}, {\"check\": \"normal caret\", \"actual\": 8, \"expected\": 8, \"passed\": true}, {\"check\": \"boundary caret\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"normal selection\", \"actual\": [5, 7], \"expected\": [5, 7], \"passed\": true}, {\"check\": \"boundary selection\", \"actual\": [0, 0], \"expected\": [0, 0], \"passed\": true}, {\"check\": \"normal stale-span\", \"actual\": false, \"expected\": false, \"passed\": true}, {\"check\": \"boundary stale-span\", \"actual\": true, \"expected\": true, \"passed\": true}, {\"check\": \"normal collapse\", \"actual\": [8, 8], \"expected\": [8, 8], \"passed\": true}, {\"check\": \"boundary collapse\", \"actual\": [1, 1], \"expected\": [1, 1], \"passed\": true}, {\"check\": \"normal delimiter\", \"actual\": \" pear\", \"expected\": \"pear \", \"passed\": false}, {\"check\": \"boundary delimiter\", \"actual\": \"x\", \"expected\": \"x\", \"passed\": true}, {\"check\": \"normal delta\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"boundary delta\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"normal capture\", \"actual\": \"pea\", \"expected\": \"pea\", \"passed\": true}, {\"check\": \"boundary capture\", \"actual\": \"\", \"expected\": \"\", \"passed\": true}, {\"check\": \"variant query or selection payload\", \"actual\": \"x\", \"expected\": \"x\", \"passed\": true}, {\"check\": \"unknown completion event\", \"actual\": {\"unchanged\": true}, \"expected\": {\"unchanged\": true}, \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":42.295,"exit_code":0,"observations":[{"actual":"red pear blue","check":"normal replace","expected":"red pear blue","passed":true},{"actual":"x","check":"boundary replace","expected":"x","passed":true},{"actual":"red ","check":"normal prefix","expected":"red ","passed":true},{"actual":"","check":"boundary prefix","expected":"","passed":true},{"actual":" blue","check":"normal suffix","expected":" blue","passed":true},{"actual":"","check":"boundary suffix","expected":"","passed":true},{"actual":8,"check":"normal caret","expected":8,"passed":true},{"actual":1,"check":"boundary caret","expected":1,"passed":true},{"actual":[5,7],"check":"normal selection","expected":[5,7],"passed":true},{"actual":[0,0],"check":"boundary selection","expected":[0,0],"passed":true},{"actual":false,"check":"normal stale-span","expected":false,"passed":true},{"actual":true,"check":"boundary stale-span","expected":true,"passed":true},{"actual":[8,8],"check":"normal collapse","expected":[8,8],"passed":true},{"actual":[1,1],"check":"boundary collapse","expected":[1,1],"passed":true},{"actual":"pear ","check":"normal delimiter","expected":"pear ","passed":true},{"actual":"x","check":"boundary delimiter","expected":"x","passed":true},{"actual":1,"check":"normal delta","expected":1,"passed":true},{"actual":1,"check":"boundary delta","expected":1,"passed":true},{"actual":"pea","check":"normal capture","expected":"pea","passed":true},{"actual":"","check":"boundary capture","expected":"","passed":true},{"actual":"x","check":"variant query or selection payload","expected":"x","passed":true},{"actual":{"unchanged":true},"check":"unknown completion event","expected":{"unchanged":true},"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"normal replace\", \"actual\": \"red pear blue\", \"expected\": \"red pear blue\", \"passed\": true}, {\"check\": \"boundary replace\", \"actual\": \"x\", \"expected\": \"x\", \"passed\": true}, {\"check\": \"normal prefix\", \"actual\": \"red \", \"expected\": \"red \", \"passed\": true}, {\"check\": \"boundary prefix\", \"actual\": \"\", \"expected\": \"\", \"passed\": true}, {\"check\": \"normal suffix\", \"actual\": \" blue\", \"expected\": \" blue\", \"passed\": true}, {\"check\": \"boundary suffix\", \"actual\": \"\", \"expected\": \"\", \"passed\": true}, {\"check\": \"normal caret\", \"actual\": 8, \"expected\": 8, \"passed\": true}, {\"check\": \"boundary caret\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"normal selection\", \"actual\": [5, 7], \"expected\": [5, 7], \"passed\": true}, {\"check\": \"boundary selection\", \"actual\": [0, 0], \"expected\": [0, 0], \"passed\": true}, {\"check\": \"normal stale-span\", \"actual\": false, \"expected\": false, \"passed\": true}, {\"check\": \"boundary stale-span\", \"actual\": true, \"expected\": true, \"passed\": true}, {\"check\": \"normal collapse\", \"actual\": [8, 8], \"expected\": [8, 8], \"passed\": true}, {\"check\": \"boundary collapse\", \"actual\": [1, 1], \"expected\": [1, 1], \"passed\": true}, {\"check\": \"normal delimiter\", \"actual\": \"pear \", \"expected\": \"pear \", \"passed\": true}, {\"check\": \"boundary delimiter\", \"actual\": \"x\", \"expected\": \"x\", \"passed\": true}, {\"check\": \"normal delta\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"boundary delta\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"normal capture\", \"actual\": \"pea\", \"expected\": \"pea\", \"passed\": true}, {\"check\": \"boundary capture\", \"actual\": \"\", \"expected\": \"\", \"passed\": true}, {\"check\": \"variant query or selection payload\", \"actual\": \"x\", \"expected\": \"x\", \"passed\": true}, {\"check\": \"unknown completion event\", \"actual\": {\"unchanged\": true}, \"expected\": {\"unchanged\": true}, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}