From c558cb8e908b079edbba6bc2ed262105b3c90eeb Mon Sep 17 00:00:00 2001 From: "pulse-triage[bot]" <249995291+pulse-triage[bot]@users.noreply.github.com> Date: Tue, 1 Dec 2026 15:31:12 +0000 Subject: [PATCH] Show the latest watchdog interruption window in UTC Expose the recorded last progress or clean stop and the restart so operators can match a gap to external logs. Keep the duration and kind reactive when a newer interruption arrives during Refresh. Contract-Neutral: Displays already returned watchdog interruption fields and refreshes their presentation without changing any API, retention, watchdog, or alert delivery contract. Change-source: pulse-maintainer --- .../9326feecf1c1aa1f.json | 33 +++++++++++++ .../alerts/AlertDeadManDestinationSection.tsx | 22 +++++++-- .../AlertDeadManDestinationSection.test.tsx | 48 ++++++++++++++++++- 3 files changed, 99 insertions(+), 4 deletions(-) create mode 100644 frontend-modern/browser-verification/9326feecf1c1aa1f.json diff --git a/frontend-modern/browser-verification/9326feecf1c1aa1f.json b/frontend-modern/browser-verification/9326feecf1c1aa1f.json new file mode 100644 index 0000000000..6c65ba500d --- /dev/null +++ b/frontend-modern/browser-verification/9326feecf1c1aa1f.json @@ -0,0 +1,33 @@ +{ + "version": 1, + "base_sha": "ce3996841491518962bae117df8117b6a500a7f0", + "verified_at": "2026-12-01T15:31:08Z", + "result": "passed", + "changed_paths": [ + "frontend-modern/src/features/alerts/AlertDeadManDestinationSection.tsx" + ], + "content_sha256": { + "frontend-modern/src/features/alerts/AlertDeadManDestinationSection.tsx": "c64d5b325a454622b963aea7ba7a7318092623461ef197f11f56ed2c5a873c3d" + }, + "routes": [ + "Alerts / Notifications / External watchdog: production section and AlertsAPI in an isolated preview; synthetic read-only GET responses" + ], + "viewports": [ + { + "width": 1365, + "height": 900 + }, + { + "width": 390, + "height": 844 + } + ], + "states": [ + "Paired desktop light and narrow dark with a fixed clock and America/Los_Angeles browser timezone; inspected all twelve before/after captures.", + "Confirmed stall and HTTP 503: candidate adds the last known progress and restart datetimes across UTC midnight while preserving the interruption summary, status, failure evidence and actions.", + "Fresh HTTP 200 with a newer clean interruption: baseline retains old duration and stop type; candidate updates both and normalizes the offset timestamps to UTC. Healthy badge and live ages update on both sources." + ], + "interactions": [ + "Playwright 1.56.1 / Chromium 141.0.7390.37: keyboard Enter on desktop and touch Refresh on narrow. Three GETs per case, no writes, real ping, page exception, or horizontal overflow." + ] +} diff --git a/frontend-modern/src/features/alerts/AlertDeadManDestinationSection.tsx b/frontend-modern/src/features/alerts/AlertDeadManDestinationSection.tsx index b057662883..6923c0bb79 100644 --- a/frontend-modern/src/features/alerts/AlertDeadManDestinationSection.tsx +++ b/frontend-modern/src/features/alerts/AlertDeadManDestinationSection.tsx @@ -82,6 +82,10 @@ const isRecord = (value: unknown): value is Record => const isTimestamp = (value: unknown): value is string => typeof value === 'string' && Number.isFinite(Date.parse(value)); +// Match the watchdog's UTC timestamps regardless of the browser's time zone. +const watchdogTimeUtc = (timestamp: string) => + `${new Date(timestamp).toISOString().slice(0, 19).replace('T', ' ')} UTC`; + const isCount = (value: unknown): value is number => typeof value === 'number' && Number.isSafeInteger(value) && value >= 0; @@ -345,9 +349,21 @@ export function AlertDeadManDestinationSection(props: AlertDeadManDestinationSec
Last interruption
- {(gap) => - `${Math.max(1, Math.round(gap().durationSeconds / 60))} min (${gap().cleanShutdown ? 'clean restart' : 'unexpected stop'})` - } + {(gap) => ( + <> +
+ {Math.max(1, Math.round(gap().durationSeconds / 60))} min ( + {gap().cleanShutdown ? 'clean restart' : 'unexpected stop'}) +
+
+ {gap().cleanShutdown ? 'Stopped: ' : 'Last known progress: '} + +
+
+ Restarted: +
+ + )}
diff --git a/frontend-modern/src/features/alerts/__tests__/AlertDeadManDestinationSection.test.tsx b/frontend-modern/src/features/alerts/__tests__/AlertDeadManDestinationSection.test.tsx index ef286ec284..a219399f2d 100644 --- a/frontend-modern/src/features/alerts/__tests__/AlertDeadManDestinationSection.test.tsx +++ b/frontend-modern/src/features/alerts/__tests__/AlertDeadManDestinationSection.test.tsx @@ -99,6 +99,33 @@ describe('AlertDeadManDestinationSection', () => { expect(input).toHaveAttribute('type', 'password'); }); + it('shows the recorded stop and restart in UTC even when the gap crosses midnight', async () => { + const readStatus = vi.mocked(AlertsAPI.getDeadManStatus); + const base = await readStatus(); + const from = '2026-08-27T01:58:03+02:00'; + const to = '2026-08-27T02:03:06+02:00'; + readStatus.mockResolvedValue({ + ...base, + lastInterruption: { from, to, durationSeconds: 303, cleanShutdown: true }, + }); + + render(() => ( + ''} + setPingUrl={() => {}} + setHasUnsavedChanges={() => {}} + /> + )); + + expect(await screen.findByText('5 min (clean restart)')).toBeInTheDocument(); + const start = screen.getByText('2026-08-26 23:58:03 UTC'); + const end = screen.getByText('2026-08-27 00:03:06 UTC'); + expect(start).toHaveAttribute('datetime', from); + expect(end).toHaveAttribute('datetime', to); + expect(start.parentElement).toHaveTextContent('Stopped:'); + expect(end.parentElement).toHaveTextContent('Restarted:'); + }); + it('surfaces encrypted configuration failures as an actionable state', async () => { vi.mocked(AlertsAPI.getDeadManStatus).mockResolvedValue({ configured: true, @@ -158,7 +185,16 @@ describe('AlertDeadManDestinationSection', () => { readStatus .mockResolvedValueOnce({ ...base, state: 'monitor_stalled', lastError: 'Monitor stopped' }) .mockResolvedValueOnce({ ...base, lastSuccessAt: undefined, lastInterruption: undefined }) - .mockResolvedValueOnce({ ...base, lastSuccessAt: '2026-08-27T12:00:29Z' }); + .mockResolvedValueOnce({ + ...base, + lastSuccessAt: '2026-08-27T12:00:29Z', + lastInterruption: { + from: '2026-08-27T11:57:00Z', + to: '2026-08-27T12:00:15Z', + durationSeconds: 195, + cleanShutdown: true, + }, + }); render(() => ( ''} @@ -173,12 +209,22 @@ describe('AlertDeadManDestinationSection', () => { expect(screen.getByText('Last known status: Monitoring stalled.')).toBeInTheDocument(); expect(screen.getByText('Monitor stopped')).toBeInTheDocument(); expect(screen.getByText('5 min (unexpected stop)')).toBeInTheDocument(); + expect(screen.getByText('2026-08-27 11:55:00 UTC').parentElement).toHaveTextContent( + 'Last known progress:', + ); + expect(screen.getByText('2026-08-27 12:00:00 UTC').parentElement).toHaveTextContent( + 'Restarted:', + ); expect(screen.getByText('Last success').nextElementSibling).toHaveTextContent('30s ago'); fireEvent.click(screen.getByRole('button', { name: 'Refresh' })); await waitFor(() => expect(screen.getByRole('status')).toHaveTextContent('Heartbeat healthy')); expect(screen.queryByText('Last known status: Monitoring stalled.')).not.toBeInTheDocument(); expect(screen.queryByText('Monitor stopped')).not.toBeInTheDocument(); + expect(screen.queryByText('5 min (unexpected stop)')).not.toBeInTheDocument(); + expect(screen.queryByText('2026-08-27 11:55:00 UTC')).not.toBeInTheDocument(); + expect(screen.getByText('3 min (clean restart)')).toBeInTheDocument(); + expect(screen.getByText('2026-08-27 12:00:15 UTC')).toBeInTheDocument(); }); it('distinguishes an unanswered first read from a confirmed unconfigured watchdog', async () => {