From d0d621a7c2d65c46dcf876986c30a20264fe9b08 Mon Sep 17 00:00:00 2001 From: "pulse-triage[bot]" <249995291+pulse-triage[bot]@users.noreply.github.com> Date: Sat, 3 Oct 2026 01:38:16 +0100 Subject: [PATCH] Exercise detector admission in partial-delivery recovery proof Drive firings through the existing monitor callback instead of sending them directly through the notifier. This records the detector notification state required by the unchanged recovery policy; keep that policy and all failed attempts intact. Change-source: pulse-maintainer --- .../monitoring/monitor_alert_handling_test.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/internal/monitoring/monitor_alert_handling_test.go b/internal/monitoring/monitor_alert_handling_test.go index 33c98887b5..498bd35b8d 100644 --- a/internal/monitoring/monitor_alert_handling_test.go +++ b/internal/monitoring/monitor_alert_handling_test.go @@ -1372,9 +1372,17 @@ func TestMonitorDelayedPartialResolutionKeepsDestinationRecovery(t *testing.T) { } n := open() a, pbs := occurrenceManager(t) + m := &Monitor{alertManager: a, notificationMgr: n} + // Use the live firing callback so the detector records notification policy + // state. Direct notifier calls would not establish LastNotified, and existing + // recovery policy would correctly suppress that unannounced detector alert. + a.SetAlertCallback(m.handleAlertFired) a.CheckPBS(pbs) old := a.GetActiveAlerts()[0].Clone() - n.SendAlert(old) + if old.LastNotified == nil { + t.Fatal("detector did not admit the firing notification") + } + awaitOccurrenceRows(t, n, 2) n.StartQueueProcessing() select { case got := <-receipts: @@ -1402,6 +1410,8 @@ func TestMonitorDelayedPartialResolutionKeepsDestinationRecovery(t *testing.T) { pbs.CPU = 0 a.CheckPBS(pbs) n = open() // deferred processor; prior destination receipts are now on disk only + m = &Monitor{alertManager: a, notificationMgr: n} + a.SetAlertCallback(m.handleAlertFired) pbs.CPU = 95 a.CheckPBS(pbs) active := a.GetActiveAlerts() @@ -1409,8 +1419,7 @@ func TestMonitorDelayedPartialResolutionKeepsDestinationRecovery(t *testing.T) { t.Fatalf("not a new occurrence: %+v", active) } current := active[0].Clone() - n.SendAlert(current) - m := &Monitor{alertManager: a, notificationMgr: n} + awaitOccurrenceRows(t, n, 2) m.handleAlertResolved(old.ID) n.StartQueueProcessing() seenFiring, seenRecovery := false, false