pub struct PromotionGate;Expand description
The champion-challenger promotion gate. Pure — evaluate has no I/O and
no clock; the caller stamps id + decided_at and writes the audit row.
Implementations§
Source§impl PromotionGate
impl PromotionGate
Sourcepub fn evaluate(
&self,
config: &PromotionGateConfig,
metrics: &[(String, f64)],
approval_present: bool,
) -> PolicyDecision
pub fn evaluate( &self, config: &PromotionGateConfig, metrics: &[(String, f64)], approval_present: bool, ) -> PolicyDecision
Evaluate a challenger against the gate config + measured metrics.
Returns a PolicyDecision — the same deny-by-default primitive every
gate emits — so the caller dispatches it through the existing audit +
approval path with no special-casing.
Decision table:
- empty thresholds → deny (no evidence ⇒ no auto-promotion).
- any threshold fails (or its metric is missing) → deny.
- all thresholds pass, approval required but absent → requires_approval.
- all thresholds pass, (approval not required, or present) → allow.
Sourcepub fn decide(
&self,
id: impl Into<String>,
agent_id: impl Into<String>,
champion_version_id: Option<String>,
challenger_version_id: impl Into<String>,
config: &PromotionGateConfig,
metrics: &[(String, f64)],
approval_present: bool,
decision: &PolicyDecision,
decided_at: DateTime<Utc>,
) -> PromotionDecision
pub fn decide( &self, id: impl Into<String>, agent_id: impl Into<String>, champion_version_id: Option<String>, challenger_version_id: impl Into<String>, config: &PromotionGateConfig, metrics: &[(String, f64)], approval_present: bool, decision: &PolicyDecision, decided_at: DateTime<Utc>, ) -> PromotionDecision
Build the full structured PromotionDecision audit record from an
evaluation. The decision passed in is the output of Self::evaluate
— the caller threads it so the audit record and the dispatched policy
decision can never disagree.
Trait Implementations§
Source§impl Clone for PromotionGate
impl Clone for PromotionGate
Source§fn clone(&self) -> PromotionGate
fn clone(&self) -> PromotionGate
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PromotionGate
impl Debug for PromotionGate
Source§impl Default for PromotionGate
impl Default for PromotionGate
Source§fn default() -> PromotionGate
fn default() -> PromotionGate
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PromotionGate
impl RefUnwindSafe for PromotionGate
impl Send for PromotionGate
impl Sync for PromotionGate
impl Unpin for PromotionGate
impl UnsafeUnpin for PromotionGate
impl UnwindSafe for PromotionGate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more