{"abstract":"The operation returns a result or retained state that violates this contract: Consume the prefix before sentinel, consuming but excluding the first sentinel; return [prefix,remainder].","category":"Iterator consumption","checks":4,"contract":"Consume the prefix before sentinel, consuming but excluding the first sentinel; return [prefix,remainder]. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.","evaluation_group":"model-342bc4e71afbc617","failed_approach":"Index-based partitioning incorrectly returns the consumed sentinel in the tail.","family":"xr-takewhile-consumes-first-failure","id":"FA-4541","implementations":{"attempt":{"sha256":"06446dce6288590a3081a7271b89246cf0802e57bd5caf10e1fcff55f60b8021","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    i=x.index(y) if y in x else len(x); return [x[:i],x[i:]]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('middle stop', solve(['a', 'stop', 'b'], 'stop'), [['a'], ['b']])\ncheck('stop first', solve(['stop', 'a'], 'stop'), [[], ['a']])\ncheck('no stop', solve(['a'], 'stop'), [['a'], []])\ncheck('empty', solve([], 'stop'), [[], []])\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":"86e66064cdf40cfcdf24775c880e969b0b41012d7168b8df2eaada859b7576db","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    g=iter(x); a=[v for v in g if v!=y]; return [a,list(g)]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('middle stop', solve(['a', 'stop', 'b'], 'stop'), [['a'], ['b']])\ncheck('stop first', solve(['stop', 'a'], 'stop'), [[], ['a']])\ncheck('no stop', solve(['a'], 'stop'), [['a'], []])\ncheck('empty', solve([], 'stop'), [[], []])\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":"efc6cd21ff52871bca5f11592e7b6e11696583106da9db125c169a7a9d14e027","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    g=iter(x); a=list(it.takewhile(lambda v:v!=y,g)); return [a,list(g)]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('middle stop', solve(['a', 'stop', 'b'], 'stop'), [['a'], ['b']])\ncheck('stop first', solve(['stop', 'a'], 'stop'), [[], ['a']])\ncheck('no stop', solve(['a'], 'stop'), [['a'], []])\ncheck('empty', solve([], 'stop'), [[], []])\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-takewhile-consumes-first-failure","generated_at":"2026-09-29T14:37:40.169022+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":"Consume the prefix before sentinel, consuming but excluding the first sentinel; return [prefix,remainder].","root_cause":"Filtering the whole stream does not stop at the first predicate failure.","sha256":"c0f98337df47414c4ec587b55a3cfc4d7c919e989daabdda305d541d9876fd95","title":"Takewhile consumes first failure · 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":37.705,"exit_code":1,"observations":[{"actual":[["a"],["stop","b"]],"check":"middle stop","expected":[["a"],["b"]],"passed":false},{"actual":[[],["stop","a"]],"check":"stop first","expected":[[],["a"]],"passed":false},{"actual":[["a"],[]],"check":"no stop","expected":[["a"],[]],"passed":true},{"actual":[[],[]],"check":"empty","expected":[[],[]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"middle stop\", \"actual\": [[\"a\"], [\"stop\", \"b\"]], \"expected\": [[\"a\"], [\"b\"]], \"passed\": false}, {\"check\": \"stop first\", \"actual\": [[], [\"stop\", \"a\"]], \"expected\": [[], [\"a\"]], \"passed\": false}, {\"check\": \"no stop\", \"actual\": [[\"a\"], []], \"expected\": [[\"a\"], []], \"passed\": true}, {\"check\": \"empty\", \"actual\": [[], []], \"expected\": [[], []], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":119.724,"exit_code":1,"observations":[{"actual":[["a","b"],[]],"check":"middle stop","expected":[["a"],["b"]],"passed":false},{"actual":[["a"],[]],"check":"stop first","expected":[[],["a"]],"passed":false},{"actual":[["a"],[]],"check":"no stop","expected":[["a"],[]],"passed":true},{"actual":[[],[]],"check":"empty","expected":[[],[]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"middle stop\", \"actual\": [[\"a\", \"b\"], []], \"expected\": [[\"a\"], [\"b\"]], \"passed\": false}, {\"check\": \"stop first\", \"actual\": [[\"a\"], []], \"expected\": [[], [\"a\"]], \"passed\": false}, {\"check\": \"no stop\", \"actual\": [[\"a\"], []], \"expected\": [[\"a\"], []], \"passed\": true}, {\"check\": \"empty\", \"actual\": [[], []], \"expected\": [[], []], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":39.236,"exit_code":0,"observations":[{"actual":[["a"],["b"]],"check":"middle stop","expected":[["a"],["b"]],"passed":true},{"actual":[[],["a"]],"check":"stop first","expected":[[],["a"]],"passed":true},{"actual":[["a"],[]],"check":"no stop","expected":[["a"],[]],"passed":true},{"actual":[[],[]],"check":"empty","expected":[[],[]],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"middle stop\", \"actual\": [[\"a\"], [\"b\"]], \"expected\": [[\"a\"], [\"b\"]], \"passed\": true}, {\"check\": \"stop first\", \"actual\": [[], [\"a\"]], \"expected\": [[], [\"a\"]], \"passed\": true}, {\"check\": \"no stop\", \"actual\": [[\"a\"], []], \"expected\": [[\"a\"], []], \"passed\": true}, {\"check\": \"empty\", \"actual\": [[], []], \"expected\": [[], []], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}