{"abstract":"Undo appends redo states in the wrong order.","category":"Undo and history","checks":8,"contract":"Distinct edits push the old present and clear redo; undo and redo transfer one state while preserving order; no-op edits and unavailable traversal preserve history.","contract_signature":"past, present, future, event, value","evaluation_group":"xi-undo","failed_approach":"Replacing the redo stack loses later states.","family":"xi-undo-undo-future","id":"FA-8046","implementations":{"attempt":{"sha256":"df772166c5c3a7dcd06f8b50c12ee755bec93d01a34c2c4ddd2705e98e0d2dfc","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(past, present, future, event, value):\n    past, future = list(past), list(future)\n    if event == 'edit' and value != present: return (past + [present], value, [])\n    if event == 'undo' and past: return (past[:-1], past[-1], [present])\n    if event == 'redo' and future: return (past + [present], future[0], future[1:])\n    return (past, present, future)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('noop retains redo', solve(['a'], 'b', ['c'], 'edit', 'b'), (['a'], 'b', ['c']))\ncheck('branch', solve(['a'], 'b', ['c'], 'edit', 'x'), (['a', 'b'], 'x', []))\ncheck('undo', solve(['a','b'], 'c', ['d'], 'undo', None), (['a'], 'b', ['c', 'd']))\ncheck('redo', solve(['a'], 'b', ['c','d'], 'redo', None), (['a', 'b'], 'c', ['d']))\ncheck('empty undo', solve([], 'a', [], 'undo', None), ([], 'a', []))\ncheck('empty redo', solve([], 'a', [], 'redo', None), ([], 'a', []))\ncheck('parameterized history length', solve(list(range(N)), N, [], 'edit', N+1), (list(range(N+1)), N+1, []))\nfor repetition in range(N):\n    check('repeat empty redo', solve([], 'a', [], 'redo', None), ([], 'a', []))\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":"15db395de38175579c0dce343ecde02e2bf46ec5ec1036d89b3ac8a93fb72dee","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(past, present, future, event, value):\n    past, future = list(past), list(future)\n    if event == 'edit' and value != present: return (past + [present], value, [])\n    if event == 'undo' and past: return (past[:-1], past[-1], future + [present])\n    if event == 'redo' and future: return (past + [present], future[0], future[1:])\n    return (past, present, future)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('noop retains redo', solve(['a'], 'b', ['c'], 'edit', 'b'), (['a'], 'b', ['c']))\ncheck('branch', solve(['a'], 'b', ['c'], 'edit', 'x'), (['a', 'b'], 'x', []))\ncheck('undo', solve(['a','b'], 'c', ['d'], 'undo', None), (['a'], 'b', ['c', 'd']))\ncheck('redo', solve(['a'], 'b', ['c','d'], 'redo', None), (['a', 'b'], 'c', ['d']))\ncheck('empty undo', solve([], 'a', [], 'undo', None), ([], 'a', []))\ncheck('empty redo', solve([], 'a', [], 'redo', None), ([], 'a', []))\ncheck('parameterized history length', solve(list(range(N)), N, [], 'edit', N+1), (list(range(N+1)), N+1, []))\nfor repetition in range(N):\n    check('repeat empty redo', solve([], 'a', [], 'redo', None), ([], 'a', []))\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-undo-undo-future","generated_at":"2026-09-29T14:38:17.739177+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"A deterministic model of undo stack transitions; this isolates one interface invariant without requiring a browser.","root_cause":"The undo future operation uses `future + [present]` where the contract requires `[present] + future`.","sha256":"1e7bf1f660ada4c71ab4d5706ed3a5d15439d7c1af951d8362af00fc4fec239a","title":"Undo stack transitions: Undo appends redo states in the wrong order · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":42.775,"exit_code":1,"observations":[{"actual":[["a"],"b",["c"]],"check":"noop retains redo","expected":[["a"],"b",["c"]],"passed":true},{"actual":[["a","b"],"x",[]],"check":"branch","expected":[["a","b"],"x",[]],"passed":true},{"actual":[["a"],"b",["c"]],"check":"undo","expected":[["a"],"b",["c","d"]],"passed":false},{"actual":[["a","b"],"c",["d"]],"check":"redo","expected":[["a","b"],"c",["d"]],"passed":true},{"actual":[[],"a",[]],"check":"empty undo","expected":[[],"a",[]],"passed":true},{"actual":[[],"a",[]],"check":"empty redo","expected":[[],"a",[]],"passed":true},{"actual":[[0,1],2,[]],"check":"parameterized history length","expected":[[0,1],2,[]],"passed":true},{"actual":[[],"a",[]],"check":"repeat empty redo","expected":[[],"a",[]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"noop retains redo\", \"actual\": [[\"a\"], \"b\", [\"c\"]], \"expected\": [[\"a\"], \"b\", [\"c\"]], \"passed\": true}, {\"check\": \"branch\", \"actual\": [[\"a\", \"b\"], \"x\", []], \"expected\": [[\"a\", \"b\"], \"x\", []], \"passed\": true}, {\"check\": \"undo\", \"actual\": [[\"a\"], \"b\", [\"c\"]], \"expected\": [[\"a\"], \"b\", [\"c\", \"d\"]], \"passed\": false}, {\"check\": \"redo\", \"actual\": [[\"a\", \"b\"], \"c\", [\"d\"]], \"expected\": [[\"a\", \"b\"], \"c\", [\"d\"]], \"passed\": true}, {\"check\": \"empty undo\", \"actual\": [[], \"a\", []], \"expected\": [[], \"a\", []], \"passed\": true}, {\"check\": \"empty redo\", \"actual\": [[], \"a\", []], \"expected\": [[], \"a\", []], \"passed\": true}, {\"check\": \"parameterized history length\", \"actual\": [[0, 1], 2, []], \"expected\": [[0, 1], 2, []], \"passed\": true}, {\"check\": \"repeat empty redo\", \"actual\": [[], \"a\", []], \"expected\": [[], \"a\", []], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.918,"exit_code":1,"observations":[{"actual":[["a"],"b",["c"]],"check":"noop retains redo","expected":[["a"],"b",["c"]],"passed":true},{"actual":[["a","b"],"x",[]],"check":"branch","expected":[["a","b"],"x",[]],"passed":true},{"actual":[["a"],"b",["d","c"]],"check":"undo","expected":[["a"],"b",["c","d"]],"passed":false},{"actual":[["a","b"],"c",["d"]],"check":"redo","expected":[["a","b"],"c",["d"]],"passed":true},{"actual":[[],"a",[]],"check":"empty undo","expected":[[],"a",[]],"passed":true},{"actual":[[],"a",[]],"check":"empty redo","expected":[[],"a",[]],"passed":true},{"actual":[[0,1],2,[]],"check":"parameterized history length","expected":[[0,1],2,[]],"passed":true},{"actual":[[],"a",[]],"check":"repeat empty redo","expected":[[],"a",[]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"noop retains redo\", \"actual\": [[\"a\"], \"b\", [\"c\"]], \"expected\": [[\"a\"], \"b\", [\"c\"]], \"passed\": true}, {\"check\": \"branch\", \"actual\": [[\"a\", \"b\"], \"x\", []], \"expected\": [[\"a\", \"b\"], \"x\", []], \"passed\": true}, {\"check\": \"undo\", \"actual\": [[\"a\"], \"b\", [\"d\", \"c\"]], \"expected\": [[\"a\"], \"b\", [\"c\", \"d\"]], \"passed\": false}, {\"check\": \"redo\", \"actual\": [[\"a\", \"b\"], \"c\", [\"d\"]], \"expected\": [[\"a\", \"b\"], \"c\", [\"d\"]], \"passed\": true}, {\"check\": \"empty undo\", \"actual\": [[], \"a\", []], \"expected\": [[], \"a\", []], \"passed\": true}, {\"check\": \"empty redo\", \"actual\": [[], \"a\", []], \"expected\": [[], \"a\", []], \"passed\": true}, {\"check\": \"parameterized history length\", \"actual\": [[0, 1], 2, []], \"expected\": [[0, 1], 2, []], \"passed\": true}, {\"check\": \"repeat empty redo\", \"actual\": [[], \"a\", []], \"expected\": [[], \"a\", []], \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}