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
Fix VMware connection test degradation handling
rcourtman13c4b5788542
diff --git a/docs/release-control/v6/internal/VMWARE_VCENTER_PHASE1_API_RUNTIME_SPEC.md b/docs/release-control/v6/internal/VMWARE_VCENTER_PHASE1_API_RUNTIME_SPEC.mdindex 1e37860501..79089bba83 100644--- a/docs/release-control/v6/internal/VMWARE_VCENTER_PHASE1_API_RUNTIME_SPEC.md+++ b/docs/release-control/v6/internal/VMWARE_VCENTER_PHASE1_API_RUNTIME_SPEC.md@@ -122,6 +122,17 @@ Phase-1 rule:through the shared browser client so the settings workflow can distinguishversion-floor, auth, TLS, permission, and network failures without aVMware-only fetch path+6. once endpoint, TLS, Automation session, base inventory, VI JSON release+ negotiation and login, and the performance-counter catalog have succeeded,+ optional signal or performance reads must use the same partial-success+ classification as runtime polling; `permission`, `not_found`, `unavailable`,+ and `endpoint` failures return a successful but explicitly `degraded` test+ result with the negotiated `viRelease`, `issueCount`, and preserved `issues`,+ while authentication, TLS, network, and required-family failures remain hard+ connection-test failures+7. the settings workflow must render that degraded result as a warning with the+ upstream diagnostic, never as a fully green connection or as a total+ connection failure## Runtime Health And Poll Summary Contractdiff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex a32c367dd6..6a147e6b51 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -3573,6 +3573,12 @@ saved-connection preview/test/update payloads must preserve stored enablementunless the caller explicitly changes it, so setup surfaces do not accidentallypreview an unchanged active connection as inactive just because JSON omitted abool field.+The VMware credential editor must also distinguish required-floor failure from+optional enrichment degradation. When the canonical connection-test response+is successful but `degraded`, the editor must keep the exact upstream+diagnostic visible in a limited-data warning and identify the negotiated VI+JSON release when available; it must not show the test as fully green or route+the warning through the hard-failure presentation.That same validation contract must stay coherent across the public`/api/auto-register` route and the direct canonical handler path used by thesame runtime surface, so Unified Agent/setup entry points do not inherit divergentdiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 0a3fda02f8..c474f698cb 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -5360,6 +5360,17 @@ preserve the canonical top-level `code` plus string-valued `details.error` and`frontend-modern/src/utils/apiClient.ts` plus`frontend-modern/src/api/responseUtils.ts` must carry that metadata through theshared error object without inventing a VMware-only fetch or parsing path.+After the required endpoint, TLS, Automation API session, base inventory,+negotiated VI JSON login, and performance-counter catalog gates succeed, those+same test routes must classify optional signal and performance read failures+the same way as the live poller. Non-fatal enrichment categories+(`permission`, `not_found`, `unavailable`, and `endpoint`) return+`success: true` with `degraded`, the negotiated `viRelease`, `issueCount`, and+preserved `issues`; authentication, TLS, network, unsupported-version, and+required API-family failures remain hard failures. A degraded response is not+a green test: the shared VMware settings client must preserve the diagnostic+and present a limited-data warning instead of converting the optional upstream+failure into either generic success or total connection failure.That same TrueNAS and VMware platform-connections contract now also ownsper-surface scope as a first-class field on the connection shape. TheTrueNAS connection payload must carry positive `monitorDatasets`,diff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.mdindex 9d40299be9..95af0739ef 100644--- a/docs/release-control/v6/internal/subsystems/monitoring.md+++ b/docs/release-control/v6/internal/subsystems/monitoring.md@@ -827,6 +827,13 @@ with no edit overlay must refresh that same summary owner, andrecomputing or shadowing it inside handler-local runtime state. Internalsub-second test harness intervals must not leak `intervalSeconds: 0` onto thatoperator-facing contract.+Manual saved-connection tests that prove the required VMware API floor but+encounter non-fatal optional signal or performance failures must record a+successful poll attempt together with `observed.degraded`, `issueCount`, and+the summarized upstream diagnostics. They must not erase the same+partial-success evidence that a live inventory poll would publish, while+authentication, TLS, network, and required API-family failures must continue+to increment canonical poll failure state.That same monitoring boundary now also owns runtime mock rebind continuity forAPI-backed supplemental providers. When `/api/system/mock-mode` flips on arunning server, the live TrueNAS and VMware provider bindings must swap to thediff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 3d6342e0bf..89ff344b47 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -1287,6 +1287,11 @@ recovery scope, or a storage/recovery-owned secret source.aliases.27. Keep alert-side recovery drill-ins on that same embedded-owner route-state 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 an owning platform/runtime destination using canonical recovery query vocabulary instead of freezing alert-local recovery URLs, reviving the retired Recovery aggregate route, 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.+ A successful VMware connection test with `degraded` optional signal or+ performance diagnostics remains connection-readiness context only; storage+ and recovery must not reinterpret that warning as datastore protection+ damage, snapshot recovery failure, restore readiness, or recovery-point+ evidence.The shared route-registration file may also expose the authenticatedrunning-release notes endpoint for deployment/update presentation. Thatroute remains deployment-installability and API-contract owned; storagediff --git a/frontend-modern/src/api/__tests__/vmware.test.ts b/frontend-modern/src/api/__tests__/vmware.test.tsindex 47dc404a0a..dd6ea240fb 100644--- a/frontend-modern/src/api/__tests__/vmware.test.ts+++ b/frontend-modern/src/api/__tests__/vmware.test.ts@@ -188,7 +188,17 @@ describe('VMwareAPI', () => {username: '[email protected]',password: 'secret',}),- ).resolves.toEqual({ success: true });+ ).resolves.toEqual({+ success: true,+ hosts: 0,+ vms: 0,+ datastores: 0,+ networks: 0,+ viRelease: undefined,+ degraded: false,+ issueCount: 0,+ issues: [],+ });await expect(VMwareAPI.testSavedConnection('conn/1', {host: 'vcsa.lab.local',@@ -196,7 +206,17 @@ describe('VMwareAPI', () => {password: '********',insecureSkipVerify: true,}),- ).resolves.toEqual({ success: true });+ ).resolves.toEqual({+ success: true,+ hosts: 0,+ vms: 0,+ datastores: 0,+ networks: 0,+ viRelease: undefined,+ degraded: false,+ issueCount: 0,+ issues: [],+ });expect(apiFetchJSON).toHaveBeenNthCalledWith(1,@@ -260,6 +280,54 @@ describe('VMwareAPI', () => {);});+ it('preserves degraded connection-test diagnostics', async () => {+ vi.mocked(apiFetchJSON).mockResolvedValueOnce({+ success: true,+ hosts: 2,+ vms: 14,+ datastores: 3,+ networks: 5,+ viRelease: ' 8.0.2.0 ',+ degraded: true,+ issueCount: 1,+ issues: [+ {+ stage: ' signals ',+ entity_type: ' host ',+ entity_id: ' host-101 ',+ category: ' endpoint ',+ message: ' VMware HostSystem recent events request failed with HTTP 500 ',+ },+ ],+ });++ await expect(+ VMwareAPI.testSavedConnection('conn-1', {+ host: 'vcsa.lab.local',+ username: '[email protected]',+ password: '********',+ }),+ ).resolves.toEqual({+ success: true,+ hosts: 2,+ vms: 14,+ datastores: 3,+ networks: 5,+ viRelease: '8.0.2.0',+ degraded: true,+ issueCount: 1,+ issues: [+ {+ stage: 'signals',+ entityType: 'host',+ entityId: 'host-101',+ category: 'endpoint',+ message: 'VMware HostSystem recent events request failed with HTTP 500',+ },+ ],+ });+ });+it('recognizes the masked-secret placeholder used for update preservation', () => {expect(isRedactedVMwareSecret('********')).toBe(true);expect(isRedactedVMwareSecret(' ******** ')).toBe(true);diff --git a/frontend-modern/src/api/vmware.ts b/frontend-modern/src/api/vmware.tsindex f7526ee29e..18e7a06f83 100644--- a/frontend-modern/src/api/vmware.ts+++ b/frontend-modern/src/api/vmware.ts@@ -86,8 +86,52 @@ export interface VMwareConnectionInput {export interface VMwareConnectionTestResult {success: boolean;+ hosts: number;+ vms: number;+ datastores: number;+ networks: number;+ viRelease?: string;+ degraded: boolean;+ issueCount: number;+ issues: VMwareConnectionTestIssue[];}+export interface VMwareConnectionTestIssue {+ stage?: string;+ entityType?: string;+ entityId?: string;+ category?: string;+ message?: string;+}++type RawVMwareConnectionTestIssue = Partial<VMwareConnectionTestIssue> & {+ entity_type?: unknown;+ entity_id?: unknown;+};++const normalizeVMwareConnectionTestResult = (+ response: Partial<VMwareConnectionTestResult> & {+ issues?: RawVMwareConnectionTestIssue[];+ },+): VMwareConnectionTestResult => ({+ success: strictBoolean(response.success),+ hosts: finiteNumberOrUndefined(response.hosts) ?? 0,+ vms: finiteNumberOrUndefined(response.vms) ?? 0,+ datastores: finiteNumberOrUndefined(response.datastores) ?? 0,+ networks: finiteNumberOrUndefined(response.networks) ?? 0,+ viRelease: optionalTrimmedString(response.viRelease),+ degraded: strictBoolean(response.degraded),+ issueCount: finiteNumberOrUndefined(response.issueCount) ?? 0,+ issues:+ arrayOrUndefined<RawVMwareConnectionTestIssue>(response.issues)?.map((issue) => ({+ stage: optionalTrimmedString(issue.stage),+ entityType: optionalTrimmedString(issue.entityType ?? issue.entity_type),+ entityId: optionalTrimmedString(issue.entityId ?? issue.entity_id),+ category: optionalTrimmedString(issue.category),+ message: optionalTrimmedString(issue.message),+ })) ?? [],+});+const normalizeVMwareConnectionPollError = (error: RawVMwareConnectionPollError | undefined,): VMwareConnectionPollError | undefined => {@@ -213,9 +257,7 @@ export class VMwareAPI {body: JSON.stringify(serializeVMwareConnectionInput(input)),},);- return {- success: strictBoolean(response.success),- };+ return normalizeVMwareConnectionTestResult(response);}static async testSavedConnection(@@ -231,9 +273,7 @@ export class VMwareAPI {: {}),},);- return {- success: strictBoolean(response.success),- };+ return normalizeVMwareConnectionTestResult(response);}static async previewConnection(diff --git a/frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/VMwareCredentialSlot.tsx b/frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/VMwareCredentialSlot.tsxindex 9469786430..ee7307a3b7 100644--- a/frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/VMwareCredentialSlot.tsx+++ b/frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/VMwareCredentialSlot.tsx@@ -90,6 +90,23 @@ export const VMwareCredentialSlot: Component<VMwareCredentialSlotProps> = (props)}</Show>+ <Show when={props.state.connectionTestWarning()}>+ {(warning) => (+ <CalloutCard+ data-testid="vmware-connection-test-warning"+ tone="warning"+ title={warning().title}+ description={+ <>+ <p>{warning().message}</p>+ <p class="mt-2">{warning().guidance}</p>+ </>+ }+ icon={<ShieldAlert class="h-5 w-5" />}+ />+ )}+ </Show>+<div class="grid gap-4 sm:grid-cols-2"><label class={formField}><span class={formLabel}>Name</span>diff --git a/frontend-modern/src/components/Settings/__tests__/useVMwareSettingsPanelState.test.tsx b/frontend-modern/src/components/Settings/__tests__/useVMwareSettingsPanelState.test.tsxindex 29b37fa039..919bd54cdc 100644--- a/frontend-modern/src/components/Settings/__tests__/useVMwareSettingsPanelState.test.tsx+++ b/frontend-modern/src/components/Settings/__tests__/useVMwareSettingsPanelState.test.tsx@@ -22,6 +22,7 @@ vi.mock('@/stores/notifications', () => ({notificationStore: {success: vi.fn(),error: vi.fn(),+ warning: vi.fn(),},}));@@ -222,6 +223,59 @@ describe('useVMwareSettingsPanelState', () => {expect(notificationStore.success).toHaveBeenCalledWith('VMware connection successful');});+ it('reports optional VMware test failures as a degraded success with diagnostics', async () => {+ vi.mocked(VMwareAPI.listConnections).mockResolvedValueOnce([+ {+ id: 'conn-1',+ name: 'lab-vcenter',+ host: 'vcsa.lab.local',+ port: 443,+ username: '[email protected]',+ password: '********',+ insecureSkipVerify: true,+ enabled: true,+ },+ ] as never);+ vi.mocked(VMwareAPI.testSavedConnection).mockResolvedValueOnce({+ success: true,+ hosts: 2,+ vms: 14,+ datastores: 3,+ networks: 5,+ viRelease: '8.0.2.0',+ degraded: true,+ issueCount: 1,+ issues: [+ {+ stage: 'signals',+ entityType: 'host',+ entityId: 'host-101',+ category: 'endpoint',+ message: 'VMware HostSystem recent events request failed with HTTP 500',+ },+ ],+ });++ const { result } = renderHook(() => useVMwareSettingsPanelState());+ await waitFor(() => expect(result.connections()).toHaveLength(1));++ result.openEditDialog(result.connections()[0]);+ const succeeded = await result.testCurrentForm();++ expect(succeeded).toBe(true);+ expect(notificationStore.warning).toHaveBeenCalledWith(+ 'VMware HostSystem recent events request failed with HTTP 500',+ );+ expect(notificationStore.success).not.toHaveBeenCalled();+ expect(result.connectionFailure()).toBeNull();+ expect(result.connectionTestWarning()).toEqual({+ title: 'VMware connection has limited data access',+ message: 'VMware HostSystem recent events request failed with HTTP 500',+ guidance:+ 'Core inventory, authentication, and API compatibility checks succeeded using VI JSON 8.0.2.0. Pulse will keep monitoring and report affected optional data as degraded.',+ });+ });+it('saves a connection without requiring a monitored-system preview', async () => {vi.mocked(VMwareAPI.listConnections).mockResolvedValueOnce([] as never)diff --git a/frontend-modern/src/components/Settings/useVMwareSettingsPanelState.ts b/frontend-modern/src/components/Settings/useVMwareSettingsPanelState.tsindex ee38089259..88461031a3 100644--- a/frontend-modern/src/components/Settings/useVMwareSettingsPanelState.ts+++ b/frontend-modern/src/components/Settings/useVMwareSettingsPanelState.ts@@ -5,6 +5,7 @@ import {isRedactedVMwareSecret,type VMwareConnection,type VMwareConnectionInput,+ type VMwareConnectionTestResult,} from '@/api/vmware';import { apiErrorCode, apiErrorDetailField, apiErrorStatus } from '@/api/responseUtils';import { notificationStore } from '@/stores/notifications';@@ -32,6 +33,12 @@ export interface VMwareConnectionFormState {hasStoredPassword: boolean;}+export interface VMwareConnectionTestWarning {+ title: string;+ message: string;+ guidance: string;+}+const REDACTED_SECRET = '********';const createEmptyFormState = (): VMwareConnectionFormState => ({@@ -93,6 +100,25 @@ const getErrorMessage = (error: unknown, fallback: string): string => {const getVMwareErrorMessage = (error: unknown, fallback: string): string =>apiErrorDetailField(error, 'error') ?? getErrorMessage(error, fallback);+const buildConnectionTestWarning = (+ result: VMwareConnectionTestResult,+): VMwareConnectionTestWarning | null => {+ if (!result.degraded) return null;+ const diagnostic =+ result.issues.find((issue) => issue.message?.trim())?.message?.trim() ||+ `${result.issueCount || result.issues.length || 1} optional VMware read${+ (result.issueCount || result.issues.length || 1) === 1 ? '' : 's'+ } could not be completed.`;+ const release = result.viRelease?.trim();+ return {+ title: 'VMware connection has limited data access',+ message: diagnostic,+ guidance: `Core inventory, authentication, and API compatibility checks succeeded${+ release ? ` using VI JSON ${release}` : ''+ }. Pulse will keep monitoring and report affected optional data as degraded.`,+ };+};+const monitoredSystemImpactPreviewUnavailableStateFromError = (error: unknown) => {return buildMonitoredSystemImpactPreviewUnavailableState({code: apiErrorCode(error),@@ -138,6 +164,8 @@ export function useVMwareSettingsPanelState() {const [previewing, setPreviewing] = createSignal(false);const [connectionFailure, setConnectionFailure] =createSignal<VMwareConnectionFailurePresentation | null>(null);+ const [connectionTestWarning, setConnectionTestWarning] =+ createSignal<VMwareConnectionTestWarning | null>(null);const [monitoredSystemPreview, setMonitoredSystemPreview] =createSignal<MonitoredSystemLedgerPreviewResponse | null>(null);const [monitoredSystemPreviewUnavailableState, setMonitoredSystemPreviewUnavailableState] =@@ -188,6 +216,7 @@ export function useVMwareSettingsPanelState() {setEditingConnectionId(null);setForm(createEmptyFormState());setConnectionFailure(null);+ setConnectionTestWarning(null);setMonitoredSystemPreview(null);setMonitoredSystemPreviewUnavailableState(null);setMonitoredSystemPreviewGenericError(null);@@ -198,6 +227,7 @@ export function useVMwareSettingsPanelState() {setEditingConnectionId(connection.id);setForm(buildFormStateFromConnection(connection));setConnectionFailure(null);+ setConnectionTestWarning(null);setMonitoredSystemPreview(null);setMonitoredSystemPreviewUnavailableState(null);setMonitoredSystemPreviewGenericError(null);@@ -209,6 +239,7 @@ export function useVMwareSettingsPanelState() {setEditingConnectionId(null);setForm(createEmptyFormState());setConnectionFailure(null);+ setConnectionTestWarning(null);setMonitoredSystemPreview(null);setMonitoredSystemPreviewUnavailableState(null);setMonitoredSystemPreviewGenericError(null);@@ -236,6 +267,7 @@ export function useVMwareSettingsPanelState() {const updateForm = (patch: Partial<VMwareConnectionFormState>) => {setConnectionFailure(null);+ setConnectionTestWarning(null);setMonitoredSystemPreview(null);setMonitoredSystemPreviewUnavailableState(null);setMonitoredSystemPreviewGenericError(null);@@ -245,14 +277,19 @@ export function useVMwareSettingsPanelState() {const testCurrentForm = async () => {setTesting(true);setConnectionFailure(null);+ setConnectionTestWarning(null);try {const payload = buildConnectionInput(form());- if (editingConnectionId()) {- await VMwareAPI.testSavedConnection(editingConnectionId()!, payload);+ const result = editingConnectionId()+ ? await VMwareAPI.testSavedConnection(editingConnectionId()!, payload)+ : await VMwareAPI.testConnection(payload);+ const warning = buildConnectionTestWarning(result);+ setConnectionTestWarning(warning);+ if (warning) {+ notificationStore.warning(warning.message);} else {- await VMwareAPI.testConnection(payload);+ notificationStore.success('VMware connection successful');}- notificationStore.success('VMware connection successful');return true;} catch (error) {const failure = buildVMwareConnectionFailurePresentation({@@ -273,10 +310,17 @@ export function useVMwareSettingsPanelState() {const testSavedConnection = async (connection: VMwareConnection) => {setTesting(true);try {- await VMwareAPI.testSavedConnection(connection.id);- notificationStore.success(- `VMware connection successful for ${connection.name || connection.host}`,- );+ const result = await VMwareAPI.testSavedConnection(connection.id);+ const warning = buildConnectionTestWarning(result);+ if (warning) {+ notificationStore.warning(+ `VMware connection for ${connection.name || connection.host} has limited data access: ${warning.message}`,+ );+ } else {+ notificationStore.success(+ `VMware connection successful for ${connection.name || connection.host}`,+ );+ }} catch (error) {const failure = buildVMwareConnectionFailurePresentation({code: apiErrorCode(error),@@ -394,6 +438,7 @@ export function useVMwareSettingsPanelState() {featureDisabledMessage,form,connectionFailure,+ connectionTestWarning,loadConnections,loading,loadingError,diff --git a/internal/api/vmware_handlers.go b/internal/api/vmware_handlers.goindex 6b9da398d9..bc7e06d74e 100644--- a/internal/api/vmware_handlers.go+++ b/internal/api/vmware_handlers.go@@ -41,6 +41,18 @@ type vmwareConnectionResponse struct {Observed *monitoring.VMwareConnectionObservedSummary `json:"observed,omitempty"`}+type vmwareConnectionTestResponse struct {+ Success bool `json:"success"`+ Hosts int `json:"hosts"`+ VMs int `json:"vms"`+ Datastores int `json:"datastores"`+ Networks int `json:"networks"`+ VIRelease string `json:"viRelease,omitempty"`+ Degraded bool `json:"degraded,omitempty"`+ IssueCount int `json:"issueCount,omitempty"`+ Issues []vmware.InventoryEnrichmentIssue `json:"issues,omitempty"`+}+type vmwareConnectionRuntimeStatus struct {Poll *monitoring.VMwareConnectionPollStatusObserved *monitoring.VMwareConnectionObservedSummary@@ -477,7 +489,7 @@ func (h *VMwareHandlers) HandleTestSavedConnection(w http.ResponseWriter, r *htth.recordTestSuccess(connectionID, summary, at)}}- writeJSON(w, http.StatusOK, map[string]any{"success": true})+ writeJSON(w, http.StatusOK, newVMwareConnectionTestResponse(summary))return}@@ -489,12 +501,30 @@ func (h *VMwareHandlers) writeConnectionTestResult(r *http.Request,instance config.VMwareVCenterInstance,) {- _, invalidConfig, err := h.testConnectionInstance(r, instance)+ summary, invalidConfig, err := h.testConnectionInstance(r, instance)if err != nil {h.writeConnectionFailure(w, invalidConfig, err)return}- writeJSON(w, http.StatusOK, map[string]any{"success": true})+ writeJSON(w, http.StatusOK, newVMwareConnectionTestResponse(summary))+}++func newVMwareConnectionTestResponse(summary *vmware.InventorySummary) vmwareConnectionTestResponse {+ response := vmwareConnectionTestResponse{Success: true}+ if summary == nil {+ return response+ }+ response.Hosts = summary.Hosts+ response.VMs = summary.VMs+ response.Datastores = summary.Datastores+ response.Networks = summary.Networks+ response.VIRelease = strings.TrimSpace(summary.VIRelease)+ response.Degraded = summary.Degraded || len(summary.Issues) > 0+ response.IssueCount = len(summary.Issues)+ if len(summary.Issues) > 0 {+ response.Issues = append([]vmware.InventoryEnrichmentIssue(nil), summary.Issues...)+ }+ return response}func (h *VMwareHandlers) writeConnectionFailure(w http.ResponseWriter, invalidConfig bool, err error) {@@ -719,6 +749,9 @@ func (h *VMwareHandlers) recordTestSuccess(connectionID string, summary *vmware.Datastores: summary.Datastores,Networks: summary.Networks,VIRelease: strings.TrimSpace(summary.VIRelease),+ Degraded: summary.Degraded || len(summary.Issues) > 0,+ IssueCount: len(summary.Issues),+ Issues: monitoring.SummarizeVMwareObservedIssues(summary.Issues),}}h.statuses[connectionID] = currentdiff --git a/internal/api/vmware_handlers_test.go b/internal/api/vmware_handlers_test.goindex ac8eece8ac..3d7b8d78ba 100644--- a/internal/api/vmware_handlers_test.go+++ b/internal/api/vmware_handlers_test.go@@ -1670,6 +1670,147 @@ func TestVMwareHandlers_HandleTestSavedConnection_MergesEditedPayloadWithoutOver}}+func TestVMwareHandlers_HandleTestSavedConnection_ReportsOptionalVIJSONFailureAsDegraded(t *testing.T) {+ setVMwareFeatureForTest(t, true)++ var serviceContentProbes []string+ upstream := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ writeUpstreamJSON := func(status int, payload any) {+ t.Helper()+ w.Header().Set("Content-Type", "application/json")+ w.WriteHeader(status)+ if err := json.NewEncoder(w).Encode(payload); err != nil {+ t.Fatalf("encode VMware upstream response: %v", err)+ }+ }++ switch {+ case r.Method == http.MethodPost && r.URL.Path == "/api/session":+ username, password, ok := r.BasicAuth()+ if !ok || username != "[email protected]" || password != "super-secret" {+ t.Fatalf("expected saved VMware credentials, got username=%q password=%q", username, password)+ }+ writeUpstreamJSON(http.StatusCreated, "automation-session")+ case r.Method == http.MethodGet && r.URL.Path == "/api/vcenter/host":+ writeUpstreamJSON(http.StatusOK, []map[string]any{{+ "host": "host-101",+ "name": "esxi-01.lab.local",+ "connection_state": "CONNECTED",+ "power_state": "POWERED_ON",+ }})+ case r.Method == http.MethodGet && (r.URL.Path == "/api/vcenter/vm" ||+ r.URL.Path == "/api/vcenter/datastore" ||+ r.URL.Path == "/api/vcenter/network"):+ writeUpstreamJSON(http.StatusOK, []map[string]any{})+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/ServiceInstance/ServiceInstance/content"):+ parts := strings.Split(r.URL.Path, "/")+ if len(parts) < 4 {+ t.Fatalf("unexpected VMware service-content path %q", r.URL.Path)+ }+ release := parts[3]+ serviceContentProbes = append(serviceContentProbes, release)+ if release != "8.0.2.0" {+ writeUpstreamJSON(http.StatusInternalServerError, map[string]any{"error": "unsupported release path"})+ return+ }+ writeUpstreamJSON(http.StatusOK, map[string]any{+ "sessionManager": map[string]any{"value": "SessionManager"},+ "perfManager": map[string]any{"value": "PerformanceManager"},+ "eventManager": map[string]any{"value": "EventManager"},+ })+ case r.Method == http.MethodPost && r.URL.Path == "/sdk/vim25/8.0.2.0/SessionManager/SessionManager/Login":+ w.Header().Set("vmware-api-session-id", "vi-session")+ writeUpstreamJSON(http.StatusOK, map[string]any{"value": "ok"})+ case r.Method == http.MethodGet && r.URL.Path == "/sdk/vim25/8.0.2.0/PerformanceManager/PerformanceManager/perfCounter":+ writeUpstreamJSON(http.StatusOK, []map[string]any{+ {"key": 1, "groupInfo": map[string]any{"key": "cpu"}, "nameInfo": map[string]any{"key": "usage"}, "rollupType": "average"},+ {"key": 2, "groupInfo": map[string]any{"key": "mem"}, "nameInfo": map[string]any{"key": "usage"}, "rollupType": "average"},+ })+ case r.Method == http.MethodGet && r.URL.Path == "/sdk/vim25/8.0.2.0/HostSystem/host-101/overallStatus":+ writeUpstreamJSON(http.StatusOK, "green")+ case r.Method == http.MethodGet && r.URL.Path == "/sdk/vim25/8.0.2.0/HostSystem/host-101/triggeredAlarmState":+ writeUpstreamJSON(http.StatusOK, []map[string]any{})+ case r.Method == http.MethodGet && r.URL.Path == "/sdk/vim25/8.0.2.0/HostSystem/host-101/recentTask":+ writeUpstreamJSON(http.StatusOK, []map[string]any{})+ case r.Method == http.MethodPost && r.URL.Path == "/sdk/vim25/8.0.2.0/EventManager/EventManager/QueryEvents":+ writeUpstreamJSON(http.StatusInternalServerError, map[string]any{"error": "vCenter event query failed"})+ case r.Method == http.MethodPost && r.URL.Path == "/sdk/vim25/8.0.2.0/PerformanceManager/PerformanceManager/QueryPerfProviderSummary":+ writeUpstreamJSON(http.StatusOK, map[string]any{"currentSupported": true, "refreshRate": 20})+ case r.Method == http.MethodPost && r.URL.Path == "/sdk/vim25/8.0.2.0/PerformanceManager/PerformanceManager/QueryAvailablePerfMetric":+ writeUpstreamJSON(http.StatusOK, []map[string]any{+ {"counterId": 1, "instance": ""},+ {"counterId": 2, "instance": ""},+ })+ case r.Method == http.MethodPost && r.URL.Path == "/sdk/vim25/8.0.2.0/PerformanceManager/PerformanceManager/QueryPerf":+ writeUpstreamJSON(http.StatusOK, []map[string]any{{+ "entity": map[string]any{"type": "HostSystem", "value": "host-101"},+ "value": []map[string]any{+ {"id": map[string]any{"counterId": 1, "instance": ""}, "value": []int64{2140}},+ {"id": map[string]any{"counterId": 2, "instance": ""}, "value": []int64{6320}},+ },+ }})+ default:+ t.Fatalf("unexpected VMware upstream request %s %s", r.Method, r.URL.Path)+ }+ }))+ defer upstream.Close()++ handler, persistence := newVMwareHandlersForTest(t)+ if err := persistence.SaveVMwareConfig([]config.VMwareVCenterInstance{{+ ID: "conn-1",+ Name: "lab-vcenter",+ Host: upstream.URL,+ Username: "[email protected]",+ Password: "super-secret",+ InsecureSkipVerify: true,+ Enabled: true,+ }}); err != nil {+ t.Fatalf("seed vmware config: %v", err)+ }++ body := marshalVMwareRequest(t, map[string]any{+ "name": "lab-vcenter",+ "host": upstream.URL,+ "username": "[email protected]",+ "password": "********",+ "insecureSkipVerify": true,+ "enabled": true,+ })+ req := httptest.NewRequest(+ http.MethodPost,+ "/api/vmware/connections/conn-1/test",+ bytes.NewReader(body),+ )+ rec := httptest.NewRecorder()+ handler.HandleTestSavedConnection(rec, req)++ if rec.Code != http.StatusOK {+ t.Fatalf("expected compatible connection with optional event failure to return 200, got %d: %s", rec.Code, rec.Body.String())+ }+ var payload struct {+ Success bool `json:"success"`+ Degraded bool `json:"degraded"`+ VIRelease string `json:"viRelease"`+ Issues []vmware.InventoryEnrichmentIssue `json:"issues"`+ }+ if err := json.NewDecoder(rec.Body).Decode(&payload); err != nil {+ t.Fatalf("decode degraded connection-test response: %v", err)+ }+ if !payload.Success || !payload.Degraded || payload.VIRelease != "8.0.2.0" {+ t.Fatalf("expected degraded success on negotiated 8.0.2.0 release, got %+v", payload)+ }+ if len(payload.Issues) != 1 ||+ payload.Issues[0].Stage != "signals" ||+ payload.Issues[0].EntityType != "host" ||+ payload.Issues[0].Category != "endpoint" ||+ payload.Issues[0].Message != "VMware HostSystem recent events request failed with HTTP 500" {+ t.Fatalf("expected preserved recent-events diagnostic, got %+v", payload.Issues)+ }+ if got, want := strings.Join(serviceContentProbes, ","), "9.0.0.0,8.0.3,8.0.2.0"; got != want {+ t.Fatalf("expected VI JSON release negotiation through %s, got %s", want, got)+ }+}+func newVMwareHandlersForTest(t *testing.T) (*VMwareHandlers, *config.ConfigPersistence) {t.Helper()diff --git a/internal/monitoring/canonical_guardrails_test.go b/internal/monitoring/canonical_guardrails_test.goindex a7bc580831..e446bc6efa 100644--- a/internal/monitoring/canonical_guardrails_test.go+++ b/internal/monitoring/canonical_guardrails_test.go@@ -15,6 +15,7 @@ import ("github.com/rcourtman/pulse-go-rewrite/internal/mock""github.com/rcourtman/pulse-go-rewrite/internal/models"unifiedresources "github.com/rcourtman/pulse-go-rewrite/internal/unifiedresources"+ "github.com/rcourtman/pulse-go-rewrite/internal/vmware"agentsdocker "github.com/rcourtman/pulse-go-rewrite/pkg/agents/docker")@@ -99,6 +100,49 @@ func TestMultiTenantMonitorListOrganizationIDsFallsBackToDefault(t *testing.T) {}}+func TestVMwareManualConnectionTestPreservesDegradedDiagnostics(t *testing.T) {+ poller := NewVMwarePoller(nil, time.Minute)+ connection := config.NewVMwareVCenterInstance()+ connection.ID = "vc-degraded"+ connection.Host = "vc.lab.local"+ connection.Username = "[email protected]"+ connection.Password = "secret"++ recordedAt := time.Date(2026, 7, 23, 19, 0, 0, 0, time.UTC)+ poller.RecordConnectionTestSuccess("default", connection.ID, &vmware.InventorySummary{+ Hosts: 2,+ VMs: 14,+ Datastores: 3,+ Networks: 5,+ VIRelease: "8.0.2.0",+ Degraded: true,+ Issues: []vmware.InventoryEnrichmentIssue{+ {+ Stage: "signals",+ EntityType: "host",+ EntityID: "host-101",+ Category: "endpoint",+ Message: "VMware HostSystem recent events request failed with HTTP 500",+ },+ },+ }, recordedAt)++ summary := poller.ConnectionSummaries("default", []config.VMwareVCenterInstance{connection})[connection.ID]+ if summary.Poll == nil || summary.Poll.LastSuccessAt == nil || !summary.Poll.LastSuccessAt.Equal(recordedAt) {+ t.Fatalf("expected degraded test to remain a successful connection attempt, got %+v", summary.Poll)+ }+ if summary.Observed == nil || !summary.Observed.Degraded || summary.Observed.IssueCount != 1 {+ t.Fatalf("expected degraded observed summary, got %+v", summary.Observed)+ }+ if len(summary.Observed.Issues) != 1 ||+ summary.Observed.Issues[0].Stage != "signals" ||+ summary.Observed.Issues[0].Category != "endpoint" ||+ summary.Observed.Issues[0].Message != "VMware HostSystem recent events request failed with HTTP 500" ||+ summary.Observed.Issues[0].Occurrences != 1 {+ t.Fatalf("expected preserved summarized diagnostic, got %+v", summary.Observed.Issues)+ }+}+func TestPVETagStyleRefreshStaysPerInstance(t *testing.T) {data, err := os.ReadFile("monitor_pve.go")if err != nil {diff --git a/internal/monitoring/vmware_poller.go b/internal/monitoring/vmware_poller.goindex 25dbf70e03..572a40aa13 100644--- a/internal/monitoring/vmware_poller.go+++ b/internal/monitoring/vmware_poller.go@@ -807,8 +807,11 @@ func (p *VMwarePoller) RecordConnectionTestSuccess(orgID, connID string, summaryDatastores: summary.Datastores,Networks: summary.Networks,VIRelease: strings.TrimSpace(summary.VIRelease),+ Degraded: summary.Degraded || len(summary.Issues) > 0,+ IssueCount: len(summary.Issues),+ Issues: summarizeVMwareObservedIssues(summary.Issues),}- status.observedIssueKey = ""+ status.observedIssueKey = summarizeVMwareObservedIssueKey(summary.Issues)}}@@ -925,7 +928,9 @@ func cloneVMwareObservedSummary(value *VMwareConnectionObservedSummary) *VMwareC}}-func summarizeVMwareObservedIssues(issues []vmware.InventoryEnrichmentIssue) []VMwareConnectionObservedIssue {+// SummarizeVMwareObservedIssues converts detailed optional-read failures into+// the bounded operator-facing issue shape shared by polling and manual tests.+func SummarizeVMwareObservedIssues(issues []vmware.InventoryEnrichmentIssue) []VMwareConnectionObservedIssue {if len(issues) == 0 {return nil}@@ -975,6 +980,10 @@ func summarizeVMwareObservedIssues(issues []vmware.InventoryEnrichmentIssue) []Vreturn summary}+func summarizeVMwareObservedIssues(issues []vmware.InventoryEnrichmentIssue) []VMwareConnectionObservedIssue {+ return SummarizeVMwareObservedIssues(issues)+}+func summarizeVMwareObservedIssueKey(issues []vmware.InventoryEnrichmentIssue) string {if len(issues) == 0 {return ""diff --git a/internal/vmware/client.go b/internal/vmware/client.goindex b30708606d..8e5024b226 100644--- a/internal/vmware/client.go+++ b/internal/vmware/client.go@@ -83,6 +83,8 @@ type InventorySummary struct {Datastores intNetworks intVIRelease string+ Degraded bool+ Issues []InventoryEnrichmentIssue}// ClientConfig configures a VMware vCenter client.@@ -169,7 +171,8 @@ func (c *Client) TestConnection(ctx context.Context) (*InventorySummary, error)if err != nil {return nil, err}- if err := c.validateSignalFloor(ctx, release, sessionID, refs.PerfManagerMoID, refs.EventManagerMoID, inventory, perfCounters); err != nil {+ issues, err := c.validateSignalFloor(ctx, release, sessionID, refs.PerfManagerMoID, refs.EventManagerMoID, inventory, perfCounters)+ if err != nil {return nil, err}return &InventorySummary{@@ -178,6 +181,8 @@ func (c *Client) TestConnection(ctx context.Context) (*InventorySummary, error)Datastores: len(inventory.Datastores),Networks: len(inventory.Networks),VIRelease: release,+ Degraded: len(issues) > 0,+ Issues: issues,}, nil}diff --git a/internal/vmware/client_signals.go b/internal/vmware/client_signals.goindex 6a81629815..f444642f5f 100644--- a/internal/vmware/client_signals.go+++ b/internal/vmware/client_signals.go@@ -99,54 +99,88 @@ func (c *Client) validateSignalFloor(eventManagerMoID string,snapshot *InventorySnapshot,perfCounters perfCounterCatalog,-) error {+) ([]InventoryEnrichmentIssue, error) {if snapshot == nil {- return nil+ return nil, nil+ }++ var issues []InventoryEnrichmentIssue+ recordOptionalIssue := func(entityType, entityID string, err error) error {+ if issue, ok := classifyInventoryEnrichmentIssue("signals", entityType, entityID, err); ok {+ issues = append(issues, *issue)+ return nil+ }+ return err}cache := &alarmNameCache{names: make(map[string]string)}if len(snapshot.Hosts) > 0 {host := snapshot.Hosts[0]if _, err := c.collectManagedEntitySignals(ctx, release, sessionID, "HostSystem", host.Host, perfManagerMoID, eventManagerMoID, cache, false); err != nil {- return err+ if err := recordOptionalIssue("host", host.Host, err); err != nil {+ return nil, err+ }}hostMetrics, err := c.collectHostPerformanceMetrics(ctx, release, sessionID, perfManagerMoID, perfCounters, host)if err != nil {- return err- }- if hostMetrics == nil || hostMetrics.CPUPercent == nil || hostMetrics.MemoryPercent == nil {- return &ConnectionError{Category: "endpoint", Message: "VMware performance metrics are unavailable for host inventory"}+ if err := recordOptionalIssue("host", host.Host, err); err != nil {+ return nil, err+ }+ } else if hostMetrics == nil || hostMetrics.CPUPercent == nil || hostMetrics.MemoryPercent == nil {+ if err := recordOptionalIssue("host", host.Host, &ConnectionError{+ Category: "endpoint",+ Message: "VMware performance metrics are unavailable for host inventory",+ }); err != nil {+ return nil, err+ }}}if len(snapshot.VMs) > 0 {vm := snapshot.VMs[0]if _, err := c.collectManagedEntitySignals(ctx, release, sessionID, "VirtualMachine", vm.VM, perfManagerMoID, eventManagerMoID, cache, false); err != nil {- return err+ if err := recordOptionalIssue("vm", vm.VM, err); err != nil {+ return nil, err+ }}if _, _, err := c.collectVMSnapshotTree(ctx, release, sessionID, vm.VM); err != nil && !isVIJSONNotFound(err) {- return err+ if err := recordOptionalIssue("vm", vm.VM, err); err != nil {+ return nil, err+ }}vmMetrics, err := c.collectVMPerformanceMetrics(ctx, release, sessionID, perfManagerMoID, perfCounters, vm)if err != nil {- return err- }- if vmMetrics == nil || vmMetrics.CPUPercent == nil || vmMetrics.MemoryPercent == nil {- return &ConnectionError{Category: "endpoint", Message: "VMware performance metrics are unavailable for vm inventory"}+ if err := recordOptionalIssue("vm", vm.VM, err); err != nil {+ return nil, err+ }+ } else if vmMetrics == nil || vmMetrics.CPUPercent == nil || vmMetrics.MemoryPercent == nil {+ if err := recordOptionalIssue("vm", vm.VM, &ConnectionError{+ Category: "endpoint",+ Message: "VMware performance metrics are unavailable for vm inventory",+ }); err != nil {+ return nil, err+ }}}if len(snapshot.Datastores) > 0 {datastore := snapshot.Datastores[0]if _, err := c.collectManagedEntitySignals(ctx, release, sessionID, "Datastore", datastore.Datastore, perfManagerMoID, eventManagerMoID, cache, false); err != nil {- return err+ if err := recordOptionalIssue("storage", datastore.Datastore, err); err != nil {+ return nil, err+ }}}if len(snapshot.Networks) > 0 {network := snapshot.Networks[0]if _, err := c.collectManagedEntitySignals(ctx, release, sessionID, "Network", network.Network, perfManagerMoID, eventManagerMoID, cache, false); err != nil {- return err+ if err := recordOptionalIssue("network", network.Network, err); err != nil {+ return nil, err+ }}}- return nil+ sort.Slice(issues, func(i, j int) bool {+ return inventoryEnrichmentIssueSortKey(issues[i]) < inventoryEnrichmentIssueSortKey(issues[j])+ })+ return issues, nil}func (c *Client) enrichInventorySnapshot(diff --git a/internal/vmware/client_test.go b/internal/vmware/client_test.goindex 5dda275fc6..4f4d04683d 100644--- a/internal/vmware/client_test.go+++ b/internal/vmware/client_test.go@@ -303,7 +303,7 @@ func TestClientCollectInventoryPreservesBaseInventoryWhenOptionalEnrichmentDegra}}-func TestClientTestConnectionRequiresSignalFloor(t *testing.T) {+func TestClientTestConnectionReportsUnavailableOptionalSignalAsDegraded(t *testing.T) {server := newVMwareTestServer(t, vmwareTestServerConfig{omitHostOverallStatus: true,})@@ -320,16 +320,49 @@ func TestClientTestConnectionRequiresSignalFloor(t *testing.T) {t.Fatalf("NewClient: %v", err)}+ summary, err := client.TestConnection(context.Background())+ if err != nil {+ t.Fatalf("TestConnection: %v", err)+ }+ if summary == nil || !summary.Degraded {+ t.Fatalf("expected degraded connection summary, got %+v", summary)+ }+ if len(summary.Issues) != 1 ||+ summary.Issues[0].Stage != "signals" ||+ summary.Issues[0].EntityType != "host" ||+ summary.Issues[0].Category != "not_found" ||+ !strings.Contains(summary.Issues[0].Message, "overall status") {+ t.Fatalf("expected unavailable host signal diagnostic, got %+v", summary.Issues)+ }+}++func TestClientTestConnectionStillRejectsSignalAuthenticationFailure(t *testing.T) {+ server := newVMwareTestServer(t, vmwareTestServerConfig{+ unauthorizedHostOverallStatus: true,+ })+ defer server.Close()++ client, err := NewClient(ClientConfig{+ Host: server.URL,+ Username: "admin",+ Password: "secret",+ InsecureSkipVerify: true,+ Timeout: 5 * time.Second,+ })+ if err != nil {+ t.Fatalf("NewClient: %v", err)+ }+_, err = client.TestConnection(context.Background())if err == nil {- t.Fatal("expected signal-floor validation error")+ t.Fatal("expected authentication failure")}connectionErr, ok := err.(*ConnectionError)if !ok {t.Fatalf("expected ConnectionError, got %T", err)}- if connectionErr.Category != "not_found" {- t.Fatalf("connection error category = %q, want not_found", connectionErr.Category)+ if connectionErr.Category != "auth" {+ t.Fatalf("connection error category = %q, want auth", connectionErr.Category)}}@@ -478,10 +511,11 @@ func TestClientResolveVIJSONReleaseClassifiesUnsupportedVersionFloor(t *testing.}type vmwareTestServerConfig struct {- omitHostOverallStatus bool- denyHostOverallStatus bool- denyClusterInventory bool- unavailableVMGuestInfo bool+ omitHostOverallStatus bool+ denyHostOverallStatus bool+ unauthorizedHostOverallStatus bool+ denyClusterInventory bool+ unavailableVMGuestInfo bool}func newVMwareTestServer(t *testing.T, cfg vmwareTestServerConfig) *httptest.Server {@@ -874,6 +908,10 @@ func newVMwareTestServer(t *testing.T, cfg vmwareTestServerConfig) *httptest.Serif !cfg.omitHostOverallStatus {mux.HandleFunc("/sdk/vim25/9.0.0.0/HostSystem/host-101/overallStatus", func(w http.ResponseWriter, r *http.Request) {requireVISession(t, r)+ if cfg.unauthorizedHostOverallStatus {+ http.Error(w, "unauthorized", http.StatusUnauthorized)+ return+ }if cfg.denyHostOverallStatus {http.Error(w, "forbidden", http.StatusForbidden)return