Skip to main content

build_tree

Function build_tree 

Source
pub fn build_tree(
    builtins: Vec<BuiltinPolicy>,
    startup: &HashMap<String, ParsedPolicy>,
    operator: &HashMap<String, ParsedPolicy>,
    last_good: &LastGoodPolicies,
) -> (PolicyTree, LoadReport)
Expand description

Assembles one PolicyTree from every source a deployment carries.

builtins are the policies compiled into the binary, startup the declarations supplied for the length of the run, operator the declarations read from the operator’s records — see crate::merge::build’s own doc comment for what each argument is. Registers the language of every ENGINES entry.

last_good must be the same LastGoodPolicies passed on every call across this deployment’s lifetime — it is what lets an operator-sourced policy that compiled at an earlier revision keep being enforced when a later revision fails to compile, per plan/policy.md’s last-good-revision behaviour. A caller holding one per build_tree call defeats it entirely: there would never be a prior revision to fall back to.