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.

Propagate agent host profiles to resources

rcourtmanada3f7509814
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index a2c03d8cd0..d307d62168 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -804,6 +804,9 @@ the canonical monitored-system blocked payload.
`linux`, while `agentIdentity.hostProfile` carries the governed profile id
such as `unraid`; frontend clients must not re-promote those profile ids
into first-class platform types.
+ Unified-resource agent payloads use the same split: `agent.platform` is
+ the normalized runtime platform and `agent.hostProfile` is the optional
+ governed profile id for host/appliance presentation.
The API aggregator must resolve host-profile identity tokens and runtime
platform fallback values through the generated platform-support backend
projection in `internal/platformsupport/manifest_generated.go`, so payload
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 5d0b97a592..6a12d4a2a5 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -611,8 +611,9 @@ frontend primitive boundary.
The generated host-profile projection also carries runtime platform fallback
metadata for shared explanation and parity with backend normalization, but
frontend primitives must still render host-profile labels through
- `agentIdentity.hostProfile` rather than prettifying presentation-only ids as
- platform values.
+ explicit backend profile fields such as `agentIdentity.hostProfile` and
+ unified-resource `platformData.agent.hostProfile` rather than prettifying
+ presentation-only ids as platform values.
9. Keep top-of-page summary interaction on shared primitives. Infrastructure, workloads, and storage summary cards must route sticky-shell behavior through `frontend-modern/src/components/shared/StickySummarySection.tsx` and route row-hover or focused-series rendering through shared chart primitives such as `frontend-modern/src/components/shared/InteractiveSparkline.tsx` and `frontend-modern/src/components/shared/DensityMap.tsx`, rather than page-local sticky wrappers or metric-card-specific hover logic. When a page keeps summary charts visible below the desktop breakpoint, it must use the shared `stickyDesktopOnly` mode instead of adding page-local media queries, so wrapped two-column summaries scroll as normal content and only become sticky once the large-screen layout is active. The shared summary-card contract must also own stable summary-card geometry for chart-backed cards so row hover, focus, synchronized readouts, or idle header metadata cannot ratchet the sticky summary taller across rerenders.
10. Keep summary chart interaction identity on one shared helper. Summary surfaces that expose row-hover, group-hover, chart-hover, or route-focus-driven chart emphasis must derive page/group/entity scope through `frontend-modern/src/components/shared/summaryCardInteraction.ts` and pass that same resolved scope into card-state, sparkline, and density-map primitives, rather than letting cards read `hovered || focused` while charts listen to a different page-local ID source. Hovering one summary chart must promote that series into the shared active entity so sibling cards highlight the same object instead of keeping chart-local hover islands, and hovering or pinning a workload group header, infrastructure cluster header, or storage pool-group header must scope the matching summary cards through that same shared contract instead of forking a page-local summary filter path. Sibling cards should surface that synchronized hover as one compact header readout through the shared summary-card contract, while the chart under the pointer keeps the only floating tooltip. `frontend-modern/src/components/Recovery/RecoverySummary.tsx` is explicitly outside this interaction dialect: recovery posture cards may share summary framing, but they must not silently grow row/group/chart hover behavior without a separate governed product decision.
11. Keep page summaries page-scoped when table rows enter contextual focus. Route-backed row selection may add a focused label and shared series emphasis, but infrastructure, workloads, and storage summary cards must continue to render the page-level series set instead of collapsing the summary down to the selected row or replacing the global trend view with row-local empty states.
diff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.md
index 7ae2ca2da7..33fce7a3c3 100644
--- a/docs/release-control/v6/internal/subsystems/monitoring.md
+++ b/docs/release-control/v6/internal/subsystems/monitoring.md
@@ -842,7 +842,11 @@ canonical host `AgentData` and shared `ResourceMetrics` contract, and
`internal/monitoring/monitor.go` must sync them into the existing `agent`
metrics-history/store path. Pulse must not add a TrueNAS-only top-level
system charts path or leave TrueNAS host telemetry outside the canonical host
-history contract.
+history contract. Host profile fields on `AgentData`, such as `hostProfile`
+for Unraid-compatible Pulse Agent hosts, are presentation identity only; typed
+read access through `internal/unifiedresources/views.go` must keep
+`Platform()` as the normalized runtime platform and expose the profile through
+a separate host-profile accessor.
That same monitoring boundary now also owns API-backed TrueNAS CPU
temperature. `internal/truenas/client.go` must use the modern
`reporting.get_data` RPC surface to derive current `cputemp` readings in the
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index ce4b634981..3c75175984 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -556,7 +556,9 @@ bypass the API fail-closed execution gate.
rows, not a storage-local platform classifier: Unraid storage may render
through the generated host-profile label and runtime platform fallback, but
storage/recovery must not reintroduce `unraid` as a first-class provider or
- recovery platform.
+ recovery platform. Shared `AgentData.hostProfile` may carry that profile id
+ for presentation, while storage and recovery must continue to treat
+ `AgentData.platform` as the normalized runtime platform.
32. Keep agentless availability endpoints neutral on the shared unified-resource and API contracts. When `internal/api/availability_handlers.go`, `internal/api/connections_handlers.go`, `internal/api/platform_mock_connections.go`, or `frontend-modern/src/hooks/useUnifiedResources.ts` surface `network-endpoint` availability resources, storage and recovery may consume their liveness as infrastructure context only; they must not reinterpret ping/TCP/HTTP endpoints as storage providers, backup targets, recovery repositories, or protected-workload evidence.
33. Keep infrastructure summary chart bucketing presentation-only on the adjacent shared API boundary. When `internal/api/router.go` normalizes mixed-cadence infrastructure history into equal-time summary buckets for operator-facing summary cards, storage and recovery may consume the resulting visual context only; they must not reinterpret those normalized chart samples as recovery freshness windows, backup cadence, or restore evidence.
34. Keep workload chart downsampling presentation-only on that same adjacent shared API boundary. When `internal/api/router.go` caps mixed-cadence workload history into equal-time buckets for operator-facing workload cards, storage and recovery may consume the resulting visual context only; they must not reinterpret those shaped chart samples as recovery freshness windows, backup cadence, or restore evidence.
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 4c6cf70d44..792b209d6e 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -619,7 +619,10 @@ canonical top-level platform identity.
Host-profile runtime fallback values are generated beside those labels so
agent-backed appliance reports can normalize to canonical runtime platforms
such as `linux` without making the appliance profile a unified-resource
-platform.
+platform. Unified-resource `AgentData` must carry that distinction explicitly:
+`agent.platform` is the normalized runtime platform, while
+`agent.hostProfile` carries a governed profile id such as `unraid` for
+presentation and host/appliance support-floor copy.
That same shared source boundary also applies when unified seeds and
supplemental providers coexist. If a canonical unified-resource seed omits an
owned supplemental source such as TrueNAS or VMware, the shared resource API
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx
index 9f477b9955..8d6258db2d 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx
+++ b/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx
@@ -198,7 +198,8 @@ describe('UnifiedResourceTable performance contract', () => {
platformData: {
sources: ['agent', 'docker'],
agent: {
- platform: 'unraid',
+ platform: 'linux',
+ hostProfile: 'unraid',
osName: 'Unraid',
osVersion: '7.1.0',
},
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSelectors.test.ts b/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSelectors.test.ts
index 352904035a..314ac02eca 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSelectors.test.ts
+++ b/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSelectors.test.ts
@@ -251,7 +251,8 @@ describe('infrastructureSelectors', () => {
platformData: {
sources: ['agent', 'docker'],
agent: {
- platform: 'unraid',
+ platform: 'linux',
+ hostProfile: 'unraid',
osName: 'Unraid',
},
},
diff --git a/frontend-modern/src/types/resource.ts b/frontend-modern/src/types/resource.ts
index 499d6940cc..32ba0104c5 100644
--- a/frontend-modern/src/types/resource.ts
+++ b/frontend-modern/src/types/resource.ts
@@ -404,6 +404,7 @@ export interface ResourceAgentMeta {
agentVersion?: string;
hostname?: string;
platform?: string;
+ hostProfile?: string;
osName?: string;
osVersion?: string;
kernelVersion?: string;
diff --git a/frontend-modern/src/utils/__tests__/resourceBadgePresentation.test.ts b/frontend-modern/src/utils/__tests__/resourceBadgePresentation.test.ts
index 07c894a46f..ed2c102d77 100644
--- a/frontend-modern/src/utils/__tests__/resourceBadgePresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/resourceBadgePresentation.test.ts
@@ -70,7 +70,8 @@ describe('resourceBadgePresentation', () => {
platformData: {
sources: ['agent', 'docker'],
agent: {
- platform: 'unraid',
+ platform: 'linux',
+ hostProfile: 'unraid',
osName: 'Unraid',
osVersion: '7.1.0',
},
@@ -91,6 +92,45 @@ describe('resourceBadgePresentation', () => {
).toEqual(['Docker / Podman']);
});
+ it('uses governed host identity tokens for legacy agent profile reports', () => {
+ expect(
+ getInfrastructureSystemIdentityBadges(
+ makeResource({
+ type: 'docker-host',
+ platformType: 'docker',
+ sourceType: 'hybrid',
+ platformData: {
+ sources: ['agent', 'docker'],
+ agent: {
+ platform: 'linux',
+ osName: 'Unraid OS 7.1.0',
+ osVersion: '7.1.0',
+ },
+ },
+ }),
+ ).map((badge) => badge.label),
+ ).toEqual(['Unraid']);
+ });
+
+ it('matches governed platform display tokens inside reported host identity text', () => {
+ expect(
+ getInfrastructureSystemIdentityBadges(
+ makeResource({
+ type: 'agent',
+ platformType: 'agent',
+ sourceType: 'agent',
+ platformData: {
+ sources: ['agent'],
+ agent: {
+ platform: 'linux',
+ osName: 'TrueNAS SCALE',
+ },
+ },
+ }),
+ ).map((badge) => badge.label),
+ ).toEqual(['TrueNAS']);
+ });
+
it('keeps API-backed platform identity ahead of reported host OS', () => {
const resource = makeResource({
platformType: 'proxmox-pve',
diff --git a/frontend-modern/src/utils/__tests__/sourcePlatforms.test.ts b/frontend-modern/src/utils/__tests__/sourcePlatforms.test.ts
index 65cfda3682..18895f405f 100644
--- a/frontend-modern/src/utils/__tests__/sourcePlatforms.test.ts
+++ b/frontend-modern/src/utils/__tests__/sourcePlatforms.test.ts
@@ -38,6 +38,11 @@ describe('sourcePlatforms', () => {
expect(getSourcePlatformPresentation('agent')?.tone).toContain('emerald');
});
+ it('matches governed display tokens from the platform manifest', () => {
+ expect(getSourcePlatformPresentation('Unraid')).toMatchObject({ label: 'Unraid' });
+ expect(getSourcePlatformPresentation('Proxmox VE')).toMatchObject({ label: 'PVE' });
+ });
+
it('returns null for unknown platforms', () => {
expect(getSourcePlatformPresentation('custom-platform')).toBeNull();
expect(getSourcePlatformPresentation('')).toBeNull();
diff --git a/frontend-modern/src/utils/platformSupportManifest.ts b/frontend-modern/src/utils/platformSupportManifest.ts
index 9778a9a3de..2506f248fd 100644
--- a/frontend-modern/src/utils/platformSupportManifest.ts
+++ b/frontend-modern/src/utils/platformSupportManifest.ts
@@ -71,6 +71,11 @@ export type {
const entriesById = new Map<string, SourcePlatformManifestEntry>(
SOURCE_PLATFORM_MANIFEST_ENTRIES.map((platform) => [platform.id, platform] as const),
);
+const entriesByDisplayToken = new Map<string, SourcePlatformManifestEntry>(
+ SOURCE_PLATFORM_MANIFEST_ENTRIES.flatMap((platform) =>
+ platform.displayTokens.map((token) => [token.trim().toLowerCase(), platform] as const),
+ ),
+);
const agentHostProfileEntriesById = new Map<string, SourceAgentHostProfileManifestEntry>(
SOURCE_AGENT_HOST_PROFILE_MANIFEST_ENTRIES.map((profile) => [profile.id, profile] as const),
);
@@ -121,7 +126,7 @@ export const getSourcePlatformManifestEntry = (
const aliasMap = SOURCE_PLATFORM_ALIAS_MAP as Record<string, string>;
const platformId = aliasMap[normalized] || normalized;
- return entriesById.get(platformId) || null;
+ return entriesById.get(platformId) || entriesByDisplayToken.get(normalized) || null;
};
export const getAgentHostProfileManifestEntry = (
diff --git a/frontend-modern/src/utils/resourceBadgePresentation.ts b/frontend-modern/src/utils/resourceBadgePresentation.ts
index 5cb4078f5d..1464f2ada8 100644
--- a/frontend-modern/src/utils/resourceBadgePresentation.ts
+++ b/frontend-modern/src/utils/resourceBadgePresentation.ts
@@ -1,6 +1,14 @@
import type { PlatformType, SourceType, Resource, ResourceType } from '@/types/resource';
import { getSourcePlatformBadge } from '@/components/shared/sourcePlatformBadges';
import { getPlatformAgentRecord, getPlatformDataRecord } from '@/utils/agentResources';
+import {
+ AGENT_HOST_PROFILE_IDS,
+ SOURCE_AGENT_HOST_PROFILE_MANIFEST_ENTRIES,
+ SOURCE_PLATFORM_MANIFEST_ENTRIES,
+ getAgentHostProfileFamily,
+ getAgentHostProfileManifestEntry,
+ getSourcePlatformManifestEntry,
+} from '@/utils/platformSupportManifest';
import { normalizeSourcePlatformKey, type KnownSourcePlatform } from '@/utils/sourcePlatforms';
import { getSourceTypePresentation } from '@/utils/sourceTypePresentation';
import {
@@ -26,22 +34,14 @@ const PRIMARY_SYSTEM_SOURCE_PRIORITY: KnownSourcePlatform[] = [
'proxmox-pmg',
'truenas',
'vmware-vsphere',
- 'unraid',
+ ...(AGENT_HOST_PROFILE_IDS.filter((profileId) =>
+ getSourcePlatformManifestEntry(profileId),
+ ) as KnownSourcePlatform[]),
'synology-dsm',
'microsoft-hyperv',
'kubernetes',
];
-const knownHostIdentityPlatformPatterns: Array<{
- pattern: RegExp;
- source: KnownSourcePlatform;
-}> = [
- { pattern: /\btrue\s*nas\b|\btruenas\b/i, source: 'truenas' },
- { pattern: /\bunraid\b/i, source: 'unraid' },
- { pattern: /\bsynology\b|\bdiskstation\b|\bdsm\b/i, source: 'synology-dsm' },
- { pattern: /\bhyper-?v\b/i, source: 'microsoft-hyperv' },
-];
-
const hostOsLabelPatterns: Array<{ pattern: RegExp; label: string }> = [
{ pattern: /\bqnap\b|\bqts\b|\bquts\b/i, label: 'QNAP' },
{ pattern: /\bubuntu\b/i, label: 'Ubuntu' },
@@ -157,9 +157,52 @@ const firstSystemSource = (
return PRIMARY_SYSTEM_SOURCE_PRIORITY.find((source) => sourceSet.has(source)) ?? null;
};
+const textContainsToken = (value: string, token: string): boolean => {
+ const normalizedToken = token.trim().toLowerCase();
+ return Boolean(normalizedToken) && value.includes(normalizedToken);
+};
+
+const getHostIdentityAgentProfile = (value: string) => {
+ const exactProfile = getAgentHostProfileManifestEntry(value);
+ if (exactProfile) return exactProfile;
+
+ const normalized = value.trim().toLowerCase();
+ if (!normalized) return null;
+
+ return (
+ SOURCE_AGENT_HOST_PROFILE_MANIFEST_ENTRIES.find((profile) =>
+ [profile.id, profile.family, ...profile.hostIdentityTokens].some((token) =>
+ textContainsToken(normalized, token),
+ ),
+ ) ?? null
+ );
+};
+
+const getHostIdentityPlatform = (value: string) => {
+ const exactPlatform = getSourcePlatformManifestEntry(value);
+ if (exactPlatform) return exactPlatform;
+
+ const normalized = value.trim().toLowerCase();
+ if (!normalized) return null;
+
+ return (
+ SOURCE_PLATFORM_MANIFEST_ENTRIES.filter(
+ (platform) => platform.id !== 'agent' && platform.id !== 'docker',
+ ).find((platform) =>
+ [platform.id, platform.family, ...platform.aliases, ...platform.displayTokens].some((token) =>
+ textContainsToken(normalized, token),
+ ),
+ ) ?? null
+ );
+};
+
const getKnownHostIdentitySource = (...values: string[]): KnownSourcePlatform | null => {
for (const value of values) {
if (!value) continue;
+ const profile = getHostIdentityAgentProfile(value);
+ if (profile && getSourcePlatformManifestEntry(profile.id)) {
+ return profile.id as KnownSourcePlatform;
+ }
const normalized = normalizeSourcePlatformKey(value);
if (
normalized &&
@@ -169,8 +212,10 @@ const getKnownHostIdentitySource = (...values: string[]): KnownSourcePlatform |
) {
return normalized;
}
- const match = knownHostIdentityPlatformPatterns.find(({ pattern }) => pattern.test(value));
- if (match) return match.source;
+ const manifestPlatform = getHostIdentityPlatform(value);
+ if (manifestPlatform && manifestPlatform.id !== 'agent' && manifestPlatform.id !== 'docker') {
+ return manifestPlatform.id as KnownSourcePlatform;
+ }
}
return null;
};
@@ -188,9 +233,23 @@ const getAgentSystemIdentityBadge = (resource: Resource): ResourceBadge | null =
const agent = getPlatformAgentRecord(resource);
if (!agent) return null;
+ const hostProfile = trimString(agent.hostProfile);
const platform = trimString(agent.platform);
const osName = trimString(agent.osName);
const osVersion = trimString(agent.osVersion);
+ if (hostProfile) {
+ const badge = getSourcePlatformBadge(hostProfile);
+ const profileFamily = getAgentHostProfileFamily(hostProfile);
+ const label = badge?.label ?? profileFamily;
+ if (label) {
+ return {
+ label,
+ classes: badge?.classes ?? `${baseBadge} ${typeClasses}`,
+ title: titleFromParts(osName || badge?.title || profileFamily || label, osVersion) ?? label,
+ };
+ }
+ }
+
const knownSource = getKnownHostIdentitySource(platform, osName);
if (knownSource) {
const badge = getSourcePlatformBadge(knownSource);
diff --git a/internal/unifiedresources/adapters.go b/internal/unifiedresources/adapters.go
index e4c90b5302..5a4d0d87cb 100644
--- a/internal/unifiedresources/adapters.go
+++ b/internal/unifiedresources/adapters.go
@@ -7,6 +7,7 @@ import (
"time"
"github.com/rcourtman/pulse-go-rewrite/internal/models"
+ "github.com/rcourtman/pulse-go-rewrite/internal/platformsupport"
"github.com/rcourtman/pulse-go-rewrite/internal/storagehealth"
)
@@ -112,6 +113,8 @@ func resourceFromHost(host models.Host) (Resource, ResourceIdentity) {
}
identity := identityFromHost(host)
+ hostProfile := agentHostProfileForHost(host)
+ platform := agentRuntimePlatformForHost(host, hostProfile)
agent := &AgentData{
AgentID: host.ID,
@@ -122,7 +125,8 @@ func resourceFromHost(host models.Host) (Resource, ResourceIdentity) {
TokenName: host.TokenName,
TokenHint: host.TokenHint,
TokenLastUsedAt: host.TokenLastUsedAt,
- Platform: host.Platform,
+ Platform: platform,
+ HostProfile: hostProfile,
OSName: host.OSName,
OSVersion: host.OSVersion,
KernelVersion: host.KernelVersion,
@@ -398,7 +402,7 @@ func resourceFromHost(host models.Host) (Resource, ResourceIdentity) {
resource := Resource{
Type: ResourceTypeAgent,
- Technology: strings.TrimSpace(host.Platform),
+ Technology: strings.TrimSpace(platform),
Name: name,
Status: storageStatus(statusFromString(host.Status), agent.StorageRisk),
LastSeen: host.LastSeen,
@@ -411,6 +415,25 @@ func resourceFromHost(host models.Host) (Resource, ResourceIdentity) {
return resource, identity
}
+func agentRuntimePlatformForHost(host models.Host, hostProfile string) string {
+ return platformsupport.NormalizeRuntimePlatformForAgentHostProfile(hostProfile, host.Platform)
+}
+
+func agentHostProfileForHost(host models.Host) string {
+ if host.Unraid != nil {
+ return agentHostProfileIDFromIdentity("unraid")
+ }
+ return agentHostProfileIDFromIdentity(host.OSName, host.Platform)
+}
+
+func agentHostProfileIDFromIdentity(values ...string) string {
+ profile, ok := platformsupport.AgentHostProfileForIdentity(values...)
+ if !ok {
+ return ""
+ }
+ return profile.ID
+}
+
func resourceFromHostUnraidStorage(host models.Host) (Resource, ResourceIdentity) {
name := host.Hostname
if host.DisplayName != "" {
diff --git a/internal/unifiedresources/adapters_test.go b/internal/unifiedresources/adapters_test.go
index f1f1dc9d32..d17f7f4979 100644
--- a/internal/unifiedresources/adapters_test.go
+++ b/internal/unifiedresources/adapters_test.go
@@ -142,6 +142,32 @@ func TestResourceFromDockerContainerIncludesContainerID(t *testing.T) {
}
}
+func TestResourceFromHostProjectsAgentHostProfile(t *testing.T) {
+ host := models.Host{
+ ID: "tower-host",
+ Hostname: "tower",
+ Platform: "unraid",
+ OSName: "Unraid",
+ OSVersion: "7.1.0",
+ Status: "online",
+ Unraid: &models.HostUnraidStorage{ArrayStarted: true},
+ }
+
+ resource, _ := resourceFromHost(host)
+ if resource.Technology != "linux" {
+ t.Fatalf("Technology = %q, want linux runtime platform", resource.Technology)
+ }
+ if resource.Agent == nil {
+ t.Fatal("expected agent payload")
+ }
+ if resource.Agent.Platform != "linux" {
+ t.Fatalf("agent platform = %q, want linux runtime platform", resource.Agent.Platform)
+ }
+ if resource.Agent.HostProfile != "unraid" {
+ t.Fatalf("agent host profile = %q, want unraid", resource.Agent.HostProfile)
+ }
+}
+
func TestResourceFromVMPreservesProxmoxPool(t *testing.T) {
vm := models.VM{
ID: "cluster-a:pve-a:101",
diff --git a/internal/unifiedresources/canonical_identity_test.go b/internal/unifiedresources/canonical_identity_test.go
index 7437692183..c084f36879 100644
--- a/internal/unifiedresources/canonical_identity_test.go
+++ b/internal/unifiedresources/canonical_identity_test.go
@@ -175,6 +175,38 @@ func TestRefreshCanonicalIdentityPrefersProxmoxNodePrimaryIDForAgentResources(t
}
}
+func TestRefreshCanonicalIdentityKeepsAgentHostProfileOutOfCanonicalIDs(t *testing.T) {
+ resource := Resource{
+ ID: "agent:tower",
+ Type: ResourceTypeAgent,
+ Name: "tower",
+ Agent: &AgentData{
+ AgentID: "host-1",
+ Hostname: "tower",
+ Platform: "linux",
+ HostProfile: "unraid",
+ OSName: "Unraid",
+ },
+ }
+
+ RefreshCanonicalIdentity(&resource)
+
+ if resource.Canonical == nil {
+ t.Fatalf("expected canonical identity")
+ }
+ if got := resource.Canonical.PlatformID; got != "tower" {
+ t.Fatalf("platformId = %q, want tower", got)
+ }
+ if got := resource.Canonical.PrimaryID; got != "agent:host-1" {
+ t.Fatalf("primaryId = %q, want agent:host-1", got)
+ }
+ for _, alias := range resource.Canonical.Aliases {
+ if alias == "unraid" {
+ t.Fatalf("agent host profile leaked into canonical aliases: %+v", resource.Canonical.Aliases)
+ }
+ }
+}
+
func TestRefreshCanonicalIdentityCanonicalizesTargetResourceTypeAliases(t *testing.T) {
resource := Resource{
ID: "agent-1",
diff --git a/internal/unifiedresources/types.go b/internal/unifiedresources/types.go
index 95c9fb33f2..545bf67b2a 100644
--- a/internal/unifiedresources/types.go
+++ b/internal/unifiedresources/types.go
@@ -655,6 +655,7 @@ type AgentData struct {
TokenHint string `json:"tokenHint,omitempty"`
TokenLastUsedAt *time.Time `json:"tokenLastUsedAt,omitempty"`
Platform string `json:"platform,omitempty"`
+ HostProfile string `json:"hostProfile,omitempty"`
OSName string `json:"osName,omitempty"`
OSVersion string `json:"osVersion,omitempty"`
KernelVersion string `json:"kernelVersion,omitempty"`
diff --git a/internal/unifiedresources/views.go b/internal/unifiedresources/views.go
index d4b7f74cb6..4d69098efa 100644
--- a/internal/unifiedresources/views.go
+++ b/internal/unifiedresources/views.go
@@ -927,6 +927,13 @@ func (v HostView) Platform() string {
return ""
}
+func (v HostView) HostProfile() string {
+ if v.r == nil || v.r.Agent == nil {
+ return ""
+ }
+ return v.r.Agent.HostProfile
+}
+
func (v HostView) OSName() string {
if v.r == nil || v.r.Agent == nil {
return ""
diff --git a/internal/unifiedresources/views_test.go b/internal/unifiedresources/views_test.go
index 94e315551e..4c24d2e540 100644
--- a/internal/unifiedresources/views_test.go
+++ b/internal/unifiedresources/views_test.go
@@ -700,9 +700,9 @@ func TestView_HostViewAccessors(t *testing.T) {
if v.ID() != "host-1" || v.Name() != "agent-host-1" {
t.Fatalf("expected ID/Name to match, got id=%q name=%q", v.ID(), v.Name())
}
- if v.Hostname() != "agent-host-1" || v.Platform() != "linux" || v.OSName() != "Ubuntu" || v.OSVersion() != "24.04" || v.KernelVersion() != "6.8.0" || v.Architecture() != "amd64" {
- t.Fatalf("expected agent OS accessors to match, got hostname=%q platform=%q os=%q %q kernel=%q arch=%q",
- v.Hostname(), v.Platform(), v.OSName(), v.OSVersion(), v.KernelVersion(), v.Architecture())
+ if v.Hostname() != "agent-host-1" || v.Platform() != "linux" || v.HostProfile() != "" || v.OSName() != "Ubuntu" || v.OSVersion() != "24.04" || v.KernelVersion() != "6.8.0" || v.Architecture() != "amd64" {
+ t.Fatalf("expected agent OS accessors to match, got hostname=%q platform=%q profile=%q os=%q %q kernel=%q arch=%q",
+ v.Hostname(), v.Platform(), v.HostProfile(), v.OSName(), v.OSVersion(), v.KernelVersion(), v.Architecture())
}
if v.MachineID() != "machine-1" || v.CPUCount() != 16 {
t.Fatalf("expected machine id/cpu count to match, got machine=%q cpus=%d", v.MachineID(), v.CPUCount())