{"abstract":"The operation returns a result or retained state that violates this contract: Remove one matching heap value if present, then restore heap ordering before draining remaining values.","category":"Heap invariants","checks":4,"contract":"Remove one matching heap value if present, then restore heap ordering before draining remaining values. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.","evaluation_group":"model-8230a726d2c61b9a","failed_approach":"Value filtering removes every equal occurrence instead of exactly one.","family":"xr-heap-arbitrary-removal-restores-invariant","id":"FA-4816","implementations":{"attempt":{"sha256":"0027d7f69a3807d99dc056aa14cce7b4bfe730ff7736788bf183b663da55e641","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=[v for v in x if v!=y]; 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('removal shifts internal children', solve(['a', 'd', 'b', 'e', 'f', 'c'], 'a'), ['b', 'c', 'd', 'e', 'f'])\ncheck('one duplicate removed', solve(['a', 'a', 'b'], 'a'), ['a', 'b'])\ncheck('missing unchanged', solve(['c', 'a', 'b'], 'z'), ['a', 'b', 'c'])\ncheck('empty', solve([], '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":"44523f2b140cbaafe4f274cc7fe5749e95c79852efebffb3300a75be259c4657","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)\n    if y in a: a.remove(y)\n    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('removal shifts internal children', solve(['a', 'd', 'b', 'e', 'f', 'c'], 'a'), ['b', 'c', 'd', 'e', 'f'])\ncheck('one duplicate removed', solve(['a', 'a', 'b'], 'a'), ['a', 'b'])\ncheck('missing unchanged', solve(['c', 'a', 'b'], 'z'), ['a', 'b', 'c'])\ncheck('empty', solve([], '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"},"fixed":{"sha256":"7a0f4ead96e33975b87f2b3d385227f305b385f9028c7101b02e74aa3c0308fc","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)\n    if y in a: a.remove(y)\n    heapq.heapify(a)\n    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('removal shifts internal children', solve(['a', 'd', 'b', 'e', 'f', 'c'], 'a'), ['b', 'c', 'd', 'e', 'f'])\ncheck('one duplicate removed', solve(['a', 'a', 'b'], 'a'), ['a', 'b'])\ncheck('missing unchanged', solve(['c', 'a', 'b'], 'z'), ['a', 'b', 'c'])\ncheck('empty', solve([], '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-arbitrary-removal-restores-invariant","generated_at":"2026-09-29T14:37:42.925805+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.","repair":"Remove one matching heap value if present, then restore heap ordering before draining remaining values.","root_cause":"Deleting a position shifts descendants without restoring the heap invariant.","sha256":"d7aacb62abc117b57603d8831a7d35c2bf2f7bccf65b96f9d8a01b6f8901f1ad","title":"Heap arbitrary removal restores invariant · case 01","variant":1,"variant_policy":"Five execution reruns of a fixed adversarial fixture suite; variant number does not alter semantic inputs.","verification":{"attempt":{"elapsed_ms":35.625,"exit_code":1,"observations":[{"actual":["b","c","d","e","f"],"check":"removal shifts internal children","expected":["b","c","d","e","f"],"passed":true},{"actual":["b"],"check":"one duplicate removed","expected":["a","b"],"passed":false},{"actual":["a","b","c"],"check":"missing unchanged","expected":["a","b","c"],"passed":true},{"actual":[],"check":"empty","expected":[],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"removal shifts internal children\", \"actual\": [\"b\", \"c\", \"d\", \"e\", \"f\"], \"expected\": [\"b\", \"c\", \"d\", \"e\", \"f\"], \"passed\": true}, {\"check\": \"one duplicate removed\", \"actual\": [\"b\"], \"expected\": [\"a\", \"b\"], \"passed\": false}, {\"check\": \"missing unchanged\", \"actual\": [\"a\", \"b\", \"c\"], \"expected\": [\"a\", \"b\", \"c\"], \"passed\": true}, {\"check\": \"empty\", \"actual\": [], \"expected\": [], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.146,"exit_code":1,"observations":[{"actual":["d","b","c","e","f"],"check":"removal shifts internal children","expected":["b","c","d","e","f"],"passed":false},{"actual":["a","b"],"check":"one duplicate removed","expected":["a","b"],"passed":true},{"actual":["a","b","c"],"check":"missing unchanged","expected":["a","b","c"],"passed":true},{"actual":[],"check":"empty","expected":[],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"removal shifts internal children\", \"actual\": [\"d\", \"b\", \"c\", \"e\", \"f\"], \"expected\": [\"b\", \"c\", \"d\", \"e\", \"f\"], \"passed\": false}, {\"check\": \"one duplicate removed\", \"actual\": [\"a\", \"b\"], \"expected\": [\"a\", \"b\"], \"passed\": true}, {\"check\": \"missing unchanged\", \"actual\": [\"a\", \"b\", \"c\"], \"expected\": [\"a\", \"b\", \"c\"], \"passed\": true}, {\"check\": \"empty\", \"actual\": [], \"expected\": [], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":40.381,"exit_code":0,"observations":[{"actual":["b","c","d","e","f"],"check":"removal shifts internal children","expected":["b","c","d","e","f"],"passed":true},{"actual":["a","b"],"check":"one duplicate removed","expected":["a","b"],"passed":true},{"actual":["a","b","c"],"check":"missing unchanged","expected":["a","b","c"],"passed":true},{"actual":[],"check":"empty","expected":[],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"removal shifts internal children\", \"actual\": [\"b\", \"c\", \"d\", \"e\", \"f\"], \"expected\": [\"b\", \"c\", \"d\", \"e\", \"f\"], \"passed\": true}, {\"check\": \"one duplicate removed\", \"actual\": [\"a\", \"b\"], \"expected\": [\"a\", \"b\"], \"passed\": true}, {\"check\": \"missing unchanged\", \"actual\": [\"a\", \"b\", \"c\"], \"expected\": [\"a\", \"b\", \"c\"], \"passed\": true}, {\"check\": \"empty\", \"actual\": [], \"expected\": [], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}