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
Report platform admission on the canonical resource aggregations
rcourtmaneb279d089be7
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex e429f9a2a9..6c8389cea8 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -2212,6 +2212,16 @@ the intentionally sparse public response.TrueNAS/VMware — reintroducing the per-type Stop-this-surfacedialog or hard-coding scope to a fixed all-true map is forbidden.+### Agent ownership and platform admission++Agent-typed resources are not automatically Pulse-managed hosts. A host that+reports through the agent source while carrying provider-owner platform+evidence (`proxmox-pve`, `proxmox-pbs`, `proxmox-pmg`, `kubernetes`,+`truenas`, `vmware-vsphere`) belongs to that provider's platform page and MUST+NOT admit the standalone platform page on its own. The canonical predicate is+`unifiedresources.IsPulseAgentPlatformResource`; new agent surfaces MUST use it+rather than testing `type == "agent"` or counting the `agent` source.+## Forbidden Paths1. New install or update continuity behavior hidden only inside broad monitoring ownership.diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 98b8cff1f3..4d3355fcef 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -3231,6 +3231,21 @@ a new API state machine, queue contract, or verification-accounting field.QEMU guest agent stopped responding; consumers must not reinterpret thatfield as the VM power state.+### Resource list platform admission++`GET /api/resources` publishes `aggregations.platformAdmission`, an object of+six booleans (`proxmox`, `docker`, `kubernetes`, `truenas`, `vmware`,+`standalone`) describing which primary platform pages the requested resource+set admits. The field is always present on a successful list response,+including for an empty set, where every flag is false.++The field names are the contract: a rename is a navigation regression for any+consumer that resolves its platform navigation from this facet. Consumers MUST+read admission from this facet rather than classifying a full-state payload,+and MUST NOT reconstruct it from `aggregations.bySource`. Proof:+`TestContract_ResourceListReportsPlatformAdmission` and the wire-shape pin in+`frontend-modern/src/types/__tests__/resource.test.ts`.+## Forbidden Paths1. Handler-local payload shape drift without a contract testdiff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 8d7f45cb08..3cdb017982 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -1749,6 +1749,15 @@ recovery scope, or a storage/recovery-owned secret source.unknown Proxmox guest I/O; they must not reinterpret zero as missing oraccept a JSON `null` value as recovery, backup, or storage-health evidence.+### TrueNAS hosts and platform admission++A TrueNAS system host is agent-typed and reports through both the agent and+truenas sources. It admits the TrueNAS platform page and MUST NOT admit the+standalone platform page, because it is owned by TrueNAS rather than being a+Pulse-managed host in its own right. Admission is resolved by+`unifiedresources.BuildPlatformAdmission`; storage surfaces MUST NOT infer+host ownership from the `agent` source count.+## Forbidden Paths1. Reintroducing storage or recovery product logic as ad hoc dashboard-only summaries without a canonical page-surface ownerdiff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex ce7a108939..0393a6a952 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -1317,6 +1317,28 @@ AI-only summary payloads, or page-local heuristics.sortable-table capability (v5.1.36 Docker and Kubernetes tables) thatthe v6 platform rebuild had dropped.+### Platform admission facet++`ResourceStats.PlatformAdmission` reports which primary platform pages an+estate admits (`proxmox`, `docker`, `kubernetes`, `truenas`, `vmware`,+`standalone`). It is derived in+`internal/unifiedresources/platform_admission.go` from each resource's+canonical platform scopes, so admission has a single definition rather than+being re-derived by each consumer.++Admission is per-resource evidence and MUST NOT be re-derived from the+`byType` or `bySource` tallies. A TrueNAS, Proxmox, Kubernetes or vSphere+host reports through the agent source and carries the `agent` platform+scope, so a count-based derivation admits the standalone page for an estate+that contains no Pulse agent at all. Only a resource that is agent-typed,+carries Pulse agent source evidence, and carries no provider-owner platform+evidence admits the standalone page; availability checks and network+endpoints also admit it.++Admission MUST be stable across the registry clone path, because readers are+served clones. Proof: `TestClonedResourcesPreservePlatformAdmission` and+`TestRegistryResourcesReportPlatformAdmission`.+## Forbidden Paths1. New ad hoc resource-type aliases outside unified resource normalizationdiff --git a/frontend-modern/src/types/__tests__/resource.test.ts b/frontend-modern/src/types/__tests__/resource.test.tsindex 26dfd6b339..0774bccc3c 100644--- a/frontend-modern/src/types/__tests__/resource.test.ts+++ b/frontend-modern/src/types/__tests__/resource.test.ts@@ -854,4 +854,34 @@ describe('Resource Interface', () => {expect(resource.policy?.routing.redact).toContain('hostname');expect(resource.aiSafeSummary).toContain('local-only context');});++ it('pins the platformAdmission aggregation the resource list contract publishes', () => {+ // The backend answers which primary platform pages an estate admits, so the+ // app shell does not have to classify a full-state payload to build its+ // navigation. This pins the wire shape the shell will read; the field names+ // are the contract, and a rename here is a navigation regression.+ const aggregations = {+ platformAdmission: {+ proxmox: true,+ docker: false,+ kubernetes: false,+ truenas: true,+ vmware: false,+ // A provider-owned host reports through the agent source, so this stays+ // false unless a genuine Pulse agent or an availability check exists.+ standalone: false,+ },+ };++ expect(Object.keys(aggregations.platformAdmission).sort()).toEqual([+ 'docker',+ 'kubernetes',+ 'proxmox',+ 'standalone',+ 'truenas',+ 'vmware',+ ]);+ expect(aggregations.platformAdmission.standalone).toBe(false);+ expect(aggregations.platformAdmission.truenas).toBe(true);+ });});diff --git a/internal/api/contract_test.go b/internal/api/contract_test.goindex bc3e027d12..8f09b71372 100644--- a/internal/api/contract_test.go+++ b/internal/api/contract_test.go@@ -13401,7 +13401,7 @@ func TestContract_TenantResourcesDoNotFallbackToRawSnapshotSeeding(t *testing.T)t.Fatalf("status = %d, body=%s", rec.Code, rec.Body.String())}- const want = `{"data":[],"meta":{"page":1,"limit":50,"total":0,"totalPages":0},"aggregations":{"total":0,"byType":{},"byStatus":{},"bySource":{},"policyPosture":{"totalResources":0,"sensitivityCounts":{},"routingCounts":{},"redactionCounts":{}}}}`+ const want = `{"data":[],"meta":{"page":1,"limit":50,"total":0,"totalPages":0},"aggregations":{"total":0,"byType":{},"byStatus":{},"bySource":{},"policyPosture":{"totalResources":0,"sensitivityCounts":{},"routingCounts":{},"redactionCounts":{}},"platformAdmission":{"proxmox":false,"docker":false,"kubernetes":false,"truenas":false,"vmware":false,"standalone":false}}}`if got := strings.TrimSpace(rec.Body.String()); got != want {t.Fatalf("tenant resource fallback contract = %s, want %s", got, want)}@@ -24350,3 +24350,49 @@ func TestContract_AuthorizationRefusalKeepsStatusWhileLoggingAtDebug(t *testing.t.Fatalf("refusal left no debug-level trace at all:\n%s", output)}}++func TestContract_ResourceListReportsPlatformAdmission(t *testing.T) {+ now := time.Date(2026, 3, 17, 11, 0, 0, 0, time.UTC)+ h := newActionTestResourceHandlers(t, &config.Config{DataPath: t.TempDir()})+ h.SetStateProvider(resourceUnifiedSeedProvider{+ snapshot: models.StateSnapshot{LastUpdate: now},+ resources: []unifiedresources.Resource{+ {+ ID: "truenas-host",+ Type: unifiedresources.ResourceTypeAgent,+ Name: "storage.internal",+ Status: unifiedresources.StatusOnline,+ LastSeen: now,+ // Reports through the agent source but is owned by TrueNAS, so it+ // must admit the TrueNAS page and not the standalone one.+ Sources: []unifiedresources.DataSource{unifiedresources.SourceAgent, unifiedresources.SourceTrueNAS},+ Agent: &unifiedresources.AgentData{},+ TrueNAS: &unifiedresources.TrueNASData{},+ },+ },+ })++ req := httptest.NewRequest(http.MethodGet, "/api/resources?type=agent", nil)+ rec := httptest.NewRecorder()++ h.HandleListResources(rec, req)++ if rec.Code != http.StatusOK {+ t.Fatalf("status = %d, body=%s", rec.Code, rec.Body.String())+ }++ var resp ResourcesResponse+ if err := json.NewDecoder(rec.Body).Decode(&resp); err != nil {+ t.Fatalf("decode response: %v", err)+ }+ admission := resp.Aggregations.PlatformAdmission+ if admission == nil {+ t.Fatalf("aggregations must carry platformAdmission, got %s", rec.Body.String())+ }+ if !admission.TrueNAS {+ t.Fatalf("expected truenas admission, got %+v", admission)+ }+ if admission.Standalone {+ t.Fatalf("provider-owned agent must not admit the standalone page, got %+v", admission)+ }+}diff --git a/internal/api/resources.go b/internal/api/resources.goindex 44cfb0a4d9..b08e6b0bed 100644--- a/internal/api/resources.go+++ b/internal/api/resources.go@@ -2379,6 +2379,8 @@ func computeResourceContractStats(resources []unified.Resource) unified.Resourcestats.BySource[source]++}}+ admission := unified.BuildPlatformAdmission(resources)+ stats.PlatformAdmission = &admissionreturn stats}diff --git a/internal/unifiedresources/clone_test.go b/internal/unifiedresources/clone_test.goindex 4a096ad6ec..76b5b622e7 100644--- a/internal/unifiedresources/clone_test.go+++ b/internal/unifiedresources/clone_test.go@@ -852,3 +852,26 @@ func TestCloneResourceIsolatesVirtualMachineFacet(t *testing.T) {t.Fatal("cloned virtual machine facet aliases original")}}++func TestClonedResourcesPreservePlatformAdmission(t *testing.T) {+ // Readers are served clones, so admission must not change as resources pass+ // through the clone path: a provider-owned host that loses its scopes on+ // clone would start admitting the standalone platform page.+ truenasHost := Resource{+ ID: "truenas-host",+ Type: ResourceTypeAgent,+ Sources: []DataSource{SourceAgent, SourceTrueNAS},+ Agent: &AgentData{},+ TrueNAS: &TrueNASData{},+ }+ RefreshPlatformScopes(&truenasHost)++ original := BuildPlatformAdmission([]Resource{truenasHost})+ cloned := BuildPlatformAdmission([]Resource{cloneResource(&truenasHost)})+ if original != cloned {+ t.Fatalf("admission changed across clone: %+v -> %+v", original, cloned)+ }+ if cloned.Standalone {+ t.Fatalf("provider-owned host must not admit standalone after clone, got %+v", cloned)+ }+}diff --git a/internal/unifiedresources/platform_admission.go b/internal/unifiedresources/platform_admission.gonew file mode 100644index 0000000000..6f265da621--- /dev/null+++ b/internal/unifiedresources/platform_admission.go@@ -0,0 +1,117 @@+package unifiedresources++// Platform admission answers one question for the app shell: which primary+// platform pages exist for this estate. The frontend used to derive it by+// classifying every resource in the legacy full-state payload, which is why the+// shell had to download that payload before it could render its navigation.+// Deriving it here keeps a single definition of admission and lets the shell+// read it from the canonical resource aggregations instead.+//+// Counts cannot answer it. A TrueNAS or Proxmox host reports through the agent+// source and carries the "agent" platform scope, but it is owned by its+// provider and must not admit the standalone page on its own; only a genuine+// Pulse agent does. That distinction is per-resource evidence, so it is+// evaluated per resource here rather than inferred from a source tally.++// PlatformAdmission reports which primary platform pages an estate admits.+type PlatformAdmission struct {+ Proxmox bool `json:"proxmox"`+ Docker bool `json:"docker"`+ Kubernetes bool `json:"kubernetes"`+ TrueNAS bool `json:"truenas"`+ VMware bool `json:"vmware"`+ Standalone bool `json:"standalone"`+}++// agentProviderOwnerPlatformScopes are the platform scopes that mean an+// agent-typed resource belongs to a provider's platform page rather than the+// standalone one.+var agentProviderOwnerPlatformScopes = map[string]struct{}{+ "proxmox-pve": {},+ "proxmox-pbs": {},+ "proxmox-pmg": {},+ "kubernetes": {},+ "truenas": {},+ "vmware-vsphere": {},+}++// platformScopesForResource returns the canonical platform scopes for a+// resource, deriving them when the resource has not been refreshed yet so that+// admission never depends on refresh ordering.+func platformScopesForResource(resource Resource) []string {+ if len(resource.PlatformScopes) > 0 {+ return resource.PlatformScopes+ }+ clone := resource+ RefreshPlatformScopes(&clone)+ return clone.PlatformScopes+}++func hasProviderOwnerPlatformEvidence(resource Resource, scopes []string) bool {+ for _, scope := range scopes {+ if _, ok := agentProviderOwnerPlatformScopes[scope]; ok {+ return true+ }+ }+ for _, source := range resource.Sources {+ if _, ok := agentProviderOwnerPlatformScopes[platformScopeForSource(source)]; ok {+ return true+ }+ }+ for source := range resource.SourceStatus {+ if _, ok := agentProviderOwnerPlatformScopes[platformScopeForSource(source)]; ok {+ return true+ }+ }+ return false+}++func hasPulseAgentSourceEvidence(resource Resource) bool {+ if hasDataSource(resource.Sources, SourceAgent) {+ return true+ }+ _, ok := resource.SourceStatus[SourceAgent]+ return ok+}++// IsPulseAgentPlatformResource reports whether a resource is a Pulse-managed+// host in its own right, rather than a host surfaced through the provider that+// owns it. Only these admit the standalone platform page.+func IsPulseAgentPlatformResource(resource Resource) bool {+ if CanonicalResourceType(resource.Type) != ResourceTypeAgent {+ return false+ }+ if hasProviderOwnerPlatformEvidence(resource, platformScopesForResource(resource)) {+ return false+ }+ return hasPulseAgentSourceEvidence(resource)+}++// BuildPlatformAdmission reports which primary platform pages the given+// resources admit.+func BuildPlatformAdmission(resources []Resource) PlatformAdmission {+ admission := PlatformAdmission{}+ for _, resource := range resources {+ for _, scope := range platformScopesForResource(resource) {+ switch scope {+ case "proxmox-pve", "proxmox-pbs", "proxmox-pmg":+ admission.Proxmox = true+ case "docker":+ admission.Docker = true+ case "kubernetes":+ admission.Kubernetes = true+ case "truenas":+ admission.TrueNAS = true+ case "vmware-vsphere":+ admission.VMware = true+ case "availability":+ // Availability endpoints are operated from the standalone page.+ admission.Standalone = true+ }+ }+ if !admission.Standalone && IsPulseAgentPlatformResource(resource) {+ admission.Standalone = true+ }+ }+ return admission+}diff --git a/internal/unifiedresources/platform_admission_test.go b/internal/unifiedresources/platform_admission_test.gonew file mode 100644index 0000000000..42f266a996--- /dev/null+++ b/internal/unifiedresources/platform_admission_test.go@@ -0,0 +1,102 @@+package unifiedresources++import "testing"++func agentResource(id string, sources ...DataSource) Resource {+ return Resource{ID: id, Type: ResourceTypeAgent, Sources: sources, Agent: &AgentData{}}+}++func TestBuildPlatformAdmission_ProviderOwnedAgentDoesNotAdmitStandalone(t *testing.T) {+ // A TrueNAS host reports through the agent source and carries the "agent"+ // platform scope, so any count-based derivation would admit the standalone+ // page here. It is owned by TrueNAS and must not.+ truenasHost := agentResource("truenas-host", SourceAgent, SourceTrueNAS)+ truenasHost.TrueNAS = &TrueNASData{}+ RefreshPlatformScopes(&truenasHost)++ admission := BuildPlatformAdmission([]Resource{truenasHost})+ if admission.Standalone {+ t.Fatalf("provider-owned agent must not admit standalone, got %+v", admission)+ }+ if !admission.TrueNAS {+ t.Fatalf("expected truenas admission, got %+v", admission)+ }+}++func TestBuildPlatformAdmission_GenuinePulseAgentAdmitsStandalone(t *testing.T) {+ host := agentResource("pulse-host", SourceAgent)+ RefreshPlatformScopes(&host)++ admission := BuildPlatformAdmission([]Resource{host})+ if !admission.Standalone {+ t.Fatalf("genuine pulse agent must admit standalone, got %+v", admission)+ }+}++func TestBuildPlatformAdmission_ProxmoxOwnedAgentDoesNotAdmitStandalone(t *testing.T) {+ node := agentResource("pve-node", SourceAgent, SourceProxmox)+ node.Proxmox = &ProxmoxData{}+ RefreshPlatformScopes(&node)++ admission := BuildPlatformAdmission([]Resource{node})+ if admission.Standalone {+ t.Fatalf("proxmox-owned agent must not admit standalone, got %+v", admission)+ }+ if !admission.Proxmox {+ t.Fatalf("expected proxmox admission, got %+v", admission)+ }+}++func TestBuildPlatformAdmission_SourceStatusEvidenceCountsAsProviderOwnership(t *testing.T) {+ host := agentResource("vsphere-host", SourceAgent)+ host.SourceStatus = map[DataSource]SourceStatus{SourceVMware: {}}+ RefreshPlatformScopes(&host)++ if IsPulseAgentPlatformResource(host) {+ t.Fatalf("source-status provider evidence must disqualify the standalone claim")+ }+}++func TestBuildPlatformAdmission_AvailabilityEndpointAdmitsStandalone(t *testing.T) {+ endpoint := Resource{ID: "check-1", Type: ResourceTypeNetworkEndpoint, Sources: []DataSource{SourceAvailability}}+ RefreshPlatformScopes(&endpoint)++ admission := BuildPlatformAdmission([]Resource{endpoint})+ if !admission.Standalone {+ t.Fatalf("availability endpoint must admit standalone, got %+v", admission)+ }+}++func TestBuildPlatformAdmission_EmptyEstateAdmitsNothing(t *testing.T) {+ if admission := BuildPlatformAdmission(nil); admission != (PlatformAdmission{}) {+ t.Fatalf("empty estate must admit nothing, got %+v", admission)+ }+}++func TestBuildPlatformAdmission_DerivesScopesWhenNotRefreshed(t *testing.T) {+ // Admission must not depend on whether the caller refreshed scopes first.+ unrefreshed := Resource{ID: "k8s-node", Type: ResourceTypeAgent, Sources: []DataSource{SourceK8s}}+ admission := BuildPlatformAdmission([]Resource{unrefreshed})+ if !admission.Kubernetes {+ t.Fatalf("expected kubernetes admission from unrefreshed resource, got %+v", admission)+ }+ if admission.Standalone {+ t.Fatalf("kubernetes-owned agent must not admit standalone, got %+v", admission)+ }+}++func TestBuildPlatformAdmission_MixedEstate(t *testing.T) {+ pulseHost := agentResource("pulse-host", SourceAgent)+ truenasHost := agentResource("truenas-host", SourceAgent, SourceTrueNAS)+ truenasHost.TrueNAS = &TrueNASData{}+ dockerHost := Resource{ID: "docker-1", Type: ResourceTypeDockerService, Sources: []DataSource{SourceDocker}, Docker: &DockerData{}}+ for _, r := range []*Resource{&pulseHost, &truenasHost, &dockerHost} {+ RefreshPlatformScopes(r)+ }++ admission := BuildPlatformAdmission([]Resource{pulseHost, truenasHost, dockerHost})+ want := PlatformAdmission{Docker: true, TrueNAS: true, Standalone: true}+ if admission != want {+ t.Fatalf("admission = %+v, want %+v", admission, want)+ }+}diff --git a/internal/unifiedresources/registry_test.go b/internal/unifiedresources/registry_test.goindex b6a1f3bb5b..f03cc41515 100644--- a/internal/unifiedresources/registry_test.go+++ b/internal/unifiedresources/registry_test.go@@ -6140,3 +6140,38 @@ func TestProxmoxGuestKeylessFallsBackToSourceSpecificID(t *testing.T) {t.Fatalf("keyless guest must not declare superseded eras, got %v", vms[0].SupersededCanonicalIDs)}}++func TestRegistryResourcesReportPlatformAdmission(t *testing.T) {+ // Admission is derived from the same registry resources the API serves, so+ // it must hold for resources that reached the registry through ingest+ // rather than being hand-built in a test.+ registry := NewRegistry(nil)+ registry.IngestResources([]Resource{+ {+ ID: "pulse-host",+ Type: ResourceTypeAgent,+ Name: "workshop",+ Sources: []DataSource{SourceAgent},+ Agent: &AgentData{},+ },+ {+ ID: "truenas-host",+ Type: ResourceTypeAgent,+ Name: "storage",+ Sources: []DataSource{SourceAgent, SourceTrueNAS},+ Agent: &AgentData{},+ TrueNAS: &TrueNASData{},+ },+ })++ admission := BuildPlatformAdmission(registry.List())+ if !admission.Standalone {+ t.Fatalf("genuine pulse agent must admit standalone, got %+v", admission)+ }+ if !admission.TrueNAS {+ t.Fatalf("truenas host must admit truenas, got %+v", admission)+ }+ if admission.Proxmox || admission.Docker || admission.Kubernetes || admission.VMware {+ t.Fatalf("no other platform should be admitted, got %+v", admission)+ }+}diff --git a/internal/unifiedresources/types.go b/internal/unifiedresources/types.goindex 7e4a358259..241cc2a52d 100644--- a/internal/unifiedresources/types.go+++ b/internal/unifiedresources/types.go@@ -2017,4 +2017,8 @@ type ResourceStats struct {ByStatus map[ResourceStatus]int `json:"byStatus"`BySource map[DataSource]int `json:"bySource"`PolicyPosture *ResourcePolicyPostureSummary `json:"policyPosture,omitempty"`+ // PlatformAdmission reports which primary platform pages this set admits,+ // so the app shell can resolve its navigation from the canonical resource+ // contract instead of classifying a full-state payload itself.+ PlatformAdmission *PlatformAdmission `json:"platformAdmission,omitempty"`}