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.

Await accepted retry before asserting webhook editor dismissal

pulse-triage[bot]76244218a3cf
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.md
index 8c6237c992..a9718d4d31 100644
--- a/docs/release-control/v6/internal/subsystems/alerts.md
+++ b/docs/release-control/v6/internal/subsystems/alerts.md
@@ -1177,6 +1177,9 @@ that ordinary notifications arrive.
`WebhookConfig.persistence.test.tsx` exercises the actual editor and mutation
owner through deferred create/update responses, failure, explicit retry,
canonical accepted response, cancellation and fixed callback-error guidance.
+The deliberate-retry control defers its response separately: clearing the old
+warning at retry start is not acknowledgement, and the draft stays locked until
+the accepted response incorporates the destination and closes the editor.
`WebhookConfig.test.tsx` now acknowledges successful saves before expecting
editor dismissal. The local `webhook-save-acknowledgement` browser fixture
checks the same components with synthetic API transport, including desktop and
diff --git a/frontend-modern/src/components/Alerts/WebhookConfig.persistence.test.tsx b/frontend-modern/src/components/Alerts/WebhookConfig.persistence.test.tsx
index f1a64fcccc..0e162351d9 100644
--- a/frontend-modern/src/components/Alerts/WebhookConfig.persistence.test.tsx
+++ b/frontend-modern/src/components/Alerts/WebhookConfig.persistence.test.tsx
@@ -119,15 +119,22 @@ describe('webhook persistence acknowledgement', () => {
expect(NotificationsAPI.createWebhook).toHaveBeenCalledTimes(1);
expect(notificationStore.success).not.toHaveBeenCalled();
- vi.mocked(NotificationsAPI.createWebhook).mockResolvedValueOnce({
- ...savedWebhook,
- id: 'new-hook',
- name: 'Accepted destination',
- });
+ const retry = deferred<Webhook>();
+ vi.mocked(NotificationsAPI.createWebhook).mockReturnValueOnce(retry.promise);
fireEvent.click(screen.getByRole('button', { name: 'Add Webhook' }));
- await waitFor(() => expect(screen.queryByRole('alert')).not.toBeInTheDocument());
- expect(screen.queryByLabelText('Name')).not.toBeInTheDocument();
+ // Starting a deliberate retry clears the old warning, not the draft.
+ expect(screen.queryByRole('alert')).not.toBeInTheDocument();
+ expect(screen.getByLabelText('Name')).toHaveValue('New destination');
+ expect(screen.getByLabelText('Name')).toBeDisabled();
+ expect(screen.getByRole('button', { name: 'Saving…' })).toBeDisabled();
+ expect(owner.webhooks()).toEqual([]);
+ expect(notificationStore.success).not.toHaveBeenCalled();
expect(NotificationsAPI.createWebhook).toHaveBeenCalledTimes(2);
+
+ retry.resolve({ ...savedWebhook, id: 'new-hook', name: 'Accepted destination' });
+ await waitFor(() => expect(screen.queryByLabelText('Name')).not.toBeInTheDocument());
+ expect(screen.queryByRole('alert')).not.toBeInTheDocument();
+ expect(notificationStore.success).toHaveBeenCalledTimes(1);
expect(vi.mocked(NotificationsAPI.createWebhook).mock.calls[1][0]).toEqual(
vi.mocked(NotificationsAPI.createWebhook).mock.calls[0][0],
);