Skip to main content

resolve_predicate

Function resolve_predicate 

Source
pub fn resolve_predicate(
    id: &str,
    policy: &ParsedPolicy,
    languages: &[&dyn Language],
    builder: &mut PolicyTreeBuilder,
    report: &mut CompileReport,
) -> Predicate
Expand description

Resolve one record’s Predicate – a working Predicate::Evaluator or a scoped Predicate::Unusable – without registering it on builder as a policy. Appends any ScopedDenial or PolicyWarning hit along the way to report.

Exposed (not just used internally by compile_policies) because didbot-pds’s loader drives this one record at a time for the operator source, so it can substitute a last-good ParsedPolicy and retry when this call resolves Predicate::Unusable for a record that previously compiled – see plan/policy.md’s last-good-revision behaviour. compile_policies itself has no notion of “the previous revision of this same id”; that state lives with the caller, across rebuilds, not in this crate’s stateless compiling step. A caller that resolves a predicate here and decides not to register it (because it is using a fallback instead) has still, harmlessly, registered any evaluator that predicate’s compile step created via builder.register_evaluator – an unused registration costs a Vec slot nothing else ever reaches, not a wrong verdict.