Skip to main content

Module evaluate

Module evaluate 

Source
Expand description

Ordered evaluation with deny-only semantics, made structural rather than conventional.

plan/policy.md: “Adding a policy can never widen what is permitted […] Order is presentational, not semantic.” combine is the one place that property lives: it folds outcomes by severity alone, so no matter what order they arrive in, the verdict — allow, reject, or freeze — can only stay the same or get more severe as more denying outcomes are folded in. Only which reason is reported, when several outcomes tie for the worst severity, depends on order.

Enums§

Verdict
The result of evaluating a subject against every candidate policy.

Functions§

combine
Fold a set of (policy, outcome) pairs into one Verdict, taking the most severe outcome regardless of the order the pairs arrive in — the structural half of “order is presentational, not semantic”.
evaluate
Evaluate a subject against a PolicyTree, in the tree’s presentational order.
severity 🔒
A total order on severity, Allow < Reject < Freeze, kept as a plain function rather than a derived Ord on Outcome because Outcome’s reason fields carry no ordering of their own.
worst
Fold outcomes into the most severe one, taking Allow < Reject < Freeze — the same total order combine folds by, exposed for callers that hold outcomes without a PolicyId to attribute each one to.