pub struct ConfigDiff {
pub rules_to_rerun: HashSet<String>,
pub rules_disabled: HashSet<String>,
pub allow_lists_changed: bool,
pub severities_changed: bool,
pub walk_exclude_changed: bool,
}Expand description
Surgical-invalidation diff between two rule configurations.
Produced by ConfigDiff::compute to classify what changed between an old
(RulesConfig, WalkConfig) snapshot and a new one. Consumers (the daemon’s
config-reload handler) use the classification to pick the cheapest correct
invalidation strategy:
- Tier 1 (filter-only): severities, allow-lists, or
enabled = falsechanged. The cached findings are still correct — applying the new config’s filter at serve time is enough. No re-evaluation. - Tier 2 (per-rule re-run): specific rules’ behavior changed (newly
enabled, rule-specific config field, or backing
.scmfile edited). Only those rules need to be re-evaluated; everything else stays cached. - Tier 3 (full reprime):
[walk] excludechanged (file set differs) or the diff doesn’t fit the above. Conservative fallback.
.scm rule-definition file diffs are tracked outside this struct because
this crate has no filesystem dependency; the daemon hashes
.normalize/rules/** itself and unions its result into rules_to_rerun
before consulting ConfigDiff::is_filter_only / ConfigDiff::requires_full_reprime.
Fields§
§rules_to_rerun: HashSet<String>Rules whose evaluation behavior changed (newly-enabled, rule-specific
config field, or .scm definition edited). These need to be re-run.
rules_disabled: HashSet<String>Rules that became disabled. Their cached findings should be dropped at serve time (no re-run needed).
allow_lists_changed: boolTrue if any allow-list (per-rule allow or top-level global-allow)
changed without a corresponding behavior change. Filter at serve time.
severities_changed: boolTrue if any rule’s severity changed without a corresponding behavior change. Override severity at serve time.
walk_exclude_changed: boolTrue if [walk] exclude changed. Forces a full reprime (Tier 3) because
the file set may differ.
Implementations§
Source§impl ConfigDiff
impl ConfigDiff
Sourcepub fn compute(
old_rules: &RulesConfig,
new_rules: &RulesConfig,
old_walk: &WalkConfig,
new_walk: &WalkConfig,
) -> Self
pub fn compute( old_rules: &RulesConfig, new_rules: &RulesConfig, old_walk: &WalkConfig, new_walk: &WalkConfig, ) -> Self
Compute a diff describing what changed between old and new.
The diff classifies each per-rule change into the cheapest tier that’s
still correct. Adding/removing a rule entry that flips enabled from
the implicit default is treated the same as toggling it explicitly.
Sourcepub fn is_filter_only(&self) -> bool
pub fn is_filter_only(&self) -> bool
True if this diff can be honored by re-filtering cached findings at serve time, with no re-evaluation.
Specifically: no rule needs re-running and [walk] exclude is
unchanged. Allow-list, severity, and enabled = false changes are all
filter-only because the cached findings are a superset of the new
answer — dropping disabled rules / allow-matched paths and overriding
severities at serve time produces the correct result.
Sourcepub fn requires_full_reprime(&self) -> bool
pub fn requires_full_reprime(&self) -> bool
True if this diff requires a full reprime (Tier 3).
Today only walk_exclude_changed triggers this; future fields that
can’t be expressed as either filter-only or per-rule re-run should
extend this check.
Trait Implementations§
Source§impl Clone for ConfigDiff
impl Clone for ConfigDiff
Source§fn clone(&self) -> ConfigDiff
fn clone(&self) -> ConfigDiff
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more