Skip to main content

evaluate_gate_thresholds

Function evaluate_gate_thresholds 

pub fn evaluate_gate_thresholds(
    thresholds: &Thresholds,
    report: &ChangeSetReport,
) -> Vec<GateViolation>
Expand description

Evaluate the [diff] gates that apply to a working-tree change-set report (codelore gate / the gate_changes MCP tool).

Four keys apply to the working-tree surface, with equal-passes boundaries mirroring evaluate_diff_gate:

  • delta_code_health_min — floor on the whole-repo-median delta (projected − baseline), the same semantics the key carries on diff. Skipped when either median is absent (no scoreable files); callers surface the skip as a notice.
  • delta_code_health_min_per_file — floor on each changed file’s own projected − baseline delta; one violation per offending file, with the file’s delta as the measured value.
  • new_file_health_min — floor on each ADDED file’s own projected score (added files carry no delta, so they never reach the previous gate); one violation per offending added file, with the file’s projected score as the measured value. Deleted files never trigger it.
  • no_new_cycles — cyclic-node MEMBERSHIP comparison: one violation per path that is cyclic in the projection but not at HEAD. This deliberately diverges from diff’s cycle-count comparison — membership names the files and still fires when two existing cycles merge into one bigger tangle (which DROPS the count).

The remaining [diff] keys (new_hotspot_max, delta_health_min, deny_degrading_verdict) are diff-only and never evaluated here.