Skip to main content

check_compatibility

Function check_compatibility 

Source
pub fn check_compatibility(
    expected: &KvCompatDescriptor,
    observed: &KvCompatDescriptor,
) -> Result<(), KvCompatMismatch>
Expand description

Rejection policy: a cache whose descriptor differs in any authoritative field is rejected.

Compares expected (the current model/runtime identity) against observed (the descriptor under which a cache’s KV was produced), field by field in a fixed order, returning the first mismatch. Returns Ok(()) only when the descriptors are fully compatible.

At runtime the engine usually compares KvCompatFingerprints (a 32-byte equality) rather than calling this; this function exists to produce a structured, human-readable rejection reason (for logs, metrics, and tests) and to pin the exact comparison contract the fingerprint must honor.