FAILURE MAP
← Case archive

FA-5286 / Python evaluation / Open access

Short circuit operands: Evaluates the right operand even when the left short-circuits · case 01

Evaluates the right operand even when the left short-circuits and changes the required Python-language result.

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

ROOT CAUSE

Evaluates the right operand even when the left short-circuits. The executable reproducer isolates this operation from the rest of the contract.

VERIFIED REPAIR

Evaluate left and rhs() or left or rhs(), returning [the actual selected operand,call log]. Python Boolean operators preserve operand values and call the right side only when needed.

Unsuccessful approach: The alternative still fails because it uses OR semantics for the AND operation.

Case contract

Evaluate left and rhs() or left or rhs(), returning [the actual selected operand,call log]. Python Boolean operators preserve operand values and call the right side only when needed. 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(operation, left, right):
    calls=[]
    def rhs():
        calls.append('right')
        return right
    r=rhs()
    result=(left and r) if operation=='and' else (left or r)
    return [result,calls]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('false AND returns original', solve('and', 0, 'right'), [0, []])
check('true AND evaluates right', solve('and', 'left', 'right'), ['right', ['right']])
check('true OR retains left', solve('or', 'left', 'right'), ['left', []])
check('false OR evaluates right', solve('or', None, 'right'), ['right', ['right']])
check('empty right remains empty', solve('and', 1, []), [[], ['right']])
check('empty left preserved', solve('and', [], None), [[], []])
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
false AND returns original[0, ['right']][0, []]Failed
true AND evaluates right['right', ['right']]['right', ['right']]Passed
true OR retains left['left', ['right']]['left', []]Failed
false OR evaluates right['right', ['right']]['right', ['right']]Passed
empty right remains empty[[], ['right']][[], ['right']]Passed
empty left preserved[[], ['right']][[], []]Failed

SHA-256 / 2bfbd532c10d6b57ea4a7f14e9e1ea1c30d2e038e9491167983da8a0d2e6feec

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(operation, left, right):
    calls=[]
    def rhs():
        calls.append('right')
        return right
    result=left or rhs()
    return [result,calls]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('false AND returns original', solve('and', 0, 'right'), [0, []])
check('true AND evaluates right', solve('and', 'left', 'right'), ['right', ['right']])
check('true OR retains left', solve('or', 'left', 'right'), ['left', []])
check('false OR evaluates right', solve('or', None, 'right'), ['right', ['right']])
check('empty right remains empty', solve('and', 1, []), [[], ['right']])
check('empty left preserved', solve('and', [], None), [[], []])
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
false AND returns original['right', ['right']][0, []]Failed
true AND evaluates right['left', []]['right', ['right']]Failed
true OR retains left['left', []]['left', []]Passed
false OR evaluates right['right', ['right']]['right', ['right']]Passed
empty right remains empty[1, []][[], ['right']]Failed
empty left preserved[None, ['right']][[], []]Failed

SHA-256 / dbce60fb0fcd0ca202721f1ed8134aa0be9cf460e1fefdddce6ed0c20c51e4aa

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(operation, left, right):
    calls=[]
    def rhs():
        calls.append('right')
        return right
    result=(left and rhs()) if operation=="and" else (left or rhs())
    return [result,calls]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('false AND returns original', solve('and', 0, 'right'), [0, []])
check('true AND evaluates right', solve('and', 'left', 'right'), ['right', ['right']])
check('true OR retains left', solve('or', 'left', 'right'), ['left', []])
check('false OR evaluates right', solve('or', None, 'right'), ['right', ['right']])
check('empty right remains empty', solve('and', 1, []), [[], ['right']])
check('empty left preserved', solve('and', [], None), [[], []])
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
false AND returns original[0, []][0, []]Passed
true AND evaluates right['right', ['right']]['right', ['right']]Passed
true OR retains left['left', []]['left', []]Passed
false OR evaluates right['right', ['right']]['right', ['right']]Passed
empty right remains empty[[], ['right']][[], ['right']]Passed
empty left preserved[[], []][[], []]Passed

SHA-256 / 67f8092f6d183ed42cc99f0ce81dc31a6e2bae5c877264ef67f6499b77de26ab

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

Case digest / a08d69a5339ede8ce8c5668812dabe99adb2ca5c68f939f59dd752bf0d95ae1d