Skip to main content

Module weights_binding

Module weights_binding 

Source
Expand description

Kernel-side model-card binding refusal.

When policy.weights_card_required is required or required_with_pin, the kernel refuses to bind a provider unless a signed model card matches the loaded weights AND the requested capability set is admissible under the card. This module is the refusal-decision surface; the policy load path lives in chio-policy and the cosign bundle verify path lives in chio-weights.

§Refusal contract

Provider bind verifies, in order:

  1. The provider’s loaded weights_hash (lowercase hex sha-256 of the canonical weights blob) byte-equals the card’s weights_hash. Mismatch surfaces as WeightsBindingError::CardMismatch / urn:chio:error:weights:card-mismatch.
  2. The requested capability scope set is a subset of the card’s allowed_capability_set. Any scope not in the set surfaces as WeightsBindingError::ScopeNotSubset / urn:chio:error:weights:scope-not-subset.
  3. No requested tool intersects the card’s banned_tools. Banned tools reject at provider bind, not at first call. Surfaces as WeightsBindingError::ToolBanned / urn:chio:error:weights:tool-banned.

All gates fail-closed: the first failing gate short-circuits.

§Async discipline

The verifier surface takes no &mut self. evaluate_weights_binding is a free function over &ModelCard so it composes cleanly with the async kernel without locking.

Structs§

WeightsBindingRequest
Inputs the kernel collects at provider bind. The provider supplies its loaded weights_hash and the operator supplies the requested capability set. Banned-tool intersection is computed against the same requested_scopes because the provider matrix unifies tool identifiers into the scope namespace.

Functions§

evaluate_weights_binding
Evaluate the kernel binding refusal contract.
evaluate_weights_binding_with_loaded_hash
Evaluate binding after the provider-side loaded-weight digest has been recomputed.

Type Aliases§

WeightsBindingError
The kernel-side bind-time decision surface error. Wraps chio_weights::error::WeightsError so consumers get a single result type to pattern-match on.