{"abstract":"Calls __enter__ manually and loses guaranteed exit on body failure and changes the required Python-language result.","category":"Context managers","checks":5,"contract":"Bind the exact __enter__ return value to the with target, including false values. A failing __enter__ prevents body and __exit__; body exceptions still call __exit__. Inputs use the finite Python types shown in the fixtures. An error string denotes the specified caught exception, not an unhandled process failure.","evaluation_group":"xl-context-enter-binding","failed_approach":"The alternative still fails because it binds the manager object label instead of its __enter__ result.","family":"xl-context-enter-binding-manual-enter-without-exit","id":"FA-5176","implementations":{"attempt":{"sha256":"1e347d27e380eec6baaf824a3a2026081931f7aa0acf869cc5f8ed1b5d24c587","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(payload, fail, body_error):\n    log=[]\n    class Manager:\n        def __init__(self): self.value='manager'\n        def __enter__(self):\n            log.append('enter')\n            if fail: raise ValueError('enter failed')\n            return payload\n        def __exit__(self,typ,exc,tb): log.append('exit'); return False\n    manager=Manager()\n    try:\n        with manager as bound:\n            log.append(['body',manager.value])\n            if body_error: raise KeyError('body failed')\n    except Exception as exc: log.append(type(exc).__name__)\n    return log\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('ordinary binding', solve('value', False, False), ['enter', ['body', 'value'], 'exit'])\ncheck('false return remains bound', solve(0, False, False), ['enter', ['body', 0], 'exit'])\ncheck('None return remains bound', solve(None, False, False), ['enter', ['body', None], 'exit'])\ncheck('enter failure skips exit', solve('value', True, False), ['enter', 'ValueError'])\ncheck('body failure still exits', solve('value', False, True), ['enter', ['body', 'value'], 'exit', 'KeyError'])\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":"f1a3f9b26aeae6a0b7a9b4649d4a4daa84645e7c7d69269056945f0fe4a6ed25","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(payload, fail, body_error):\n    log=[]\n    try:\n        log.append('enter')\n        if fail: raise ValueError('enter failed')\n        log.append(['body',payload])\n        if body_error: raise KeyError('body failed')\n        log.append('exit')\n    except Exception as exc: log.append(type(exc).__name__)\n    return log\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('ordinary binding', solve('value', False, False), ['enter', ['body', 'value'], 'exit'])\ncheck('false return remains bound', solve(0, False, False), ['enter', ['body', 0], 'exit'])\ncheck('None return remains bound', solve(None, False, False), ['enter', ['body', None], 'exit'])\ncheck('enter failure skips exit', solve('value', True, False), ['enter', 'ValueError'])\ncheck('body failure still exits', solve('value', False, True), ['enter', ['body', 'value'], 'exit', 'KeyError'])\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":"73b8659395ff0179c5440f6dec07c2cc5f47e44c7f652f79e33d9410b3729621","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(payload, fail, body_error):\n    log=[]\n    class Manager:\n        def __init__(self): self.value='manager'\n        def __enter__(self):\n            log.append('enter')\n            if fail: raise ValueError('enter failed')\n            return payload\n        def __exit__(self,typ,exc,tb): log.append('exit'); return False\n    manager=Manager()\n    try:\n        with manager as bound:\n            log.append(['body',bound])\n            if body_error: raise KeyError('body failed')\n    except Exception as exc: log.append(type(exc).__name__)\n    return log\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('ordinary binding', solve('value', False, False), ['enter', ['body', 'value'], 'exit'])\ncheck('false return remains bound', solve(0, False, False), ['enter', ['body', 0], 'exit'])\ncheck('None return remains bound', solve(None, False, False), ['enter', ['body', None], 'exit'])\ncheck('enter failure skips exit', solve('value', True, False), ['enter', 'ValueError'])\ncheck('body failure still exits', solve('value', False, True), ['enter', ['body', 'value'], 'exit', 'KeyError'])\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":"xl-context-enter-binding-manual-enter-without-exit","generated_at":"2026-09-29T14:37:46.820375+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Runs Python standard-library language operations in a deterministic local reproducer. Literal expected answers are authored independently. Related defects share an evaluation group to avoid benchmark split leakage.","repair":"Bind the exact __enter__ return value to the with target, including false values. A failing __enter__ prevents body and __exit__; body exceptions still call __exit__.","root_cause":"Calls __enter__ manually and loses guaranteed exit on body failure. The executable reproducer isolates this operation from the rest of the contract.","sha256":"5721f11f52629c5e7857903225c85da146363ca409ea5da58952dfd4df63d06d","title":"Context enter binding: Calls __enter__ manually and loses guaranteed exit on body failure · case 01","variant":1,"variant_policy":"The five numbered cases rerun the same authored boundary fixtures; they are reproducibility runs, not independent input variants.","verification":{"attempt":{"elapsed_ms":40.623,"exit_code":1,"observations":[{"actual":["enter",["body","manager"],"exit"],"check":"ordinary binding","expected":["enter",["body","value"],"exit"],"passed":false},{"actual":["enter",["body","manager"],"exit"],"check":"false return remains bound","expected":["enter",["body",0],"exit"],"passed":false},{"actual":["enter",["body","manager"],"exit"],"check":"None return remains bound","expected":["enter",["body",null],"exit"],"passed":false},{"actual":["enter","ValueError"],"check":"enter failure skips exit","expected":["enter","ValueError"],"passed":true},{"actual":["enter",["body","manager"],"exit","KeyError"],"check":"body failure still exits","expected":["enter",["body","value"],"exit","KeyError"],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"ordinary binding\", \"actual\": [\"enter\", [\"body\", \"manager\"], \"exit\"], \"expected\": [\"enter\", [\"body\", \"value\"], \"exit\"], \"passed\": false}, {\"check\": \"false return remains bound\", \"actual\": [\"enter\", [\"body\", \"manager\"], \"exit\"], \"expected\": [\"enter\", [\"body\", 0], \"exit\"], \"passed\": false}, {\"check\": \"None return remains bound\", \"actual\": [\"enter\", [\"body\", \"manager\"], \"exit\"], \"expected\": [\"enter\", [\"body\", null], \"exit\"], \"passed\": false}, {\"check\": \"enter failure skips exit\", \"actual\": [\"enter\", \"ValueError\"], \"expected\": [\"enter\", \"ValueError\"], \"passed\": true}, {\"check\": \"body failure still exits\", \"actual\": [\"enter\", [\"body\", \"manager\"], \"exit\", \"KeyError\"], \"expected\": [\"enter\", [\"body\", \"value\"], \"exit\", \"KeyError\"], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":110.37,"exit_code":1,"observations":[{"actual":["enter",["body","value"],"exit"],"check":"ordinary binding","expected":["enter",["body","value"],"exit"],"passed":true},{"actual":["enter",["body",0],"exit"],"check":"false return remains bound","expected":["enter",["body",0],"exit"],"passed":true},{"actual":["enter",["body",null],"exit"],"check":"None return remains bound","expected":["enter",["body",null],"exit"],"passed":true},{"actual":["enter","ValueError"],"check":"enter failure skips exit","expected":["enter","ValueError"],"passed":true},{"actual":["enter",["body","value"],"KeyError"],"check":"body failure still exits","expected":["enter",["body","value"],"exit","KeyError"],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"ordinary binding\", \"actual\": [\"enter\", [\"body\", \"value\"], \"exit\"], \"expected\": [\"enter\", [\"body\", \"value\"], \"exit\"], \"passed\": true}, {\"check\": \"false return remains bound\", \"actual\": [\"enter\", [\"body\", 0], \"exit\"], \"expected\": [\"enter\", [\"body\", 0], \"exit\"], \"passed\": true}, {\"check\": \"None return remains bound\", \"actual\": [\"enter\", [\"body\", null], \"exit\"], \"expected\": [\"enter\", [\"body\", null], \"exit\"], \"passed\": true}, {\"check\": \"enter failure skips exit\", \"actual\": [\"enter\", \"ValueError\"], \"expected\": [\"enter\", \"ValueError\"], \"passed\": true}, {\"check\": \"body failure still exits\", \"actual\": [\"enter\", [\"body\", \"value\"], \"KeyError\"], \"expected\": [\"enter\", [\"body\", \"value\"], \"exit\", \"KeyError\"], \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":37.107,"exit_code":0,"observations":[{"actual":["enter",["body","value"],"exit"],"check":"ordinary binding","expected":["enter",["body","value"],"exit"],"passed":true},{"actual":["enter",["body",0],"exit"],"check":"false return remains bound","expected":["enter",["body",0],"exit"],"passed":true},{"actual":["enter",["body",null],"exit"],"check":"None return remains bound","expected":["enter",["body",null],"exit"],"passed":true},{"actual":["enter","ValueError"],"check":"enter failure skips exit","expected":["enter","ValueError"],"passed":true},{"actual":["enter",["body","value"],"exit","KeyError"],"check":"body failure still exits","expected":["enter",["body","value"],"exit","KeyError"],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"ordinary binding\", \"actual\": [\"enter\", [\"body\", \"value\"], \"exit\"], \"expected\": [\"enter\", [\"body\", \"value\"], \"exit\"], \"passed\": true}, {\"check\": \"false return remains bound\", \"actual\": [\"enter\", [\"body\", 0], \"exit\"], \"expected\": [\"enter\", [\"body\", 0], \"exit\"], \"passed\": true}, {\"check\": \"None return remains bound\", \"actual\": [\"enter\", [\"body\", null], \"exit\"], \"expected\": [\"enter\", [\"body\", null], \"exit\"], \"passed\": true}, {\"check\": \"enter failure skips exit\", \"actual\": [\"enter\", \"ValueError\"], \"expected\": [\"enter\", \"ValueError\"], \"passed\": true}, {\"check\": \"body failure still exits\", \"actual\": [\"enter\", [\"body\", \"value\"], \"exit\", \"KeyError\"], \"expected\": [\"enter\", [\"body\", \"value\"], \"exit\", \"KeyError\"], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}