Skip to main content

evaluate_weights_binding

Function evaluate_weights_binding 

Source
pub fn evaluate_weights_binding(
    card: &ModelCard,
    request: &WeightsBindingRequest<'_>,
) -> Result<(), WeightsBindingError>
Expand description

Evaluate the kernel binding refusal contract.

Returns Ok(()) only when ALL three gates pass:

  1. card.weights_hash == request.loaded_weights_hash,
  2. card.allowed_capability_set.covers(request.requested_scopes),
  3. card.banned_tools.intersects(request.requested_tools) is false.

Fail-closed: any failing gate returns the matching WeightsBindingError. The first failing gate short-circuits; deployments needing distinct telemetry per gate read the WeightsError::urn.