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.

Model Proxmox cluster grouping in infrastructure settings

rcourtman83444d7510bc
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index bc0ea8ef8b..77b15067c0 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -228,6 +228,7 @@ an add-only capacity posture.
Those lifecycle-owned settings hooks may consume websocket state only through `frontend-modern/src/contexts/appRuntime.ts`; they must not import `frontend-modern/src/App.tsx` or recreate root-shell providers.
Discovery configuration is part of that same lifecycle-owned workspace boundary. `InfrastructureSourceManager.tsx` must open one canonical discovery editor through `InfrastructureDiscoverySettingsDialog.tsx`, `DiscoverySettingsForm.tsx`, and `discoverySettingsModel.ts`, while the System/Network shell stays limited to network-boundary controls instead of reintroducing a second editable discovery surface. That same workspace boundary now owns the add-flow entry split too: the landing strip opens the grouped `Add infrastructure` picker, while `Detect from address` remains a picker-owned utility route instead of a competing top-level header action.
The same lifecycle-owned workspace boundary now also owns attached-agent composition. When a unified Pulse Agent augments a first-class platform source such as Proxmox VE, the source manager and edit dialog must present one primary platform row with explicit `API` plus `Pulse Agent` composition rather than duplicating that same machine as a second peer row under a generic Pulse Agent platform bucket. Standalone hosts with no owning platform source remain grouped under a standalone-host owner bucket, with `Pulse Agent` shown as the collection method rather than as the pseudo-platform label.
+ When that primary Proxmox source is cluster-backed, the same workspace boundary must render the row under the canonical cluster moniker carried by the backend grouping contract rather than under one sibling node's hostname. Cluster-member node agents belong as augmentations on that owning Proxmox row, not as separate standalone-host peers.
That same lifecycle-owned workspace boundary also owns agent version
posture on infrastructure settings. The landing table stays compact and
should only raise row-level attention when an attached or standalone agent
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index f5c39df949..feb3046d59 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -420,9 +420,13 @@ the canonical monitored-system blocked payload.
source-oriented and backend-authored: one primary source row may carry
attached collection methods such as a linked Pulse Agent, but attached
methods must not be emitted as duplicate peer rows when backend ownership
- can prove they augment the same source. Agent-backed connections also own
- canonical version/update facts on that same payload: when a source or
- attachment is backed by Pulse Agent, `/api/connections` carries the
+ can prove they augment the same source. When the owning source is a
+ Proxmox cluster, that same backend-authored system payload must also
+ carry the canonical cluster identity so the frontend can label the row by
+ cluster moniker instead of by one endpoint node's hostname. Agent-backed
+ connections also own canonical version/update facts on that same payload:
+ when a source or attachment is backed by Pulse Agent, `/api/connections`
+ carries the
installed agent version, the current server-side target agent version when
it is meaningful, and whether an update is available, so settings surfaces
do not invent frontend-local version comparison rules.
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 940cde7608..4499c5cd10 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -323,7 +323,11 @@ work extends shared components instead of creating new local variants.
dialog for mutable sources, but pause, resume, remove, last-error detail,
and agent uninstall commands must live inside that owned edit surface or
the shared row-action owner rather than returning to inline landing-page
- action clutter or a revived provider-specific detail page.
+ action clutter or a revived provider-specific detail page. When the
+ backend marks a grouped Proxmox row with canonical cluster identity, the
+ table primitive must render that cluster moniker as the row title instead
+ of falling back to one sibling node hostname or reopening a standalone-host
+ presentation for cluster-member agents.
Phase 9 retired the
parallel reporting/inventory surface entirely:
`useInfrastructureReportingState`, `InfrastructureOperationsController`,
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index d43201a983..2ff07508b8 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -239,7 +239,10 @@ querying, and the operator-facing storage health presentation layer.
platform row is collecting additional host telemetry through Pulse Agent,
but they must not reinterpret attached agents as separate protected
systems, duplicate recovery inventory rows, or a storage-local ownership
- taxonomy. The same shared `/api/connections` payload also owns any
+ taxonomy. When that grouped platform row is a Proxmox cluster, storage and
+ recovery must also treat the backend-authored cluster moniker as the
+ canonical row identity instead of re-expanding cluster-member agents into
+ sibling host rows or per-node storage owners. The same shared `/api/connections` payload also owns any
agent-version/update facts carried alongside those grouped rows; adjacent
storage or recovery surfaces may reuse that signal for operator context,
but must not fork their own version-comparison semantics or another agent
diff --git a/frontend-modern/src/api/__tests__/connections.test.ts b/frontend-modern/src/api/__tests__/connections.test.ts
index 84aa621290..76a38d0b9b 100644
--- a/frontend-modern/src/api/__tests__/connections.test.ts
+++ b/frontend-modern/src/api/__tests__/connections.test.ts
@@ -1,5 +1,10 @@
import { describe, expect, it, vi, beforeEach } from 'vitest';
-import { ConnectionsAPI, type Connection, type ProbeResponse } from '../connections';
+import {
+ ConnectionsAPI,
+ type Connection,
+ type ConnectionSystem,
+ type ProbeResponse,
+} from '../connections';
import { apiFetchJSON } from '@/utils/apiClient';
vi.mock('@/utils/apiClient', () => ({
@@ -31,12 +36,20 @@ describe('ConnectionsAPI', () => {
capabilities: { supportsPause: true, supportsScope: true, supportsTest: true },
},
];
- mockedApiFetchJSON.mockResolvedValueOnce({ connections });
+ const systems: ConnectionSystem[] = [
+ {
+ id: 'pve-lab',
+ type: 'pve',
+ clusterName: 'homelab',
+ components: [{ connectionId: 'pve-lab', type: 'pve', role: 'primary' }],
+ },
+ ];
+ mockedApiFetchJSON.mockResolvedValueOnce({ connections, systems });
const result = await ConnectionsAPI.list();
expect(mockedApiFetchJSON).toHaveBeenCalledWith('/api/connections');
- expect(result).toEqual({ connections, systems: [] });
+ expect(result).toEqual({ connections, systems });
});
it('list() normalizes missing fields to empty collections', async () => {
diff --git a/frontend-modern/src/api/connections.ts b/frontend-modern/src/api/connections.ts
index 0cdb063fe9..f743f0fe90 100644
--- a/frontend-modern/src/api/connections.ts
+++ b/frontend-modern/src/api/connections.ts
@@ -62,6 +62,7 @@ export interface ConnectionSystemComponent {
export interface ConnectionSystem {
id: string;
type: ConnectionType;
+ clusterName?: string;
components: ConnectionSystemComponent[];
}
diff --git a/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx b/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx
index 0d4cacc0df..e7c80de78e 100644
--- a/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx
+++ b/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx
@@ -11,7 +11,7 @@ import { ConnectionEditor } from './ConnectionEditor/ConnectionEditor';
import { NodeCredentialSlot } from './ConnectionEditor/CredentialSlots/NodeCredentialSlot';
import { TrueNASCredentialSlot } from './ConnectionEditor/CredentialSlots/TrueNASCredentialSlot';
import { VMwareCredentialSlot } from './ConnectionEditor/CredentialSlots/VMwareCredentialSlot';
-import type { Connection, ConnectionType } from '@/api/connections';
+import type { Connection, ConnectionType, ProbeCandidate } from '@/api/connections';
import type { TrueNASConnection } from '@/api/truenas';
import type { VMwareConnection } from '@/api/vmware';
import type { NodeConfig, NodeConfigWithStatus } from '@/types/nodes';
@@ -104,6 +104,9 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
const [showDiscoverySettings, setShowDiscoverySettings] = createSignal(false);
const [selectedDiscoveredSource, setSelectedDiscoveredSource] =
createSignal<DiscoveredServer | null>(null);
+ const [selectedProbeCandidate, setSelectedProbeCandidate] = createSignal<ProbeCandidate | null>(
+ null,
+ );
const readOnly = createMemo(() => presentationPolicyIsReadOnly());
const routeStep = createMemo<InfrastructurePanelStep | null>(() => {
if (readOnly()) return null;
@@ -180,12 +183,24 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
const openAddFlow = (step: InfrastructurePanelStep) => {
setSelectedDiscoveredSource(null);
+ setSelectedProbeCandidate(null);
if (!addFlowTracker()) {
setAddFlowTracker(createOpenedOnboardingTracker());
}
navigate(buildInfrastructureOnboardingPath(step), { scroll: false });
};
+ const openAddFlowFromProbe = (candidate: ProbeCandidate) => {
+ setSelectedDiscoveredSource(null);
+ setSelectedProbeCandidate(candidate);
+ if (!addFlowTracker()) {
+ setAddFlowTracker(createOpenedOnboardingTracker());
+ }
+ navigate(buildInfrastructureOnboardingPath(candidate.type as ManagedAddTypeStep), {
+ scroll: false,
+ });
+ };
+
const reviewDiscoveredSource = (server: DiscoveredServer) => {
if (!addFlowTracker()) {
setAddFlowTracker(createOpenedOnboardingTracker());
@@ -197,6 +212,7 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
const closeAddFlow = () => {
resetInlineEditorState();
setSelectedDiscoveredSource(null);
+ setSelectedProbeCandidate(null);
setAddFlowTracker(null);
clearSharedInfrastructureOnboardingMetricsTracker();
navigateToWorkspace(Boolean(routeStep()));
@@ -360,7 +376,7 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
Pulse Agent
</div>
<div class="text-lg font-semibold text-base-content">{connection.name}</div>
- <Show when={connection.address}>
+ <Show when={connection.address && connection.address !== connection.name}>
<div class="break-words text-sm text-muted">{connection.address}</div>
</Show>
</div>
@@ -533,7 +549,7 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
<div class="flex flex-wrap items-start justify-between gap-4">
<div class="space-y-1">
<div class="text-sm font-medium text-base-content">{connection.name}</div>
- <Show when={connection.address}>
+ <Show when={connection.address && connection.address !== connection.name}>
<div class="break-words text-xs text-muted">{connection.address}</div>
</Show>
<Show when={versionPresentation()}>
@@ -707,15 +723,32 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
const discoveredPrefill = () => {
const discovered = selectedDiscoveredSource();
- if (!discovered || discovered.type !== context.type) {
- return undefined;
+ if (discovered && discovered.type === context.type) {
+ return {
+ type: discovered.type,
+ name: discovered.hostname?.trim() || discovered.ip,
+ host: `https://${discovered.hostname?.trim() || discovered.ip}:${discovered.port}`,
+ } satisfies Partial<NodeConfig>;
}
- return {
- type: discovered.type,
- name: discovered.hostname?.trim() || discovered.ip,
- host: `https://${discovered.hostname?.trim() || discovered.ip}:${discovered.port}`,
- } satisfies Partial<NodeConfig>;
+ const probed = selectedProbeCandidate();
+ if (probed && probed.type === context.type) {
+ const url = (() => {
+ try {
+ return new URL(probed.host);
+ } catch {
+ return null;
+ }
+ })();
+ const derivedName = url?.hostname || probed.host.replace(/^https?:\/\//, '').split(':')[0];
+ return {
+ type: probed.type as NodeConfig['type'],
+ name: derivedName,
+ host: probed.host,
+ } satisfies Partial<NodeConfig>;
+ }
+
+ return undefined;
};
switch (context.type) {
@@ -770,6 +803,10 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
const endpoint = `https://${discovered.hostname?.trim() || discovered.ip}:${discovered.port}`;
return `Pulse discovered ${endpoint}. Review the endpoint, finish the credentials, and then save it as a monitored source.`;
}
+ const probed = selectedProbeCandidate();
+ if (probed && probed.type === activeAddType()) {
+ return `Pulse detected ${probed.host}. Review the endpoint, finish the credentials, and then save it as a monitored source.`;
+ }
const presentation = getInfrastructureOnboardingProductPresentation(
activeAddType() as InfrastructureOnboardingConnectionType,
);
@@ -777,9 +814,9 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
});
const editDialogTitle = createMemo(() => {
- const connection = editingConnection();
- if (!connection) return 'Edit source';
- return `Edit ${connection.name}`;
+ const row = editingRow();
+ if (!row) return 'Edit source';
+ return `Edit ${row.name}`;
});
const editDialogDescription = createMemo(() => {
@@ -805,6 +842,7 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
? undefined
: (type) => openAddFlow(type === 'agent' ? 'agent' : (type as ManagedAddTypeStep))
}
+ onAddInfrastructure={readOnly() ? undefined : () => openAddFlow('pick')}
onRunDiscovery={
readOnly()
? undefined
@@ -882,6 +920,8 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
mode="add"
onboardingMetricsTracker={addFlowTracker()}
onBackToCatalog={() => openAddFlow('pick')}
+ onSelectAgentRoute={() => openAddFlow('agent')}
+ onSelectCandidate={openAddFlowFromProbe}
onClose={closeAddFlow}
onSaved={handleAddSaved}
renderCredentialSlot={({ type, onCancel, onSaved }) =>
@@ -894,11 +934,15 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
<ConnectionEditor
mode="add"
initialType={activeAddType() ?? undefined}
+ initialCandidate={selectedProbeCandidate()}
showSlotHeader={false}
trackInitialCatalogSelection={
- activeAddType() !== 'agent' && !selectedDiscoveredSource()
+ activeAddType() !== 'agent' &&
+ !selectedDiscoveredSource() &&
+ !selectedProbeCandidate()
}
onboardingMetricsTracker={addFlowTracker()}
+ onBackToCatalog={() => openAddFlow('pick')}
onClose={closeAddFlow}
onSaved={handleAddSaved}
renderCredentialSlot={({ type, onCancel, onSaved }) =>
diff --git a/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx b/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx
index 5723567820..710842eea4 100644
--- a/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx
@@ -70,6 +70,7 @@ vi.mock('../useConnectionsLedger', () => ({
ownerType: connection.type,
name: connection.name || connection.id,
subtitle: connection.type === 'agent' ? 'via Pulse Agent' : 'via platform API',
+ source: connection.type === 'agent' ? 'agent' : 'api',
host: connection.address,
coverageLabels: ['VMs'],
statusLabel: connection.state === 'paused' ? 'Paused' : 'Active',
@@ -240,11 +241,12 @@ describe('InfrastructureWorkspace', () => {
expect(screen.getByRole('button', { name: /Run discovery/i })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /Discovery settings/i })).toBeInTheDocument();
expect(screen.queryByRole('button', { name: /Detect from address/i })).toBeNull();
- expect(screen.getByText('VMware vCenter')).toBeInTheDocument();
- expect(screen.getByText('TrueNAS SCALE')).toBeInTheDocument();
expect(screen.getByText('Proxmox VE')).toBeInTheDocument();
- expect(screen.getByText('Standalone hosts')).toBeInTheDocument();
+ expect(screen.queryByText('VMware vCenter')).toBeNull();
+ expect(screen.queryByText('TrueNAS SCALE')).toBeNull();
+ expect(screen.queryByText('Standalone hosts')).toBeNull();
expect(screen.getByRole('button', { name: /Add Proxmox VE/i })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: /^Add infrastructure$/i })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /Edit/i })).toBeInTheDocument();
expect(screen.queryByRole('heading', { name: 'Monitored systems' })).not.toBeInTheDocument();
});
@@ -267,9 +269,6 @@ describe('InfrastructureWorkspace', () => {
await waitFor(() => expect(screen.getByText('discovered-pve.lab')).toBeInTheDocument());
expect(screen.getByText('Discovered')).toBeInTheDocument();
- expect(screen.getByText(/Automatic discovery off/i)).toBeInTheDocument();
- expect(screen.getByText(/1 candidate/i)).toBeInTheDocument();
- expect(screen.getByText(/Updated /i)).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: /Run discovery/i }));
expect(triggerDiscoveryScan).toHaveBeenCalledTimes(1);
@@ -289,15 +288,25 @@ describe('InfrastructureWorkspace', () => {
it('opens a type-specific add route from the matching platform section', () => {
renderWorkspace();
- fireEvent.click(screen.getByRole('button', { name: /Add TrueNAS SCALE/i }));
+ fireEvent.click(screen.getByRole('button', { name: /Add Proxmox VE/i }));
- expect(navigateSpy).toHaveBeenCalledWith('/settings/infrastructure?add=truenas', {
+ expect(navigateSpy).toHaveBeenCalledWith('/settings/infrastructure?add=pve', {
scroll: false,
});
expect(createInfrastructureOnboardingMetricsTrackerMock).toHaveBeenCalledTimes(1);
expect(onboardingMetricsTrackers[0]?.recordOpened).toHaveBeenCalledTimes(1);
});
+ it('opens the platform picker from the Add infrastructure footer button', () => {
+ renderWorkspace();
+
+ fireEvent.click(screen.getByRole('button', { name: /^Add infrastructure$/i }));
+
+ expect(navigateSpy).toHaveBeenCalledWith('/settings/infrastructure?add=pick', {
+ scroll: false,
+ });
+ });
+
it('renders the route-backed picker dialog when the pick query is present', async () => {
routeState.search = '?add=pick';
renderWorkspace();
@@ -306,7 +315,6 @@ describe('InfrastructureWorkspace', () => {
const dialog = screen.getByRole('dialog');
expect(screen.getAllByText('Add infrastructure').length).toBeGreaterThan(0);
expect(screen.getByText('Choose the source type you want to add.')).toBeInTheDocument();
- expect(within(dialog).getByText('Choose a source type')).toBeInTheDocument();
expect(within(dialog).getByRole('button', { name: 'Detect from address' })).toBeInTheDocument();
expect(within(dialog).getByText('Virtualization')).toBeInTheDocument();
expect(within(dialog).getByRole('button', { name: /TrueNAS SCALE/i })).toBeInTheDocument();
@@ -351,7 +359,6 @@ describe('InfrastructureWorkspace', () => {
'Probe an address and let Pulse open the matching credential flow when it recognizes the platform.',
),
).toBeInTheDocument();
- expect(screen.getAllByText('Detect from address').length).toBeGreaterThan(0);
expect(
within(screen.getByRole('dialog')).getByRole('button', { name: /Back to source types/i }),
).toBeInTheDocument();
@@ -417,6 +424,7 @@ describe('InfrastructureWorkspace', () => {
ownerType: 'pve',
name: primaryConnection.name || primaryConnection.id,
subtitle: 'via platform API and Pulse Agent',
+ source: 'both',
host: primaryConnection.address,
coverageLabels: ['VMs', 'Host telemetry'],
statusLabel: 'Active',
@@ -451,6 +459,61 @@ describe('InfrastructureWorkspace', () => {
expect(screen.getByRole('button', { name: /Copy uninstall command/i })).toBeInTheDocument();
});
+ it('renders Proxmox cluster rows under the cluster moniker instead of a sibling standalone host row', async () => {
+ const primaryConnection = connectionFixture();
+ const dellyAgent = connectionFixture({
+ id: 'agent:agent-delly',
+ type: 'agent',
+ name: 'delly',
+ address: 'delly',
+ surfaces: ['host'],
+ scope: { host: true },
+ source: 'agent',
+ capabilities: { supportsPause: false, supportsScope: false, supportsTest: false },
+ });
+ const minipcAgent = connectionFixture({
+ id: 'agent:agent-minipc',
+ type: 'agent',
+ name: 'minipc',
+ address: 'minipc',
+ surfaces: ['host'],
+ scope: { host: true },
+ source: 'agent',
+ capabilities: { supportsPause: false, supportsScope: false, supportsTest: false },
+ });
+
+ connectionState.connections = [primaryConnection, dellyAgent, minipcAgent];
+ connectionState.rows = [
+ {
+ id: primaryConnection.id,
+ ownerType: 'pve',
+ name: 'homelab',
+ subtitle: 'via platform API and Pulse Agent',
+ source: 'both',
+ host: primaryConnection.address,
+ coverageLabels: ['VMs', 'Containers', 'Storage', 'Backups', 'Host telemetry'],
+ statusLabel: 'Active',
+ statusClassName: 'bg-green-100 text-green-800',
+ agentUpdateCount: 0,
+ lastActivityText: '1m ago',
+ enabled: true,
+ canEdit: true,
+ canPause: true,
+ canRemove: true,
+ isAgent: false,
+ attachedConnections: [dellyAgent, minipcAgent],
+ connection: primaryConnection,
+ },
+ ];
+
+ renderWorkspace();
+
+ await waitFor(() => expect(screen.getByText('homelab')).toBeInTheDocument());
+ expect(screen.getByText('API + Agent')).toBeInTheDocument();
+ expect(screen.queryByText('Standalone hosts')).toBeNull();
+ expect(screen.queryByText(/^minipc$/)).toBeNull();
+ });
+
it('hides the add flow and source-manager actions in read-only mode', () => {
presentationPolicyIsReadOnlyMock.mockReturnValue(true);
routeState.search = '?add=agent';
diff --git a/frontend-modern/src/components/Settings/__tests__/useConnectionsLedger.test.ts b/frontend-modern/src/components/Settings/__tests__/useConnectionsLedger.test.ts
new file mode 100644
index 0000000000..4d2ae7f6d1
--- /dev/null
+++ b/frontend-modern/src/components/Settings/__tests__/useConnectionsLedger.test.ts
@@ -0,0 +1,88 @@
+import { renderHook, waitFor } from '@solidjs/testing-library';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import { ConnectionsAPI, type Connection, type ConnectionSystem } from '@/api/connections';
+import { useConnectionsLedger } from '../useConnectionsLedger';
+
+describe('useConnectionsLedger', () => {
+ afterEach(() => {
+ vi.restoreAllMocks();
+ });
+
+ it('renders a Proxmox cluster row from the canonical system metadata', async () => {
+ const connections: Connection[] = [
+ {
+ id: 'pve:delly',
+ type: 'pve',
+ name: 'delly',
+ address: 'https://delly:8006',
+ state: 'active',
+ stateReason: '',
+ enabled: true,
+ surfaces: ['vms', 'containers', 'storage', 'backups'],
+ scope: { vms: true, containers: true, storage: true, backups: true },
+ lastSeen: '2026-04-23T12:00:00Z',
+ lastError: null,
+ source: 'agent',
+ capabilities: { supportsPause: true, supportsScope: true, supportsTest: true },
+ },
+ {
+ id: 'agent:agent-delly',
+ type: 'agent',
+ name: 'delly',
+ address: 'delly',
+ state: 'active',
+ stateReason: '',
+ enabled: true,
+ surfaces: ['host'],
+ scope: { host: true },
+ lastSeen: '2026-04-23T12:00:00Z',
+ lastError: null,
+ source: 'agent',
+ capabilities: { supportsPause: false, supportsScope: false, supportsTest: false },
+ },
+ {
+ id: 'agent:agent-minipc',
+ type: 'agent',
+ name: 'minipc',
+ address: 'minipc',
+ state: 'active',
+ stateReason: '',
+ enabled: true,
+ surfaces: ['host'],
+ scope: { host: true },
+ lastSeen: '2026-04-23T12:00:00Z',
+ lastError: null,
+ source: 'agent',
+ capabilities: { supportsPause: false, supportsScope: false, supportsTest: false },
+ },
+ ];
+ const systems: ConnectionSystem[] = [
+ {
+ id: 'pve:delly',
+ type: 'pve',
+ clusterName: 'homelab',
+ components: [
+ { connectionId: 'pve:delly', type: 'pve', role: 'primary' },
+ { connectionId: 'agent:agent-delly', type: 'agent', role: 'attachment' },
+ { connectionId: 'agent:agent-minipc', type: 'agent', role: 'attachment' },
+ ],
+ },
+ ];
+ vi.spyOn(ConnectionsAPI, 'list').mockResolvedValue({ connections, systems });
+
+ const { result } = renderHook(() => useConnectionsLedger());
+
+ await waitFor(() => expect(result.rows()).toHaveLength(1));
+ expect(result.rows()[0]).toMatchObject({
+ id: 'pve:delly',
+ ownerType: 'pve',
+ name: 'homelab',
+ source: 'both',
+ host: 'https://delly:8006',
+ });
+ expect(result.rows()[0].attachedConnections.map((connection) => connection.id)).toEqual([
+ 'agent:agent-delly',
+ 'agent:agent-minipc',
+ ]);
+ });
+});
diff --git a/frontend-modern/src/components/Settings/useConnectionsLedger.ts b/frontend-modern/src/components/Settings/useConnectionsLedger.ts
index 63107a40f0..5ff1652375 100644
--- a/frontend-modern/src/components/Settings/useConnectionsLedger.ts
+++ b/frontend-modern/src/components/Settings/useConnectionsLedger.ts
@@ -6,7 +6,14 @@ import {
type ConnectionSystem,
type ConnectionType,
} from '@/api/connections';
-import { connectionLastActivityText, type InfrastructureSystemRow } from './connectionsTableModel';
+import {
+ connectionLastActivityText,
+ surfaceLabel,
+ type InfrastructureSourceKind,
+ type InfrastructureSystemRow,
+} from './connectionsTableModel';
+
+export { surfaceLabel };
const POLL_INTERVAL_MS = 15000;
@@ -48,29 +55,6 @@ const STATE_PRESENTATION: Record<ConnectionState, { label: string; badgeClass: s
},
};
-const SURFACE_LABELS: Record<string, string> = {
- vms: 'VMs',
- containers: 'Containers',
- storage: 'Storage',
- backups: 'Backups',
- datastores: 'Datastores',
- syncJobs: 'Sync jobs',
- verifyJobs: 'Verify jobs',
- pruneJobs: 'Prune jobs',
- garbageJobs: 'GC jobs',
- mailStats: 'Mail stats',
- queues: 'Queues',
- quarantine: 'Quarantine',
- domainStats: 'Domain stats',
- host: 'Host telemetry',
- hosts: 'Hosts',
- datasets: 'Datasets',
- pools: 'Pools',
- replication: 'Replication',
-};
-
-export const surfaceLabel = (key: string): string => SURFACE_LABELS[key] ?? key;
-
const PLATFORM_API_TYPES: ReadonlySet<ConnectionType> = new Set([
'pve',
'pbs',
@@ -124,6 +108,15 @@ const subtitleFor = (connections: readonly Connection[], primaryConnection: Conn
return `via ${productLabel}`;
};
+const sourceFor = (connections: readonly Connection[]): InfrastructureSourceKind => {
+ const hasPlatformAPI = connections.some((connection) => PLATFORM_API_TYPES.has(connection.type));
+ const hasPulseAgent = connections.some((connection) => connection.type === 'agent');
+ if (hasPlatformAPI && hasPulseAgent) return 'both';
+ if (hasPlatformAPI) return 'api';
+ if (hasPulseAgent) return 'agent';
+ return 'unknown';
+};
+
const agentUpdateCountFor = (connections: readonly Connection[]): number =>
connections.filter(
(connection) => connection.type === 'agent' && Boolean(connection.agentUpdateAvailable),
@@ -133,9 +126,14 @@ const buildRow = (
ownerType: ConnectionType,
primaryConnection: Connection,
componentConnections: readonly Connection[],
+ system?: ConnectionSystem | null,
): InfrastructureSystemRow => {
const presentation = STATE_PRESENTATION[primaryConnection.state] ?? STATE_PRESENTATION.pending;
- const name = primaryConnection.name || primaryConnection.address || primaryConnection.id;
+ const clusterName = system?.clusterName?.trim();
+ const name =
+ ownerType === 'pve' && clusterName
+ ? clusterName
+ : primaryConnection.name || primaryConnection.address || primaryConnection.id;
const host =
primaryConnection.address && primaryConnection.address !== name
? primaryConnection.address
@@ -152,6 +150,7 @@ const buildRow = (
ownerType,
name,
subtitle: subtitleFor(componentConnections, primaryConnection),
+ source: sourceFor(componentConnections),
host,
coverageLabels: coverageLabelsFor(componentConnections),
statusLabel: presentation.label,
@@ -170,7 +169,7 @@ const buildRow = (
};
export const connectionToRow = (connection: Connection): InfrastructureSystemRow =>
- buildRow(connection.type, connection, [connection]);
+ buildRow(connection.type, connection, [connection], null);
const systemToRow = (
system: ConnectionSystem,
@@ -187,7 +186,7 @@ const systemToRow = (
componentConnections.push(primaryConnection);
}
- return buildRow(system.type, primaryConnection, componentConnections);
+ return buildRow(system.type, primaryConnection, componentConnections, system);
};
export interface ConnectionsLedger {
diff --git a/internal/api/connections_grouping.go b/internal/api/connections_grouping.go
index 272c691993..245aac1b6a 100644
--- a/internal/api/connections_grouping.go
+++ b/internal/api/connections_grouping.go
@@ -11,10 +11,11 @@ import (
)
type connectionSystemGroup struct {
- id string
- typ ConnectionType
- name string
- components map[string]ConnectionSystemComponent
+ id string
+ typ ConnectionType
+ name string
+ clusterName string
+ components map[string]ConnectionSystemComponent
}
func buildConnectionSystems(
@@ -30,6 +31,7 @@ func buildConnectionSystems(
connectionByID[connection.ID] = connection
}
+ clusterNames := buildProxmoxClusterNames(connectionByID, monitor)
hostIndex := buildConnectionHostIndex(connections)
agentAttachments := resolveAgentAttachments(connectionByID, hostIndex, monitor)
@@ -39,11 +41,17 @@ func buildConnectionSystems(
if group != nil {
return group
}
+ clusterName := strings.TrimSpace(clusterNames[primary.ID])
+ sortName := strings.ToLower(primary.Name)
+ if clusterName != "" {
+ sortName = strings.ToLower(clusterName)
+ }
group = &connectionSystemGroup{
- id: primary.ID,
- typ: primary.Type,
- name: strings.ToLower(primary.Name),
- components: make(map[string]ConnectionSystemComponent, 2),
+ id: primary.ID,
+ typ: primary.Type,
+ name: sortName,
+ clusterName: clusterName,
+ components: make(map[string]ConnectionSystemComponent, 2),
}
group.components[primary.ID] = ConnectionSystemComponent{
ConnectionID: primary.ID,
@@ -91,9 +99,10 @@ func buildConnectionSystems(
return components[i].ConnectionID < components[j].ConnectionID
})
out = append(out, ConnectionSystem{
- ID: group.id,
- Type: group.typ,
- Components: components,
+ ID: group.id,
+ Type: group.typ,
+ ClusterName: group.clusterName,
+ Components: components,
})
}
@@ -133,19 +142,23 @@ func resolveAgentAttachments(
return attachments
}
- register := func(agentID, primaryID string, allowOverride bool) {
+ register := func(agentID, primaryID string, allowOverride, allowClusterAttach bool) {
agentID = strings.TrimSpace(agentID)
primaryID = strings.TrimSpace(primaryID)
if agentID == "" || primaryID == "" || agentID == primaryID {
return
}
- if _, ok := connectionByID[agentID]; !ok {
+ agent, ok := connectionByID[agentID]
+ if !ok {
return
}
primary, ok := connectionByID[primaryID]
if !ok || primary.Type == ConnectionTypeAgent {
return
}
+ if !allowClusterAttach && !connectionsShareHost(agent, primary) {
+ return
+ }
existing, exists := attachments[agentID]
if !exists || existing == "" {
@@ -166,7 +179,12 @@ func resolveAgentAttachments(
if strings.TrimSpace(node.LinkedAgentID) == "" || strings.TrimSpace(node.Instance) == "" {
continue
}
- register("agent:"+strings.TrimSpace(node.LinkedAgentID), "pve:"+strings.TrimSpace(node.Instance), false)
+ register(
+ "agent:"+strings.TrimSpace(node.LinkedAgentID),
+ "pve:"+strings.TrimSpace(node.Instance),
+ false,
+ true,
+ )
}
resources, _ := monitor.UnifiedResourceSnapshot()
@@ -182,7 +200,9 @@ func resolveAgentAttachments(
continue
}
if primaryID := primaryConnectionIDForResource(resource, hostIndex); primaryID != "" {
- register(agentID, primaryID, false)
+ allowClusterAttach := resource.Proxmox != nil &&
+ strings.TrimSpace(resource.Agent.LinkedNodeID) != ""
+ register(agentID, primaryID, false, allowClusterAttach)
}
}
@@ -195,6 +215,49 @@ func resolveAgentAttachments(
return attachments
}
+func buildProxmoxClusterNames(
+ connectionByID map[string]Connection,
+ monitor *monitoring.Monitor,
+) map[string]string {
+ clusterNames := make(map[string]string)
+ if monitor == nil {
+ return clusterNames
+ }
+
+ record := func(primaryID, clusterName string) {
+ primaryID = strings.TrimSpace(primaryID)
+ clusterName = strings.TrimSpace(clusterName)
+ if primaryID == "" || clusterName == "" {
+ return
+ }
+ primary, ok := connectionByID[primaryID]
+ if !ok || primary.Type != ConnectionTypePVE {
+ return
+ }
+ if _, exists := clusterNames[primaryID]; exists {
+ return
+ }
+ clusterNames[primaryID] = clusterName
+ }
+
+ for _, node := range monitor.NodesSnapshot() {
+ if !node.IsClusterMember {
+ continue
+ }
+ record("pve:"+strings.TrimSpace(node.Instance), node.ClusterName)
+ }
+
+ resources, _ := monitor.UnifiedResourceSnapshot()
+ for _, resource := range resources {
+ if resource.Proxmox == nil || !resource.Proxmox.IsClusterMember {
+ continue
+ }
+ record("pve:"+strings.TrimSpace(resource.Proxmox.Instance), resource.Proxmox.ClusterName)
+ }
+
+ return clusterNames
+}
+
type connectionHostIndex struct {
byType map[ConnectionType]map[string][]string
}
@@ -277,6 +340,53 @@ func normalizedConnectionHost(connection Connection) string {
return ""
}
+// connectionHostCandidates returns every distinct normalized host string a
+// connection could be reached as. Connections frequently carry both a name
+// (often a hostname) and an address (often a URL or IP), and we want any
+// overlap to count as "same host" for grouping purposes.
+func connectionHostCandidates(connection Connection) []string {
+ seen := make(map[string]struct{}, 2)
+ out := make([]string, 0, 2)
+ for _, candidate := range []string{connection.Address, connection.Name} {
+ normalized := normalizeHost(candidate)
+ if normalized == "" {
+ continue
+ }
+ if _, ok := seen[normalized]; ok {
+ continue
+ }
+ seen[normalized] = struct{}{}
+ out = append(out, normalized)
+ }
+ return out
+}
+
+// connectionsShareHost reports whether two connections appear to point at the
+// same physical host. Used to gate agent→primary attachment so that sibling
+// cluster members (e.g. a separate Proxmox node sharing the cluster API
+// connection) stay visible as their own systems instead of being absorbed
+// into the connection's primary row.
+func connectionsShareHost(a, b Connection) bool {
+ aHosts := connectionHostCandidates(a)
+ if len(aHosts) == 0 {
+ return false
+ }
+ bHosts := connectionHostCandidates(b)
+ if len(bHosts) == 0 {
+ return false
+ }
+ bSet := make(map[string]struct{}, len(bHosts))
+ for _, host := range bHosts {
+ bSet[host] = struct{}{}
+ }
+ for _, host := range aHosts {
+ if _, ok := bSet[host]; ok {
+ return true
+ }
+ }
+ return false
+}
+
func normalizeHost(raw string) string {
value := strings.TrimSpace(raw)
if value == "" {
diff --git a/internal/api/connections_grouping_test.go b/internal/api/connections_grouping_test.go
index 292e36fee3..0a794a8e1b 100644
--- a/internal/api/connections_grouping_test.go
+++ b/internal/api/connections_grouping_test.go
@@ -99,3 +99,238 @@ func TestBuildConnectionSystems_AttachesMergedAgentToOwningProxmoxSource(t *test
t.Fatalf("unexpected attachment component: %+v", system.Components[1])
}
}
+
+func TestBuildConnectionSystems_ClusterMemberAgentsAttachToOwningProxmoxSystem(t *testing.T) {
+ cfg := &config.Config{DataPath: t.TempDir()}
+ monitor, err := monitoring.New(cfg)
+ if err != nil {
+ t.Fatalf("monitoring.New: %v", err)
+ }
+ t.Cleanup(func() { monitor.Stop() })
+
+ now := time.Date(2026, 4, 23, 12, 0, 0, 0, time.UTC)
+ adapter := unified.NewMonitorAdapter(nil)
+ adapter.PopulateSupplementalRecords(unified.SourceProxmox, []unified.IngestRecord{
+ {
+ SourceID: "node-delly",
+ Resource: unified.Resource{
+ ID: "resource-node-delly",
+ Type: unified.ResourceTypeAgent,
+ Name: "delly",
+ Status: unified.StatusOnline,
+ LastSeen: now,
+ Sources: []unified.DataSource{unified.SourceProxmox, unified.SourceAgent},
+ Identity: unified.ResourceIdentity{
+ MachineID: "machine-delly",
+ Hostnames: []string{"delly"},
+ },
+ Proxmox: &unified.ProxmoxData{
+ Instance: "delly",
+ NodeName: "delly",
+ ClusterName: "homelab",
+ IsClusterMember: true,
+ LinkedAgentID: "agent-delly",
+ },
+ Agent: &unified.AgentData{
+ AgentID: "agent-delly",
+ Hostname: "delly",
+ MachineID: "machine-delly",
+ LinkedNodeID: "node-delly",
+ },
+ },
+ },
+ {
+ SourceID: "node-minipc",
+ Resource: unified.Resource{
+ ID: "resource-node-minipc",
+ Type: unified.ResourceTypeAgent,
+ Name: "minipc",
+ Status: unified.StatusOnline,
+ LastSeen: now,
+ Sources: []unified.DataSource{unified.SourceProxmox, unified.SourceAgent},
+ Identity: unified.ResourceIdentity{
+ MachineID: "machine-minipc",
+ Hostnames: []string{"minipc"},
+ },
+ Proxmox: &unified.ProxmoxData{
+ Instance: "delly",
+ NodeName: "minipc",
+ ClusterName: "homelab",
+ IsClusterMember: true,
+ LinkedAgentID: "agent-minipc",
+ },
+ Agent: &unified.AgentData{
+ AgentID: "agent-minipc",
+ Hostname: "minipc",
+ MachineID: "machine-minipc",
+ LinkedNodeID: "node-minipc",
+ },
+ },
+ },
+ })
+ setTestUnexportedField(t, monitor, "resourceStore", monitoring.ResourceStoreInterface(adapter))
+
+ connections := []Connection{
+ {
+ ID: "pve:delly",
+ Type: ConnectionTypePVE,
+ Name: "delly",
+ Address: "https://delly:8006",
+ State: ConnectionStateActive,
+ Enabled: true,
+ Surfaces: []string{"vms", "containers", "storage", "backups"},
+ Scope: map[string]bool{"vms": true, "containers": true, "storage": true, "backups": true},
+ Source: ConnectionSourceAgent,
+ Capabilities: ConnectionCapabilities{SupportsPause: true, SupportsScope: true, SupportsTest: true},
+ },
+ {
+ ID: "agent:agent-delly",
+ Type: ConnectionTypeAgent,
+ Name: "delly",
+ Address: "delly",
+ State: ConnectionStateActive,
+ Enabled: true,
+ Surfaces: []string{"host"},
+ Scope: map[string]bool{"host": true},
+ LastSeen: &now,
+ Source: ConnectionSourceAgent,
+ Capabilities: ConnectionCapabilities{SupportsPause: false, SupportsScope: false, SupportsTest: false},
+ },
+ {
+ ID: "agent:agent-minipc",
+ Type: ConnectionTypeAgent,
+ Name: "minipc",
+ Address: "minipc",
+ State: ConnectionStateActive,
+ Enabled: true,
+ Surfaces: []string{"host"},
+ Scope: map[string]bool{"host": true},
+ LastSeen: &now,
+ Source: ConnectionSourceAgent,
+ Capabilities: ConnectionCapabilities{SupportsPause: false, SupportsScope: false, SupportsTest: false},
+ },
+ }
+
+ systems := buildConnectionSystems(connections, monitor)
+ if len(systems) != 1 {
+ t.Fatalf("expected 1 grouped cluster system, got %d (%+v)", len(systems), systems)
+ }
+
+ system := systems[0]
+ if system.ID != "pve:delly" {
+ t.Fatalf("system id = %q, want %q", system.ID, "pve:delly")
+ }
+ if system.Type != ConnectionTypePVE {
+ t.Fatalf("system type = %q, want %q", system.Type, ConnectionTypePVE)
+ }
+ if system.ClusterName != "homelab" {
+ t.Fatalf("system clusterName = %q, want %q", system.ClusterName, "homelab")
+ }
+ if len(system.Components) != 3 {
+ t.Fatalf("expected 3 system components, got %+v", system.Components)
+ }
+
+ componentRoles := make(map[string]ConnectionSystemComponentRole, len(system.Components))
+ for _, component := range system.Components {
+ componentRoles[component.ConnectionID] = component.Role
+ }
+ if componentRoles["pve:delly"] != ConnectionSystemComponentRolePrimary {
+ t.Fatalf("pve:delly role = %q, want %q", componentRoles["pve:delly"], ConnectionSystemComponentRolePrimary)
+ }
+ if componentRoles["agent:agent-delly"] != ConnectionSystemComponentRoleAttachment {
+ t.Fatalf("agent:agent-delly role = %q, want %q", componentRoles["agent:agent-delly"], ConnectionSystemComponentRoleAttachment)
+ }
+ if componentRoles["agent:agent-minipc"] != ConnectionSystemComponentRoleAttachment {
+ t.Fatalf("agent:agent-minipc role = %q, want %q", componentRoles["agent:agent-minipc"], ConnectionSystemComponentRoleAttachment)
+ }
+}
+
+func TestBuildConnectionSystems_GuestAgentStaysStandaloneWhenOnlyClusterInstanceMatches(t *testing.T) {
+ cfg := &config.Config{DataPath: t.TempDir()}
+ monitor, err := monitoring.New(cfg)
+ if err != nil {
+ t.Fatalf("monitoring.New: %v", err)
+ }
+ t.Cleanup(func() { monitor.Stop() })
+
+ now := time.Date(2026, 4, 23, 12, 0, 0, 0, time.UTC)
+ adapter := unified.NewMonitorAdapter(nil)
+ adapter.PopulateSupplementalRecords(unified.SourceProxmox, []unified.IngestRecord{
+ {
+ SourceID: "guest-100",
+ Resource: unified.Resource{
+ ID: "resource-guest-100",
+ Type: unified.ResourceTypeAgent,
+ Name: "docker-vm",
+ Status: unified.StatusOnline,
+ LastSeen: now,
+ Sources: []unified.DataSource{unified.SourceProxmox, unified.SourceAgent},
+ Identity: unified.ResourceIdentity{
+ MachineID: "machine-guest-100",
+ Hostnames: []string{"docker-vm"},
+ },
+ Proxmox: &unified.ProxmoxData{
+ Instance: "delly",
+ NodeName: "minipc",
+ ClusterName: "homelab",
+ IsClusterMember: true,
+ VMID: 100,
+ },
+ Agent: &unified.AgentData{
+ AgentID: "agent-guest-100",
+ Hostname: "docker-vm",
+ MachineID: "machine-guest-100",
+ LinkedVMID: "guest-100",
+ LinkedNodeID: "",
+ },
+ },
+ },
+ })
+ setTestUnexportedField(t, monitor, "resourceStore", monitoring.ResourceStoreInterface(adapter))
+
+ connections := []Connection{
+ {
+ ID: "pve:delly",
+ Type: ConnectionTypePVE,
+ Name: "delly",
+ Address: "https://delly:8006",
+ State: ConnectionStateActive,
+ Enabled: true,
+ Surfaces: []string{"vms", "containers", "storage", "backups"},
+ Scope: map[string]bool{"vms": true, "containers": true, "storage": true, "backups": true},
+ Source: ConnectionSourceAgent,
+ Capabilities: ConnectionCapabilities{SupportsPause: true, SupportsScope: true, SupportsTest: true},
+ },
+ {
+ ID: "agent:agent-guest-100",
+ Type: ConnectionTypeAgent,
+ Name: "docker-vm",
+ Address: "docker-vm",
+ State: ConnectionStateActive,
+ Enabled: true,
+ Surfaces: []string{"host"},
+ Scope: map[string]bool{"host": true},
+ LastSeen: &now,
+ Source: ConnectionSourceAgent,
+ Capabilities: ConnectionCapabilities{SupportsPause: false, SupportsScope: false, SupportsTest: false},
+ },
+ }
+
+ systems := buildConnectionSystems(connections, monitor)
+ if len(systems) != 2 {
+ t.Fatalf("expected 2 grouped systems, got %d (%+v)", len(systems), systems)
+ }
+
+ systemsByID := make(map[string]ConnectionSystem, len(systems))
+ for _, system := range systems {
+ systemsByID[system.ID] = system
+ }
+
+ if len(systemsByID["pve:delly"].Components) != 1 {
+ t.Fatalf("pve:delly should keep only its primary component, got %+v", systemsByID["pve:delly"].Components)
+ }
+ guestSystem := systemsByID["agent:agent-guest-100"]
+ if len(guestSystem.Components) != 1 || guestSystem.Components[0].Role != ConnectionSystemComponentRolePrimary {
+ t.Fatalf("guest agent should remain standalone, got %+v", guestSystem.Components)
+ }
+}
diff --git a/internal/api/connections_types.go b/internal/api/connections_types.go
index af01c99781..1038b943f2 100644
--- a/internal/api/connections_types.go
+++ b/internal/api/connections_types.go
@@ -101,9 +101,10 @@ type ConnectionSystemComponent struct {
// attached collection methods such as a unified agent augmenting a Proxmox
// source.
type ConnectionSystem struct {
- ID string `json:"id"`
- Type ConnectionType `json:"type"`
- Components []ConnectionSystemComponent `json:"components"`
+ ID string `json:"id"`
+ Type ConnectionType `json:"type"`
+ ClusterName string `json:"clusterName,omitempty"`
+ Components []ConnectionSystemComponent `json:"components"`
}
// ConnectionsListResponse is the envelope for GET /api/connections.
diff --git a/internal/api/contract_test.go b/internal/api/contract_test.go
index d92e45ba7b..caac9ed8f0 100644
--- a/internal/api/contract_test.go
+++ b/internal/api/contract_test.go
@@ -11456,8 +11456,9 @@ func TestContract_ConnectionPayloadShapeStaysCanonical(t *testing.T) {
Capabilities: ConnectionCapabilities{SupportsPause: true, SupportsScope: true, SupportsTest: true},
}
system := ConnectionSystem{
- ID: "pve-lab",
- Type: ConnectionTypePVE,
+ ID: "pve-lab",
+ Type: ConnectionTypePVE,
+ ClusterName: "homelab",
Components: []ConnectionSystemComponent{
{
ConnectionID: "pve-lab",
@@ -11473,7 +11474,7 @@ func TestContract_ConnectionPayloadShapeStaysCanonical(t *testing.T) {
if err != nil {
t.Fatalf("marshal Connection: %v", err)
}
- want := `{"connections":[{"id":"pve-lab","type":"pve","name":"lab","address":"https://pve.lab:8006","state":"active","enabled":true,"surfaces":["vms","containers"],"scope":{"containers":true,"vms":true},"lastSeen":"2026-04-19T10:00:00Z","source":"manual","capabilities":{"supportsPause":true,"supportsScope":true,"supportsTest":true}}],"systems":[{"id":"pve-lab","type":"pve","components":[{"connectionId":"pve-lab","type":"pve","role":"primary"}]}]}`
+ want := `{"connections":[{"id":"pve-lab","type":"pve","name":"lab","address":"https://pve.lab:8006","state":"active","enabled":true,"surfaces":["vms","containers"],"scope":{"containers":true,"vms":true},"lastSeen":"2026-04-19T10:00:00Z","source":"manual","capabilities":{"supportsPause":true,"supportsScope":true,"supportsTest":true}}],"systems":[{"id":"pve-lab","type":"pve","clusterName":"homelab","components":[{"connectionId":"pve-lab","type":"pve","role":"primary"}]}]}`
assertJSONSnapshot(t, body, want)
}