FAILURE MAP
← Case archive

FA-10431 / Caching / Open access

A successful read resets LFU frequency instead of accumulating it · case 01

A successful read resets LFU frequency instead of accumulating it.

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

ROOT CAUSE

Read accounting initializes rather than increments an existing frequency.

VERIFIED REPAIR

Preserve the cache-state invariant: Increment the count only for a resident key; a lookup miss must not insert a frequency entry.

Unsuccessful approach: Incrementing with a default count accidentally caches missed keys.

Case contract

Increment the count only for a resident key; a lookup miss must not insert a frequency entry.

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(counts, key):
    out=dict(counts)
    if key in out: out[key]=1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*({'a': 3}, 'a')), {'a': 4})
check('fixture 2', solve(*({'a': 0}, 'a')), {'a': 1})
check('fixture 3', solve(*({'a': 2}, 'b')), {'a': 2})
check('fixture 4', solve(*({}, 'a')), {})
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': 1}{'a': 4}Failed
fixture 2{'a': 1}{'a': 1}Passed
fixture 3{'a': 2}{'a': 2}Passed
fixture 4{}{}Passed

SHA-256 / e63505245fa93086bfd9e89697f4db09a15558f0c1cbbdd83f6c7f146b60e1ad

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(counts, key):
    out=dict(counts)
    out[key]=out.get(key,0)+1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*({'a': 3}, 'a')), {'a': 4})
check('fixture 2', solve(*({'a': 0}, 'a')), {'a': 1})
check('fixture 3', solve(*({'a': 2}, 'b')), {'a': 2})
check('fixture 4', solve(*({}, 'a')), {})
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': 4}{'a': 4}Passed
fixture 2{'a': 1}{'a': 1}Passed
fixture 3{'a': 2, 'b': 1}{'a': 2}Failed
fixture 4{'a': 1}{}Failed

SHA-256 / 0c179a015341a52b5cd71a88b1c6774a1b0dbfe15156699406d784471726c8d5

3 / The verified repair

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

N = 1
observations = []
def solve(counts, key):
    out=dict(counts)
    if key in out: out[key]+=1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*({'a': 3}, 'a')), {'a': 4})
check('fixture 2', solve(*({'a': 0}, 'a')), {'a': 1})
check('fixture 3', solve(*({'a': 2}, 'b')), {'a': 2})
check('fixture 4', solve(*({}, 'a')), {})
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': 4}{'a': 4}Passed
fixture 2{'a': 1}{'a': 1}Passed
fixture 3{'a': 2}{'a': 2}Passed
fixture 4{}{}Passed

SHA-256 / 0b19a8ce9d920128e77ae2858fddd5e8025a0b9b81e3dd9d37790a1f8660e4f9

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

Case digest / 500ae73cc0e370a19fe3036a2a8860bb0720d91dfaa65b94e732a65d570c2876