FAILURE MAP
← Case archive

FA-10421 / Caching / Open access

A newly requested cached key is evicted before its hit updates recency · case 01

A newly requested cached key is evicted before its hit updates recency.

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

ROOT CAUSE

The insertion evicts against stale recency that predates the immediately preceding read.

VERIFIED REPAIR

Preserve the cache-state invariant: A nonempty full unique-key LRU list receives a read hit or miss, then a distinct incoming key. Return order after touch and one capacity-preserving insertion. Empty capacity stores nothing.

Unsuccessful approach: Removing the hit itself keeps the cold entry and discards the hot entry.

Case contract

A nonempty full unique-key LRU list receives a read hit or miss, then a distinct incoming key. Return order after touch and one capacity-preserving insertion. Empty capacity stores nothing.

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(order, hit, incoming):
    return order[1:]+[incoming]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*(['a', 'b'], 'a', 'c')), ['a', 'c'])
check('fixture 2', solve(*(['a', 'b'], 'b', 'c')), ['b', 'c'])
check('fixture 3', solve(*(['a'], 'a', 'b')), ['b'])
check('fixture 4', solve(*(['a', 'b'], 'z', 'c')), ['b', 'c'])
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['b', 'c']['a', 'c']Failed
fixture 2['b', 'c']['b', 'c']Passed
fixture 3['b']['b']Passed
fixture 4['b', 'c']['b', 'c']Passed

SHA-256 / 0c4c1470b2ed8ecf2f75e0544e17e736a054bc2f6c195f1aeb048b7d5bcbb277

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(order, hit, incoming):
    return [x for x in order if x != hit]+[incoming]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*(['a', 'b'], 'a', 'c')), ['a', 'c'])
check('fixture 2', solve(*(['a', 'b'], 'b', 'c')), ['b', 'c'])
check('fixture 3', solve(*(['a'], 'a', 'b')), ['b'])
check('fixture 4', solve(*(['a', 'b'], 'z', 'c')), ['b', 'c'])
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['b', 'c']['a', 'c']Failed
fixture 2['a', 'c']['b', 'c']Failed
fixture 3['b']['b']Passed
fixture 4['a', 'b', 'c']['b', 'c']Failed

SHA-256 / 4f629805cb69258c200675831897401cdbb3683038809cd5e0df9974e32087d2

3 / The verified repair

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

N = 1
observations = []
def solve(order, hit, incoming):
    updated=[x for x in order if x != hit]+[hit] if hit in order else list(order)
    return updated[1:]+[incoming] if updated else []
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*(['a', 'b'], 'a', 'c')), ['a', 'c'])
check('fixture 2', solve(*(['a', 'b'], 'b', 'c')), ['b', 'c'])
check('fixture 3', solve(*(['a'], 'a', 'b')), ['b'])
check('fixture 4', solve(*(['a', 'b'], 'z', 'c')), ['b', 'c'])
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['a', 'c']['a', 'c']Passed
fixture 2['b', 'c']['b', 'c']Passed
fixture 3['b']['b']Passed
fixture 4['b', 'c']['b', 'c']Passed

SHA-256 / d34b252667a69c6245f9528be36d9e25a7c8ccdbebb3d3ada5100a173e6a1390

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

Case digest / cd4d63ed8174bf7ad33e2054e916fd6dac9f58a51594df994746a5398303bf0d