FA-5241 / Exception flow / Open access
Exception chaining metadata: Turns implicit context into an explicit cause · case 01
Turns implicit context into an explicit cause and changes the required Python-language result.
ROOT CAUSE
Turns implicit context into an explicit cause. The executable reproducer isolates this operation from the rest of the contract.
VERIFIED REPAIR
Wrap ValueError in RuntimeError with implicit, explicit, or from-None chaining. Return [error type,cause type or None,context type or None,suppress-context flag]. Suppressing displayed context does not erase __context__.
Unsuccessful approach: The alternative still fails because it deletes the stored context when only context display should be suppressed.
Case contract
Wrap ValueError in RuntimeError with implicit, explicit, or from-None chaining. Return [error type,cause type or None,context type or None,suppress-context flag]. Suppressing displayed context does not erase __context__. Inputs use the finite Python types shown in the fixtures. An error string denotes the specified caught exception, not an unhandled process failure.
Why this case matters
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.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(mode):
try:
try:
raise ValueError('original')
except ValueError as original:
error=RuntimeError('wrapper')
if mode=='explicit':
raise error from original
elif mode=='suppressed':
raise error from None
else:
raise error from original
except BaseException as caught:
pass
return [type(caught).__name__, None if caught.__cause__ is None else type(caught.__cause__).__name__, None if caught.__context__ is None else type(caught.__context__).__name__, caught.__suppress_context__]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('explicit cause', solve('explicit'), ['RuntimeError', 'ValueError', 'ValueError', True])
check('suppressed display', solve('suppressed'), ['RuntimeError', None, 'ValueError', True])
check('implicit context', solve('implicit'), ['RuntimeError', None, 'ValueError', False])
check('default path remains implicit', solve('other'), ['RuntimeError', None, 'ValueError', False])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| explicit cause | ['RuntimeError', 'ValueError', 'ValueError', True] | ['RuntimeError', 'ValueError', 'ValueError', True] | Passed |
| suppressed display | ['RuntimeError', None, 'ValueError', True] | ['RuntimeError', None, 'ValueError', True] | Passed |
| implicit context | ['RuntimeError', 'ValueError', 'ValueError', True] | ['RuntimeError', None, 'ValueError', False] | Failed |
| default path remains implicit | ['RuntimeError', 'ValueError', 'ValueError', True] | ['RuntimeError', None, 'ValueError', False] | Failed |
SHA-256 / 8bc2008a7e2853a46b3e7861407038d997fb6b40cbc7a931fa098bb87b2158e5
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(mode):
try:
try:
raise ValueError('original')
except ValueError as original:
error=RuntimeError('wrapper')
if mode=='explicit':
raise error from original
elif mode=='suppressed':
raise error from None
else:
raise error
except BaseException as caught:
if caught.__suppress_context__: caught.__context__=None
return [type(caught).__name__, None if caught.__cause__ is None else type(caught.__cause__).__name__, None if caught.__context__ is None else type(caught.__context__).__name__, caught.__suppress_context__]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('explicit cause', solve('explicit'), ['RuntimeError', 'ValueError', 'ValueError', True])
check('suppressed display', solve('suppressed'), ['RuntimeError', None, 'ValueError', True])
check('implicit context', solve('implicit'), ['RuntimeError', None, 'ValueError', False])
check('default path remains implicit', solve('other'), ['RuntimeError', None, 'ValueError', False])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| explicit cause | ['RuntimeError', 'ValueError', None, True] | ['RuntimeError', 'ValueError', 'ValueError', True] | Failed |
| suppressed display | ['RuntimeError', None, None, True] | ['RuntimeError', None, 'ValueError', True] | Failed |
| implicit context | ['RuntimeError', None, 'ValueError', False] | ['RuntimeError', None, 'ValueError', False] | Passed |
| default path remains implicit | ['RuntimeError', None, 'ValueError', False] | ['RuntimeError', None, 'ValueError', False] | Passed |
SHA-256 / 4c1a8015a097b22a5f860007b35fb625df679c6850518d5b5701c9e363bc9855
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(mode):
try:
try:
raise ValueError('original')
except ValueError as original:
error=RuntimeError('wrapper')
if mode=='explicit':
raise error from original
elif mode=='suppressed':
raise error from None
else:
raise error
except BaseException as caught:
pass
return [type(caught).__name__, None if caught.__cause__ is None else type(caught.__cause__).__name__, None if caught.__context__ is None else type(caught.__context__).__name__, caught.__suppress_context__]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('explicit cause', solve('explicit'), ['RuntimeError', 'ValueError', 'ValueError', True])
check('suppressed display', solve('suppressed'), ['RuntimeError', None, 'ValueError', True])
check('implicit context', solve('implicit'), ['RuntimeError', None, 'ValueError', False])
check('default path remains implicit', solve('other'), ['RuntimeError', None, 'ValueError', False])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| explicit cause | ['RuntimeError', 'ValueError', 'ValueError', True] | ['RuntimeError', 'ValueError', 'ValueError', True] | Passed |
| suppressed display | ['RuntimeError', None, 'ValueError', True] | ['RuntimeError', None, 'ValueError', True] | Passed |
| implicit context | ['RuntimeError', None, 'ValueError', False] | ['RuntimeError', None, 'ValueError', False] | Passed |
| default path remains implicit | ['RuntimeError', None, 'ValueError', False] | ['RuntimeError', None, 'ValueError', False] | Passed |
SHA-256 / f298b5850e85d1c41cef21ebfc85bc463d87ca117fcc39239a37d1937c35333e
Verification & scope
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.
Observations recorded using Python 3.12.14 at 2026-09-29T14:37:47.431562+00:00.
Case digest / ca931bfa66216771f8ed50fd8388335b8e7a0c1218170bc9ca3b45876cbe0651