mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-10-14 00:00:30 +00:00
8827defb63
Phase 3 of docs/ALERT_ENGINE_EVOLUTION.md: the effective alert policy for a resource — type default thresholds, the type's DisableAll switches, custom rules, the per-resource override — is now answered by one ordered fold (effectiveAlertPolicyNoLock in alert_policy.go), translated from the persisted AlertConfig. The config keeps its shape; the engine stops reading it piecemeal. Before this, every check path read its own DisableAll* boolean and picked its own override lookup, and the scattered reads drifted (#1738 was an override lookup that existed on some paths and not others; connection.go hand-rolled its own type-to-switch mapping). Now: - resolveResourceThresholds and getGuestThresholds delegate to the fold. - All 40+ DisableAll* reads across the check paths, the config-change reconciliation, and the connection detector go through alertPolicyTypeSwitchesNoLock — the single place those booleans are read on behalf of evaluation. Characterization first: alert_policy_test.go pins the fold against the legacy resolution paths (per-type defaults, overrides, storage aliases, guest custom rules by priority, every type's switch pair) before any call site moved.