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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Clear ended Proxmox backup activity from resource snapshots
pulse-triage[bot]1d4e20a46e9c
diff --git a/frontend-modern/src/utils/__tests__/resourceStateAdapters.backup-progress.test.ts b/frontend-modern/src/utils/__tests__/resourceStateAdapters.backup-progress.test.tsnew file mode 100644index 0000000000..8fad058d9c--- /dev/null+++ b/frontend-modern/src/utils/__tests__/resourceStateAdapters.backup-progress.test.ts@@ -0,0 +1,154 @@+import { describe, expect, it } from 'vitest';+import type { Resource } from '@/types/resource';+import {+ mergeCanonicalResourceDeltaSnapshot,+ mergeCanonicalResourceSnapshot,+} from '@/utils/resourceStateAdapters';++const guest = (type: 'vm' | 'system-container', instance = 'site-a'): Resource => ({+ id: `${instance}:pve1:101`,+ type,+ name: 'same-name',+ displayName: 'same-name',+ platformId: instance,+ platformType: 'proxmox-pve',+ sourceType: 'api',+ sources: ['proxmox'],+ status: 'running',+ lastSeen: 1000,+ proxmox: {+ vmid: 101,+ instance,+ nodeName: 'pve1',+ runtimeStatus: 'running',+ ...(type === 'vm' ? { guestAgentStatus: 'expected-unreachable' } : {}),+ backupInProgress: true,+ lastBackup: '2026-10-24T12:00:00Z',+ diskStatusReason: 'agent-not-running',+ },+});++const paths = ['full', 'delta', 'fast-delta'] as const;+const merge = (path: (typeof paths)[number], incoming: Resource, previous: Resource[]) =>+ path === 'full'+ ? mergeCanonicalResourceSnapshot([incoming, previous[1]!], previous)+ : mergeCanonicalResourceDeltaSnapshot(+ [incoming, previous[1]!],+ previous,+ new Set([incoming.id]),+ path === 'fast-delta' ? new Map([[incoming.id, ['proxmox']]]) : undefined,+ );++describe.each(paths)('backup activity through %s merging', (path) => {+ it.each(['vm', 'system-container'] as const)(+ 'withdraws omitted native false for a %s without inventing guest-agent recovery',+ (type) => {+ const active = guest(type);+ const other = guest(type, 'site-b');+ const previous = mergeCanonicalResourceSnapshot([active, other], []);+ const incoming = structuredClone(active);+ delete incoming.proxmox!.backupInProgress;+ incoming.proxmox!.lock = 'backup';+ const [cleared, independent] = merge(path, incoming, previous);+ expect(cleared!.proxmox?.backupInProgress ?? false).toBe(false);+ expect(cleared!.proxmox?.lastBackup).toBe(active.proxmox!.lastBackup);+ expect(cleared!.proxmox?.guestAgentStatus).toBe(active.proxmox!.guestAgentStatus);+ expect(cleared!.proxmox?.diskStatusReason).toBe('agent-not-running');+ expect(cleared!.proxmox?.lock).toBe('backup');+ expect(independent!.proxmox?.backupInProgress).toBe(true);+ expect(previous[0]!.proxmox?.backupInProgress).toBe(true);+ expect(active.proxmox?.backupInProgress).toBe(true);+ },+ );++ it.each([true, false])('honours explicit native activity %s', (backupInProgress) => {+ const active = guest('vm');+ const previous = mergeCanonicalResourceSnapshot([active, guest('vm', 'site-b')], []);+ const incoming = {+ ...active,+ proxmox: { ...active.proxmox, backupInProgress },+ platformData: { vmid: 101, backupInProgress: !backupInProgress },+ };+ expect(merge(path, incoming, previous)[0]!.proxmox?.backupInProgress).toBe(backupInProgress);+ });++ it.each([+ { vmid: 101, cpus: 4 },+ { runtimeStatus: 'running' },+ { vmid: 0, runtimeStatus: 'running' },+ { vmid: -1, runtimeStatus: 'running' },+ { vmid: 1.5, runtimeStatus: 'running' },+ { vmid: 101, runtimeStatus: ' ' },+ ])('keeps activity when a thin facet has no complete native runtime: %j', (proxmox) => {+ const active = guest('vm');+ const previous = mergeCanonicalResourceSnapshot([active, guest('vm', 'site-b')], []);+ const [kept] = merge(path, { ...active, proxmox }, previous);+ expect(kept!.proxmox?.backupInProgress).toBe(true);+ });++ it('clears the native compatibility mirror too', () => {+ const active = guest('vm');+ active.platformData = { sources: ['proxmox'], proxmox: active.proxmox };+ const previous = mergeCanonicalResourceSnapshot([active, guest('vm', 'site-b')], []);+ const incoming = structuredClone(active);+ delete incoming.proxmox!.backupInProgress;+ incoming.platformData = { sources: ['proxmox'], proxmox: incoming.proxmox };+ // A mirror change requires the general delta path, not the metric-only fast path.+ const [cleared] =+ path === 'full'+ ? mergeCanonicalResourceSnapshot([incoming, previous[1]!], previous)+ : mergeCanonicalResourceDeltaSnapshot(+ [incoming, previous[1]!],+ previous,+ new Set([incoming.id]),+ path === 'fast-delta'+ ? new Map([[incoming.id, ['proxmox', 'platformData.proxmox']]])+ : undefined,+ );+ expect(cleared!.proxmox?.backupInProgress).toBeUndefined();+ expect(cleared!.platformData).toMatchObject({ proxmox: incoming.proxmox });+ expect(+ (cleared!.platformData?.proxmox as Resource['proxmox'])?.backupInProgress,+ ).toBeUndefined();+ });+});++describe('legacy backup activity', () => {+ it.each([true, false])('preserves an initial explicit legacy boolean: %s', (flag) => {+ const raw = {+ ...guest('system-container'),+ proxmox: undefined,+ platformData: { vmid: 101, instance: 'site-a', backupInProgress: flag },+ };+ expect(mergeCanonicalResourceSnapshot([raw], [])[0]!.proxmox?.backupInProgress).toBe(flag);+ });++ it.each([true, false, undefined])('uses only an explicit legacy boolean: %s', (flag) => {+ const active = guest('system-container');+ const previous = mergeCanonicalResourceSnapshot([active], []);+ const incoming = {+ ...active,+ proxmox: undefined,+ platformData: {+ vmid: 101,+ instance: 'site-a',+ ...(flag === undefined ? {} : { backupInProgress: flag }),+ },+ };+ for (const [row] of [+ mergeCanonicalResourceSnapshot([incoming], previous),+ mergeCanonicalResourceDeltaSnapshot([incoming], previous, new Set([active.id])),+ ]) {+ expect(row!.proxmox?.backupInProgress).toBe(flag ?? true);+ }+ });++ it('does not infer a missing legacy flag from a previously merged runtime', () => {+ const active = guest('vm');+ const [row] = mergeCanonicalResourceSnapshot(+ [{ ...active, proxmox: undefined, platformData: { vmid: 101, cpus: 2 } }],+ mergeCanonicalResourceSnapshot([active], []),+ );+ expect(row!.proxmox?.backupInProgress).toBe(true);+ });+});diff --git a/frontend-modern/src/utils/resourceStateAdapters.ts b/frontend-modern/src/utils/resourceStateAdapters.tsindex 3863e1b3a4..527e6b0573 100644--- a/frontend-modern/src/utils/resourceStateAdapters.ts+++ b/frontend-modern/src/utils/resourceStateAdapters.ts@@ -118,11 +118,12 @@ const mergeRecord = <T extends JsonRecord>(incoming?: T, existing?: T): T | undereturn { ...existing, ...incoming };};-// Native VM facets carry a runtime state and an explicit guest-agent outcome.-// Their optional read reason, lock, false expected flag and guest filesystems-// are omitempty on wire. A new outcome supersedes those fields, not unrelated-// richer metadata; withdrawn filesystems must not hide a linked agent's.-// Partial/legacy facets without that evidence must retain the prior facts.+// Native guest runtime facets omit backupInProgress when false. Their positive+// VMID and runtime state distinguish them from thin/legacy enrichment. This+// applies to LXC too, independently of any QEMU guest-agent outcome.+// Only an explicit guest-agent outcome also withdraws its optional read reason,+// lock, false expected flag and filesystems. Neither withdrawal establishes thaw.+// Partial/legacy facets without the relevant evidence retain the prior facts.const mergeProxmoxFacet = <T extends JsonRecord>(incoming?: T, existing?: T): T | undefined => {const merged = mergeRecord(incoming, existing);if (@@ -132,12 +133,16 @@ const mergeProxmoxFacet = <T extends JsonRecord>(incoming?: T, existing?: T): T!Number.isInteger(incoming.vmid) ||incoming.vmid <= 0 ||typeof incoming.runtimeStatus !== 'string' ||- !incoming.runtimeStatus.trim() ||- typeof incoming.guestAgentStatus !== 'string' ||- !incoming.guestAgentStatus.trim()+ !incoming.runtimeStatus.trim())return merged;const next = { ...merged };+ if (!Object.prototype.hasOwnProperty.call(incoming, 'backupInProgress')) {+ delete next.backupInProgress;+ }+ if (typeof incoming.guestAgentStatus !== 'string' || !incoming.guestAgentStatus.trim()) {+ return next;+ }for (const key of ['diskStatusReason', 'guestAgentExpected', 'lock', 'disks']) {if (!Object.prototype.hasOwnProperty.call(incoming, key)) delete next[key];}@@ -508,6 +513,9 @@ const canonicalizeLegacyPlatformData = (resource: Resource): Resource['platformD}}if (platformData.disks !== undefined) proxmoxPayload.disks = platformData.disks;+ if (typeof platformData.backupInProgress === 'boolean') {+ proxmoxPayload.backupInProgress = platformData.backupInProgress;+ }if (Object.keys(proxmoxPayload).length > 0) {normalized.proxmox = proxmoxPayload;}