Skip to main content

evaluate_diff_gate

Function evaluate_diff_gate 

pub fn evaluate_diff_gate(
    thresholds: &Thresholds,
    new_hotspot_count: u32,
    delta_code_health: f64,
    base_cycles: u32,
    head_cycles: u32,
    delta_health_ratio: Option<f64>,
    delta_health_verdict: Option<&str>,
) -> Vec<GateViolation>
Expand description

Evaluate the [diff] section against a base→head delta.

new_hotspot_count is the number of files that newly enter the top-N hotspot ranking at head (i.e. weren’t in the base ranking). delta_code_health is head_median_health − base_median_health — a positive value means health improved, a negative value means it dropped. Convention follows the [diff] delta_code_health_min gate: the configured threshold is the floor for the delta, so the gate fails when delta_code_health < delta_code_health_min.

Returns an empty vec when no [diff] gates are configured (the caller’s empty-thresholds short-circuit covers this, but the internal early-return keeps the function safe to call from downstream tooling that wires [diff] standalone).