FAILURE MAP
← Case archive

FA-10386 / Caching / Open access

Replacing a cached value duplicates its recency entry · case 01

Replacing a cached value duplicates its recency entry.

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

ROOT CAUSE

Replacement appends a second linked-list entry for the same cache key.

VERIFIED REPAIR

Preserve the cache-state invariant: Put key at the most-recent end of a unique least-to-most-recent list, removing its previous position.

Unsuccessful approach: Suppressing duplicate insertion fails to promote the replaced entry.

Case contract

Put key at the most-recent end of a unique least-to-most-recent list, removing its previous position.

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

SHA-256 / 4914aa90d1b2f689e87ad1f35ff8ef0205de779811211d3b8968f9719657cadc

2 / The unsuccessful fix

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

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

SHA-256 / 4a619eceb988dd46c62ec9f395a035e6ddbd64a86a0695e4dcd1fa4f7ea66fe9

3 / The verified repair

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

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

SHA-256 / f58977141e6966b255d57b80a0f411f437c779ff323f72710f2bfe88960ac07e

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

Case digest / 20d10b0d85d6adce7ebd2859ea6eaa718f2df1bfc5ac1854f624dbef08d6df1d