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
Normalize configured platform replacement selectors
rcourtmanf7a6a0f83ed1
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex 1d2c0d5bf6..9fd4c31667 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -746,6 +746,12 @@ workloads, storage, and recovery handoffs must read the canonical connectionfixtures from `internal/mock/fixture_graph.go` instead of handler-local demolists, so operator-facing demos stay coherent across those adjacent productsurfaces without a restart.+That same lifecycle-owned platform-connections boundary also owns configured+Proxmox, PBS, and PMG replacement continuity. Node update handlers must pass+the current platform surface into monitored-system admission through the shared+structured replacement selector so host or name edits preserve the intended+slot without reintroducing lifecycle-local matcher closures or empty-estate+fallbacks.That same lifecycle-owned VMware workspace must also keep the backend-runtimeshape hidden behind one operator-facing connection model. The settings surfacemay show one VMware connection's poll health, last error classification, anddiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 470c7801cb..97cad98b34 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -1069,6 +1069,12 @@ closed when monitored-system usage is unavailable, and return the canonicalcurrent/projected count delta, enforced limit verdict, effect label, andcurrent/projected ledger entries produced by the shared monitored-systemprojection layer instead of by handler-local heuristics.+Configured Proxmox, PBS, and PMG update handlers in+internal/api/config_node_handlers.go must use that same structured+replacement-selector contract when they enforce monitored-system admission:+source-owned names, host URLs, hostnames, and resource identifiers may cross+the API boundary, but handler-local matcher closures must not become the+source of truth for replacement identity.Provider-backed preview routes such as `/api/truenas/connections/preview`,`/api/truenas/connections/{id}/preview`, `/api/vmware/connections/preview`,and `/api/vmware/connections/{id}/preview` must serialize that same canonicaldiff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex e6b9861a96..2bf43a976b 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -346,6 +346,11 @@ recovery-adjacent setup, deploy, and API-backed update helpers may reuse thecanonical monitored-system cap boundary, but they must preserve remaininggrouped sources on a counted host and must not reinterpret unavailable usage asan empty estate.+Configured Proxmox, PBS, and PMG node replacements on that adjacent API+boundary must identify the replaced source-owned surface through the shared+monitored-system replacement selector, not storage- or recovery-local matching+rules, so a platform host edit preserves non-replaced grouped evidence before+storage or recovery consumes the resulting runtime context.That same adjacent `internal/api/` boundary now also governs public-democommercial redaction for storage and recovery viewers. Shared storage/recoverysurfaces may run beside a demo runtime that has real internal entitlements,diff --git a/internal/api/config_node_handlers.go b/internal/api/config_node_handlers.goindex ec3dc85794..5ca51344bb 100644--- a/internal/api/config_node_handlers.go+++ b/internal/api/config_node_handlers.go@@ -749,20 +749,10 @@ func proxmoxMonitoredSystemReplacement(instance config.PVEInstance) unifiedresouhostname := pulseTokenHostCandidate(instance.Host)return unifiedresources.MonitoredSystemReplacement{Source: unifiedresources.SourceProxmox,- Matches: func(resource unifiedresources.Resource) bool {- if resource.Proxmox == nil {- return false- }- if name != "" && strings.EqualFold(strings.TrimSpace(resource.Proxmox.Instance), name) {- return true- }- if name != "" && strings.EqualFold(strings.TrimSpace(resource.Proxmox.NodeName), name) {- return true- }- if host != "" && strings.EqualFold(strings.TrimSpace(resource.Proxmox.HostURL), host) {- return true- }- return hostname != "" && strings.EqualFold(pulseTokenHostCandidate(resource.Proxmox.HostURL), hostname)+ Selector: unifiedresources.MonitoredSystemReplacementSelector{+ Name: name,+ Hostname: hostname,+ HostURL: host,},}}@@ -773,17 +763,10 @@ func pbsMonitoredSystemReplacement(instance config.PBSInstance) unifiedresourceshostname := pulseTokenHostCandidate(instance.Host)return unifiedresources.MonitoredSystemReplacement{Source: unifiedresources.SourcePBS,- Matches: func(resource unifiedresources.Resource) bool {- if resource.PBS == nil {- return false- }- if name != "" && strings.EqualFold(strings.TrimSpace(resource.PBS.InstanceID), name) {- return true- }- if host != "" && strings.EqualFold(strings.TrimSpace(resource.PBS.HostURL), host) {- return true- }- return hostname != "" && strings.EqualFold(strings.TrimSpace(resource.PBS.Hostname), hostname)+ Selector: unifiedresources.MonitoredSystemReplacementSelector{+ ResourceID: name,+ Hostname: hostname,+ HostURL: host,},}}@@ -793,14 +776,9 @@ func pmgMonitoredSystemReplacement(instance config.PMGInstance) unifiedresourceshostname := pulseTokenHostCandidate(instance.Host)return unifiedresources.MonitoredSystemReplacement{Source: unifiedresources.SourcePMG,- Matches: func(resource unifiedresources.Resource) bool {- if resource.PMG == nil {- return false- }- if name != "" && strings.EqualFold(strings.TrimSpace(resource.PMG.InstanceID), name) {- return true- }- return hostname != "" && strings.EqualFold(strings.TrimSpace(resource.PMG.Hostname), hostname)+ Selector: unifiedresources.MonitoredSystemReplacementSelector{+ ResourceID: name,+ Hostname: hostname,},}}diff --git a/internal/api/contract_test.go b/internal/api/contract_test.goindex e349af9f0b..3c3567c152 100644--- a/internal/api/contract_test.go+++ b/internal/api/contract_test.go@@ -5431,6 +5431,143 @@ func TestContract_MonitoredSystemUsageUnavailableIncludesReason(t *testing.T) {}}+func TestContract_ConfiguredNodeReplacementsUseCanonicalSelectors(t *testing.T) {+ testCases := []struct {+ name string+ current any+ updated any+ source unifiedresources.DataSource+ currentRoot unifiedresources.Resource+ replacement func(any) unifiedresources.MonitoredSystemReplacement+ candidate func(any) unifiedresources.MonitoredSystemCandidate+ }{+ {+ name: "proxmox",+ current: config.PVEInstance{+ Name: " pve-a ",+ Host: " https://pve-a.lab.local:8006 ",+ },+ updated: config.PVEInstance{+ Name: "pve-b",+ Host: "https://pve-b.lab.local:8006",+ },+ source: unifiedresources.SourceProxmox,+ currentRoot: unifiedresources.Resource{+ ID: "pve-a",+ Type: unifiedresources.ResourceTypeAgent,+ Name: "pve-a",+ Status: unifiedresources.StatusOnline,+ Proxmox: &unifiedresources.ProxmoxData{+ Instance: "pve-a",+ NodeName: "pve-a-node",+ HostURL: "https://pve-a.lab.local:8006",+ },+ },+ replacement: func(value any) unifiedresources.MonitoredSystemReplacement {+ return proxmoxMonitoredSystemReplacement(value.(config.PVEInstance))+ },+ candidate: func(value any) unifiedresources.MonitoredSystemCandidate {+ return proxmoxMonitoredSystemCandidate(value.(config.PVEInstance))+ },+ },+ {+ name: "pbs",+ current: config.PBSInstance{+ Name: " backup-a ",+ Host: " https://backup-a.lab.local:8007 ",+ },+ updated: config.PBSInstance{+ Name: "backup-b",+ Host: "https://backup-b.lab.local:8007",+ },+ source: unifiedresources.SourcePBS,+ currentRoot: unifiedresources.Resource{+ ID: "pbs-a",+ Type: unifiedresources.ResourceTypePBS,+ Name: "backup-a",+ Status: unifiedresources.StatusOnline,+ PBS: &unifiedresources.PBSData{+ InstanceID: "backup-a",+ Hostname: "backup-a.lab.local",+ HostURL: "https://backup-a.lab.local:8007",+ },+ },+ replacement: func(value any) unifiedresources.MonitoredSystemReplacement {+ return pbsMonitoredSystemReplacement(value.(config.PBSInstance))+ },+ candidate: func(value any) unifiedresources.MonitoredSystemCandidate {+ return pbsMonitoredSystemCandidate(value.(config.PBSInstance))+ },+ },+ {+ name: "pmg",+ current: config.PMGInstance{+ Name: " mail-a ",+ Host: " https://mail-a.lab.local:8006 ",+ },+ updated: config.PMGInstance{+ Name: "mail-b",+ Host: "https://mail-b.lab.local:8006",+ },+ source: unifiedresources.SourcePMG,+ currentRoot: unifiedresources.Resource{+ ID: "pmg-a",+ Type: unifiedresources.ResourceTypePMG,+ Name: "mail-a",+ Status: unifiedresources.StatusOnline,+ PMG: &unifiedresources.PMGData{+ InstanceID: "mail-a",+ Hostname: "mail-a.lab.local",+ },+ },+ replacement: func(value any) unifiedresources.MonitoredSystemReplacement {+ return pmgMonitoredSystemReplacement(value.(config.PMGInstance))+ },+ candidate: func(value any) unifiedresources.MonitoredSystemCandidate {+ return pmgMonitoredSystemCandidate(value.(config.PMGInstance))+ },+ },+ }++ for _, tc := range testCases {+ t.Run(tc.name, func(t *testing.T) {+ replacement := tc.replacement(tc.current)+ if replacement.Source != tc.source {+ t.Fatalf("replacement source = %q, want %q", replacement.Source, tc.source)+ }+ if replacement.Matches != nil {+ t.Fatal("configured node replacement must use the canonical selector contract, not a handler-local matcher")+ }+ if !replacement.MatchesResource(tc.currentRoot) {+ t.Fatalf("replacement selector did not match current %s root", tc.name)+ }++ registry := unifiedresources.NewRegistry(nil)+ registry.IngestRecords(tc.source, []unifiedresources.IngestRecord{+ {+ SourceID: tc.currentRoot.ID,+ Resource: tc.currentRoot,+ },+ })++ projection := unifiedresources.ProjectMonitoredSystemCandidateReplacement(+ registry,+ replacement,+ tc.candidate(tc.updated),+ )+ if projection.CurrentCount != 1 {+ t.Fatalf("CurrentCount = %d, want 1", projection.CurrentCount)+ }+ if projection.ProjectedCount != 1 {+ t.Fatalf("ProjectedCount = %d, want 1", projection.ProjectedCount)+ }+ if projection.AdditionalCount != 0 {+ t.Fatalf("AdditionalCount = %d, want 0", projection.AdditionalCount)+ }+ })+ }+}+func TestContract_DemoModeCommercialSurfacePolicy(t *testing.T) {t.Run("hidden routes return not found", func(t *testing.T) {next := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {