{"abstract":"The operation returns a result or retained state that violates this contract: Replace exactly one selected original list item, then heapify and drain; changing a key requires restoring heap order.","category":"Heap invariants","checks":4,"contract":"Replace exactly one selected original list item, then heapify and drain; changing a key requires restoring heap order. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.","contract_signature":"x, y=None","evaluation_group":"model-0ed8a0211a40f17e","failed_approach":"Equality-based replacement changes all equal-valued items instead of the requested original position.","family":"xr-heap-key-replacement-reheapifies","id":"FA-4821","implementations":{"attempt":{"sha256":"dc0127827c3af17cd9dae3729e61b1662442e8bcf018e3b4ecba34198fe55266","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom collections import Counter, ChainMap, deque\nimport heapq\nN = 1\nobservations = []\ndef solve(x, y=None):\n    a=list(x); a=[y[1] if v==x[y[0]] else v for v in a]; heapq.heapify(a); return [heapq.heappop(a) for _ in range(len(a))]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('decrease nonroot', solve(['b', 'c', 'd'], [2, 'a']), ['a', 'b', 'c'])\ncheck('duplicate one occurrence', solve(['b', 'b', 'c'], [1, 'a']), ['a', 'b', 'c'])\ncheck('increase root', solve(['a', 'b', 'c'], [0, 'd']), ['b', 'c', 'd'])\ncheck('singleton', solve(['b'], [0, 'a']), ['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":"15ad263215dc3f25a89789221592fb178196ba7bf33b6e4a6378dbb879a46c27","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom collections import Counter, ChainMap, deque\nimport heapq\nN = 1\nobservations = []\ndef solve(x, y=None):\n    a=list(x); heapq.heapify(a); a[y[0]]=y[1]; return [heapq.heappop(a) for _ in range(len(a))]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('decrease nonroot', solve(['b', 'c', 'd'], [2, 'a']), ['a', 'b', 'c'])\ncheck('duplicate one occurrence', solve(['b', 'b', 'c'], [1, 'a']), ['a', 'b', 'c'])\ncheck('increase root', solve(['a', 'b', 'c'], [0, 'd']), ['b', 'c', 'd'])\ncheck('singleton', solve(['b'], [0, 'a']), ['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":"xr-heap-key-replacement-reheapifies","generated_at":"2026-09-29T14:37:43.079163+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"A controlled local-runtime regression for collection APIs, language semantics, or ownership wrappers. Fixtures include boundary and interaction cases.","root_cause":"Changing a key after heapification invalidates heap order and can target a rearranged position.","sha256":"2f061e8467455ac6a643b15c4979ec61461fbd6596595255b086c01e452e0c49","title":"Heap key replacement reheapifies · case 01","variant":1,"variant_policy":"Five execution reruns of a fixed adversarial fixture suite; variant number does not alter semantic inputs.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":116.461,"exit_code":1,"observations":[{"actual":["a","b","c"],"check":"decrease nonroot","expected":["a","b","c"],"passed":true},{"actual":["a","a","c"],"check":"duplicate one occurrence","expected":["a","b","c"],"passed":false},{"actual":["b","c","d"],"check":"increase root","expected":["b","c","d"],"passed":true},{"actual":["a"],"check":"singleton","expected":["a"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"decrease nonroot\", \"actual\": [\"a\", \"b\", \"c\"], \"expected\": [\"a\", \"b\", \"c\"], \"passed\": true}, {\"check\": \"duplicate one occurrence\", \"actual\": [\"a\", \"a\", \"c\"], \"expected\": [\"a\", \"b\", \"c\"], \"passed\": false}, {\"check\": \"increase root\", \"actual\": [\"b\", \"c\", \"d\"], \"expected\": [\"b\", \"c\", \"d\"], \"passed\": true}, {\"check\": \"singleton\", \"actual\": [\"a\"], \"expected\": [\"a\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":39.438,"exit_code":1,"observations":[{"actual":["b","a","c"],"check":"decrease nonroot","expected":["a","b","c"],"passed":false},{"actual":["b","a","c"],"check":"duplicate one occurrence","expected":["a","b","c"],"passed":false},{"actual":["d","b","c"],"check":"increase root","expected":["b","c","d"],"passed":false},{"actual":["a"],"check":"singleton","expected":["a"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"decrease nonroot\", \"actual\": [\"b\", \"a\", \"c\"], \"expected\": [\"a\", \"b\", \"c\"], \"passed\": false}, {\"check\": \"duplicate one occurrence\", \"actual\": [\"b\", \"a\", \"c\"], \"expected\": [\"a\", \"b\", \"c\"], \"passed\": false}, {\"check\": \"increase root\", \"actual\": [\"d\", \"b\", \"c\"], \"expected\": [\"b\", \"c\", \"d\"], \"passed\": false}, {\"check\": \"singleton\", \"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."}}