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
rename resource analysis copy and fix workload deeplinks
rcourtmanc6cd9f8787f6
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 4b4e73b73b..aa020ef62d 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -194,6 +194,13 @@ querying, and the operator-facing storage health presentation layer.24. Keep backend-native platform configuration reads on the adjacent AI/runtime and platform contracts. When `internal/api/` wires native TrueNAS app config for Assistant, storage and recovery may use that runtime shape during investigation, but they must not grow a parallel recovery-local config transport or provider-shaped configuration payload.25. Keep provider-backed poll cadence and settings-runtime health on the adjacent platform-connections contract. When shared `internal/api/` and poller wiring expose TrueNAS last-sync status, failure summaries, discovered contribution counts, manual saved-test status refresh, or platform handoff links in settings, storage and recovery may consume the resulting datasets, apps, disks, and recovery artifacts but must not redefine those settings-runtime health semantics or connection-level handoffs in storage/recovery-local transport or page flows.26. Keep cross-surface recovery handoffs on the shared route-helper contract. When infrastructure or other unified-resource consumers expose TrueNAS recovery links, they must reuse the canonical `frontend-modern/src/routing/resourceLinks.ts` recovery builder with owned `platform` and `node` queries instead of inventing drawer-local recovery URLs or treating PBS services as the only infrastructure-to-recovery path.+ That same shared route-helper boundary also owns exact workload handoffs+ when storage or recovery surfaces send operators back to node-scoped+ workloads for investigation context. Proxmox VM and system-container links+ must carry the canonical workload identity (`<instance>:<node>:<vmid>`) in+ the shared `/workloads` `resource` query rather than an opaque unified+ resource id, so recovery/storage drill-downs reopen the intended workload+ drawer instead of landing on an unselected table state.27. Keep alert-side recovery drill-ins on that same shared route-helper contract. When alert investigation surfaces such as resource-incident panels expose recovery follow-up links for TrueNAS or future API-backed platforms, they must route through the canonical `frontend-modern/src/routing/resourceLinks.ts` recovery builder instead of freezing alert-local recovery URLs or introducing another provider-shaped recovery handoff vocabulary.28. Keep VMware onboarding runtime and recovery semantics separate on that same adjacent platform-connections contract. When `internal/api/router.go`, `internal/api/router_routes_registration.go`, or `internal/api/vmware_handlers.go` evolve VMware connection CRUD, poller-owned `poll` / `observed` summary payloads, saved-test refresh, or observed datastore/VM snapshot visibility, storage and recovery may consume the resulting shared context but must not treat those onboarding/runtime payloads as canonical recovery artifacts, restore capability, or recovery-local control transport.29. Keep VMware datastore projection on the shared unified-resource and storage-source contracts. When `frontend-modern/src/hooks/useUnifiedResources.ts` or shared `internal/api/router.go` wiring starts surfacing VMware-backed canonical `storage` resources, storage and recovery may expose those datastores through the owned `vmware-vsphere` source/platform vocabulary for inventory, capacity, and handoff flows only; they must not reinterpret that projection as VMware recovery support, restore semantics, or a provider-local protection surface.diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex 644d9d7297..f2a8675705 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -203,6 +203,15 @@ assembly branch.may consume `frontend-modern/src/hooks/useUnifiedResources.ts`, but hiddenselectors must pass an explicit `enabled` gate instead of booting the`all-resources` transport behind a collapsed or non-rendered summary shell.+13. Keep operator-facing resource analysis vocabulary task-first on unified-resource+ surfaces. `frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx`,+ `frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts`,+ and `frontend-modern/src/components/Discovery/DiscoveryTab.tsx` may expose+ provider identity or governed safe-summary posture when that context helps+ an operator, but the rendered labels must stay product-neutral and use+ `Analysis`, `Analysis Reasoning`, and `Safe Summary` rather than reviving+ generic `AI` or `AI-Safe` branding inside the resource drawer or discovery+ shell.## Forbidden Paths@@ -906,6 +915,12 @@ back to generic agent or Docker-only semantics when host telemetry is alsopresent. Runtime-local filters like `agent` or cluster context may still beadded as secondary scope, but the canonical platform query must remain thefirst-class route boundary for shared workload navigation.+That same shared workload-route contract also owns exact guest selection for+node-scoped workloads. Proxmox VM and system-container links must emit the+canonical workload identity (`<instance>:<node>:<vmid>`) in the shared+`resource` query rather than an opaque unified-resource id, so direct route+loads and cross-surface drill-downs reopen the correct workload drawer instead+of landing on an unselected table state.That same routing contract now also owns recovery deep links for unifiedresources. Infrastructure drawers and other cross-surface consumers must routeTrueNAS-backed top-level systems through canonical `/recovery` route statediff --git a/frontend-modern/src/components/Discovery/DiscoveryTab.tsx b/frontend-modern/src/components/Discovery/DiscoveryTab.tsxindex be83b84fa6..c713453215 100644--- a/frontend-modern/src/components/Discovery/DiscoveryTab.tsx+++ b/frontend-modern/src/components/Discovery/DiscoveryTab.tsx@@ -14,6 +14,10 @@ import {getDiscoverySuggestedURLFallback,getDiscoveryURLSuggestionSourceLabel,} from '@/utils/discoveryPresentation';+import {+ DISCOVERY_ANALYSIS_EXPLANATION,+ DISCOVERY_ANALYSIS_REASONING_LABEL,+} from '@/utils/resourceAnalysisPresentation';import { useDiscoveryTabState } from './useDiscoveryTabState';interface DiscoveryTabProps {@@ -92,7 +96,7 @@ export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {return (<div class="space-y-4">- {/* AI Provider Badge - Always visible when AI is configured */}+ {/* Analysis provider badge - shown when a provider is configured */}<Show when={!discoveryInfo.loading && discoveryInfo()?.ai_provider}><div class="flex items-center gap-2"><Show@@ -128,7 +132,7 @@ export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {</div></Show>- {/* "What Discovery Does" Explanation - Shown when no discovery yet */}+ {/* "What Discovery Does" explanation - shown when no discovery exists yet */}<Show when={!discovery() && !isScanning() && !showLoadingSpinner() && showExplanation()}><div class="rounded border border-amber-200 bg-amber-50 p-3 shadow-sm dark:border-amber-800 dark:bg-amber-900"><div class="flex items-start justify-between gap-3">@@ -149,9 +153,7 @@ export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {<div class="text-xs text-amber-800 dark:text-amber-200"><p class="font-medium mb-1">What Discovery Does</p><p class="text-amber-700 dark:text-amber-300">- Discovery runs read-only commands to gather system information (processes, ports,- services), then uses AI to analyze and identify what's running. No data is stored- externally - only the analysis result is saved locally.+ {DISCOVERY_ANALYSIS_EXPLANATION}</p></div></div>@@ -770,11 +772,11 @@ export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {</Show></div>- {/* AI Reasoning (collapsible) */}+ {/* Analysis reasoning (collapsible) */}<Show when={d().ai_reasoning}><details class="rounded border shadow-sm"><summary class="p-3 text-[11px] font-medium uppercase tracking-wide text-base-content cursor-pointer hover:bg-surface-hover">- AI Reasoning+ {DISCOVERY_ANALYSIS_REASONING_LABEL}</summary><div class="px-3 pb-3"><p class="text-xs text-muted">{d().ai_reasoning}</p>diff --git a/frontend-modern/src/components/Discovery/__tests__/DiscoveryTab.test.tsx b/frontend-modern/src/components/Discovery/__tests__/DiscoveryTab.test.tsxindex b9bc64a426..8c4ed33bc4 100644--- a/frontend-modern/src/components/Discovery/__tests__/DiscoveryTab.test.tsx+++ b/frontend-modern/src/components/Discovery/__tests__/DiscoveryTab.test.tsx@@ -15,7 +15,9 @@ vi.mock('@/api/discovery', () => {};});+import * as discoveryApi from '@/api/discovery';import { DiscoveryTab } from '@/components/Discovery/DiscoveryTab';+describe('DiscoveryTab', () => {afterEach(() => {cleanup();@@ -29,4 +31,52 @@ describe('DiscoveryTab', () => {expect(await screen.findByRole('button', { name: 'Run Discovery Now' })).toBeInTheDocument();});++ it('renders task-first analysis copy for provider and reasoning context', async () => {+ vi.mocked(discoveryApi.getDiscoveryInfo).mockResolvedValue({+ ai_provider: {+ provider: 'anthropic',+ model: 'claude-haiku-4-5',+ is_local: false,+ label: 'Cloud (Anthropic)',+ },+ commands: [],+ command_categories: [],+ });+ vi.mocked(discoveryApi.getDiscovery).mockResolvedValue({+ id: 'discovery-1',+ resource_type: 'agent',+ resource_id: 'agent-1',+ target_id: 'agent-1',+ agent_id: 'agent-1',+ hostname: 'pve1',+ service_type: 'database',+ service_name: 'postgresql',+ service_version: '16.1',+ category: 'database',+ cli_access: 'psql',+ facts: [],+ config_paths: [],+ data_paths: [],+ log_paths: [],+ ports: [],+ user_notes: '',+ user_secrets: {},+ confidence: 0.72,+ ai_reasoning: 'Mapped open ports and running processes to a PostgreSQL service.',+ discovered_at: '2026-04-15T00:00:00Z',+ updated_at: '2026-04-15T00:00:00Z',+ scan_duration: 12,+ });++ render(() => (+ <DiscoveryTab resourceType="agent" agentId="agent-1" resourceId="agent-1" hostname="pve1" />+ ));++ expect(await screen.findByText('Analysis: Cloud (Anthropic)')).toBeInTheDocument();+ expect(await screen.findByText('Analysis Reasoning')).toBeInTheDocument();+ expect(+ await screen.findByText('Mapped open ports and running processes to a PostgreSQL service.'),+ ).toBeInTheDocument();+ });});diff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsxindex 851a37148e..e6e8756688 100644--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx@@ -39,6 +39,10 @@ import { formatIdentifierLabel } from '@/utils/textPresentation';import { shouldShowResourcePlatformId } from '@/utils/resourceIdentity';import { buildInfrastructureResourceHref } from '@/routing/resourceLinks';import { getDiscoveryLoadingState } from '@/utils/discoveryPresentation';+import {+ RESOURCE_ANALYSIS_LABEL,+ RESOURCE_SAFE_SUMMARY_LABEL,+} from '@/utils/resourceAnalysisPresentation';import { formatInteger } from './resourceDetailMappers';import {ResourceDetailDrawerSupportDisclosure as SupportDisclosure,@@ -637,7 +641,7 @@ export const ResourceDetailDrawerOverviewTab: Component<ResourceDetailDrawerOver{(intel) => (<div class="space-y-1.5 text-[11px]"><div class="flex items-center justify-between gap-2">- <span class="text-muted uppercase tracking-wide">AI</span>+ <span class="text-muted uppercase tracking-wide">{RESOURCE_ANALYSIS_LABEL}</span></div><div class="flex items-center justify-between gap-2"><span class="text-muted">Health</span>@@ -739,7 +743,7 @@ export const ResourceDetailDrawerOverviewTab: Component<ResourceDetailDrawerOver</Show><Show when={drawer.governanceSummary()}><div class="flex flex-col gap-1">- <span class="text-muted">AI-Safe Summary</span>+ <span class="text-muted">{RESOURCE_SAFE_SUMMARY_LABEL}</span><div class="rounded border border-border bg-surface-hover px-2 py-1.5 text-[10px] text-base-content">{drawer.governanceSummary()}</div>diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsxindex deb72438b5..0e2856b815 100644--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx@@ -438,14 +438,14 @@ describe('ResourceDetailDrawer change history section', () => {expect(screen.queryByText('VM Child')).toBeNull();expect(screen.queryByText('Capabilities 1')).toBeNull();expect(screen.queryByText('Relationships 1')).toBeNull();- expect(screen.queryByText('AI')).toBeNull();+ expect(screen.queryByText('Analysis')).toBeNull();fireEvent.click(screen.getByRole('button', { name: 'Show access' }));expect(screen.getByText('Analysis')).toBeInTheDocument();expect(screen.getByRole('button', { name: 'Open analysis' })).toBeInTheDocument();fireEvent.click(screen.getByRole('button', { name: 'Show context' }));- await screen.findByText('AI');+ await within(screen.getByTestId('resource-investigation-context')).findByText('Analysis');expect(screen.getByTestId('resource-investigation-context')@@ -503,7 +503,7 @@ describe('ResourceDetailDrawer change history section', () => {await screen.findByText('Current state');expect(screen.queryByText('Context')).toBeNull();expect(screen.queryByText('Governance')).toBeNull();- expect(screen.queryByText('AI-Safe Summary')).toBeNull();+ expect(screen.queryByText('Safe Summary')).toBeNull();expect(screen.queryByText('Routing Cloud Summary')).toBeNull();});diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsxindex d67b2021fb..176132c2e7 100644--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx@@ -547,7 +547,7 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {expect(overflowRender.container.querySelector('details')).toBeTruthy();});- it('surfaces policy governance details and AI-safe summary', () => {+ it('surfaces policy governance details and the safe summary', () => {const resource = baseResource({id: 'sensitive-resource-1',name: 'sensitive-host',@@ -560,7 +560,7 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {redact: ['hostname', 'ip-address', 'alias'],},},- aiSafeSummary: 'restricted host summary safe for remote AI consumption',+ aiSafeSummary: 'restricted host summary safe for remote provider consumption',});const { getAllByText, getByRole, getByText, queryByText } = render(() => (@@ -569,17 +569,17 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {expect(getByText('Context')).toBeInTheDocument();expect(queryByText('Governance')).toBeNull();- expect(queryByText('AI-Safe Summary')).toBeNull();+ expect(queryByText('Safe Summary')).toBeNull();fireEvent.click(getByRole('button', { name: 'Show context' }));expect(getByText('Governance')).toBeInTheDocument();expect(getByText('Redactions')).toBeInTheDocument();- expect(getByText('AI-Safe Summary')).toBeInTheDocument();+ expect(getByText('Safe Summary')).toBeInTheDocument();expect(getAllByText('Restricted').length).toBeGreaterThan(0);expect(getAllByText('Local Only').length).toBeGreaterThan(0);expect(getByText('Hostname')).toBeInTheDocument();expect(getByText('IP Address')).toBeInTheDocument();expect(- getAllByText('restricted host summary safe for remote AI consumption').length,+ getAllByText('restricted host summary safe for remote provider consumption').length,).toBeGreaterThan(0);expect(getByText('Sensitive Host')).toBeInTheDocument();expect(queryByText('sensitive-host')).toBeNull();@@ -604,15 +604,15 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {));expect(getByText('Context')).toBeInTheDocument();- expect(queryByText('AI-Safe Summary')).toBeNull();+ expect(queryByText('Safe Summary')).toBeNull();fireEvent.click(getByRole('button', { name: 'Show context' }));- expect(getByText('AI-Safe Summary')).toBeInTheDocument();+ expect(getByText('Safe Summary')).toBeInTheDocument();expect(getAllByText('redacted by policy').length).toBeGreaterThan(0);});- it('surfaces canonical AI intelligence for the resource overview', async () => {+ it('surfaces canonical analysis context for the resource overview', async () => {const resource = baseResource({});- const { getByRole, getByText, queryByText } = render(() => (+ const { getByRole, getByTestId, getByText, queryByText } = render(() => (<ResourceDetailDrawer resource={resource} />));@@ -620,10 +620,12 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {expect(getByText('Context')).toBeInTheDocument();});- expect(queryByText('AI')).toBeNull();+ expect(queryByText('Analysis')).toBeNull();fireEvent.click(getByRole('button', { name: 'Show context' }));await waitFor(() => {- expect(getByText('AI')).toBeInTheDocument();+ expect(+ within(getByTestId('resource-investigation-context')).getByText('Analysis'),+ ).toBeInTheDocument();});expect(getByText('Health')).toBeInTheDocument();expect(getByText('A · 92/100')).toBeInTheDocument();diff --git a/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts b/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.tsindex 705c5ab626..cfc00cef37 100644--- a/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts+++ b/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts@@ -23,6 +23,7 @@ import {getResourceRoutingScopeLabel,hasDefaultResourcePolicyPosture,} from '@/utils/resourcePolicyPresentation';+import { formatResourceAnalysisSummary } from '@/utils/resourceAnalysisPresentation';import type { ResourceIntelligence } from '@/types/aiIntelligence';import {buildTemperatureRows,@@ -189,7 +190,7 @@ export const useResourceDetailDrawerDerivedState = (const summary: string[] = [];if (intel && hasMeaningfulResourceIntelligence()) {- summary.push(`AI ${intel.health.grade} · ${Math.round(intel.health.score)}/100`);+ summary.push(formatResourceAnalysisSummary(intel.health.grade, intel.health.score));}if (resourceCorrelations().length > 0) {summary.push(diff --git a/frontend-modern/src/hooks/useWorkloads.ts b/frontend-modern/src/hooks/useWorkloads.tsindex 884084723f..f9b96b0e34 100644--- a/frontend-modern/src/hooks/useWorkloads.ts+++ b/frontend-modern/src/hooks/useWorkloads.ts@@ -12,7 +12,11 @@ import { eventBus } from '@/stores/events';import { resolvePlatformTypeFromSources } from '@/utils/sourcePlatforms';import { canonicalDiscoveryResourceType } from '@/utils/discoveryTarget';import { normalizeDiskArray } from '@/utils/format';-import { isDockerManagedAppContainer, resolveWorkloadTypeFromString } from '@/utils/workloads';+import {+ buildCanonicalNodeScopedWorkloadId,+ isDockerManagedAppContainer,+ resolveWorkloadTypeFromString,+} from '@/utils/workloads';import {getPreferredResourceClusterName,getPreferredResourceKubernetesContext,@@ -364,13 +368,15 @@ const mapResourceToWorkload = (resource: APIResource): WorkloadGuest | null => {// routing, discovery, anomalies, and drawer selection align with the shared// resource model.const guestId = (() => {- if (- (workloadType === 'vm' || workloadType === 'system-container') &&- instance &&- node &&- vmid > 0- ) {- return `${instance}:${node}:${vmid}`;+ if (workloadType === 'vm' || workloadType === 'system-container') {+ const canonicalId = buildCanonicalNodeScopedWorkloadId({+ instance,+ node,+ vmid,+ });+ if (canonicalId) {+ return canonicalId;+ }}if (workloadType === 'pod') {const clusterId = resource.kubernetes?.clusterId;diff --git a/frontend-modern/src/routing/__tests__/resourceLinks.test.ts b/frontend-modern/src/routing/__tests__/resourceLinks.test.tsindex f98e88788a..8dce880de2 100644--- a/frontend-modern/src/routing/__tests__/resourceLinks.test.ts+++ b/frontend-modern/src/routing/__tests__/resourceLinks.test.ts@@ -221,6 +221,30 @@ describe('resource link routing contract', () => {);});+ it('builds exact workloads links for Proxmox system-container resources using canonical guest ids', () => {+ expect(+ buildWorkloadsHrefForResource({+ id: 'system-container-45cf61f16a6e2c16',+ type: 'system-container',+ name: 'artifact-cache-01',+ displayName: 'Artifact Cache 01',+ platformId: 'pve2',+ platformType: 'proxmox-pve',+ sourceType: 'api',+ status: 'online',+ lastSeen: Date.now(),+ clusterId: 'Core Fabric',+ proxmox: {+ node: 'pve2',+ instance: 'Core Fabric',+ vmid: 112,+ },+ } as any),+ ).toBe(+ '/workloads?type=system-container&platform=proxmox-pve&agent=pve2&resource=Core+Fabric%3Apve2%3A112',+ );+ });+it('maps pod workloads to kubernetes infrastructure source with cluster query', () => {const href = buildInfrastructureHrefForWorkload(baseGuest({diff --git a/frontend-modern/src/routing/resourceLinks.ts b/frontend-modern/src/routing/resourceLinks.tsindex 5233b62821..2dd083dcbe 100644--- a/frontend-modern/src/routing/resourceLinks.ts+++ b/frontend-modern/src/routing/resourceLinks.ts@@ -7,6 +7,7 @@ import { normalizeStorageSourceKey } from '@/utils/storageSources';import { normalizeRecoveryItemTypeQueryValue } from '@/utils/recoveryItemTypePresentation';import {canonicalizeWorkloadFilterType,+ getCanonicalWorkloadIdForResource,resolveWorkloadType,} from '@/utils/workloads';import type { WorkloadGuest } from '@/types/workloads';@@ -354,7 +355,7 @@ export const buildWorkloadsHrefForResource = (resource: Resource): string | nulltype: resource.type,platform: resource.platformType,agent: firstNonEmpty([resource.parentId, resource.platformId]),- resource: resource.id,+ resource: getCanonicalWorkloadIdForResource(resource),});}diff --git a/frontend-modern/src/utils/__tests__/resourceAnalysisPresentation.test.ts b/frontend-modern/src/utils/__tests__/resourceAnalysisPresentation.test.tsnew file mode 100644index 0000000000..0557f32be9--- /dev/null+++ b/frontend-modern/src/utils/__tests__/resourceAnalysisPresentation.test.ts@@ -0,0 +1,26 @@+import { describe, expect, it } from 'vitest';++import {+ DISCOVERY_ANALYSIS_EXPLANATION,+ DISCOVERY_ANALYSIS_REASONING_LABEL,+ RESOURCE_ANALYSIS_LABEL,+ RESOURCE_SAFE_SUMMARY_LABEL,+ formatResourceAnalysisSummary,+} from '@/utils/resourceAnalysisPresentation';++describe('resourceAnalysisPresentation', () => {+ it('keeps resource investigation labels product-neutral', () => {+ expect(RESOURCE_ANALYSIS_LABEL).toBe('Analysis');+ expect(RESOURCE_SAFE_SUMMARY_LABEL).toBe('Safe Summary');+ expect(DISCOVERY_ANALYSIS_REASONING_LABEL).toBe('Analysis Reasoning');+ });++ it('formats resource analysis summaries with rounded health scores', () => {+ expect(formatResourceAnalysisSummary('A', 91.6)).toBe('Analysis A · 92/100');+ });++ it('keeps discovery explanation focused on the configured analysis provider', () => {+ expect(DISCOVERY_ANALYSIS_EXPLANATION).toContain('configured analysis provider');+ expect(DISCOVERY_ANALYSIS_EXPLANATION).not.toContain('uses AI');+ });+});diff --git a/frontend-modern/src/utils/__tests__/workloads.test.ts b/frontend-modern/src/utils/__tests__/workloads.test.tsindex 6978de1825..e6d1865762 100644--- a/frontend-modern/src/utils/__tests__/workloads.test.ts+++ b/frontend-modern/src/utils/__tests__/workloads.test.ts@@ -1,5 +1,6 @@import { describe, expect, it } from 'vitest';import {+ buildCanonicalNodeScopedWorkloadId,canonicalizeWorkloadFilterType,getDiscoveryResourceTypeForWorkload,normalizeWorkloadViewModeParam,@@ -7,6 +8,7 @@ import {resolveWorkloadTypeFromString,getWorkloadMetricsKind,getCanonicalWorkloadId,+ getCanonicalWorkloadIdForResource,isDockerManagedAppContainer,getWebInterfaceTargetLabelForWorkload,} from '@/utils/workloads';@@ -206,6 +208,54 @@ describe('getCanonicalWorkloadId', () => {});});+describe('buildCanonicalNodeScopedWorkloadId', () => {+ it('builds canonical ids from instance, node, and vmid', () => {+ expect(+ buildCanonicalNodeScopedWorkloadId({+ instance: 'Core Fabric',+ node: 'pve2',+ vmid: 112,+ }),+ ).toBe('Core Fabric:pve2:112');+ });++ it('returns null when any canonical part is missing', () => {+ expect(buildCanonicalNodeScopedWorkloadId({ instance: 'Core Fabric', node: '', vmid: 112 })).toBeNull();+ expect(buildCanonicalNodeScopedWorkloadId({ instance: '', node: 'pve2', vmid: 112 })).toBeNull();+ expect(buildCanonicalNodeScopedWorkloadId({ instance: 'Core Fabric', node: 'pve2', vmid: 0 })).toBeNull();+ });+});++describe('getCanonicalWorkloadIdForResource', () => {+ it('uses proxmox guest identity for vm and system-container resources', () => {+ expect(+ getCanonicalWorkloadIdForResource({+ id: 'system-container-45cf61f16a6e2c16',+ type: 'system-container',+ clusterId: 'Core Fabric',+ proxmox: {+ node: 'pve2',+ vmid: 112,+ },+ } as any),+ ).toBe('Core Fabric:pve2:112');+ });++ it('falls back to the resource id when canonical guest identity is incomplete', () => {+ expect(+ getCanonicalWorkloadIdForResource({+ id: 'vm-123',+ type: 'vm',+ clusterId: '',+ proxmox: {+ node: 'pve1',+ vmid: 0,+ },+ } as any),+ ).toBe('vm-123');+ });+});+describe('isDockerManagedAppContainer', () => {it('returns true for docker-platform app containers', () => {expect(diff --git a/frontend-modern/src/utils/resourceAnalysisPresentation.ts b/frontend-modern/src/utils/resourceAnalysisPresentation.tsnew file mode 100644index 0000000000..8ee4333ba8--- /dev/null+++ b/frontend-modern/src/utils/resourceAnalysisPresentation.ts@@ -0,0 +1,8 @@+export const RESOURCE_ANALYSIS_LABEL = 'Analysis';+export const RESOURCE_SAFE_SUMMARY_LABEL = 'Safe Summary';+export const DISCOVERY_ANALYSIS_REASONING_LABEL = 'Analysis Reasoning';+export const DISCOVERY_ANALYSIS_EXPLANATION =+ 'Discovery runs read-only commands to gather system information (processes, ports, services), then uses the configured analysis provider to identify what is running. No data is stored externally; only the analysis result is saved locally.';++export const formatResourceAnalysisSummary = (grade: string, score: number): string =>+ `${RESOURCE_ANALYSIS_LABEL} ${grade} · ${Math.round(score)}/100`;diff --git a/frontend-modern/src/utils/workloads.ts b/frontend-modern/src/utils/workloads.tsindex 2b2197c400..8b7f2ea6d2 100644--- a/frontend-modern/src/utils/workloads.ts+++ b/frontend-modern/src/utils/workloads.ts@@ -1,6 +1,6 @@import type { WorkloadGuest, WorkloadType, ViewMode } from '@/types/workloads';import type { ResourceType as DiscoveryResourceType } from '@/types/discovery';-import type { ResourceDiscoveryTarget } from '@/types/resource';+import type { Resource, ResourceDiscoveryTarget } from '@/types/resource';import type { MetricResourceKind } from '@/utils/metricsKeys';import { canonicalizeFrontendResourceType } from '@/utils/resourceTypeCompat';import { canonicalDiscoveryResourceType } from '@/utils/discoveryTarget';@@ -95,17 +95,58 @@ export const getCanonicalWorkloadId = (guest: Pick<WorkloadGuest, 'id' | 'workloadType' | 'type' | 'instance' | 'node' | 'vmid'>,): string => {const type = resolveWorkloadType(guest);- if (- (type === 'vm' || type === 'system-container') &&- guest.instance &&- guest.node &&- guest.vmid > 0- ) {- return `${guest.instance}:${guest.node}:${guest.vmid}`;+ if (type === 'vm' || type === 'system-container') {+ const canonicalId = buildCanonicalNodeScopedWorkloadId({+ instance: guest.instance,+ node: guest.node,+ vmid: guest.vmid,+ });+ if (canonicalId) {+ return canonicalId;+ }}return guest.id;};+type NodeScopedWorkloadIdentity = {+ instance?: string | null;+ node?: string | null;+ vmid?: number | null;+};++const normalizeNodeScopedWorkloadKeyPart = (value?: string | null): string =>+ (value || '').trim();++export const buildCanonicalNodeScopedWorkloadId = ({+ instance,+ node,+ vmid,+}: NodeScopedWorkloadIdentity): string | null => {+ const normalizedInstance = normalizeNodeScopedWorkloadKeyPart(instance);+ const normalizedNode = normalizeNodeScopedWorkloadKeyPart(node);+ const normalizedVmid = Number.isFinite(vmid) ? Number(vmid) : 0;+ if (!normalizedInstance || !normalizedNode || normalizedVmid <= 0) {+ return null;+ }+ return `${normalizedInstance}:${normalizedNode}:${normalizedVmid}`;+};++export const getCanonicalWorkloadIdForResource = (+ resource: Pick<Resource, 'id' | 'type' | 'clusterId' | 'proxmox'>,+): string => {+ if (resource.type === 'vm' || resource.type === 'system-container') {+ const canonicalId = buildCanonicalNodeScopedWorkloadId({+ instance: resource.proxmox?.instance || resource.clusterId,+ node: resource.proxmox?.node || resource.proxmox?.nodeName,+ vmid: resource.proxmox?.vmid,+ });+ if (canonicalId) {+ return canonicalId;+ }+ }+ return resource.id;+};+export const resolveDiscoveryTargetForWorkload = (guest: Pick<WorkloadGuest,