Skip to main content

evaluate_new_code_rows

Function evaluate_new_code_rows 

pub fn evaluate_new_code_rows(
    cfg: &NewCodeGates,
    scope: &NewCodeScope,
) -> Vec<GateViolation>
Expand description

Pure inner comparison for the two-band [new_code] gate over a NewCodeScope.

Two independent bands, each evaluated only when the config enables it:

  • born_health_min — one violation per born-in-window file whose HEAD code-health score is below the floor (strict <, mirroring code_health_min). Skipped when born_health_min is absent.
  • touched_no_degradation — one violation per touched-but-not-born file whose net window health movement is negative. The fail test is net < -f64::EPSILON, so a file that held steady — the typo-fix case that nets exactly zero — passes; only a genuine net-degradation fails. The f64::EPSILON guard is the gate layer’s established float-noise band (the same one ratchet uses); the semantic noise immunity comes from the delta-health banding upstream, which nets sub-risk-band churn to zero. Skipped when touched_no_degradation is off.

Each violation’s gate names its band, so the rendered message discloses which obligation a file missed (“born in window” vs “net … over Nd”). A noop (empty) when neither band is enabled or the scope is empty (including the shallow-history skip, which yields empty born/touched).