From 1b2ac272c81390caa9a42d838f7780ec4d03d1cc Mon Sep 17 00:00:00 2001 From: rcourtman Date: Fri, 8 May 2026 17:04:36 +0100 Subject: [PATCH] Surface platform identity for agent-only Proxmox VE hosts Standalone hosts on the Infrastructure surface were rendering Proxmox VE nodes as their broader OS family. Pi/delly/minipc all showed "debian 9.1.9" instead of "Proxmox VE 9.1.9" because connectionAgentHostProfileLabel preferred agent.platform over agent.osName when no explicit hostProfile was reported. The agent correctly carries the platform identity in osName but the broader family ("debian", "raspbian") was winning the display. Reverse the preference so osName takes priority, falling back to the prettified platform family only when osName is absent. The canonical badge presentation already handled this correctly for the resource list; this change brings the connection-table summary into agreement. Add unit coverage for the Proxmox VE, Unraid, fallback, and absent identity cases inside ConnectionsTable.test.tsx. --- .../__tests__/ConnectionsTable.test.tsx | 50 ++++++++++++++++++- .../Settings/connectionsTableModel.ts | 7 ++- 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/frontend-modern/src/components/Settings/__tests__/ConnectionsTable.test.tsx b/frontend-modern/src/components/Settings/__tests__/ConnectionsTable.test.tsx index c1edc6176..202d2f8c6 100644 --- a/frontend-modern/src/components/Settings/__tests__/ConnectionsTable.test.tsx +++ b/frontend-modern/src/components/Settings/__tests__/ConnectionsTable.test.tsx @@ -2,7 +2,8 @@ import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { ConnectionsTable } from '../ConnectionsTable'; import type { InfrastructureSystemRow } from '../connectionsTableModel'; -import type { Connection } from '@/api/connections'; +import { connectionAgentIdentitySummary } from '../connectionsTableModel'; +import type { Connection, ConnectionAgentIdentity } from '@/api/connections'; import type { ConnectionRowActions } from '../useConnectionRowActions'; const connectionFixture = (overrides: Partial = {}): Connection => ({ @@ -266,3 +267,50 @@ describe('ConnectionsTable', () => { expect(screen.queryByRole('button', { name: 'Remove' })).toBeNull(); }); }); + +describe('connectionAgentIdentitySummary', () => { + const withAgentIdentity = ( + agentIdentity: Partial | undefined, + ): Connection => + connectionFixture({ agentIdentity: agentIdentity as ConnectionAgentIdentity | undefined }); + + it('uses osName platform identity over the broader agent platform family', () => { + // Pi/delly/minipc shape: agent reports platform="debian"/"raspbian" because + // Proxmox VE is Debian-based, but osName carries the canonical identity. + // Display must surface the platform identity, not the OS family. + const summary = connectionAgentIdentitySummary( + withAgentIdentity({ + platform: 'debian', + osName: 'Proxmox VE', + osVersion: '9.1.9', + }), + ); + expect(summary).toBe('Proxmox VE 9.1.9'); + }); + + it('uses Unraid osName over Linux platform family', () => { + const summary = connectionAgentIdentitySummary( + withAgentIdentity({ + platform: 'linux', + osName: 'Unraid', + osVersion: '7.2.2', + }), + ); + expect(summary).toBe('Unraid 7.2.2'); + }); + + it('falls back to prettified platform when osName is missing', () => { + const summary = connectionAgentIdentitySummary( + withAgentIdentity({ + platform: 'linux', + osVersion: '6.1.0', + }), + ); + expect(summary).toBe('Linux 6.1.0'); + }); + + it('returns null when no agent identity is present', () => { + const summary = connectionAgentIdentitySummary(withAgentIdentity(undefined)); + expect(summary).toBeNull(); + }); +}); diff --git a/frontend-modern/src/components/Settings/connectionsTableModel.ts b/frontend-modern/src/components/Settings/connectionsTableModel.ts index aafd2670e..c62ee1d61 100644 --- a/frontend-modern/src/components/Settings/connectionsTableModel.ts +++ b/frontend-modern/src/components/Settings/connectionsTableModel.ts @@ -60,7 +60,12 @@ const connectionAgentHostProfileLabel = ( if (hostProfile) { return getAgentHostProfileFamily(hostProfile) ?? prettifyPlatform(hostProfile); } - return prettifyPlatform(identity?.platform ?? identity?.osName); + // Prefer osName over platform: osName carries the specific platform identity + // ("Proxmox VE", "Unraid", "TrueNAS SCALE") while platform is the broader OS + // family ("debian", "linux") that loses that identity on display. + const osName = identity?.osName?.trim(); + const platform = identity?.platform?.trim(); + return prettifyPlatform(osName || platform); }; const isIPv4Literal = (value: string): boolean => /^\d{1,3}(?:\.\d{1,3}){3}$/.test(value);