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
Keep retained guest disk readings out of current-capacity selection
pulse-triage[bot]dcb0a692d4d0
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.mdindex f2709a956c..bc7fd8b5aa 100644--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md@@ -3019,6 +3019,24 @@ precedence, reinterpret ratios above an arbitrary threshold, or replace anestablished provider history series; source authority and canonical identityconvergence belong upstream in the unified-resource and monitoring contracts.+Workloads disk selection follows the same guest-read freshness rule as the+row and drawer in `frontend-modern/src/utils/workloadGuestPresentation.ts`.+`workloadSelectors.ts` sorts current available readings before unavailable or+last-known readings in **both** directions; retaining a labelled number for+inspection does not promote it to a current capacity observation.+`frontend-modern/src/utils/searchQuery.ts` must not match a numeric `disk`+condition from absent, explicitly unavailable, negative-sentinel or non-finite+usage, or from a non-current guest filesystem read. An actually reported zero+still matches zero. The Workloads wrapper recognises the shared parser's+existing numeric equality syntax instead of treating it as a name query.+Linked Pulse Agent filesystems follow that agent's lease+and stopped-guest boundary, not a failed Proxmox read; unrelated stale agent+metadata must not suppress a current platform reading. Text/OR searches and+unfiltered inventory remain available. These are selection rules, not health,+thaw, collection-recovery or alert-policy verdicts. The selector and search+regressions cover refusal/retention, same-identity fresh withdrawal, linked-agent+precedence, both sort directions and unknown-versus-zero controls.+Resource table rows that surface policy posture must show at most a singleinline summary chip for blocking `local-only`/`restricted` posture; non-blocking `sensitive` +`local-first` and redaction-only metadata belongs in Data Handling, detail, anddiff --git a/frontend-modern/browser-verification/c9dc60052ed46ffc.json b/frontend-modern/browser-verification/c9dc60052ed46ffc.jsonnew file mode 100644index 0000000000..57189f0c6b--- /dev/null+++ b/frontend-modern/browser-verification/c9dc60052ed46ffc.json@@ -0,0 +1,52 @@+{+ "version": 1,+ "result": "passed",+ "base_sha": "331994d372006c528f360c9d67da18c1ef99825a",+ "changed_paths": [+ "frontend-modern/src/components/Workloads/workloadSelectors.ts",+ "frontend-modern/src/utils/searchQuery.ts"+ ],+ "content_sha256": {+ "frontend-modern/src/components/Workloads/workloadSelectors.ts": "27a4649e0f2169b6ea273b4d78871de03e70ae067dfff1e4ffd3e004f7dd6a40",+ "frontend-modern/src/utils/searchQuery.ts": "2d40eb13684ee91ae1291f430b6047be96ece2e08ea5b83baccb5d05a6cb813b"+ },+ "routes": [+ "/proxmox?tab=workloads (synthetic canonical snapshot, production mapper/SearchInput/selectors/GuestRow fixture at /tmp/disk-selection/index.html)"+ ],+ "states": [+ "Current high/low/zero disk metrics; retained backup lock; unavailable permission denial; missing canonical metric",+ "Live/stale linked-agent filesystem precedence; full same-identity fresh snapshot withdrawal"+ ],+ "interactions": [+ "Sort disk ascending/descending: all current values first, unknown/retained values last in both directions",+ "Numeric high filter and reported zero equality filter; name search and OR retain inventory access",+ "Fresh snapshot restores numeric membership; keyboard Escape returns complete inventory"+ ],+ "viewports": [+ {+ "width": 1365,+ "height": 900+ },+ {+ "width": 390,+ "height": 844+ }+ ],+ "verified_at": "2026-10-09T11:45:21.503Z",+ "browsers": [+ {+ "engine": "desktop",+ "version": "141.0.7390.37"+ },+ {+ "engine": "phone",+ "version": "26.0"+ }+ ],+ "playwright_version": "1.56.1",+ "evidence": {+ "result": "Current lane outcome evidence/browser-result.json",+ "screenshots": "Eight inspected desktop/phone captures retained beside lane outcome",+ "limits": "Synthetic canonical snapshots, actual useWorkloads mapper, shared SearchInput and production selectors/GuestRow/CSS. Sort buttons are fixture controls. No full-app, native collector/thaw/liveness, physical device, installed or release acceptance."+ }+}diff --git a/frontend-modern/src/components/Workloads/__tests__/workloadSelectors.branchcov.test.ts b/frontend-modern/src/components/Workloads/__tests__/workloadSelectors.branchcov.test.tsindex ad485174fe..dcbca3ac35 100644--- a/frontend-modern/src/components/Workloads/__tests__/workloadSelectors.branchcov.test.ts+++ b/frontend-modern/src/components/Workloads/__tests__/workloadSelectors.branchcov.test.ts@@ -521,13 +521,13 @@ describe('workloadSelectors (branch coverage)', () => {).toBe(100);});- it('returns 0 for usage of 0 and clamps negative usage to 0', () => {+ it('keeps a reported zero but treats negative usage as unavailable', () => {expect(getDiskUsagePercent(makeGuest(1, { disk: { total: 100, used: 0, free: 100, usage: 0 } })),).toBe(0);expect(getDiskUsagePercent(makeGuest(2, { disk: { total: 100, used: 0, free: 100, usage: -5 } })),- ).toBe(0);+ ).toBeNull();});it('falls back to used/total when usage is non-finite (Infinity)', () => {diff --git a/frontend-modern/src/components/Workloads/__tests__/workloadSelectors.test.ts b/frontend-modern/src/components/Workloads/__tests__/workloadSelectors.test.tsindex 22c4df6e88..4c33dd824e 100644--- a/frontend-modern/src/components/Workloads/__tests__/workloadSelectors.test.ts+++ b/frontend-modern/src/components/Workloads/__tests__/workloadSelectors.test.ts@@ -1026,3 +1026,118 @@ describe('workloadSelectors', () => {});});});++describe('current guest disk selection', () => {+ const diskGuest = (id: number, usage: number, overrides: Partial<WorkloadGuest> = {}) =>+ makeGuest(id, {+ type: 'qemu',+ workloadType: 'vm',+ status: 'running',+ disk: { total: 100, used: usage, free: 100 - usage, usage },+ ...overrides,+ });+ const select = (guests: WorkloadGuest[], searchTerm: string) =>+ filterWorkloads({+ guests,+ searchTerm,+ viewMode: 'all',+ statusMode: 'all',+ selectedNode: null,+ selectedHostHint: null,+ selectedKubernetesContext: null,+ });++ it.each(['prev-vm-locked', 'prev-agent-timeout', 'permission-denied', 'agent-cooldown'])(+ 'excludes %s numbers from disk sorting and numeric search without hiding inventory',+ (diskStatusReason) => {+ const guest = diskGuest(1, 95, { diskStatusReason });+ expect(getDiskUsagePercent(guest)).toBeNull();+ expect(select([guest], 'disk>90')).toEqual([]);+ expect(select([guest], 'name:workload-1')).toEqual([guest]);+ expect(select([guest], '')).toEqual([guest]);+ },+ );++ it.each(['asc', 'desc'] as const)(+ 'keeps unavailable and retained readings after all current readings when sorting %s',+ (direction) => {+ const current = [diskGuest(1, 0), diskGuest(2, 40), diskGuest(3, 95)];+ const unknown = [+ diskGuest(4, 99, { diskStatusReason: 'prev-vm-locked' }),+ diskGuest(5, 1, { diskStatusReason: 'agent-timeout' }),+ diskGuest(6, 0, { disk: undefined as unknown as WorkloadGuest['disk'] }),+ ];+ const input = [unknown[0], current[1], unknown[2], current[2], unknown[1], current[0]];+ const sorted = [...input].sort(createWorkloadSortComparator('disk', direction)!);+ expect(sorted.slice(0, 3)).toEqual(direction === 'asc' ? current : [...current].reverse());+ expect(new Set(sorted.slice(3))).toEqual(new Set(unknown));+ expect(input[0]).toBe(unknown[0]);+ },+ );++ it('restores filtering and sorting only when the same guest gets a current reading', () => {+ const retained = diskGuest(1, 95, { diskStatusReason: 'prev-vm-locked' });+ const peer = diskGuest(2, 40);+ const current = { ...retained, diskStatusReason: undefined };+ expect(select([retained, peer], 'disk>90')).toEqual([]);+ expect([retained, peer].sort(createWorkloadSortComparator('disk', 'desc')!)).toEqual([+ peer,+ retained,+ ]);+ expect(select([current, peer], 'disk>90')).toEqual([current]);+ expect([current, peer].sort(createWorkloadSortComparator('disk', 'desc')!)).toEqual([+ current,+ peer,+ ]);+ expect('diskStatusReason' in retained && retained.diskStatusReason).toBe('prev-vm-locked');+ });++ it('follows linked-agent filesystem freshness rather than the failed Proxmox read', () => {+ const linked = diskGuest(1, 95, { disksFromAgent: true, diskStatusReason: 'agent-error' });+ expect(getDiskUsagePercent(linked)).toBe(95);+ expect(select([linked], 'disk>90')).toEqual([linked]);+ const stale = { ...linked, agentStale: true };+ expect(getDiskUsagePercent(stale)).toBeNull();+ expect(select([stale], 'disk>90')).toEqual([]);+ const stopped = { ...linked, status: 'stopped' };+ expect(getDiskUsagePercent(stopped)).toBeNull();+ expect(select([stopped], 'disk>90')).toEqual([]);+ const platform = diskGuest(2, 95, { agentStale: true });+ expect(getDiskUsagePercent(platform)).toBe(95);+ expect(select([platform], 'disk>90')).toEqual([platform]);+ });++ it('does not invent zero from unavailable telemetry or a negative sentinel', () => {+ const unavailable = diskGuest(1, 0, {+ telemetryAvailability: {+ cpu: true,+ memory: true,+ disk: false,+ networkIO: true,+ diskIO: true,+ uptime: true,+ },+ });+ const sentinel = diskGuest(2, -1);+ for (const guest of [unavailable, sentinel]) {+ expect(getDiskUsagePercent(guest)).toBeNull();+ expect(select([guest], 'disk=0')).toEqual([]);+ }+ const zero = diskGuest(3, 0);+ expect(getDiskUsagePercent(zero)).toBe(0);+ expect(select([zero], 'disk=0')).toEqual([zero]);+ });++ it('recognises legacy qemu types and does not apply Proxmox refusal to LXC disk readings', () => {+ const vm = diskGuest(1, 95, { workloadType: undefined, diskStatusReason: 'prev-vm-locked' });+ const lxc = diskGuest(2, 95, {+ type: 'lxc',+ workloadType: 'system-container',+ diskStatusReason: 'permission-denied',+ });+ expect(getDiskUsagePercent(vm)).toBeNull();+ expect(select([vm], 'disk>90')).toEqual([]);+ expect(getDiskUsagePercent(lxc)).toBe(95);+ expect(select([lxc], 'disk>90')).toEqual([lxc]);+ });+});diff --git a/frontend-modern/src/components/Workloads/workloadSelectors.ts b/frontend-modern/src/components/Workloads/workloadSelectors.tsindex c1896da8fe..7fc47c3e3c 100644--- a/frontend-modern/src/components/Workloads/workloadSelectors.ts+++ b/frontend-modern/src/components/Workloads/workloadSelectors.ts@@ -4,7 +4,12 @@ import {type IODistributionStats,type WorkloadIOEmphasis,} from './guestRowModel';-import { parseFilterStack, evaluateFilterStack, splitSearchExclusions } from '@/utils/searchQuery';+import {+ parseFilter,+ parseFilterStack,+ evaluateFilterStack,+ splitSearchExclusions,+} from '@/utils/searchQuery';import { normalizeSourcePlatformQueryValue } from '@/utils/sourcePlatforms';import { OFFLINE_HEALTH_STATUSES } from '@/utils/status';import { hasFailedAttachedAvailabilityCheck } from '@/utils/availabilityProbePresentation';@@ -16,6 +21,7 @@ import {workloadMatchesViewMode,} from '@/utils/workloads';import { getWorkloadTypePresentation } from '@/utils/workloadTypePresentation';+import { getWorkloadGuestDiskRead } from '@/utils/workloadGuestPresentation';import {getKubernetesContextKey,getWorkloadHostHintCandidates,@@ -240,7 +246,12 @@ export const filterWorkloads = ({const exclusions: string[] = [];searchParts.forEach((part) => {- if (part.includes('>') || part.includes('<') || part.includes(':')) {+ if (+ part.includes('>') ||+ part.includes('<') ||+ part.includes(':') ||+ parseFilter(part).type === 'metric'+ ) {filters.push(part);} else {const split = splitSearchExclusions(part);@@ -273,7 +284,16 @@ export const filterWorkloads = ({export const getDiskUsagePercent = (guest: WorkloadGuest): number | null => {const disk = guest?.disk;- if (!disk) return null;+ // The row may retain a clearly labelled last-known number. It must not+ // compete with current readings when sorting capacity, in either direction.+ if (+ !disk ||+ guest.telemetryAvailability?.disk === false ||+ getWorkloadGuestDiskRead(guest, resolveWorkloadType(guest) === 'vm').state !== 'current' ||+ (typeof disk.usage === 'number' && disk.usage < 0)+ ) {+ return null;+ }const clamp = (value: number) => Math.min(100, Math.max(0, value));diff --git a/frontend-modern/src/utils/__tests__/searchQuery.branchcov.test.ts b/frontend-modern/src/utils/__tests__/searchQuery.branchcov.test.tsindex 7214c93fb5..54e2a34504 100644--- a/frontend-modern/src/utils/__tests__/searchQuery.branchcov.test.ts+++ b/frontend-modern/src/utils/__tests__/searchQuery.branchcov.test.ts@@ -132,14 +132,14 @@ describe('evaluateMetricCondition — field switch branches (via evaluateFilterS).toBe(true);});- it('disk: falsy/missing disk yields 0', () => {+ it('disk: falsy/missing disk does not match a low-usage condition', () => {expect(evaluateFilterStack(makeGuest({ disk: null as unknown as VM['disk'] }),single(metric('disk', '<', 1)),),- ).toBe(true);- expect(evaluateFilterStack(guestWithout(['disk']), single(metric('disk', '<', 1)))).toBe(true);+ ).toBe(false);+ expect(evaluateFilterStack(guestWithout(['disk']), single(metric('disk', '<', 1)))).toBe(false);});it('uptime: running guest uses the uptime value', () => {diff --git a/frontend-modern/src/utils/__tests__/searchQuery.branchcov0712b.test.ts b/frontend-modern/src/utils/__tests__/searchQuery.branchcov0712b.test.tsindex 7a3b91a7fd..0ca13d079f 100644--- a/frontend-modern/src/utils/__tests__/searchQuery.branchcov0712b.test.ts+++ b/frontend-modern/src/utils/__tests__/searchQuery.branchcov0712b.test.ts@@ -245,14 +245,13 @@ describe('evaluateMetricCondition — field-switch arms (via evaluateFilterStack).toBe(true);});- it('returns 0 when disk is null (falsy short-circuit)', () => {- // null disk -> 0 ; 0 <= 0 true+ it('does not substitute zero when disk is null', () => {expect(evaluateFilterStack(makeGuest({ disk: null as unknown as VM['disk'] }),single(metric('disk', '<=', 0)),),- ).toBe(true);+ ).toBe(false);});});diff --git a/frontend-modern/src/utils/__tests__/searchQuery.test.ts b/frontend-modern/src/utils/__tests__/searchQuery.test.tsindex 26c411b737..c226fe0e93 100644--- a/frontend-modern/src/utils/__tests__/searchQuery.test.ts+++ b/frontend-modern/src/utils/__tests__/searchQuery.test.ts@@ -7,6 +7,7 @@ import {matchesSearchTermSplit,} from '@/utils/searchQuery';import type { VM } from '@/types/api';+import type { WorkloadGuest } from '@/types/workloads';describe('parseFilter', () => {it('parses metric conditions with > operator', () => {@@ -429,3 +430,76 @@ describe('evaluateFilterStack', () => {});});});++describe('disk filter freshness and unknown values', () => {+ const guest = (overrides: Partial<WorkloadGuest> = {}): WorkloadGuest => ({+ id: 'fixture-vm',+ vmid: 101,+ name: 'retained-vm',+ node: 'pve1',+ instance: 'fixture',+ type: 'qemu',+ workloadType: 'vm',+ status: 'running',+ cpu: 0,+ cpus: 1,+ memory: { usage: 0, total: 100, used: 0, free: 100 },+ disk: { usage: 95, total: 100, used: 95, free: 5 },+ networkIn: 0,+ networkOut: 0,+ diskRead: 0,+ diskWrite: 0,+ uptime: 1,+ template: false,+ lastBackup: 0,+ tags: [],+ lock: '',+ lastSeen: '2026-10-09T11:33:33Z',+ ...overrides,+ });+ const matches = (vm: WorkloadGuest, query: string) =>+ evaluateFilterStack(vm, parseFilterStack(query));++ it.each(['>0', '>=0', '<100', '<=100', '=0', '==0'])(+ 'does not match disk%s when the reading is absent, invalid or not current',+ (comparison) => {+ const unknown = [+ guest({ disk: undefined as unknown as WorkloadGuest['disk'] }),+ guest({ disk: { total: 0, used: 0, free: 0 } as WorkloadGuest['disk'] }),+ guest({ disk: { usage: -1, total: 100, used: 95, free: 5 } }),+ guest({ disk: { usage: NaN, total: 100, used: 95, free: 5 } }),+ guest({ disk: { usage: Infinity, total: 100, used: 95, free: 5 } }),+ guest({ diskStatusReason: 'prev-vm-locked' }),+ guest({ diskStatusReason: 'permission-denied' }),+ guest({+ telemetryAvailability: {+ cpu: true,+ memory: true,+ disk: false,+ networkIO: true,+ diskIO: true,+ uptime: true,+ },+ }),+ ];+ for (const vm of unknown) expect(matches(vm, `disk${comparison}`)).toBe(false);+ },+ );++ it('preserves valid reported zero and numeric disk comparisons', () => {+ expect(matches(guest({ disk: { usage: 0, total: 100, used: 0, free: 100 } }), 'disk=0')).toBe(+ true,+ );+ expect(matches(guest(), 'disk>90')).toBe(true);+ expect(matches(guest(), 'disk<90')).toBe(false);+ expect(matches(guest(), 'disk>=95 AND name:retained')).toBe(true);+ });++ it('keeps OR text matches and other metrics independent of unavailable disk readings', () => {+ const retained = guest({ diskStatusReason: 'prev-vm-locked' });+ expect(matches(retained, 'disk>90 OR name:retained')).toBe(true);+ expect(matches(retained, 'disk>90 AND name:retained')).toBe(false);+ expect(matches(retained, 'cpu=0')).toBe(true);+ expect(matches(retained, 'name:retained')).toBe(true);+ });+});diff --git a/frontend-modern/src/utils/searchQuery.ts b/frontend-modern/src/utils/searchQuery.tsindex ab47a7fa63..df192bcff6 100644--- a/frontend-modern/src/utils/searchQuery.ts+++ b/frontend-modern/src/utils/searchQuery.ts@@ -1,5 +1,6 @@-import type { VM, Container } from '@/types/api';-import { getWorkloadCPUPercent } from '@/utils/workloads';+import type { WorkloadGuest } from '@/types/workloads';+import { getWorkloadCPUPercent, resolveWorkloadType } from '@/utils/workloads';+import { getWorkloadGuestDiskRead } from '@/utils/workloadGuestPresentation';// Exclusion-aware split of a free-text search. Terms prefixed with `-` hide// matching rows ("-watchtower" hides anything whose haystack contains@@ -146,7 +147,7 @@ export function parseFilterStack(searchString: string): FilterStack {return { filters, operators };}-type FilterableItem = VM | Container;+type FilterableItem = WorkloadGuest;function evaluateMetricCondition(guest: FilterableItem, condition: MetricCondition): boolean {let value: number;@@ -158,9 +159,20 @@ function evaluateMetricCondition(guest: FilterableItem, condition: MetricConditicase 'memory':value = 'memory' in guest && guest.memory ? guest.memory.usage : 0;break;- case 'disk':- value = 'disk' in guest && guest.disk ? (guest.disk.usage ?? 0) : 0;+ case 'disk': {+ // Missing and retained reads are not zero (or current capacity).+ // Preserve the same provider/linked-agent freshness rule as the row.+ if (+ guest.telemetryAvailability?.disk === false ||+ getWorkloadGuestDiskRead(guest, resolveWorkloadType(guest) === 'vm').state !== 'current'+ ) {+ return false;+ }+ const usage = guest.disk?.usage;+ if (typeof usage !== 'number' || !Number.isFinite(usage) || usage < 0) return false;+ value = usage;break;+ }case 'uptime':// Uptime in seconds (only for running VMs/containers)value =