{"abstract":"The operation returns a result or retained state that violates this contract: Materialize each group before advancing the outer group iterator, since group iterators share their source.","category":"Iterator consumption","checks":4,"contract":"Materialize each group before advancing the outer group iterator, since group iterators share their source. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.","evaluation_group":"model-76abd571aefd3eda","failed_approach":"Replacing invalidated groups with empty lists silently loses their contents.","family":"xr-groupby-materialize-before-advancing","id":"FA-4571","implementations":{"attempt":{"sha256":"3da4bf0c67a18fa6e99fa90566964416d484cd1e91c53e032595977bfaea209b","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport itertools as it\nfrom collections import deque\nN = 1\nobservations = []\ndef solve(x, y=None):\n    groups=list(it.groupby(x)); return [[k,[]] for k,g in groups]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('two groups', solve(['a', 'a', 'b']), [['a', ['a', 'a']], ['b', ['b']]])\ncheck('one group', solve(['a', 'a']), [['a', ['a', 'a']]])\ncheck('empty', solve([]), [])\ncheck('three runs', solve(['b', 'a', 'b']), [['b', ['b']], ['a', ['a']], ['b', ['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":"1d8e3ffaddb14e9ee23cc909e957ba4d53ca01afae4afd2b62fa3b93b523a5a9","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport itertools as it\nfrom collections import deque\nN = 1\nobservations = []\ndef solve(x, y=None):\n    groups=list(it.groupby(x)); return [[k,list(g)] for k,g in groups]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('two groups', solve(['a', 'a', 'b']), [['a', ['a', 'a']], ['b', ['b']]])\ncheck('one group', solve(['a', 'a']), [['a', ['a', 'a']]])\ncheck('empty', solve([]), [])\ncheck('three runs', solve(['b', 'a', 'b']), [['b', ['b']], ['a', ['a']], ['b', ['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"},"fixed":{"sha256":"3ab59a5bf74048490f48054364b876bb0806d56bbd03cc0cbed95afa1b0b84f9","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport itertools as it\nfrom collections import deque\nN = 1\nobservations = []\ndef solve(x, y=None):\n    return [[k,list(g)] for k,g in it.groupby(x)]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('two groups', solve(['a', 'a', 'b']), [['a', ['a', 'a']], ['b', ['b']]])\ncheck('one group', solve(['a', 'a']), [['a', ['a', 'a']]])\ncheck('empty', solve([]), [])\ncheck('three runs', solve(['b', 'a', 'b']), [['b', ['b']], ['a', ['a']], ['b', ['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-groupby-materialize-before-advancing","generated_at":"2026-09-29T14:37:40.684988+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":"Materialize each group before advancing the outer group iterator, since group iterators share their source.","root_cause":"Advancing the outer iterator exhausts group iterators sharing its source.","sha256":"0a1f7e3dc09917886fef0f1925a1801d7968623373cb60f4ecc8a26664cc2811","title":"Groupby materialize before advancing · 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":39.622,"exit_code":1,"observations":[{"actual":[["a",[]],["b",[]]],"check":"two groups","expected":[["a",["a","a"]],["b",["b"]]],"passed":false},{"actual":[["a",[]]],"check":"one group","expected":[["a",["a","a"]]],"passed":false},{"actual":[],"check":"empty","expected":[],"passed":true},{"actual":[["b",[]],["a",[]],["b",[]]],"check":"three runs","expected":[["b",["b"]],["a",["a"]],["b",["b"]]],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"two groups\", \"actual\": [[\"a\", []], [\"b\", []]], \"expected\": [[\"a\", [\"a\", \"a\"]], [\"b\", [\"b\"]]], \"passed\": false}, {\"check\": \"one group\", \"actual\": [[\"a\", []]], \"expected\": [[\"a\", [\"a\", \"a\"]]], \"passed\": false}, {\"check\": \"empty\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"three runs\", \"actual\": [[\"b\", []], [\"a\", []], [\"b\", []]], \"expected\": [[\"b\", [\"b\"]], [\"a\", [\"a\"]], [\"b\", [\"b\"]]], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":35.005,"exit_code":1,"observations":[{"actual":[["a",[]],["b",[]]],"check":"two groups","expected":[["a",["a","a"]],["b",["b"]]],"passed":false},{"actual":[["a",[]]],"check":"one group","expected":[["a",["a","a"]]],"passed":false},{"actual":[],"check":"empty","expected":[],"passed":true},{"actual":[["b",[]],["a",[]],["b",[]]],"check":"three runs","expected":[["b",["b"]],["a",["a"]],["b",["b"]]],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"two groups\", \"actual\": [[\"a\", []], [\"b\", []]], \"expected\": [[\"a\", [\"a\", \"a\"]], [\"b\", [\"b\"]]], \"passed\": false}, {\"check\": \"one group\", \"actual\": [[\"a\", []]], \"expected\": [[\"a\", [\"a\", \"a\"]]], \"passed\": false}, {\"check\": \"empty\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"three runs\", \"actual\": [[\"b\", []], [\"a\", []], [\"b\", []]], \"expected\": [[\"b\", [\"b\"]], [\"a\", [\"a\"]], [\"b\", [\"b\"]]], \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":39.054,"exit_code":0,"observations":[{"actual":[["a",["a","a"]],["b",["b"]]],"check":"two groups","expected":[["a",["a","a"]],["b",["b"]]],"passed":true},{"actual":[["a",["a","a"]]],"check":"one group","expected":[["a",["a","a"]]],"passed":true},{"actual":[],"check":"empty","expected":[],"passed":true},{"actual":[["b",["b"]],["a",["a"]],["b",["b"]]],"check":"three runs","expected":[["b",["b"]],["a",["a"]],["b",["b"]]],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"two groups\", \"actual\": [[\"a\", [\"a\", \"a\"]], [\"b\", [\"b\"]]], \"expected\": [[\"a\", [\"a\", \"a\"]], [\"b\", [\"b\"]]], \"passed\": true}, {\"check\": \"one group\", \"actual\": [[\"a\", [\"a\", \"a\"]]], \"expected\": [[\"a\", [\"a\", \"a\"]]], \"passed\": true}, {\"check\": \"empty\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"three runs\", \"actual\": [[\"b\", [\"b\"]], [\"a\", [\"a\"]], [\"b\", [\"b\"]]], \"expected\": [[\"b\", [\"b\"]], [\"a\", [\"a\"]], [\"b\", [\"b\"]]], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}