{"abstract":"An IME composition is overwritten before commitment.","category":"Text editing","checks":8,"contract":"Composition is preserved; replace the normalized half-open selection and collapse both endpoints immediately after inserted text.","evaluation_group":"xi-text-selection","failed_approach":"Blocking noncomposition edits disables ordinary input.","family":"xi-text-selection-composition","id":"FA-7906","implementations":{"attempt":{"sha256":"b7371df21cc12f5b181dc42285dff1468f3019e9a0e54ad644eb9a0e413d0154","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(text, anchor, focus, replacement, composing):\n    if not composing: return (text, anchor, focus)\n    lo = min(anchor, focus)\n    hi = max(anchor, focus)\n    result = text[:lo] + replacement + text[hi:]\n    caret = lo + len(replacement)\n    return (result, caret, caret)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('composition', solve('abcdef', 1, 4, 'XY', True), ('abcdef', 1, 4))\ncheck('forward', solve('abcdef', 1, 4, 'XY', False), ('aXYef', 3, 3))\ncheck('backward', solve('abcdef', 4, 1, 'XY', False), ('aXYef', 3, 3))\ncheck('insertion', solve('ab', 1, 1, 'XYZ', False), ('aXYZb', 4, 4))\ncheck('delete', solve('abc', 0, 3, '', False), ('', 0, 0))\ncheck('no selection', solve('abc', 2, 2, '', False), ('abc', 2, 2))\ncheck('parameterized selected length', solve('a'*N, 0, N, 'X', False), ('X', 1, 1))\nfor repetition in range(N):\n    check('repeat no selection', solve('abc', 2, 2, '', False), ('abc', 2, 2))\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":"527e26c59b6831aee42129ab394004b6380fb8fea55dde91caa700143db34a4b","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(text, anchor, focus, replacement, composing):\n    if False: return (text, anchor, focus)\n    lo = min(anchor, focus)\n    hi = max(anchor, focus)\n    result = text[:lo] + replacement + text[hi:]\n    caret = lo + len(replacement)\n    return (result, caret, caret)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('composition', solve('abcdef', 1, 4, 'XY', True), ('abcdef', 1, 4))\ncheck('forward', solve('abcdef', 1, 4, 'XY', False), ('aXYef', 3, 3))\ncheck('backward', solve('abcdef', 4, 1, 'XY', False), ('aXYef', 3, 3))\ncheck('insertion', solve('ab', 1, 1, 'XYZ', False), ('aXYZb', 4, 4))\ncheck('delete', solve('abc', 0, 3, '', False), ('', 0, 0))\ncheck('no selection', solve('abc', 2, 2, '', False), ('abc', 2, 2))\ncheck('parameterized selected length', solve('a'*N, 0, N, 'X', False), ('X', 1, 1))\nfor repetition in range(N):\n    check('repeat no selection', solve('abc', 2, 2, '', False), ('abc', 2, 2))\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":"fc2f2c1a50e0138b1115cb5974ca3f32bfb6e374e5c68d2b170eef373d133908","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(text, anchor, focus, replacement, composing):\n    if composing: return (text, anchor, focus)\n    lo = min(anchor, focus)\n    hi = max(anchor, focus)\n    result = text[:lo] + replacement + text[hi:]\n    caret = lo + len(replacement)\n    return (result, caret, caret)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('composition', solve('abcdef', 1, 4, 'XY', True), ('abcdef', 1, 4))\ncheck('forward', solve('abcdef', 1, 4, 'XY', False), ('aXYef', 3, 3))\ncheck('backward', solve('abcdef', 4, 1, 'XY', False), ('aXYef', 3, 3))\ncheck('insertion', solve('ab', 1, 1, 'XYZ', False), ('aXYZb', 4, 4))\ncheck('delete', solve('abc', 0, 3, '', False), ('', 0, 0))\ncheck('no selection', solve('abc', 2, 2, '', False), ('abc', 2, 2))\ncheck('parameterized selected length', solve('a'*N, 0, N, 'X', False), ('X', 1, 1))\nfor repetition in range(N):\n    check('repeat no selection', solve('abc', 2, 2, '', False), ('abc', 2, 2))\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":" 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":"xi-text-selection-composition","generated_at":"2026-09-29T14:38:16.409280+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"A deterministic model of text selection replacement; this isolates one interface invariant without requiring a browser.","repair":"Implement the composition operation as `if composing:`.","root_cause":"The composition operation uses `if False:` where the contract requires `if composing:`.","sha256":"a8138f886a3577bf7d29ebc0f0aeb1f1e85c886c3e950615027339c0d94033dc","title":"Text selection replacement: An IME composition is overwritten before commitment · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":44.768,"exit_code":1,"observations":[{"actual":["aXYef",3,3],"check":"composition","expected":["abcdef",1,4],"passed":false},{"actual":["abcdef",1,4],"check":"forward","expected":["aXYef",3,3],"passed":false},{"actual":["abcdef",4,1],"check":"backward","expected":["aXYef",3,3],"passed":false},{"actual":["ab",1,1],"check":"insertion","expected":["aXYZb",4,4],"passed":false},{"actual":["abc",0,3],"check":"delete","expected":["",0,0],"passed":false},{"actual":["abc",2,2],"check":"no selection","expected":["abc",2,2],"passed":true},{"actual":["a",0,1],"check":"parameterized selected length","expected":["X",1,1],"passed":false},{"actual":["abc",2,2],"check":"repeat no selection","expected":["abc",2,2],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"composition\", \"actual\": [\"aXYef\", 3, 3], \"expected\": [\"abcdef\", 1, 4], \"passed\": false}, {\"check\": \"forward\", \"actual\": [\"abcdef\", 1, 4], \"expected\": [\"aXYef\", 3, 3], \"passed\": false}, {\"check\": \"backward\", \"actual\": [\"abcdef\", 4, 1], \"expected\": [\"aXYef\", 3, 3], \"passed\": false}, {\"check\": \"insertion\", \"actual\": [\"ab\", 1, 1], \"expected\": [\"aXYZb\", 4, 4], \"passed\": false}, {\"check\": \"delete\", \"actual\": [\"abc\", 0, 3], \"expected\": [\"\", 0, 0], \"passed\": false}, {\"check\": \"no selection\", \"actual\": [\"abc\", 2, 2], \"expected\": [\"abc\", 2, 2], \"passed\": true}, {\"check\": \"parameterized selected length\", \"actual\": [\"a\", 0, 1], \"expected\": [\"X\", 1, 1], \"passed\": false}, {\"check\": \"repeat no selection\", \"actual\": [\"abc\", 2, 2], \"expected\": [\"abc\", 2, 2], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":43.268,"exit_code":1,"observations":[{"actual":["aXYef",3,3],"check":"composition","expected":["abcdef",1,4],"passed":false},{"actual":["aXYef",3,3],"check":"forward","expected":["aXYef",3,3],"passed":true},{"actual":["aXYef",3,3],"check":"backward","expected":["aXYef",3,3],"passed":true},{"actual":["aXYZb",4,4],"check":"insertion","expected":["aXYZb",4,4],"passed":true},{"actual":["",0,0],"check":"delete","expected":["",0,0],"passed":true},{"actual":["abc",2,2],"check":"no selection","expected":["abc",2,2],"passed":true},{"actual":["X",1,1],"check":"parameterized selected length","expected":["X",1,1],"passed":true},{"actual":["abc",2,2],"check":"repeat no selection","expected":["abc",2,2],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"composition\", \"actual\": [\"aXYef\", 3, 3], \"expected\": [\"abcdef\", 1, 4], \"passed\": false}, {\"check\": \"forward\", \"actual\": [\"aXYef\", 3, 3], \"expected\": [\"aXYef\", 3, 3], \"passed\": true}, {\"check\": \"backward\", \"actual\": [\"aXYef\", 3, 3], \"expected\": [\"aXYef\", 3, 3], \"passed\": true}, {\"check\": \"insertion\", \"actual\": [\"aXYZb\", 4, 4], \"expected\": [\"aXYZb\", 4, 4], \"passed\": true}, {\"check\": \"delete\", \"actual\": [\"\", 0, 0], \"expected\": [\"\", 0, 0], \"passed\": true}, {\"check\": \"no selection\", \"actual\": [\"abc\", 2, 2], \"expected\": [\"abc\", 2, 2], \"passed\": true}, {\"check\": \"parameterized selected length\", \"actual\": [\"X\", 1, 1], \"expected\": [\"X\", 1, 1], \"passed\": true}, {\"check\": \"repeat no selection\", \"actual\": [\"abc\", 2, 2], \"expected\": [\"abc\", 2, 2], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":40.582,"exit_code":0,"observations":[{"actual":["abcdef",1,4],"check":"composition","expected":["abcdef",1,4],"passed":true},{"actual":["aXYef",3,3],"check":"forward","expected":["aXYef",3,3],"passed":true},{"actual":["aXYef",3,3],"check":"backward","expected":["aXYef",3,3],"passed":true},{"actual":["aXYZb",4,4],"check":"insertion","expected":["aXYZb",4,4],"passed":true},{"actual":["",0,0],"check":"delete","expected":["",0,0],"passed":true},{"actual":["abc",2,2],"check":"no selection","expected":["abc",2,2],"passed":true},{"actual":["X",1,1],"check":"parameterized selected length","expected":["X",1,1],"passed":true},{"actual":["abc",2,2],"check":"repeat no selection","expected":["abc",2,2],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"composition\", \"actual\": [\"abcdef\", 1, 4], \"expected\": [\"abcdef\", 1, 4], \"passed\": true}, {\"check\": \"forward\", \"actual\": [\"aXYef\", 3, 3], \"expected\": [\"aXYef\", 3, 3], \"passed\": true}, {\"check\": \"backward\", \"actual\": [\"aXYef\", 3, 3], \"expected\": [\"aXYef\", 3, 3], \"passed\": true}, {\"check\": \"insertion\", \"actual\": [\"aXYZb\", 4, 4], \"expected\": [\"aXYZb\", 4, 4], \"passed\": true}, {\"check\": \"delete\", \"actual\": [\"\", 0, 0], \"expected\": [\"\", 0, 0], \"passed\": true}, {\"check\": \"no selection\", \"actual\": [\"abc\", 2, 2], \"expected\": [\"abc\", 2, 2], \"passed\": true}, {\"check\": \"parameterized selected length\", \"actual\": [\"X\", 1, 1], \"expected\": [\"X\", 1, 1], \"passed\": true}, {\"check\": \"repeat no selection\", \"actual\": [\"abc\", 2, 2], \"expected\": [\"abc\", 2, 2], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}