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 report inventory failures through realtime hydration

pulse-triage[bot]cab7cdf59f42
diff --git a/frontend-modern/browser-verification/ce04d1ee01414db6.json b/frontend-modern/browser-verification/ce04d1ee01414db6.json
new file mode 100644
index 0000000000..bbf19dbc4f
--- /dev/null
+++ b/frontend-modern/browser-verification/ce04d1ee01414db6.json
@@ -0,0 +1,35 @@
+{
+ "version": 1,
+ "base_sha": "3a27b125e7de84c58cb9107914171192ec301492",
+ "verified_at": "2026-11-02T18:57:50.197653Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/hooks/useUnifiedResources.ts"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/hooks/useUnifiedResources.ts": "bc9cbd38a7a94815d48686f4a30feff8277d81843e21b7020f8154a595a29a3e"
+ },
+ "routes": [
+ "/settings/support/reporting"
+ ],
+ "viewports": [
+ {
+ "width": 1280,
+ "height": 900
+ },
+ {
+ "width": 390,
+ "height": 844
+ }
+ ],
+ "states": [
+ "Actual App and Settings Reporting consumer with synthetic HTTP canonical inventory/schedule producers and real websocket server delivery through the existing Vite proxy, store, adapters and hook. Chromium desktop/light and WebKit phone/dark; Playwright 1.56.1 matches integration lock.",
+ "Canonical denial with live initial hydration; accepted inventory followed by failed revalidation and socket update; cached saved-scope picker remount, live update and real reconnect; pending explicit retry with socket delivery; failed retry and successful explicit empty REST recovery."
+ ],
+ "interactions": [
+ "65 checks: live socket frame is observed through the actual store; retained failure survives updates/reconnect/remount without a new REST request, hides choices and disables Select all. Explicit keyboard Retry and duplicate-safe pending state preserved; only accepted REST recovery clears error.",
+ "Saved report scope and draft stay intact. No generation or write from read/reconnect/retry; one explicit schedule PUT keeps the exact saved VM ID and workspace. Existing API-client two-request HTTP403 CSRF recovery and unrelated consumer defaults remain unchanged.",
+ "Eight final desktop/narrow screenshots opened with native view_image; warning, retry, recovered choices, saved chip/count and accepted-empty distinction reviewed. No body overflow; existing narrow type rail scrolls; captures are scrolled and do not show every control.",
+ "No uncaught page errors; both contexts/browsers, websocket server, Vite and local HTTP server close. Earlier browser script syntax failure is retained separately; it did not execute any journey."
+ ]
+}
diff --git a/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts b/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts
index 6fc5f506eb..cb720d195d 100644
--- a/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts
+++ b/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts
@@ -3479,6 +3479,103 @@ describe('useUnifiedResources', () => {
}
});
+ it.each(['update', 'reconnect', 'remount'] as const)(
+ 'keeps picker canonical denial through websocket %s until explicit recovery',
+ async (delivery) => {
+ const { useResources } = await import('../useResources');
+ const disposals: (() => void)[] = [];
+ const mount = () => {
+ let result!: ReturnType<typeof useResources>;
+ createRoot((dispose) => {
+ disposals.push(dispose);
+ result = useResources(undefined, { retainReadError: true });
+ });
+ return result;
+ };
+ const publish = (version: number, cpu: number) => {
+ batch(() => {
+ setWsState('resources', reconcile([createWsResource({ cpu: { current: cpu } })]));
+ setWsState('lastUpdate', version);
+ setWsResourceChange({ version, changedIds: null });
+ });
+ };
+ try {
+ let picker = mount();
+ await picker.refetch();
+ expect(apiFetchMock).toHaveBeenCalledTimes(1);
+ expect(picker.error()).toBeUndefined();
+ const failure = new Error('canonical picker inventory denied');
+ apiFetchMock.mockRejectedValueOnce(failure);
+ await expect(picker.refetch()).rejects.toBe(failure);
+ expect(picker.error()).toBe(failure);
+ const calls = apiFetchMock.mock.calls.length;
+
+ if (delivery === 'reconnect') setWsConnected(false);
+ if (delivery === 'remount') disposals.shift()!();
+ publish(1, 71);
+ if (delivery === 'reconnect') setWsConnected(true);
+ if (delivery === 'remount') picker = mount();
+ await flushAsync();
+ // Assert the frame really reached the projection, not just a socket
+ // toggle that never delivered any inventory to the consumer.
+ expect(picker.resources()[0].cpu?.current).toBe(71);
+ expect(picker.loading()).toBe(false);
+ expect(picker.error()).toBe(failure);
+ expect(apiFetchMock).toHaveBeenCalledTimes(calls);
+
+ const accepted = deferred<ReturnType<typeof resourceResponse>>();
+ apiFetchMock.mockReturnValueOnce(accepted.promise);
+ const retry = picker.refetch();
+ publish(2, 82);
+ await flushAsync();
+ expect(picker.resources()[0].cpu?.current).toBe(82);
+ expect(picker.error()).toBe(failure);
+ accepted.resolve(resourceResponse([]));
+ await retry;
+ expect(picker.error()).toBeUndefined();
+ expect(picker.loading()).toBe(false);
+ expect(picker.resources()).toHaveLength(0);
+
+ disposals.shift()!();
+ picker = mount();
+ await flushAsync();
+ expect(picker.error()).toBeUndefined();
+ expect(apiFetchMock).toHaveBeenCalledTimes(calls + 1);
+ } finally {
+ disposals.forEach((dispose) => dispose());
+ }
+ },
+ );
+
+ it('keeps the default consumer websocket error-clearing policy', async () => {
+ const { useResources } = await import('../useResources');
+ let dispose = () => {};
+ let consumer!: ReturnType<typeof useResources>;
+ createRoot((d) => {
+ dispose = d;
+ consumer = useResources();
+ });
+ try {
+ await consumer.refetch();
+ const failure = new Error('transient default-consumer failure');
+ apiFetchMock.mockRejectedValueOnce(failure);
+ await expect(consumer.refetch()).rejects.toBe(failure);
+ expect(consumer.error()).toBe(failure);
+ const calls = apiFetchMock.mock.calls.length;
+ batch(() => {
+ setWsState('resources', reconcile([createWsResource({ cpu: { current: 71 } })]));
+ setWsState('lastUpdate', 1);
+ setWsResourceChange({ version: 1, changedIds: null });
+ });
+ await flushAsync();
+ expect(consumer.resources()[0].cpu?.current).toBe(71);
+ expect(consumer.error()).toBeUndefined();
+ expect(apiFetchMock).toHaveBeenCalledTimes(calls);
+ } finally {
+ dispose();
+ }
+ });
+
it('retains a scoped failed read across remounts until a real successful retry', async () => {
const options = {
query: 'type=physical_disk&parent=vm-alpha',
diff --git a/frontend-modern/src/hooks/useUnifiedResources.ts b/frontend-modern/src/hooks/useUnifiedResources.ts
index b3319b6f54..c05bb170f4 100644
--- a/frontend-modern/src/hooks/useUnifiedResources.ts
+++ b/frontend-modern/src/hooks/useUnifiedResources.ts
@@ -2074,7 +2074,10 @@ export function useUnifiedResources(options?: UseUnifiedResourcesOptions) {
setPolicyPosture(cacheEntry.policyPosture);
setAggregations(cacheEntry.aggregations);
setFacets(cacheEntry.facets);
- setError(undefined);
+ // Realtime rows are not a successful canonical read. Opt-in selection
+ // consumers keep a failed read (including on reconnect/remount) until
+ // REST succeeds; other consumers retain their existing websocket policy.
+ if (!retainReadError) setError(undefined);
setLoading(false);
});