FA-10521 / Caching / Open access
Batch cache retrieval loses request order and duplicate positions · case 01
Batch cache retrieval loses request order and duplicate positions.
ROOT CAUSE
Iterating the cache map loses request positions, duplicate requests and misses.
VERIFIED REPAIR
Preserve the cache-state invariant: Return one [key,hit-or-miss,value-or-None] result for every requested key in original order, including repeated keys and cached negative values.
Unsuccessful approach: Deduplicating request keys still collapses independent output slots and omits misses.
Case contract
Return one [key,hit-or-miss,value-or-None] result for every requested key in original order, including repeated keys and cached negative values.
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(cache, keys):
return [[k,"hit",cache[k]] for k in cache if k in keys]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*({'a': 1, 'b': 2}, ['b', 'a', 'b'])), [['b', 'hit', 2], ['a', 'hit', 1], ['b', 'hit', 2]])
check('fixture 2', solve(*({'a': None}, ['a', 'z'])), [['a', 'hit', None], ['z', 'miss', None]])
check('fixture 3', solve(*({}, [])), [])
check('fixture 4', solve(*({}, ['a'])), [['a', 'miss', None]])
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 | [['a', 'hit', 1], ['b', 'hit', 2]] | [['b', 'hit', 2], ['a', 'hit', 1], ['b', 'hit', 2]] | Failed |
| fixture 2 | [['a', 'hit', None]] | [['a', 'hit', None], ['z', 'miss', None]] | Failed |
| fixture 3 | [] | [] | Passed |
| fixture 4 | [] | [['a', 'miss', None]] | Failed |
SHA-256 / 49f8811356e6aefcfcc7157b717271492687225001a8d0144630084eaaeb2334
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(cache, keys):
return [[k,"hit",cache[k]] if k in cache else [k,"miss",None] for k in dict.fromkeys(keys)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*({'a': 1, 'b': 2}, ['b', 'a', 'b'])), [['b', 'hit', 2], ['a', 'hit', 1], ['b', 'hit', 2]])
check('fixture 2', solve(*({'a': None}, ['a', 'z'])), [['a', 'hit', None], ['z', 'miss', None]])
check('fixture 3', solve(*({}, [])), [])
check('fixture 4', solve(*({}, ['a'])), [['a', 'miss', None]])
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', 'hit', 2], ['a', 'hit', 1]] | [['b', 'hit', 2], ['a', 'hit', 1], ['b', 'hit', 2]] | Failed |
| fixture 2 | [['a', 'hit', None], ['z', 'miss', None]] | [['a', 'hit', None], ['z', 'miss', None]] | Passed |
| fixture 3 | [] | [] | Passed |
| fixture 4 | [['a', 'miss', None]] | [['a', 'miss', None]] | Passed |
SHA-256 / cffd40162c9f228cee0f845c70f3b262d4ac78ac721af7324c63b32d1c75057a
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(cache, keys):
return [[k,'hit',cache[k]] if k in cache else [k,'miss',None] for k in keys]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*({'a': 1, 'b': 2}, ['b', 'a', 'b'])), [['b', 'hit', 2], ['a', 'hit', 1], ['b', 'hit', 2]])
check('fixture 2', solve(*({'a': None}, ['a', 'z'])), [['a', 'hit', None], ['z', 'miss', None]])
check('fixture 3', solve(*({}, [])), [])
check('fixture 4', solve(*({}, ['a'])), [['a', 'miss', None]])
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', 'hit', 2], ['a', 'hit', 1], ['b', 'hit', 2]] | [['b', 'hit', 2], ['a', 'hit', 1], ['b', 'hit', 2]] | Passed |
| fixture 2 | [['a', 'hit', None], ['z', 'miss', None]] | [['a', 'hit', None], ['z', 'miss', None]] | Passed |
| fixture 3 | [] | [] | Passed |
| fixture 4 | [['a', 'miss', None]] | [['a', 'miss', None]] | Passed |
SHA-256 / 5a46395513c048ae8a3b0fb10b9da3e5c5b759745d6e0e1a83dfbd60d614fae8
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.786843+00:00.
Case digest / edce8176f9ff9804912f317ec2b277c4d5d47ebe6adcdfca37f62a3a459cafef