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 ambiguous workload parents out of legacy fallback

pulse-triage[bot]d56b7be00187
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
index e5095ccb28..351ec00504 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -26,7 +26,9 @@ fields take precedence over inferred legacy guest-ID prefixes, whose positive VM
may fill missing fields but cannot contradict them. Supplied node snapshots
overlay only the same native ID and tuple; a shared native ID cannot erase
another tuple. Ambiguous tuples or native-ID aliases do not provide parent
-evidence. Row status and host-relative memory use the validated row parent in grouped and flat modes;
+evidence. Legacy fallback must also resolve the candidate's own tuple back to
+that same node; a unique native ID cannot restore an ambiguous tuple, even
+when the guest's instance or node fields are absent. Row status and host-relative memory use the validated row parent in grouped and flat modes;
a group label is not authority to supply another row's parent. Unrelated
platforms do not inherit Proxmox parent state from matching labels.
@@ -41,6 +43,9 @@ host-memory denominator unavailable, never zero or another node's capacity.
Verification: `workloadTopology.attribution.test.ts` and
`workloadTopology.scope.test.ts` cover collided scopes, parent ambiguity,
source-field precedence, legacy hints and unrelated platforms.
+`workloadTopology.ambiguousParent.test.ts` discriminates complete and incomplete
+guest fields, both native aliases, VM/LXC types and both inventory orders;
+unique, consistent legacy fallbacks remain valid.
`WorkloadsSurface.performance.contract.test.tsx` checks both supplied inventory
orders and same-node snapshot overlays; `useWorkloadTableMetricHistory.test.tsx`
checks the native-ID transport boundary. Parent-bound browser proof checks real
diff --git a/frontend-modern/browser-verification/d89ec2be99dc920f.json b/frontend-modern/browser-verification/d89ec2be99dc920f.json
new file mode 100644
index 0000000000..53fc940237
--- /dev/null
+++ b/frontend-modern/browser-verification/d89ec2be99dc920f.json
@@ -0,0 +1,51 @@
+{
+ "version": 1,
+ "result": "passed",
+ "base_sha": "7e86161e06dfa04957d845331b221d7de29f49b0",
+ "changed_paths": [
+ "frontend-modern/src/components/Workloads/workloadTopology.ts"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/components/Workloads/workloadTopology.ts": "f6535409aba9cf8d5761e348e9e63ef355c2b5c5edecf0c0866ea98226af34ce"
+ },
+ "routes": [
+ "/proxmox?tab=workloads",
+ "/proxmox?tab=workloads&agent=node%7Clab%7Ceast-pve1",
+ "/proxmox?tab=workloads&agent=lab-east-pve1"
+ ],
+ "states": [
+ "Chromium desktop and WebKit phone; light/dark; synthetic legacy guest IDs through actual production useWorkloadsDerivedState and WorkloadsSurface/WorkloadPanel/GuestRow; not authenticated App or native backend proof.",
+ "Same tuple lab-east/pve1, native-a/native-c, offline/online, 8/64 GiB; native-a-101/VMID101, complete/incomplete fields; parent map null and actual host-memory row N/A.",
+ "Unique fallback restored after duplicate removal: 13% of 8 GiB/offline parent; independent node remains 3% of 32 GiB.",
+ "Distinct tuple groups, flat rows, Node filter/reload, missing parent, ambiguous removable bookmark."
+ ],
+ "interactions": [
+ "distinct tuple groups; each row uses its own node power and host-memory denominator",
+ "unique native IDs cannot restore a duplicate tuple: complete/missing instance/missing node/missing both fields; both inventory orders; actual row host memory is N/A",
+ "unique consistent incomplete guest fallback restores 8 GiB denominator and offline parent state without fabricating zero capacity",
+ "inventory order cannot change parent attribution or remount the canonical row",
+ "flat rows retain the same validated parent",
+ "real Node filter selects only its tuple and serialises an unambiguous bookmark",
+ "scoped bookmark survives reload through production URL sync",
+ "missing/duplicated parent withholds host share; exact-parent restoration restores it",
+ "ambiguous legacy bookmark stays a visible removable filter, not a first-node selection or inventory outage; clearing restores both rows",
+ "unambiguous existing node-name hint still selects its node",
+ "All sixteen final captures visually inspected; no horizontal overflow or page/console errors; API stubs only GET; browser/server cleanup observed."
+ ],
+ "viewports": [
+ {
+ "width": 1365,
+ "height": 900
+ },
+ {
+ "width": 390,
+ "height": 844
+ }
+ ],
+ "verified_at": "2026-10-09T22:00:10.608Z",
+ "playwright": "1.56.1",
+ "browser_versions": {
+ "desktop": "141.0.7390.37",
+ "phone": "26.0"
+ }
+}
diff --git a/frontend-modern/src/components/Workloads/__tests__/workloadTopology.ambiguousParent.test.ts b/frontend-modern/src/components/Workloads/__tests__/workloadTopology.ambiguousParent.test.ts
new file mode 100644
index 0000000000..450ca9e714
--- /dev/null
+++ b/frontend-modern/src/components/Workloads/__tests__/workloadTopology.ambiguousParent.test.ts
@@ -0,0 +1,85 @@
+import { describe, expect, it } from 'vitest';
+import type { Node } from '@/types/api';
+import type { WorkloadGuest } from '@/types/workloads';
+import { getCanonicalWorkloadId } from '@/utils/workloads';
+import {
+ buildGuestParentNodeMap,
+ buildNodeByInstance,
+ workloadNodeScopeId,
+} from '../workloadTopology';
+
+const node = (id: string, total: number, status: string): Node =>
+ ({ id, instance: 'lab-east', name: 'pve1', memory: { total }, status }) as Node;
+const first = node('native-a', 8 * 1024 ** 3, 'offline');
+const second = node('native-c', 64 * 1024 ** 3, 'online');
+const guest = (fields: Partial<WorkloadGuest> = {}): WorkloadGuest =>
+ ({
+ id: 'native-a-101',
+ vmid: 101,
+ instance: 'lab-east',
+ node: 'pve1',
+ type: 'qemu',
+ workloadType: 'vm',
+ platformScopes: ['proxmox-pve'],
+ ...fields,
+ }) as WorkloadGuest;
+const shapes: Array<{ label: string; fields: Partial<WorkloadGuest> }> = [
+ { label: 'complete fields', fields: {} },
+ { label: 'missing node', fields: { node: '' } },
+ { label: 'missing instance', fields: { instance: '' } },
+ { label: 'missing both', fields: { instance: '', node: '' } },
+ { label: 'whitespace fields', fields: { instance: ' ', node: '\t' } },
+ { label: 'absent fields', fields: { instance: undefined, node: undefined } },
+];
+
+describe('Workloads ambiguous parent fallback', () => {
+ for (const order of ['forward', 'reversed'] as const) {
+ const inventory = order === 'forward' ? [first, second] : [second, first];
+ describe(`${order} inventory`, () => {
+ it.each(
+ shapes.flatMap(({ label, fields }) =>
+ ['native-a-101', 'native-c-101'].flatMap((id) =>
+ ['qemu', 'lxc'].map((type) => ({ label, fields, id, type })),
+ ),
+ ),
+ )('cannot restore an ambiguous tuple: $label / $id / $type', ({ fields, id, type }) => {
+ const map = buildNodeByInstance(inventory);
+ expect(map[workloadNodeScopeId({ instance: 'lab-east', node: 'pve1' })]).toBeUndefined();
+ // Both IDs are unique; neither supplies evidence that the tuple is unique.
+ expect(map['native-a']).toBe(first);
+ expect(map['native-c']).toBe(second);
+ const row = guest({
+ ...fields,
+ id,
+ type,
+ workloadType: type === 'lxc' ? 'system-container' : 'vm',
+ });
+ expect(buildGuestParentNodeMap([row], map)[getCanonicalWorkloadId(row)]).toBeUndefined();
+ });
+
+ it.each(shapes)(
+ 'retains consistent fallback when the parent tuple is unique: $label',
+ ({ fields }) => {
+ const other = { ...second, instance: 'elsewhere' };
+ const unique = order === 'forward' ? [first, other] : [other, first];
+ const row = guest(fields);
+ expect(
+ buildGuestParentNodeMap([row], buildNodeByInstance(unique))[
+ getCanonicalWorkloadId(row)
+ ],
+ ).toBe(first);
+ },
+ );
+
+ it('does not revive a duplicate tuple after a third snapshot', () => {
+ const third = node('native-d', 16 * 1024 ** 3, 'online');
+ const row = guest({ instance: '', node: '', id: 'native-d-101' });
+ expect(
+ buildGuestParentNodeMap([row], buildNodeByInstance([...inventory, third]))[
+ getCanonicalWorkloadId(row)
+ ],
+ ).toBeUndefined();
+ });
+ });
+ }
+});
diff --git a/frontend-modern/src/components/Workloads/workloadTopology.ts b/frontend-modern/src/components/Workloads/workloadTopology.ts
index 6aa6b36423..48c2fd5fbd 100644
--- a/frontend-modern/src/components/Workloads/workloadTopology.ts
+++ b/frontend-modern/src/components/Workloads/workloadTopology.ts
@@ -219,6 +219,8 @@ export const buildGuestParentNodeMap = (
// Legacy IDs may supply an otherwise missing parent, but must not
// contradict source-owned instance/node fields or resolve an ID collision.
+ // A unique native ID is not evidence of a unique tuple: revalidate the
+ // candidate's tuple too, including when guest fields are incomplete.
if (guest.id) {
const lastDash = guest.id.lastIndexOf('-');
if (
@@ -231,6 +233,8 @@ export const buildGuestParentNodeMap = (
const candidate = nodeMap[nodeId];
if (
candidate &&
+ nodeMap[workloadNodeScopeId({ instance: candidate.instance, node: candidate.name })] ===
+ candidate &&
(!guest.instance?.trim() || guest.instance.trim() === candidate.instance?.trim()) &&
(!guest.node?.trim() || guest.node.trim() === candidate.name?.trim())
) {