FA-10401 / Caching / Open access
Replacing an entry double-counts its existing cache weight · case 01
Replacing an entry double-counts its existing cache weight.
ROOT CAUSE
Admission adds the new weight without subtracting the replaced value weight.
VERIFIED REPAIR
Preserve the cache-state invariant: Return total cache weight after inserting or replacing key with nonnegative weight in a unique key-to-weight mapping.
Unsuccessful approach: Defaulting missing old weight to the new weight makes new entries consume no space.
Case contract
Return total cache weight after inserting or replacing key with nonnegative weight in a unique key-to-weight mapping.
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(weights, key, weight):
return sum(weights.values())+weight
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*({'a': 4, 'b': 3}, 'a', 6)), 9)
check('fixture 2', solve(*({'a': 4}, 'b', 2)), 6)
check('fixture 3', solve(*({}, 'a', 0)), 0)
check('fixture 4', solve(*({'a': 4}, 'a', 1)), 1)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1 | 13 | 9 | Failed |
| fixture 2 | 6 | 6 | Passed |
| fixture 3 | 0 | 0 | Passed |
| fixture 4 | 5 | 1 | Failed |
SHA-256 / 5131514662e7c6ef818648637c971b87b3bb59b0a4efa3023024ce63db2550fc
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(weights, key, weight):
return sum(weights.values())+weight-weights.get(key, weight)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*({'a': 4, 'b': 3}, 'a', 6)), 9)
check('fixture 2', solve(*({'a': 4}, 'b', 2)), 6)
check('fixture 3', solve(*({}, 'a', 0)), 0)
check('fixture 4', solve(*({'a': 4}, 'a', 1)), 1)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1 | 9 | 9 | Passed |
| fixture 2 | 4 | 6 | Failed |
| fixture 3 | 0 | 0 | Passed |
| fixture 4 | 1 | 1 | Passed |
SHA-256 / 679e190293518409fda3f2c477204edd5e442e7c15319a41e7c021c79796b632
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(weights, key, weight):
return sum(weights.values())-weights.get(key,0)+weight
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*({'a': 4, 'b': 3}, 'a', 6)), 9)
check('fixture 2', solve(*({'a': 4}, 'b', 2)), 6)
check('fixture 3', solve(*({}, 'a', 0)), 0)
check('fixture 4', solve(*({'a': 4}, 'a', 1)), 1)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1 | 9 | 9 | Passed |
| fixture 2 | 6 | 6 | Passed |
| fixture 3 | 0 | 0 | Passed |
| fixture 4 | 1 | 1 | Passed |
SHA-256 / 10bdff661a52f3f236ee677f153ffba9c7a4511b5435bbe8c171c30050c8498e
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.675281+00:00.
Case digest / 84c609def9d3e3dc55c4d68d6e68822fce3629ad0dbfaab25701e05fa6ca268c