Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Keep copied webhook close outcomes distinct from recovery

pulse-triage[bot]b0f7a63181b1
diff --git a/docs/WEBHOOKS.md b/docs/WEBHOOKS.md
index be6862c275..cd038af44d 100644
--- a/docs/WEBHOOKS.md
+++ b/docs/WEBHOOKS.md
@@ -48,6 +48,8 @@ For generic webhooks, use Go templates to format the JSON payload.
**Convenience fields:**
- `{{.ValueFormatted}}`, `{{.ThresholdFormatted}}`
- `{{.StartTime}}`, `{{.Acknowledged}}`, `{{.AckTime}}`, `{{.AckUser}}`
+- `{{.NotRecovered}}` (a resolved batch includes a known non-recovery close;
+ inspect each member's `.Resolution` for its reason and successor)
**Template helpers:** `title`, `upper`, `lower`, `printf`, `urlquery`/`urlencode`, `urlpath`/`pathescape`, `jsonString`
@@ -82,7 +84,9 @@ incidents or close tickets.
These fields and behaviors are stable; ticket-routing integrations can rely on them.
**Events.** `{{.Event}}` is `"alert"` or `"resolved"` — there is no separate
-"info" event class. Recovery delivery depends on **Notify on resolve** and a
+"info" event class. A resolved event closes an alert occurrence, not necessarily
+a recovered condition; see [non-recovery closes](#resolved-does-not-always-mean-recovered).
+Resolved delivery depends on **Notify on resolve** and a
successful firing-delivery receipt for that occurrence and destination. Do not
assume that every configured webhook receives both events.
@@ -214,6 +218,29 @@ Content-Type: application/json
}
```
+### Resolved does not always mean recovered
+
+When a linked Pulse agent takes over a node metric, the node's open alert can
+close with reason `moved_to_agent` even while its last reading is above the
+threshold. The event is still `resolved` so integrations can close the old
+occurrence, but **this is not a recovery**. Record it as moved, not healthy;
+check the successor agent's current reading and alert policy separately.
+Do not assume that the successor has already fired an equivalent alert.
+
+The [full PSA template](#sample-psa-payloads) below includes each member's
+`resolutionReason`, `successorResourceId` and `successorName`. For a member
+without a resolution, these strings are empty: the sender treats that close
+as an ordinary recovery, not proof that every metric or workload is healthy.
+On a firing event they are not recovery evidence at all.
+
+Use the reason on **each member**, not just the primary alert or the batch's
+`notRecovered` flag. A group can contain both moved alerts and ordinary
+recoveries. The flag identifies known non-recovery closes, but `false` is not
+an independent health verdict. Retain an unknown non-empty reason or missing
+fields from an older/custom payload for reconciliation; do not silently map
+them to healthy. An absent successor identity does not justify guessing from
+a display name. Keep the original occurrence and any successor separate.
+
### Receiver correlation and deduplication
Keep ticket correlation separate from suppressing repeated processing:
@@ -229,6 +256,10 @@ Keep ticket correlation separate from suppressing repeated processing:
identify its observed occurrence; a later start with the same ID must be
processed as a new occurrence. Firing and recovery use the same occurrence
record, so an old delayed recovery must not close a newer incident.
+- For a `resolved` event, inspect each member's [resolution reason](#resolved-does-not-always-mean-recovered).
+ Close a moved occurrence as moved, not recovered, and keep unknown or
+ incomplete outcomes for reconciliation. Do not mark an entire mixed group
+ healthy from its event name or primary summary.
- Within that record, handle `event` **and severity**. A warning becoming
critical is an update, not a duplicate warning. Decide explicitly whether
reminders update the existing ticket; do not create another ticket for each
@@ -248,7 +279,8 @@ Keep ticket correlation separate from suppressing repeated processing:
this legacy header.
Validate in an authorised test environment with firing, retry, warning-to-critical,
-recovery, recurrence of the same condition and a changed multi-alert group.
+recovery, recurrence of the same condition, a changed multi-alert group and
+a mixed moved/recovered close.
Check actual tickets and receiver restart behaviour before enabling automatic
actions. Do not cause a production outage or notification storm for this test.
@@ -308,8 +340,9 @@ There are two integration models. The push model is usually the right fit when t
inbound endpoint (an ITSM/PSA inbound webhook, an email connector, or middleware
that opens service tickets). Shape the JSON with a [custom template](#-custom-templates)
to match the receiving system's schema. The bridge can open or update a ticket
-on `alert` and resolve that occurrence on `resolved`, subject to the [delivery
-conditions above](#-delivery-contract). Add authentication as a custom header
+on `alert` and close that occurrence on `resolved`, subject to the [delivery
+conditions above](#-delivery-contract) and its [resolution reason](#resolved-does-not-always-mean-recovered).
+Do not label a moved close as recovery. Add authentication as a custom header
in the settings form; keep its value private.
Configure it from the UI (**Alerts → Notifications → Add Webhook**) per org, or programmatically with an org-bound admin token:
@@ -340,12 +373,13 @@ member-aware template below; do not use the short example as an exactly-once key
### Sample PSA payloads
A fuller template for normal queued firing and recovery notifications includes
-tenant context and every member's occurrence, severity and condition. The
+tenant context and every member's occurrence, severity, condition and close reason. The
primary fields remain convenient summary context, **not the whole batch**:
```json
{
"event": "{{.Event | jsonString}}",
+ "notRecovered": {{.NotRecovered}},
"alertId": "{{.ID | jsonString}}",
"messageKey": "{{.MessageKey | jsonString}}",
"severity": "{{.Level | jsonString}}",
@@ -369,7 +403,10 @@ primary fields remain convenient summary context, **not the whole batch**:
"alertType": "{{.Type | jsonString}}",
"resourceId": "{{.ResourceID | jsonString}}",
"resource": "{{.ResourceName | jsonString}}",
- "summary": "{{.Message | jsonString}}"
+ "summary": "{{.Message | jsonString}}",
+ "resolutionReason": "{{with .Resolution}}{{.Reason | jsonString}}{{end}}",
+ "successorResourceId": "{{with .Resolution}}{{.SuccessorResourceID | jsonString}}{{end}}",
+ "successorName": "{{with .Resolution}}{{.SuccessorName | jsonString}}{{end}}"
}{{$comma = ","}}{{end}}{{end}}
]
}
@@ -401,7 +438,12 @@ informational levels too; a two-priority mapping does not cover every condition.
The **resolved** event retains the original member `alertId` and `startedAt`,
letting the bridge close that occurrence's ticket rather than a later incident
-with the same ID. Its primary summary is:
+with the same ID. For an **ordinary recovery** (empty member `resolutionReason`),
+its primary summary is shown below. A moved close instead carries
+`resolutionReason: "moved_to_agent"` and successor context in the member array;
+it must not produce the healthy ticket outcome shown here. Member `summary`
+retains the original alert message, so use the structured reason rather than
+parsing that text for recovery.
```json
{
diff --git a/frontend-modern/public/docs/WEBHOOKS.md b/frontend-modern/public/docs/WEBHOOKS.md
index be6862c275..cd038af44d 100644
--- a/frontend-modern/public/docs/WEBHOOKS.md
+++ b/frontend-modern/public/docs/WEBHOOKS.md
@@ -48,6 +48,8 @@ For generic webhooks, use Go templates to format the JSON payload.
**Convenience fields:**
- `{{.ValueFormatted}}`, `{{.ThresholdFormatted}}`
- `{{.StartTime}}`, `{{.Acknowledged}}`, `{{.AckTime}}`, `{{.AckUser}}`
+- `{{.NotRecovered}}` (a resolved batch includes a known non-recovery close;
+ inspect each member's `.Resolution` for its reason and successor)
**Template helpers:** `title`, `upper`, `lower`, `printf`, `urlquery`/`urlencode`, `urlpath`/`pathescape`, `jsonString`
@@ -82,7 +84,9 @@ incidents or close tickets.
These fields and behaviors are stable; ticket-routing integrations can rely on them.
**Events.** `{{.Event}}` is `"alert"` or `"resolved"` — there is no separate
-"info" event class. Recovery delivery depends on **Notify on resolve** and a
+"info" event class. A resolved event closes an alert occurrence, not necessarily
+a recovered condition; see [non-recovery closes](#resolved-does-not-always-mean-recovered).
+Resolved delivery depends on **Notify on resolve** and a
successful firing-delivery receipt for that occurrence and destination. Do not
assume that every configured webhook receives both events.
@@ -214,6 +218,29 @@ Content-Type: application/json
}
```
+### Resolved does not always mean recovered
+
+When a linked Pulse agent takes over a node metric, the node's open alert can
+close with reason `moved_to_agent` even while its last reading is above the
+threshold. The event is still `resolved` so integrations can close the old
+occurrence, but **this is not a recovery**. Record it as moved, not healthy;
+check the successor agent's current reading and alert policy separately.
+Do not assume that the successor has already fired an equivalent alert.
+
+The [full PSA template](#sample-psa-payloads) below includes each member's
+`resolutionReason`, `successorResourceId` and `successorName`. For a member
+without a resolution, these strings are empty: the sender treats that close
+as an ordinary recovery, not proof that every metric or workload is healthy.
+On a firing event they are not recovery evidence at all.
+
+Use the reason on **each member**, not just the primary alert or the batch's
+`notRecovered` flag. A group can contain both moved alerts and ordinary
+recoveries. The flag identifies known non-recovery closes, but `false` is not
+an independent health verdict. Retain an unknown non-empty reason or missing
+fields from an older/custom payload for reconciliation; do not silently map
+them to healthy. An absent successor identity does not justify guessing from
+a display name. Keep the original occurrence and any successor separate.
+
### Receiver correlation and deduplication
Keep ticket correlation separate from suppressing repeated processing:
@@ -229,6 +256,10 @@ Keep ticket correlation separate from suppressing repeated processing:
identify its observed occurrence; a later start with the same ID must be
processed as a new occurrence. Firing and recovery use the same occurrence
record, so an old delayed recovery must not close a newer incident.
+- For a `resolved` event, inspect each member's [resolution reason](#resolved-does-not-always-mean-recovered).
+ Close a moved occurrence as moved, not recovered, and keep unknown or
+ incomplete outcomes for reconciliation. Do not mark an entire mixed group
+ healthy from its event name or primary summary.
- Within that record, handle `event` **and severity**. A warning becoming
critical is an update, not a duplicate warning. Decide explicitly whether
reminders update the existing ticket; do not create another ticket for each
@@ -248,7 +279,8 @@ Keep ticket correlation separate from suppressing repeated processing:
this legacy header.
Validate in an authorised test environment with firing, retry, warning-to-critical,
-recovery, recurrence of the same condition and a changed multi-alert group.
+recovery, recurrence of the same condition, a changed multi-alert group and
+a mixed moved/recovered close.
Check actual tickets and receiver restart behaviour before enabling automatic
actions. Do not cause a production outage or notification storm for this test.
@@ -308,8 +340,9 @@ There are two integration models. The push model is usually the right fit when t
inbound endpoint (an ITSM/PSA inbound webhook, an email connector, or middleware
that opens service tickets). Shape the JSON with a [custom template](#-custom-templates)
to match the receiving system's schema. The bridge can open or update a ticket
-on `alert` and resolve that occurrence on `resolved`, subject to the [delivery
-conditions above](#-delivery-contract). Add authentication as a custom header
+on `alert` and close that occurrence on `resolved`, subject to the [delivery
+conditions above](#-delivery-contract) and its [resolution reason](#resolved-does-not-always-mean-recovered).
+Do not label a moved close as recovery. Add authentication as a custom header
in the settings form; keep its value private.
Configure it from the UI (**Alerts → Notifications → Add Webhook**) per org, or programmatically with an org-bound admin token:
@@ -340,12 +373,13 @@ member-aware template below; do not use the short example as an exactly-once key
### Sample PSA payloads
A fuller template for normal queued firing and recovery notifications includes
-tenant context and every member's occurrence, severity and condition. The
+tenant context and every member's occurrence, severity, condition and close reason. The
primary fields remain convenient summary context, **not the whole batch**:
```json
{
"event": "{{.Event | jsonString}}",
+ "notRecovered": {{.NotRecovered}},
"alertId": "{{.ID | jsonString}}",
"messageKey": "{{.MessageKey | jsonString}}",
"severity": "{{.Level | jsonString}}",
@@ -369,7 +403,10 @@ primary fields remain convenient summary context, **not the whole batch**:
"alertType": "{{.Type | jsonString}}",
"resourceId": "{{.ResourceID | jsonString}}",
"resource": "{{.ResourceName | jsonString}}",
- "summary": "{{.Message | jsonString}}"
+ "summary": "{{.Message | jsonString}}",
+ "resolutionReason": "{{with .Resolution}}{{.Reason | jsonString}}{{end}}",
+ "successorResourceId": "{{with .Resolution}}{{.SuccessorResourceID | jsonString}}{{end}}",
+ "successorName": "{{with .Resolution}}{{.SuccessorName | jsonString}}{{end}}"
}{{$comma = ","}}{{end}}{{end}}
]
}
@@ -401,7 +438,12 @@ informational levels too; a two-priority mapping does not cover every condition.
The **resolved** event retains the original member `alertId` and `startedAt`,
letting the bridge close that occurrence's ticket rather than a later incident
-with the same ID. Its primary summary is:
+with the same ID. For an **ordinary recovery** (empty member `resolutionReason`),
+its primary summary is shown below. A moved close instead carries
+`resolutionReason: "moved_to_agent"` and successor context in the member array;
+it must not produce the healthy ticket outcome shown here. Member `summary`
+retains the original alert message, so use the structured reason rather than
+parsing that text for recovery.
```json
{
diff --git a/frontend-modern/src/utils/__tests__/webhookCloseHelp.test.ts b/frontend-modern/src/utils/__tests__/webhookCloseHelp.test.ts
new file mode 100644
index 0000000000..4c1abb2210
--- /dev/null
+++ b/frontend-modern/src/utils/__tests__/webhookCloseHelp.test.ts
@@ -0,0 +1,100 @@
+import { readFileSync } from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { describe, expect, it } from 'vitest';
+
+import { renderDocMarkdown } from '@/features/docs/docMarkdown';
+
+const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../..');
+const guide = (): string =>
+ readFileSync(
+ process.env.PULSE_WEBHOOK_CLOSE_HELP_TEST_INPUT || path.join(root, 'docs/WEBHOOKS.md'),
+ 'utf8',
+ );
+const article = (): HTMLElement => {
+ const element = document.createElement('article');
+ element.innerHTML = renderDocMarkdown(guide(), 'WEBHOOKS');
+ return element;
+};
+const closeText = (): string => {
+ const section = guide().split('### Resolved does not always mean recovered')[1]?.split('### ')[0];
+ expect(
+ section,
+ 'non-recovery guidance must be beside the copied integration contract',
+ ).toBeDefined();
+ const element = document.createElement('article');
+ element.innerHTML = renderDocMarkdown(section!, 'WEBHOOKS');
+ return element.textContent!.replace(/\s+/g, ' ').trim();
+};
+
+describe('webhook non-recovery close help', () => {
+ it('ships the exact tested guidance and member-aware copied template', () => {
+ expect(readFileSync(path.join(root, 'frontend-modern/public/docs/WEBHOOKS.md'), 'utf8')).toBe(
+ guide(),
+ );
+ const codes = [...article().querySelectorAll('pre code')];
+ const payload = codes.find((code) => code.textContent!.includes('"alerts": ['));
+ expect(
+ payload,
+ 'the full PSA template must survive the shipped Markdown renderer',
+ ).toBeDefined();
+ for (const field of ['resolutionReason', 'successorResourceId', 'successorName']) {
+ expect(payload!.textContent).toContain(`"${field}"`);
+ }
+ expect(payload!.textContent).toContain('"notRecovered": {{.NotRecovered}}');
+ expect(payload!.textContent).toContain('{{with .Resolution}}{{.Reason | jsonString}}{{end}}');
+ });
+
+ it('distinguishes an agent handover from measured recovery and a successor alert', () => {
+ const text = closeText();
+ expect(text).toContain('moved_to_agent even while its last reading is above the threshold');
+ expect(text).toContain('this is not a recovery');
+ expect(text).toContain('Record it as moved, not healthy');
+ expect(text).toContain(
+ "check the successor agent's current reading and alert policy separately",
+ );
+ expect(text).toContain(
+ 'Do not assume that the successor has already fired an equivalent alert',
+ );
+ });
+
+ it('keeps mixed, unknown and older payloads from becoming blanket health verdicts', () => {
+ const text = closeText();
+ expect(text).toContain('Use the reason on each member');
+ expect(text).toContain('A group can contain both moved alerts and ordinary recoveries');
+ expect(text).toContain('false is not an independent health verdict');
+ expect(text).toContain(
+ 'unknown non-empty reason or missing fields from an older/custom payload',
+ );
+ expect(text).toContain('do not silently map them to healthy');
+ expect(text).toContain(
+ 'An absent successor identity does not justify guessing from a display name',
+ );
+ });
+
+ it('does not reinterpret firing events, empty reasons or old member messages as health proof', () => {
+ const text = closeText();
+ expect(text).toContain('not proof that every metric or workload is healthy');
+ expect(text).toContain('On a firing event they are not recovery evidence at all');
+ const fullText = article().textContent!.replace(/\s+/g, ' ');
+ expect(fullText).toContain('Member summary retains the original alert message');
+ expect(fullText).toContain(
+ 'use the structured reason rather than parsing that text for recovery',
+ );
+ expect(fullText).toContain('old delayed recovery must not close a newer incident');
+ expect(fullText).toContain('Close a moved occurrence as moved, not recovered');
+ });
+
+ it('connects the event contract, receiver and bridge entry points to the rendered guidance', () => {
+ const doc = article();
+ expect(doc.querySelector('#resolved-does-not-always-mean-recovered')).not.toBeNull();
+ const labels = [
+ ...doc.querySelectorAll('a[href="#resolved-does-not-always-mean-recovered"]'),
+ ].map((link) => link.textContent);
+ expect(labels).toEqual(['non-recovery closes', 'resolution reason', 'resolution reason']);
+ expect(doc.querySelector('a[href="#sample-psa-payloads"]')?.textContent).toBe(
+ 'full PSA payload',
+ );
+ expect(doc.querySelector('#sample-psa-payloads')).not.toBeNull();
+ });
+});
diff --git a/internal/notifications/webhook_guide_test.go b/internal/notifications/webhook_guide_test.go
index 5a079cc3ea..49913112f0 100644
--- a/internal/notifications/webhook_guide_test.go
+++ b/internal/notifications/webhook_guide_test.go
@@ -41,20 +41,24 @@ func webhookGuidePSATemplate(t *testing.T) string {
}
type guideMember struct {
- ID string `json:"alertId"`
- StartedAt string `json:"startedAt"`
- Severity string `json:"severity"`
- ResourceID string `json:"resourceId"`
- Resource string `json:"resource"`
- Summary string `json:"summary"`
+ ID string `json:"alertId"`
+ StartedAt string `json:"startedAt"`
+ Severity string `json:"severity"`
+ ResourceID string `json:"resourceId"`
+ Resource string `json:"resource"`
+ Summary string `json:"summary"`
+ ResolutionReason string `json:"resolutionReason"`
+ SuccessorResourceID string `json:"successorResourceId"`
+ SuccessorName string `json:"successorName"`
}
type guidePayload struct {
- Event string `json:"event"`
- TenantID string `json:"tenantId"`
- StartedAt string `json:"startedAt"`
- AlertCount int `json:"alertCount"`
- Members []guideMember `json:"alerts"`
+ Event string `json:"event"`
+ TenantID string `json:"tenantId"`
+ StartedAt string `json:"startedAt"`
+ AlertCount int `json:"alertCount"`
+ Members []guideMember `json:"alerts"`
+ NotRecovered *bool `json:"notRecovered"`
}
type guideRequest struct {
@@ -113,8 +117,8 @@ func TestWebhookGuidePSALifecycle(t *testing.T) {
require.Equal(t, "alert", first.Event)
require.Equal(t, "synthetic-tenant", first.TenantID)
require.Equal(t, 1, first.AlertCount)
- require.Equal(t, guideMember{alert.ID, start.Format(time.RFC3339Nano), "warning",
- alert.ResourceID, alert.ResourceName, alert.Message}, first.Members[0])
+ require.Equal(t, guideMember{ID: alert.ID, StartedAt: start.Format(time.RFC3339Nano), Severity: "warning",
+ ResourceID: alert.ResourceID, Resource: alert.ResourceName, Summary: alert.Message}, first.Members[0])
// A synthetic retry retains the member identity even when rendering anew.
require.NoError(t, manager.sendGroupedWebhook(webhook, []*alerts.Alert{alert}))
@@ -172,6 +176,86 @@ func TestWebhookGuidePSAGroupMembershipAndInfo(t *testing.T) {
require.Equal(t, "info", resolved.Members[2].Severity)
}
+func TestWebhookGuidePSACloseReasons(t *testing.T) {
+ start := time.Date(2026, 10, 7, 3, 0, 0, 123456789, time.UTC)
+ recovered := &alerts.Alert{ID: "node::metric-threshold:cpu", StartTime: start,
+ ResourceID: "node", ResourceName: "synthetic-node", Node: "synthetic-node",
+ Level: alerts.AlertLevelWarning, Type: "cpu", Value: 95, Threshold: 90,
+ Message: "Original high CPU reading"}
+ moved := recovered.Clone()
+ moved.ID = "node::metric-threshold:memory"
+ moved.Type = "memory"
+ moved.Message = "Original high memory reading"
+ moved.Resolution = &alerts.AlertResolution{Reason: alerts.AlertResolutionMovedToAgent,
+ SuccessorResourceID: "agent-\"id\"\\path", SuccessorName: "agent \"name\"\né — 警告"}
+ missingSuccessor := moved.Clone()
+ missingSuccessor.Resolution.SuccessorResourceID = ""
+ missingSuccessor.Resolution.SuccessorName = ""
+ unknown := moved.Clone()
+ unknown.Resolution.Reason = alerts.AlertResolutionReason("future-\"reason\"\n")
+
+ for _, tc := range []struct {
+ name string
+ members []*alerts.Alert
+ firing bool
+ notRecovered bool
+ }{
+ {"firing-is-not-recovery", []*alerts.Alert{recovered}, true, false},
+ {"ordinary-recovery", []*alerts.Alert{recovered}, false, false},
+ {"moved-still-above-threshold", []*alerts.Alert{moved}, false, true},
+ {"recovered-primary-moved-member", []*alerts.Alert{recovered, moved}, false, true},
+ {"moved-primary-recovered-member", []*alerts.Alert{moved, recovered}, false, true},
+ {"missing-successor", []*alerts.Alert{missingSuccessor}, false, true},
+ // The batch flag recognises current reasons only. Preserve an unknown
+ // member reason even when the flag is false; it is not a health verdict.
+ {"unknown-reason-preserved", []*alerts.Alert{unknown}, false, false},
+ {"nil-member-skipped", []*alerts.Alert{nil, recovered, moved}, false, true},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ manager, webhook, requests := webhookGuideSender(t, webhookGuidePSATemplate(t))
+ if tc.firing {
+ require.NoError(t, manager.sendGroupedWebhook(webhook, tc.members))
+ } else {
+ require.NoError(t, manager.sendResolvedWebhook(webhook, tc.members, start.Add(time.Minute)))
+ }
+ request, payload := webhookGuideRead(t, requests)
+ require.NotNil(t, payload.NotRecovered, "copied payload must distinguish missing from false")
+ require.Equal(t, tc.notRecovered, *payload.NotRecovered)
+ require.Equal(t, map[bool]string{true: "alert", false: "resolved"}[tc.firing], payload.Event)
+
+ var raw struct {
+ Members []map[string]json.RawMessage `json:"alerts"`
+ }
+ require.NoError(t, json.Unmarshal([]byte(request.body), &raw))
+ index := 0
+ for _, member := range tc.members {
+ if member == nil {
+ continue
+ }
+ require.Less(t, index, len(payload.Members))
+ got := payload.Members[index]
+ require.Equal(t, member.ID, got.ID)
+ require.Equal(t, member.StartTime.UTC().Format(time.RFC3339Nano), got.StartedAt)
+ require.Equal(t, member.Message, got.Summary, "member message is not a recovery summary")
+ for _, key := range []string{"resolutionReason", "successorResourceId", "successorName"} {
+ require.Contains(t, raw.Members[index], key, "an empty known field must differ from an older missing field")
+ }
+ wantReason, wantID, wantName := "", "", ""
+ if member.Resolution != nil {
+ wantReason = string(member.Resolution.Reason)
+ wantID = member.Resolution.SuccessorResourceID
+ wantName = member.Resolution.SuccessorName
+ }
+ require.Equal(t, wantReason, got.ResolutionReason)
+ require.Equal(t, wantID, got.SuccessorResourceID)
+ require.Equal(t, wantName, got.SuccessorName)
+ index++
+ }
+ require.Len(t, payload.Members, index)
+ })
+ }
+}
+
func TestWebhookGuideShortTemplateEscapesStrings(t *testing.T) {
section := strings.SplitN(webhookGuide(t), "### Sample PSA payloads", 2)[0]
block := regexp.MustCompile("(?s)```http\\nPOST /api/notifications/webhooks\\nX-Pulse-Org-ID:.*?\\n\\n(.*?)\\n```").FindStringSubmatch(section)