fix(alerting): reject null fireMode on ExchangeMatchCondition + repair in-flight rows
All checks were successful
All checks were successful
The rule editor wizard reset the condition payload on kind-change without
seeding a fireMode default; the ExchangeMatchCondition ctor allowed null to
pass through; AlertEvaluatorJob then NPE-looped every tick on a saved rule.
- core: compact ctor now rejects null fireMode (Jackson-deser path only — all
production callers already pass a value).
- V14: repair existing EXCHANGE_MATCH rows with fireMode=null to
PER_EXCHANGE + perExchangeLingerSeconds=300 (default matches the wizard).
- ui: ConditionStep.onKindChange seeds EXCHANGE_MATCH defaults so the
Select's displayed fallback ("Per exchange") is actually in form state.
- ui: validateStep('condition', ...) now enforces fireMode presence + the
mode-specific fields before the user reaches Review.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
-- V14 — Repair EXCHANGE_MATCH rules persisted with fireMode=null.
|
||||
-- Root cause: the rule editor wizard reset the condition payload on kind
|
||||
-- change without seeding a fireMode default, and the backend ctor allowed
|
||||
-- null to pass. Stricter ctor in ExchangeMatchCondition now rejects null
|
||||
-- fireMode — existing rows need to be repaired so startup doesn't fail
|
||||
-- deserialization and the evaluator stops NPE-looping on them.
|
||||
--
|
||||
-- Default to PER_EXCHANGE + perExchangeLingerSeconds=300 — the same default
|
||||
-- the UI now seeds when a user picks EXCHANGE_MATCH.
|
||||
UPDATE alert_rules
|
||||
SET condition = jsonb_set(
|
||||
jsonb_set(condition, '{fireMode}', '"PER_EXCHANGE"', true),
|
||||
'{perExchangeLingerSeconds}',
|
||||
COALESCE(condition->'perExchangeLingerSeconds', '300'::jsonb),
|
||||
true
|
||||
),
|
||||
updated_at = now()
|
||||
WHERE condition_kind = 'EXCHANGE_MATCH'
|
||||
AND (condition->>'fireMode') IS NULL;
|
||||
Reference in New Issue
Block a user