From 6c6539637628cd90dae6570ca1b13e51e02c5eb9 Mon Sep 17 00:00:00 2001 From: "pulse-triage[bot]" <249995291+pulse-triage[bot]@users.noreply.github.com> Date: Sat, 5 Sep 2026 10:31:48 +0100 Subject: [PATCH] test(notifications): pin recovery wording in received webhook payloads Recovery notifications must describe the healthy state rather than repeat the original breach. Existing Telegram and Discord receiver tests checked resolved markers and colours but did not protect that distinction, allowing misleading recovery wording to regress unnoticed. Assert healthy wording and absence of the breach message in received payloads, and preserve the original alert message. This is test-only regression protection; it does not establish external provider acceptance or installed recovery. Validation: go test -race ./internal/notifications -run 'Test(SendResolvedWebhook|ResolvedJobs|BuildResolvedNotificationContent)' -count=3 passed. Change-source: pulse-maintainer --- internal/notifications/notifications_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/notifications/notifications_test.go b/internal/notifications/notifications_test.go index 1038a0e2d..ee27dc148 100644 --- a/internal/notifications/notifications_test.go +++ b/internal/notifications/notifications_test.go @@ -4155,6 +4155,12 @@ func TestSendResolvedWebhookServiceTemplates(t *testing.T) { if !strings.Contains(text, "Resolved") { t.Errorf("expected 'Resolved' in text, got %q", text) } + if !strings.Contains(text, "web-vm-01 on pve1 is now healthy") || strings.Contains(text, testAlert.Message) { + t.Errorf("recovery text must describe recovery, not the original breach: %q", text) + } + if testAlert.Message != "CPU high on web-vm-01" { + t.Fatal("rendering recovery mutated the original alert message") + } }) t.Run("discord resolved uses green embed color", func(t *testing.T) { @@ -4190,6 +4196,10 @@ func TestSendResolvedWebhookServiceTemplates(t *testing.T) { t.Fatal("expected at least one embed") } embed := embeds[0].(map[string]any) + description, _ := embed["description"].(string) + if !strings.Contains(description, "web-vm-01 on pve1 is now healthy") || strings.Contains(description, testAlert.Message) { + t.Errorf("recovery description must describe recovery, not the original breach: %q", description) + } // Green color = 3066993 if embed["color"] != float64(3066993) { t.Errorf("expected green embed color 3066993, got %v", embed["color"])