FAILURE MAP
← Case archive

FA-5236 / Exception flow / Open access

Exception chaining metadata: Leaves implicit context visible when from-None suppression was requested · case 01

Leaves implicit context visible when from-None suppression was requested and changes the required Python-language result.

Verified by executionVariant 1 · 4 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Leaves implicit context visible when from-None suppression was requested. 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 turns implicit context into an explicit cause.

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
            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 fixtureActualExpectedOutcome
explicit cause['RuntimeError', 'ValueError', 'ValueError', True]['RuntimeError', 'ValueError', 'ValueError', True]Passed
suppressed display['RuntimeError', None, 'ValueError', False]['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 / f07726ef7355c01b0cd1097f2da3deb21d5c5aa6b6e116b9e1e5bc8a9b7be607

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 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 fixtureActualExpectedOutcome
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

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 fixtureActualExpectedOutcome
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.268088+00:00.

Case digest / 2deb9d4875bd2d0ed547e9baef388dd39a2021fb20ee384d3d7db7445d63da58