FAILURE MAP
← Case archive

FA-10451 / Caching / Open access

Replacing a dirty value with a read result silently loses pending writes · case 01

Replacing a dirty value with a read result silently loses pending writes.

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

ROOT CAUSE

Read-through refresh overwrites locally modified cache state.

VERIFIED REPAIR

Preserve the cache-state invariant: Entry is [value,dirty]. A fetched value replaces only clean state; a dirty local write remains authoritative until flushed.

Unsuccessful approach: Refusing every refresh also prevents clean entries from receiving remote updates.

Case contract

Entry is [value,dirty]. A fetched value replaces only clean state; a dirty local write remains authoritative until flushed.

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(entry, fetched):
    return [fetched,False]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*(['local', True], 'remote')), ['local', True])
check('fixture 2', solve(*(['old', False], 'remote')), ['remote', False])
check('fixture 3', solve(*([None, True], 'remote')), [None, True])
check('fixture 4', solve(*([None, False], 0)), [0, False])
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['remote', False]['local', True]Failed
fixture 2['remote', False]['remote', False]Passed
fixture 3['remote', False][None, True]Failed
fixture 4[0, False][0, False]Passed

SHA-256 / 506a56fd4de4e58db4486306787bbc3c249ae86c91fdc5cbdb345fca105f2b1c

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(entry, fetched):
    return [entry[0],entry[1]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*(['local', True], 'remote')), ['local', True])
check('fixture 2', solve(*(['old', False], 'remote')), ['remote', False])
check('fixture 3', solve(*([None, True], 'remote')), [None, True])
check('fixture 4', solve(*([None, False], 0)), [0, False])
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['local', True]['local', True]Passed
fixture 2['old', False]['remote', False]Failed
fixture 3[None, True][None, True]Passed
fixture 4[None, False][0, False]Failed

SHA-256 / babef84de440a1f78682137495def41fb4c3e6c5c6fb32afcd82e0c935babf1c

3 / The verified repair

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

N = 1
observations = []
def solve(entry, fetched):
    return list(entry) if entry[1] else [fetched,False]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*(['local', True], 'remote')), ['local', True])
check('fixture 2', solve(*(['old', False], 'remote')), ['remote', False])
check('fixture 3', solve(*([None, True], 'remote')), [None, True])
check('fixture 4', solve(*([None, False], 0)), [0, False])
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['local', True]['local', True]Passed
fixture 2['remote', False]['remote', False]Passed
fixture 3[None, True][None, True]Passed
fixture 4[0, False][0, False]Passed

SHA-256 / d781f38ccc0a070cd97d828331b1b3c0e090f0c493978ef2a46d88f9eaca47c6

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

Case digest / b04fd6dac6fb43687f5cde62d606fb8950acbf55b504ceeb99176a6f4c623422