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(api): initialize chart services once per router
rcourtman5b80ca990fe8
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex 224806740b..18ceb43eab 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -9906,3 +9906,12 @@ The shared footer stacks its action groups on narrow screens and wraps controlswithin each group. Delete, Test, Pause, Cancel and Save must remain visible andkeyboard reachable without horizontal scrolling. Desktop groups retain theirexisting ordering. Browser proof covers both narrow and desktop viewports.++### Chart service initialization preserves lifecycle authority (16 October 2026)++`internal/api/charts_compat.go` and the router constructor share one guarded+chart service initialization path per router. This only synchronizes service+publication. Tenant monitors still resolve from each request context, and chart+reads do not gain enrollment, heartbeat or agent lifecycle authority. The+concurrent initialization contract and tenant-isolation race tests are owned+by api-contracts.diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 500c51a211..f0fbfeb726 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -12293,3 +12293,14 @@ This is neutral to storage-recovery because no persistence or recovery path chanplatforms, saved credentials, omitted/cleared settings and unchanged configurationand health. `frontend-modern/src/api/__tests__/nodes.test.ts` binds the optionalbody to the saved-node route, including explicit false and empty values.++### Router chart service initializes once for concurrent requests (16 October 2026)++Each router constructs and publishes its chart service once, including routers+created without the normal constructor. Eager construction uses the same guarded+accessor as lazy history and chart handlers. Concurrent requests share that+router's service, while different routers retain separate services and resolve+the tenant monitor from each request context. Payload and route authority are+unchanged. `TestChartServiceInitializationIsConcurrentAndRouterScoped` in+`internal/api/contract_test.go` and `TestMultiTenant_TenantIsolation` are the+direct race-detector proofs. This is a separate CI stabilization slice.diff --git a/docs/release-control/v6/internal/subsystems/security-privacy.md b/docs/release-control/v6/internal/subsystems/security-privacy.mdindex 6db88bf1c7..be8c8c3e86 100644--- a/docs/release-control/v6/internal/subsystems/security-privacy.md+++ b/docs/release-control/v6/internal/subsystems/security-privacy.md@@ -3350,3 +3350,13 @@ command ceilings are unchanged. The host and observer auth-guidance recoverycontrols in `send_report_test.go` and `observer_delivery_test.go` verify observedstatus/endpoint, non-disclosure and resumed ordinary reporting with the samecredential. They are not a credential inventory probe or native recovery proof.++### Concurrent chart service publication retains tenant boundaries (16 October 2026)++`internal/api/router.go` initializes each router's chart service through the+same guarded accessor used by concurrent history and chart requests. The+service remains scoped to its router and resolves the monitor from the current+request context. This synchronizes publication without changing authentication,+authorization, tenant selection or disclosure. The concurrent initialization+regression in `internal/api/contract_test.go` and the existing+`TestMultiTenant_TenantIsolation` race test verify that boundary.diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 5de56989cb..453af34825 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -6951,3 +6951,11 @@ health, backup coverage or recovery readiness. PVE, PBS and PMG retain theirseparate saved connection identities. The direct real-TLS regressions in`config_handlers_connection_test.go` assert unchanged configuration and health.The request and permission contract remains owned by api-contracts.++### Concurrent chart service publication adds no recovery state (16 October 2026)++Initializing the router's chart service once is in-memory synchronization.+It adds no store, persisted shape, backup, restore or migration path and does+not turn chart history into recovery-readiness authority. Separate routers+retain separate services. Concurrent publication and tenant-isolation proof+remain owned by api-contracts.diff --git a/internal/api/charts_compat.go b/internal/api/charts_compat.goindex b810fbf837..a48fc92576 100644--- a/internal/api/charts_compat.go+++ b/internal/api/charts_compat.go@@ -20,9 +20,11 @@ func (r routerChartMonitorResolver) MonitorForContext(ctx context.Context) *moni}func (r *Router) ensureChartService() *chartapi.Service {- if r.chartService == nil {- r.chartService = chartapi.NewService(routerChartMonitorResolver{router: r})- }+ r.chartServiceOnce.Do(func() {+ if r.chartService == nil {+ r.chartService = chartapi.NewService(routerChartMonitorResolver{router: r})+ }+ })return r.chartService}diff --git a/internal/api/contract_test.go b/internal/api/contract_test.goindex 95c5fce382..06b31f7bb0 100644--- a/internal/api/contract_test.go+++ b/internal/api/contract_test.go@@ -27233,3 +27233,36 @@ func TestContract_DiagnosticsTLSGuidanceSurvivesSerialization(t *testing.T) {})}}++func TestChartServiceInitializationIsConcurrentAndRouterScoped(t *testing.T) {+ const requests = 64+ router := &Router{}+ start := make(chan struct{})+ services := make(chan *chartapi.Service, requests)+ for range requests {+ go func() {+ <-start+ services <- router.ensureChartService()+ }()+ }+ close(start)++ var shared *chartapi.Service+ for range requests {+ service := <-services+ if service == nil {+ t.Fatal("chart service was not initialized")+ }+ if shared == nil {+ shared = service+ } else if service != shared {+ t.Fatal("concurrent requests received different chart services")+ }+ }+ if router.ensureChartService() != shared {+ t.Fatal("later requests replaced the chart service")+ }+ if (&Router{}).ensureChartService() == shared {+ t.Fatal("different routers shared a chart service")+ }+}diff --git a/internal/api/router.go b/internal/api/router.goindex 8e3191e5fd..98e2b784a6 100644--- a/internal/api/router.go+++ b/internal/api/router.go@@ -83,6 +83,7 @@ type Router struct {monitor *monitoring.Monitor // Legacy/Default supportmtMonitor *monitoring.MultiTenantMonitor // Multi-tenant managerchartService *chartapi.Service+ chartServiceOnce sync.OncealertHandlers *AlertHandlersconfigHandlers *ConfigHandlerstrueNASHandlers *TrueNASHandlers@@ -258,7 +259,7 @@ func NewRouter(cfg *config.Config, monitor *monitoring.Monitor, mtMonitor *monitmonitorSupplementalRecords: make(map[unifiedresources.DataSource]monitoring.MonitorSupplementalRecordsProvider),startedPatrolOrgs: make(map[string]bool),}- r.chartService = chartapi.NewService(routerChartMonitorResolver{router: r})+ r.ensureChartService()if r.wsHub != nil {r.wsHub.SetTrustedProxyChecker(isTrustedProxyIP)}