{"abstract":"The operation returns a result or retained state that violates this contract: Push then pop returns the smaller of the new value and previous heap minimum, retaining the other; empty heap returns the new value and remains empty.","category":"Heap invariants","checks":4,"contract":"Push then pop returns the smaller of the new value and previous heap minimum, retaining the other; empty heap returns the new value and remains empty. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.","contract_signature":"x, y=None","evaluation_group":"model-61634cf2dbffcf07","failed_approach":"Push alone retains an extra item and returns no removed value.","family":"xr-heappushpop-can-return-new-smallest","id":"FA-4806","implementations":{"attempt":{"sha256":"4561f68cbbd243e1a9bd1a6e87835f007e67f9aa9fa685c6c904a90dc0d59131","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.heappush(a,y); return [None,sorted(a)]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('new smallest immediately returned', solve(['b', 'c'], 'a'), ['a', ['b', 'c']])\ncheck('new largest retained', solve(['a', 'b'], 'c'), ['a', ['b', 'c']])\ncheck('empty', solve([], 'a'), ['a', []])\ncheck('equal minimum', solve(['a', 'b'], 'a'), ['a', ['a', 'b']])\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":"a61db9a5fb79e44bf187c88f2f0658767b28bed1b7ba6ba9c6e74046f7635253","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); v=heapq.heapreplace(a,y) if a else y; return [v,sorted(a)]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('new smallest immediately returned', solve(['b', 'c'], 'a'), ['a', ['b', 'c']])\ncheck('new largest retained', solve(['a', 'b'], 'c'), ['a', ['b', 'c']])\ncheck('empty', solve([], 'a'), ['a', []])\ncheck('equal minimum', solve(['a', 'b'], 'a'), ['a', ['a', 'b']])\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-heappushpop-can-return-new-smallest","generated_at":"2026-09-29T14:37:42.922387+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":"Heap replacement always removes an old item even when the new item should be returned immediately.","sha256":"e63e2baa203422d6825c59847712fdb41faed971ff8c99f76efae36882519822","title":"Heappushpop can return new smallest · 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":36.329,"exit_code":1,"observations":[{"actual":[null,["a","b","c"]],"check":"new smallest immediately returned","expected":["a",["b","c"]],"passed":false},{"actual":[null,["a","b","c"]],"check":"new largest retained","expected":["a",["b","c"]],"passed":false},{"actual":[null,["a"]],"check":"empty","expected":["a",[]],"passed":false},{"actual":[null,["a","a","b"]],"check":"equal minimum","expected":["a",["a","b"]],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"new smallest immediately returned\", \"actual\": [null, [\"a\", \"b\", \"c\"]], \"expected\": [\"a\", [\"b\", \"c\"]], \"passed\": false}, {\"check\": \"new largest retained\", \"actual\": [null, [\"a\", \"b\", \"c\"]], \"expected\": [\"a\", [\"b\", \"c\"]], \"passed\": false}, {\"check\": \"empty\", \"actual\": [null, [\"a\"]], \"expected\": [\"a\", []], \"passed\": false}, {\"check\": \"equal minimum\", \"actual\": [null, [\"a\", \"a\", \"b\"]], \"expected\": [\"a\", [\"a\", \"b\"]], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.546,"exit_code":1,"observations":[{"actual":["b",["a","c"]],"check":"new smallest immediately returned","expected":["a",["b","c"]],"passed":false},{"actual":["a",["b","c"]],"check":"new largest retained","expected":["a",["b","c"]],"passed":true},{"actual":["a",[]],"check":"empty","expected":["a",[]],"passed":true},{"actual":["a",["a","b"]],"check":"equal minimum","expected":["a",["a","b"]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"new smallest immediately returned\", \"actual\": [\"b\", [\"a\", \"c\"]], \"expected\": [\"a\", [\"b\", \"c\"]], \"passed\": false}, {\"check\": \"new largest retained\", \"actual\": [\"a\", [\"b\", \"c\"]], \"expected\": [\"a\", [\"b\", \"c\"]], \"passed\": true}, {\"check\": \"empty\", \"actual\": [\"a\", []], \"expected\": [\"a\", []], \"passed\": true}, {\"check\": \"equal minimum\", \"actual\": [\"a\", [\"a\", \"b\"]], \"expected\": [\"a\", [\"a\", \"b\"]], \"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."}}