Skip to main content

is_cacheable

Function is_cacheable 

Source
pub fn is_cacheable(trace: &Trace) -> bool
Expand description

Whether a finished decision may be cached at all.

The single place these rules live. They were duplicated nowhere and must stay that way: a second backend re-deriving “was this proven?” from its own reading of the receipt is how one of them eventually accepts something the other would reject, and the failure is silent — an unverified answer served from cache looks exactly like a verified one.

Rejects, in order:

  1. Not served from a real attempt. BestAttempt is the budget-exhausted fallback, served without a passing verdict; caching it would replay an answer that never passed anything.
  2. A cache hit. Harmless in itself, but it would relocate cache_source onto a replay rather than the decision that ran a gate, letting the provenance chain go a hop stale.
  3. A verdict that is not an unambiguous Pass. An Abstain is “the gate could not tell”, which is precisely the state that must never be frozen and replayed.
  4. A deferred Fail already on the receipt. Rarely the path that matters — deferred verdicts usually arrive later via /v1/feedback, which is what retract handles — but free to check.