Skip to main content

Module policy_trigger

Module policy_trigger 

Source
Expand description

Lifecycle triggers and the trigger set of every shipped policy. What: The lifecycle points at which policies run, which shipped policy runs at which point, and which points this executable can serve. Why: A policy runs only for the triggers it declares. A trigger whose lifecycle is not ported must be answered as “unavailable”, never as an empty result that would read as “checked and clean”.

In TS you’d write (pseudocode):

// type PolicyTrigger = 'pre-forward' | 'post-commit' | 'manual-push' | 'direct-check' | 'direct-fix';

Enums§

Trigger
What: One lifecycle point. An enum is a closed set of named alternatives. #[derive(...)] asks the compiler to generate copying (Clone, Copy), debug printing (Debug) and == (Eq, PartialEq). Why: The set is fixed by the event format, where each event names its trigger.

Functions§

policy_runs_on
What: Whether a policy declares a trigger. bool is true or false. Why: The stage asks this once per policy before anything else.
policy_triggers
What: The triggers a shipped policy declares, copied from the incumbent definitions. Why: The engine skips a policy at every other lifecycle point, exactly as the incumbent’s stage did.
trigger_is_ported
What: Whether this executable implements the lifecycle a trigger belongs to. Why: Every lifecycle is ported: the exhaustive match below answers true for each variant, and a new variant fails to compile until it is answered here. The engine still checks this before running a lifecycle, so a future unported variant gets a typed “unavailable” instead of running zero policies and looking clean.
trigger_name
What: The wire spelling of a trigger. &'static str is text baked into the program for its whole run (sibling String would be an owned copy). Why: Events print exactly the spellings the incumbent emitted.