FA-10396 / Caching / Open access
Weighted eviction frees fewer bytes than the new budget requires · case 01
Weighted eviction frees fewer bytes than the new budget requires.
ROOT CAUSE
One eviction is assumed to free enough space regardless of entry weight.
VERIFIED REPAIR
Preserve the cache-state invariant: Entries are [key,nonnegative weight] in eviction order. Remove a prefix until remaining weight is at most the nonnegative budget; retain zero-weight entries if no eviction is necessary.
Unsuccessful approach: An entry-count limit is substituted for a byte-weight budget.
Case contract
Entries are [key,nonnegative weight] in eviction order. Remove a prefix until remaining weight is at most the nonnegative budget; retain zero-weight entries if no eviction is necessary.
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(entries, budget):
out=list(entries)
if sum(w for k,w in out)>budget:
out=out[1:]
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*([['a', 4], ['b', 3], ['c', 2]], 2)), [['c', 2]])
check('fixture 2', solve(*([['a', 4], ['b', 3]], 4)), [['b', 3]])
check('fixture 3', solve(*([], 0)), [])
check('fixture 4', solve(*([['a', 0], ['b', 0]], 0)), [['a', 0], ['b', 0]])
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 | [['b', 3], ['c', 2]] | [['c', 2]] | Failed |
| fixture 2 | [['b', 3]] | [['b', 3]] | Passed |
| fixture 3 | [] | [] | Passed |
| fixture 4 | [['a', 0], ['b', 0]] | [['a', 0], ['b', 0]] | Passed |
SHA-256 / db9f34fc78caf221e6e414dc65637d7859c4842857cba52a6ffbc43de2a5419a
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(entries, budget):
out=list(entries)
while len(out)>budget:
out.pop(0)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*([['a', 4], ['b', 3], ['c', 2]], 2)), [['c', 2]])
check('fixture 2', solve(*([['a', 4], ['b', 3]], 4)), [['b', 3]])
check('fixture 3', solve(*([], 0)), [])
check('fixture 4', solve(*([['a', 0], ['b', 0]], 0)), [['a', 0], ['b', 0]])
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 | [['b', 3], ['c', 2]] | [['c', 2]] | Failed |
| fixture 2 | [['a', 4], ['b', 3]] | [['b', 3]] | Failed |
| fixture 3 | [] | [] | Passed |
| fixture 4 | [] | [['a', 0], ['b', 0]] | Failed |
SHA-256 / b101e10dd1c681942fa7a2a59558d4a9ce13ebca06aa7cdd347ae27a2077aeba
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(entries, budget):
out=list(entries)
while sum(w for k,w in out)>budget:
out.pop(0)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*([['a', 4], ['b', 3], ['c', 2]], 2)), [['c', 2]])
check('fixture 2', solve(*([['a', 4], ['b', 3]], 4)), [['b', 3]])
check('fixture 3', solve(*([], 0)), [])
check('fixture 4', solve(*([['a', 0], ['b', 0]], 0)), [['a', 0], ['b', 0]])
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 | [['c', 2]] | [['c', 2]] | Passed |
| fixture 2 | [['b', 3]] | [['b', 3]] | Passed |
| fixture 3 | [] | [] | Passed |
| fixture 4 | [['a', 0], ['b', 0]] | [['a', 0], ['b', 0]] | Passed |
SHA-256 / ac58d53fbdec1687a2abb52b19f9cd0ac368c36162affed99005ba21f673d302
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.632379+00:00.
Case digest / f398403a68deee6edf6ecec3c8ac3ccaf905dc397d7ddd2beb50f44616c11059