FAILURE MAP
← Case archive

FA-4381 / Mapping semantics / Open access

Map get preserves falsy value · case 01

The operation returns a result or retained state that violates this contract: Look up a key and use the fallback only when absent; falsy present values are retained.

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

ROOT CAUSE

Boolean fallback treats present falsy values as absent.

VERIFIED REPAIR

Look up a key and use the fallback only when absent; falsy present values are retained.

Unsuccessful approach: Special-casing None still conflates a present None with a missing key.

Case contract

Look up a key and use the fallback only when absent; falsy present values are retained. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

Why this case matters

A controlled local-runtime regression for collection APIs, language semantics, or ownership wrappers. Fixtures include boundary and interaction cases.

1 / The failure

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

N = 1
observations = []
def solve(x, y=None):
    return x.get(y[0]) or y[1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('zero value', solve({'a': 0}, ['a', 'fallback']), 0)
check('None value', solve({'a': None}, ['a', 'fallback']), None)
check('false value', solve({'a': False}, ['a', 'fallback']), False)
check('missing key', solve({}, ['a', 'fallback']), 'fallback')
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
zero valuefallback0Failed
None valuefallbackNoneFailed
false valuefallbackFalseFailed
missing keyfallbackfallbackPassed

SHA-256 / 9f0e04dbaf77bd97466e29db451d800b57dbeb3602c772bbf439a6a0f12ee426

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x, y=None):
    return x.get(y[0],y[1]) if x.get(y[0]) is not None else y[1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('zero value', solve({'a': 0}, ['a', 'fallback']), 0)
check('None value', solve({'a': None}, ['a', 'fallback']), None)
check('false value', solve({'a': False}, ['a', 'fallback']), False)
check('missing key', solve({}, ['a', 'fallback']), 'fallback')
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
zero value00Passed
None valuefallbackNoneFailed
false valueFalseFalsePassed
missing keyfallbackfallbackPassed

SHA-256 / 18c4d67134b687b3142702989aaacbb1207ed5d1e7088057afa3dfeeb2303e4b

3 / The verified repair

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

N = 1
observations = []
def solve(x, y=None):
    return x.get(y[0],y[1])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('zero value', solve({'a': 0}, ['a', 'fallback']), 0)
check('None value', solve({'a': None}, ['a', 'fallback']), None)
check('false value', solve({'a': False}, ['a', 'fallback']), False)
check('missing key', solve({}, ['a', 'fallback']), 'fallback')
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
zero value00Passed
None valueNoneNonePassed
false valueFalseFalsePassed
missing keyfallbackfallbackPassed

SHA-256 / 108a866402883d20bd6986262135c73b8864bddb3ab28785e5724916b3f5cb05

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

Case digest / e9e57797471c0b5597ebd55f33d42612d74b42560cafd86e40affabf99cb42ee