pub fn decide_cache_reuse(
expected: Option<&KvCompatFingerprint>,
stored: Option<&KvCompatFingerprint>,
cache_is_empty: bool,
) -> CacheReuseDecisionExpand description
Decide whether a cache may be reused, given the authoritative expected identity (if any), the stamp currently on the cache (if any), and whether the cache provably carries no KV.
Decision matrix (every non-Reuse outcome discards KV — fail-closed):
| expected | stored | empty | decision |
|---|---|---|---|
| Some(e) | Some(s) | * | e == s ? Reuse : DiscardAndRecompute |
| Some(_) | None | true | StampFresh |
| Some(_) | None | false | DiscardAndRecompute |
| None | * | * | DiscardAndRecompute |
The unstamped-but-populated and no-authoritative-identity rows are the fail-closed guards: a cache we cannot authoritatively attribute is never reused, only recomputed.