FAILURE MAP
← Case archive

FA-10411 / Caching / Open access

A cached negative lookup is mistaken for a miss · case 01

A cached negative lookup is mistaken for a miss.

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

ROOT CAUSE

Payload truthiness doubles as the cache membership indicator.

VERIFIED REPAIR

Preserve the cache-state invariant: Return [hit,value] for any stored key, including None, false, zero and empty values; absent keys return [miss,None].

Unsuccessful approach: A None check still conflates an explicitly cached negative result with absence.

Case contract

Return [hit,value] for any stored key, including None, false, zero and empty values; absent keys return [miss,None].

Why this case matters

A deterministic cache state transformation. Inputs are copied or treated as immutable; no remote storage, real clock, or concurrent interleaving is simulated.

1 / The failure

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

N = 1
observations = []
def solve(cache, key):
    return ['hit',cache[key]] if cache.get(key) else ['miss',None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*({'a': None}, 'a')), ['hit', None])
check('fixture 2', solve(*({'a': 0}, 'a')), ['hit', 0])
check('fixture 3', solve(*({'a': False}, 'a')), ['hit', False])
check('fixture 4', solve(*({}, 'a')), ['miss', None])
check('fixture 5', solve(*({'a': 'x'}, 'a')), ['hit', 'x'])
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
fixture 1['miss', None]['hit', None]Failed
fixture 2['miss', None]['hit', 0]Failed
fixture 3['miss', None]['hit', False]Failed
fixture 4['miss', None]['miss', None]Passed
fixture 5['hit', 'x']['hit', 'x']Passed

SHA-256 / 3b536b2e5faa4ddf1b0e7129481aa50e230598b1433cc0116144167344763ca0

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(cache, key):
    return ['hit',cache[key]] if cache.get(key) is not None else ['miss',None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*({'a': None}, 'a')), ['hit', None])
check('fixture 2', solve(*({'a': 0}, 'a')), ['hit', 0])
check('fixture 3', solve(*({'a': False}, 'a')), ['hit', False])
check('fixture 4', solve(*({}, 'a')), ['miss', None])
check('fixture 5', solve(*({'a': 'x'}, 'a')), ['hit', 'x'])
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
fixture 1['miss', None]['hit', None]Failed
fixture 2['hit', 0]['hit', 0]Passed
fixture 3['hit', False]['hit', False]Passed
fixture 4['miss', None]['miss', None]Passed
fixture 5['hit', 'x']['hit', 'x']Passed

SHA-256 / 5002a73694a75dd57aab492eebf56b2735a08b69edcced75257262beaeba3744

3 / The verified repair

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

N = 1
observations = []
def solve(cache, key):
    return ['hit',cache[key]] if key in cache else ['miss',None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*({'a': None}, 'a')), ['hit', None])
check('fixture 2', solve(*({'a': 0}, 'a')), ['hit', 0])
check('fixture 3', solve(*({'a': False}, 'a')), ['hit', False])
check('fixture 4', solve(*({}, 'a')), ['miss', None])
check('fixture 5', solve(*({'a': 'x'}, 'a')), ['hit', 'x'])
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
fixture 1['hit', None]['hit', None]Passed
fixture 2['hit', 0]['hit', 0]Passed
fixture 3['hit', False]['hit', False]Passed
fixture 4['miss', None]['miss', None]Passed
fixture 5['hit', 'x']['hit', 'x']Passed

SHA-256 / c7905b5a5726db64d58e91e743f9f77b975c1db75108e74f54816310cb24055f

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

Case digest / fd752b017d4869c7f915bf5b8a35a8150c8ebb3c717e374a5713f4f02e0f97b8