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
Curate canonical mock demo scenarios
rcourtman095a4f761f35
diff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.mdindex c750b486e0..ddc8f9f16e 100644--- a/docs/release-control/v6/internal/subsystems/monitoring.md+++ b/docs/release-control/v6/internal/subsystems/monitoring.md@@ -137,6 +137,13 @@ and curve shape from the same canonical resource-role registry, so database,cache, backup, web, and storage workloads keep believable long-range behaviorinstead of switching from one generic seeded pattern to a different recentruntime pattern.+That same mock-runtime owner now also owns demo-scenario curation. The+canonical `internal/mock/fixture_graph.go` path may project an authored demo+estate over generic fixture synthesis, but that authored layer must stay+graph-native and runtime-stable so infrastructure, workloads, storage, and+recovery all present the same human-readable platform story instead of a lab+of random names, legacy `mock-cluster` labels, or surface-specific mock+overrides.That same chart boundary also owns storage-series identity. Monitoring and`ReadState` consumers must address storage pool and physical-disk historythrough the resolved unified-resource metrics target, so seeded history,@@ -281,6 +288,14 @@ Source-owned IDs exposed through those same typed views must also trim outerwhitespace before they reach monitoring consumers, so a docker host, VM, node,or storage view cannot appear to carry a different source identity justbecause the ingest payload wrapped the source ID in spaces.+That same monitoring-owned Docker ingest path must also preserve persisted+container metadata across routine container recreation. When+`ApplyDockerReport` observes the same canonical docker host reporting a new+runtime container ID under the same normalized container name, monitoring must+copy custom URL, description, tags, and notes metadata onto the new container+ID instead of dropping that operator state on ordinary container replacement.+If multiple prior containers normalize to the same name, the migration must+fail closed and skip the copy rather than guessing between ambiguous sources.The same applies to proxmox topology coordinates exposed through typed views:node, cluster, and instance accessors must return canonical trimmed values somonitoring consumers do not fork topology grouping or labeling on `" pve-a "`diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex d897ae0064..71defed87b 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -245,6 +245,11 @@ recovery surfaces. Mock summary cards, seeded history, and provider-backedstorage/recovery counts must come from the same canonical fixture graph sostorage and recovery demos show realistic healthy-versus-attention balanceinstead of blank history, stale provider context, or page-local fixture drift.+That same recovery-facing demo contract also owns subject readability. When+mock recovery points project inventory-only Kubernetes PVC protection, the+subject identity shown to operators must stay human-readable+`<cluster>/<namespace>/<pvc>` context from the canonical graph instead of+opaque hash-like IDs that break demo trust and cross-surface recognition.That same adjacent chart boundary now also assumes seeded and live mockstorage timelines are one continuous series. Disk-temperature, pool-usage,used-capacity, and available-space cards may consume shaped chart payloads fordiff --git a/internal/mock/demo_scenarios.go b/internal/mock/demo_scenarios.gonew file mode 100644index 0000000000..276110ead6--- /dev/null+++ b/internal/mock/demo_scenarios.go@@ -0,0 +1,645 @@+package mock++import (+ "fmt"+ "sort"+ "strings"+ "time"++ "github.com/rcourtman/pulse-go-rewrite/internal/models"+)++type demoWorkloadProfile struct {+ Name string+ Tags []string+ BackupAge time.Duration+ ForceState string+}++type demoDockerHostProfile struct {+ Hostname string+ DisplayName string+ Containers []demoDockerContainerProfile+}++type demoDockerContainerProfile struct {+ Name string+ Image string+ Tags []string+ Health string+ Description string+}++type demoKubernetesNodeProfile struct {+ Name string+ Roles []string+}++type demoKubernetesDeploymentProfile struct {+ Name string+ Namespace string+ DesiredReplicas int32+ ReadyReplicas int32+}++type demoKubernetesPodProfile struct {+ Name string+ Namespace string+ NodeIndex int+ OwnerKind string+ OwnerName string+ Phase string+ Reason string+ Message string+ Container string+ Image string+ ContainerOK bool+ Restarts int32+}++var demoVMProfiles = []demoWorkloadProfile{+ {Name: "checkout-web-01", Tags: []string{"production", "web", "customer-facing"}, BackupAge: 6 * time.Hour},+ {Name: "checkout-web-02", Tags: []string{"production", "web", "customer-facing"}, BackupAge: 7 * time.Hour},+ {Name: "orders-api-01", Tags: []string{"production", "api", "critical"}, BackupAge: 3 * time.Hour},+ {Name: "orders-api-02", Tags: []string{"production", "api", "critical"}, BackupAge: 4 * time.Hour},+ {Name: "postgres-primary-01", Tags: []string{"production", "database", "critical"}, BackupAge: 90 * time.Minute},+ {Name: "postgres-replica-01", Tags: []string{"production", "database", "replica"}, BackupAge: 2 * time.Hour},+ {Name: "redis-cache-01", Tags: []string{"production", "cache", "latency-sensitive"}, BackupAge: 12 * time.Hour},+ {Name: "observability-core-01", Tags: []string{"monitoring", "platform", "production"}, BackupAge: 10 * time.Hour},+ {Name: "ci-runner-01", Tags: []string{"ci", "platform", "shared-services"}, BackupAge: 18 * time.Hour},+ {Name: "analytics-batch-01", Tags: []string{"analytics", "batch", "internal"}, BackupAge: 26 * time.Hour},+ {Name: "erp-app-01", Tags: []string{"business", "api", "internal"}, BackupAge: 8 * time.Hour},+ {Name: "docs-portal-01", Tags: []string{"web", "internal", "docs"}, BackupAge: 14 * time.Hour},+}++var demoContainerProfiles = []demoWorkloadProfile{+ {Name: "edge-proxy-01", Tags: []string{"production", "ingress", "edge"}, BackupAge: 6 * time.Hour},+ {Name: "auth-service-01", Tags: []string{"production", "api", "security"}, BackupAge: 4 * time.Hour},+ {Name: "billing-worker-01", Tags: []string{"production", "queue", "worker"}, BackupAge: 8 * time.Hour},+ {Name: "reporting-api-01", Tags: []string{"internal", "api", "reporting"}, BackupAge: 10 * time.Hour},+ {Name: "minio-gateway-01", Tags: []string{"storage", "internal", "gateway"}, BackupAge: 12 * time.Hour},+ {Name: "wireguard-edge-01", Tags: []string{"edge", "security", "vpn"}, BackupAge: 8 * time.Hour},+ {Name: "docs-wiki-01", Tags: []string{"internal", "web", "docs"}, BackupAge: 14 * time.Hour},+ {Name: "smtp-relay-01", Tags: []string{"mail", "queue", "platform"}, BackupAge: 16 * time.Hour},+ {Name: "grafana-agent-01", Tags: []string{"monitoring", "agent", "platform"}, BackupAge: 11 * time.Hour},+ {Name: "artifact-cache-01", Tags: []string{"ci", "cache", "platform"}, BackupAge: 19 * time.Hour},+ {Name: "backup-orchestrator-01", Tags: []string{"backup", "platform", "worker"}, BackupAge: 45 * time.Minute},+ {Name: "dev-portal-01", Tags: []string{"development", "web", "internal"}, BackupAge: 20 * time.Hour},+}++var demoDockerHostProfiles = []demoDockerHostProfile{+ {+ Hostname: "edge-apps-01",+ DisplayName: "Edge Apps 01",+ Containers: []demoDockerContainerProfile{+ {Name: "customer-portal", Image: "ghcr.io/pulse-demo/customer-portal:2026.04", Tags: []string{"web", "customer-facing", "production"}, Health: "healthy"},+ {Name: "inventory-api", Image: "ghcr.io/pulse-demo/inventory-api:2026.04", Tags: []string{"api", "production", "platform"}, Health: "healthy"},+ {Name: "edge-proxy", Image: "traefik:v3.1", Tags: []string{"ingress", "edge", "production"}, Health: "healthy"},+ {Name: "vaultwarden", Image: "vaultwarden/server:1.32.7", Tags: []string{"security", "internal"}, Health: "healthy"},+ {Name: "uptime-kuma", Image: "louislam/uptime-kuma:1.23.16", Tags: []string{"monitoring", "internal"}, Health: "healthy"},+ },+ },+ {+ Hostname: "ops-services-01",+ DisplayName: "Ops Services 01",+ Containers: []demoDockerContainerProfile{+ {Name: "postgres-archive", Image: "postgres:16.4", Tags: []string{"database", "archive", "internal"}, Health: "healthy"},+ {Name: "backup-coordinator", Image: "ghcr.io/pulse-demo/backup-coordinator:2026.04", Tags: []string{"backup", "platform", "worker"}, Health: "unhealthy"},+ {Name: "sftp-ingest", Image: "atmoz/sftp:latest", Tags: []string{"transfer", "integration", "internal"}, Health: "healthy"},+ {Name: "prometheus", Image: "prom/prometheus:v2.54.1", Tags: []string{"monitoring", "platform"}, Health: "healthy"},+ {Name: "grafana-agent", Image: "grafana/agent:v0.42.0", Tags: []string{"monitoring", "agent", "platform"}, Health: "healthy"},+ },+ },+}++var demoKubernetesNodeProfiles = []demoKubernetesNodeProfile{+ {Name: "prod-euw1-k8s-01", Roles: []string{"control-plane"}},+ {Name: "prod-euw1-k8s-02", Roles: []string{"worker"}},+ {Name: "prod-euw1-k8s-03", Roles: []string{"worker"}},+}++var demoKubernetesDeploymentProfiles = []demoKubernetesDeploymentProfile{+ {Name: "checkout-web", Namespace: "apps", DesiredReplicas: 3, ReadyReplicas: 3},+ {Name: "checkout-api", Namespace: "services", DesiredReplicas: 3, ReadyReplicas: 3},+ {Name: "payments-worker", Namespace: "services", DesiredReplicas: 2, ReadyReplicas: 1},+ {Name: "platform-observability", Namespace: "monitoring", DesiredReplicas: 2, ReadyReplicas: 2},+}++var demoKubernetesPodProfiles = []demoKubernetesPodProfile{+ {Name: "checkout-web-7fd84d8f76-2xp6n", Namespace: "apps", NodeIndex: 1, OwnerKind: "Deployment", OwnerName: "checkout-web", Phase: "Running", Container: "checkout-web", Image: "ghcr.io/pulse-demo/checkout-web:2026.04", ContainerOK: true},+ {Name: "checkout-web-7fd84d8f76-kjpl2", Namespace: "apps", NodeIndex: 2, OwnerKind: "Deployment", OwnerName: "checkout-web", Phase: "Running", Container: "checkout-web", Image: "ghcr.io/pulse-demo/checkout-web:2026.04", ContainerOK: true},+ {Name: "checkout-api-6c746d5bcf-c7z2p", Namespace: "services", NodeIndex: 1, OwnerKind: "Deployment", OwnerName: "checkout-api", Phase: "Running", Container: "checkout-api", Image: "ghcr.io/pulse-demo/checkout-api:2026.04", ContainerOK: true},+ {Name: "checkout-api-6c746d5bcf-s48vh", Namespace: "services", NodeIndex: 2, OwnerKind: "Deployment", OwnerName: "checkout-api", Phase: "Running", Container: "checkout-api", Image: "ghcr.io/pulse-demo/checkout-api:2026.04", ContainerOK: true},+ {Name: "payments-worker-58484d44f7-f6gzh", Namespace: "services", NodeIndex: 2, OwnerKind: "Deployment", OwnerName: "payments-worker", Phase: "Running", Container: "payments-worker", Image: "ghcr.io/pulse-demo/payments-worker:2026.04", ContainerOK: false, Reason: "CrashLoopBackOff", Message: "Back-off restarting failed container", Restarts: 7},+ {Name: "payments-worker-58484d44f7-s9m5r", Namespace: "services", NodeIndex: 1, OwnerKind: "Deployment", OwnerName: "payments-worker", Phase: "Running", Container: "payments-worker", Image: "ghcr.io/pulse-demo/payments-worker:2026.04", ContainerOK: true},+ {Name: "platform-observability-0", Namespace: "monitoring", NodeIndex: 0, OwnerKind: "StatefulSet", OwnerName: "platform-observability", Phase: "Running", Container: "platform-observability", Image: "grafana/loki:3.1.0", ContainerOK: true},+ {Name: "platform-observability-1", Namespace: "monitoring", NodeIndex: 2, OwnerKind: "StatefulSet", OwnerName: "platform-observability", Phase: "Running", Container: "platform-observability", Image: "prom/prometheus:v2.54.1", ContainerOK: true},+ {Name: "ingress-nginx-controller-86d96647c9-jms2p", Namespace: "ingress-nginx", NodeIndex: 0, OwnerKind: "Deployment", OwnerName: "ingress-nginx-controller", Phase: "Running", Container: "controller", Image: "registry.k8s.io/ingress-nginx/controller:v1.11.2", ContainerOK: true},+ {Name: "cron-nightly-backfill-28918234", Namespace: "services", NodeIndex: 2, OwnerKind: "Job", OwnerName: "cron-nightly-backfill", Phase: "Pending", Reason: "PodInitializing", Message: "Waiting for scheduled execution window", Container: "cron-nightly-backfill", Image: "ghcr.io/pulse-demo/cron-nightly-backfill:2026.04", ContainerOK: false},+}++const demoProxmoxClusterName = "Core Fabric"++func applyDemoScenarioGraph(graph *FixtureGraph, now time.Time) {+ if graph == nil {+ return+ }++ applyDemoNodeScenario(&graph.State)+ vmNames := applyDemoWorkloadScenario(graph.State.VMs, demoVMProfiles, now)+ containerNames := applyDemoContainerScenario(graph.State.Containers, demoContainerProfiles, now)+ applyDemoDockerScenario(&graph.State, now)+ applyDemoKubernetesScenario(&graph.State, now)+ applyDemoStorageScenario(&graph.State)+ applyDemoBackupScenario(&graph.State, vmNames, containerNames, now)+}++func applyDemoNodeScenario(state *models.StateSnapshot) {+ if state == nil {+ return+ }++ nodeDisplayNames := []string{+ "West Production A",+ "West Production B",+ "West Production C",+ "Disaster Recovery A",+ "Disaster Recovery B",+ }+ for i := range state.Nodes {+ state.Nodes[i].Instance = scenarioClusterAlias(state.Nodes[i].Instance)+ if state.Nodes[i].IsClusterMember || strings.TrimSpace(state.Nodes[i].ClusterName) != "" {+ state.Nodes[i].ClusterName = scenarioClusterAlias(state.Nodes[i].ClusterName)+ }+ if i < len(nodeDisplayNames) {+ state.Nodes[i].DisplayName = nodeDisplayNames[i]+ }+ }++ hostsByID := make(map[string]*models.Host, len(state.Hosts))+ hostsByHostname := make(map[string]*models.Host, len(state.Hosts))+ for i := range state.Hosts {+ host := &state.Hosts[i]+ if id := strings.TrimSpace(host.ID); id != "" {+ hostsByID[id] = host+ }+ if name := strings.ToLower(strings.TrimSpace(host.Hostname)); name != "" {+ hostsByHostname[name] = host+ }+ }+ for _, node := range state.Nodes {+ if host := hostsByID[strings.TrimSpace(node.LinkedAgentID)]; host != nil {+ host.DisplayName = node.DisplayName+ continue+ }+ if host := hostsByHostname[strings.ToLower(strings.TrimSpace(node.Name))]; host != nil {+ host.DisplayName = node.DisplayName+ }+ }+}++func applyDemoWorkloadScenario(workloads []models.VM, profiles []demoWorkloadProfile, now time.Time) map[int]string {+ guestNames := make(map[int]string, len(workloads))+ sort.Slice(workloads, func(i, j int) bool {+ if workloads[i].VMID == workloads[j].VMID {+ return workloads[i].ID < workloads[j].ID+ }+ return workloads[i].VMID < workloads[j].VMID+ })+ for i := range workloads {+ profile := namedWorkloadProfile(profiles, i)+ workloads[i].Name = profile.Name+ workloads[i].Instance = scenarioClusterAlias(workloads[i].Instance)+ workloads[i].Tags = mergeScenarioTags(workloads[i].Tags, profile.Tags)+ workloads[i].Status = normalizeWorkloadState(profile.ForceState, "running")+ if !now.IsZero() && profile.BackupAge > 0 {+ workloads[i].LastBackup = now.Add(-profile.BackupAge)+ }+ guestNames[workloads[i].VMID] = workloads[i].Name+ }+ return guestNames+}++func applyDemoContainerScenario(workloads []models.Container, profiles []demoWorkloadProfile, now time.Time) map[int]string {+ guestNames := make(map[int]string, len(workloads))+ sort.Slice(workloads, func(i, j int) bool {+ if workloads[i].VMID == workloads[j].VMID {+ return workloads[i].ID < workloads[j].ID+ }+ return workloads[i].VMID < workloads[j].VMID+ })+ for i := range workloads {+ profile := namedWorkloadProfile(profiles, i)+ workloads[i].Name = profile.Name+ workloads[i].Instance = scenarioClusterAlias(workloads[i].Instance)+ workloads[i].Tags = mergeScenarioTags(workloads[i].Tags, profile.Tags)+ workloads[i].Status = normalizeWorkloadState(profile.ForceState, "running")+ if !now.IsZero() && profile.BackupAge > 0 {+ workloads[i].LastBackup = now.Add(-profile.BackupAge)+ }+ guestNames[workloads[i].VMID] = workloads[i].Name+ }+ return guestNames+}++func applyDemoDockerScenario(state *models.StateSnapshot, now time.Time) {+ if state == nil {+ return+ }++ sort.Slice(state.DockerHosts, func(i, j int) bool {+ return state.DockerHosts[i].ID < state.DockerHosts[j].ID+ })+ for i := range state.DockerHosts {+ hostProfile := demoDockerHostProfiles[i%len(demoDockerHostProfiles)]+ host := &state.DockerHosts[i]+ host.Hostname = hostProfile.Hostname+ host.DisplayName = hostProfile.DisplayName+ host.Status = "online"+ host.Containers = applyDemoDockerContainerProfiles(host.Containers, hostProfile.Containers, now)+ flagged := 0+ for _, container := range host.Containers {+ switch strings.ToLower(strings.TrimSpace(container.Health)) {+ case "unhealthy", "starting":+ flagged+++ }+ }+ if flagged > 0 {+ host.Status = "degraded"+ }+ }+}++func applyDemoDockerContainerProfiles(+ containers []models.DockerContainer,+ profiles []demoDockerContainerProfile,+ now time.Time,+) []models.DockerContainer {+ sort.Slice(containers, func(i, j int) bool {+ return containers[i].ID < containers[j].ID+ })+ for i := range containers {+ profile := profiles[i%len(profiles)]+ containers[i].Name = profile.Name+ containers[i].Image = profile.Image+ containers[i].Labels = mergeScenarioLabelSet(containers[i].Labels, profile.Tags)+ containers[i].State = "running"+ containers[i].Status = "Up"+ containers[i].Health = profile.Health+ if containers[i].StartedAt == nil {+ started := now+ if started.IsZero() {+ started = time.Now()+ }+ started = started.Add(-time.Duration(600+i*300) * time.Second)+ containers[i].StartedAt = &started+ }+ containers[i].FinishedAt = nil+ if containers[i].MemoryLimit <= 0 {+ containers[i].MemoryLimit = int64(2+i%3) * 1024 * 1024 * 1024+ }+ if containers[i].RootFilesystemBytes <= 0 {+ containers[i].RootFilesystemBytes = int64(20+i%4*10) * 1024 * 1024 * 1024+ }+ }+ return containers+}++func applyDemoKubernetesScenario(state *models.StateSnapshot, now time.Time) {+ if state == nil || len(state.KubernetesClusters) == 0 {+ return+ }++ for clusterIndex := range state.KubernetesClusters {+ cluster := &state.KubernetesClusters[clusterIndex]+ cluster.Name = "Production"+ cluster.DisplayName = "Production"+ cluster.Status = "warning"++ nodeNameMap := make(map[string]string, len(cluster.Nodes))+ for i := range cluster.Nodes {+ profile := demoKubernetesNodeProfiles[i%len(demoKubernetesNodeProfiles)]+ oldName := cluster.Nodes[i].Name+ cluster.Nodes[i].Name = profile.Name+ cluster.Nodes[i].Ready = true+ cluster.Nodes[i].Unschedulable = false+ cluster.Nodes[i].Roles = append([]string(nil), profile.Roles...)+ nodeNameMap[oldName] = profile.Name+ }++ for i := range state.Hosts {+ host := &state.Hosts[i]+ if renamed, ok := nodeNameMap[strings.TrimSpace(host.Hostname)]; ok {+ host.Hostname = renamed+ host.DisplayName = humanizeHostDisplayName(renamed)+ }+ }++ for i := range cluster.Deployments {+ profile := demoKubernetesDeploymentProfiles[i%len(demoKubernetesDeploymentProfiles)]+ cluster.Deployments[i].Name = profile.Name+ cluster.Deployments[i].Namespace = profile.Namespace+ cluster.Deployments[i].DesiredReplicas = profile.DesiredReplicas+ cluster.Deployments[i].UpdatedReplicas = profile.ReadyReplicas+ cluster.Deployments[i].ReadyReplicas = profile.ReadyReplicas+ cluster.Deployments[i].AvailableReplicas = profile.ReadyReplicas+ cluster.Deployments[i].Labels = map[string]string{+ "app.kubernetes.io/name": profile.Name,+ "cluster": cluster.ID,+ "environment": "production",+ }+ }++ for i := range cluster.Pods {+ profile := demoKubernetesPodProfiles[i%len(demoKubernetesPodProfiles)]+ pod := &cluster.Pods[i]+ pod.Name = profile.Name+ pod.Namespace = profile.Namespace+ if profile.NodeIndex >= 0 && profile.NodeIndex < len(cluster.Nodes) {+ pod.NodeName = cluster.Nodes[profile.NodeIndex].Name+ } else if renamed, ok := nodeNameMap[pod.NodeName]; ok {+ pod.NodeName = renamed+ }+ pod.OwnerKind = profile.OwnerKind+ pod.OwnerName = profile.OwnerName+ pod.Phase = profile.Phase+ pod.Reason = profile.Reason+ pod.Message = profile.Message+ pod.Restarts = int(profile.Restarts)+ if len(pod.Containers) == 0 {+ pod.Containers = []models.KubernetesPodContainer{{}}+ }+ for j := range pod.Containers {+ pod.Containers[j].Name = profile.Container+ pod.Containers[j].Image = profile.Image+ pod.Containers[j].RestartCount = profile.Restarts+ if profile.ContainerOK {+ pod.Containers[j].Ready = true+ pod.Containers[j].State = "running"+ pod.Containers[j].Reason = ""+ pod.Containers[j].Message = ""+ } else {+ pod.Containers[j].Ready = false+ switch strings.ToLower(strings.TrimSpace(profile.Phase)) {+ case "pending":+ pod.Containers[j].State = "waiting"+ pod.Containers[j].Reason = "PodInitializing"+ default:+ pod.Containers[j].State = "waiting"+ pod.Containers[j].Reason = "CrashLoopBackOff"+ }+ pod.Containers[j].Message = profile.Message+ }+ }+ pod.Labels = map[string]string{+ "app.kubernetes.io/name": profile.OwnerName,+ "app.kubernetes.io/part-of": "pulse-demo-estate",+ "app.kubernetes.io/instance": profile.OwnerName,+ }+ }++ initializeMockKubernetesClusterUsage(cluster, now, false)+ }++ syncMockKubernetesNodeHosts(state)+}++func applyDemoStorageScenario(state *models.StateSnapshot) {+ if state == nil {+ return+ }++ clusterStorageNames := map[string]string{+ "local": "iso-library",+ "local-zfs": "service-pool",+ "shared-storage": "shared-backup-fabric",+ "pbs-pve1": "backup-vault-a",+ "pbs-pve2": "backup-vault-b",+ "pbs-pve3": "backup-vault-c",+ }+ for i := range state.Storage {+ storage := &state.Storage[i]+ if name := strings.TrimSpace(clusterStorageNames[storage.Name]); name != "" {+ storage.Name = name+ }+ storage.Instance = scenarioClusterAlias(storage.Instance)+ }++ for i := range state.PBSInstances {+ state.PBSInstances[i].Name = []string{"backup-vault", "dr-vault"}[minInt(i, 1)]+ if len(state.PBSInstances[i].Datastores) > 0 {+ datastoreNames := []string{"primary-vault", "offsite-vault", "replica-vault"}+ for j := range state.PBSInstances[i].Datastores {+ if j < len(datastoreNames) {+ state.PBSInstances[i].Datastores[j].Name = datastoreNames[j]+ }+ state.PBSInstances[i].Datastores[j].Status = "available"+ }+ }+ }++ for i := range state.PMGInstances {+ if i == 0 {+ state.PMGInstances[i].Name = "mail-gateway-eu"+ } else {+ state.PMGInstances[i].Name = "mail-gateway-us"+ }+ }+}++func applyDemoBackupScenario(+ state *models.StateSnapshot,+ vmNames map[int]string,+ containerNames map[int]string,+ now time.Time,+) {+ if state == nil {+ return+ }++ nameForBackup := func(backupType string, vmid int) string {+ switch strings.ToLower(strings.TrimSpace(backupType)) {+ case "qemu", "vm":+ return vmNames[vmid]+ case "lxc", "ct":+ return containerNames[vmid]+ default:+ return ""+ }+ }++ for i := range state.PVEBackups.StorageBackups {+ backup := &state.PVEBackups.StorageBackups[i]+ if guestName := nameForBackup(backup.Type, backup.VMID); guestName != "" {+ backup.Notes = fmt.Sprintf("Backup of %s", guestName)+ }+ if backup.Storage == "local" {+ backup.Storage = "backup-vault"+ }+ }++ for i := range state.PBSBackups {+ backup := &state.PBSBackups[i]+ if backup.Instance == "pbs-main" {+ backup.Instance = "backup-vault"+ } else if backup.Instance == "pbs-secondary" {+ backup.Instance = "dr-vault"+ }+ if backup.Datastore == "backup-store" {+ backup.Datastore = "primary-vault"+ } else if backup.Datastore == "offsite-backup" {+ backup.Datastore = "offsite-vault"+ } else if backup.Datastore == "replica-store" {+ backup.Datastore = "replica-vault"+ }+ if guestName := nameForBackup(backup.BackupType, atoiSafe(backup.VMID)); guestName != "" {+ backup.Comment = fmt.Sprintf("Protected recovery point for %s", guestName)+ }+ }++ for i := range state.PVEBackups.GuestSnapshots {+ snapshot := &state.PVEBackups.GuestSnapshots[i]+ if guestName := nameForBackup(snapshot.Type, snapshot.VMID); guestName != "" {+ snapshot.Description = fmt.Sprintf("%s snapshot", guestName)+ }+ }++ for i := range state.ReplicationJobs {+ job := &state.ReplicationJobs[i]+ if guestName := vmNames[job.GuestID]; guestName != "" {+ job.GuestName = guestName+ }+ job.SourceStorage = scenarioStorageAlias(job.SourceStorage)+ job.TargetStorage = scenarioStorageAlias(job.TargetStorage)+ }++ for i := range state.VMs {+ if state.VMs[i].LastBackup.IsZero() {+ state.VMs[i].LastBackup = now.Add(-12 * time.Hour)+ }+ }+ for i := range state.Containers {+ if state.Containers[i].LastBackup.IsZero() {+ state.Containers[i].LastBackup = now.Add(-18 * time.Hour)+ }+ }++ state.PMGBackups = extractPMGBackups(state.PVEBackups.StorageBackups)+ state.Backups.PVE = state.PVEBackups+ state.Backups.PBS = append([]models.PBSBackup(nil), state.PBSBackups...)+ state.Backups.PMG = append([]models.PMGBackup(nil), state.PMGBackups...)+}++func namedWorkloadProfile(profiles []demoWorkloadProfile, index int) demoWorkloadProfile {+ if len(profiles) == 0 {+ return demoWorkloadProfile{Name: fmt.Sprintf("workload-%02d", index+1)}+ }+ profile := profiles[index%len(profiles)]+ if index < len(profiles) {+ return profile+ }+ baseName := strings.TrimSpace(profile.Name)+ baseName = strings.TrimRight(baseName, "0123456789-")+ baseName = strings.TrimRight(baseName, "-")+ if baseName == "" {+ baseName = "workload"+ }+ profile.Name = fmt.Sprintf("%s-%02d", baseName, index+1)+ return profile+}++func mergeScenarioTags(existing []string, scenario []string) []string {+ seen := make(map[string]struct{}, len(existing)+len(scenario))+ out := make([]string, 0, len(existing)+len(scenario))+ for _, set := range [][]string{scenario, existing} {+ for _, tag := range set {+ tag = strings.TrimSpace(strings.ToLower(tag))+ if tag == "" {+ continue+ }+ if _, ok := seen[tag]; ok {+ continue+ }+ seen[tag] = struct{}{}+ out = append(out, tag)+ }+ }+ return out+}++func mergeScenarioLabelSet(existing map[string]string, tags []string) map[string]string {+ labels := make(map[string]string, len(existing)+len(tags)+1)+ for key, value := range existing {+ labels[key] = value+ }+ if _, ok := labels["com.pulse.demo"]; !ok {+ labels["com.pulse.demo"] = "true"+ }+ for _, tag := range tags {+ tag = strings.TrimSpace(strings.ToLower(tag))+ if tag == "" {+ continue+ }+ labels["com.pulse.role."+tag] = "true"+ }+ return labels+}++func normalizeWorkloadState(preferred, fallback string) string {+ state := strings.ToLower(strings.TrimSpace(preferred))+ if state == "" {+ state = strings.ToLower(strings.TrimSpace(fallback))+ }+ switch state {+ case "running", "online":+ return "running"+ case "stopped", "offline":+ return "stopped"+ default:+ return "running"+ }+}++func scenarioClusterAlias(name string) string {+ switch strings.TrimSpace(strings.ToLower(name)) {+ case "", "standalone":+ return strings.TrimSpace(name)+ case "mock-cluster":+ return demoProxmoxClusterName+ default:+ return name+ }+}++func scenarioStorageAlias(name string) string {+ switch strings.ToLower(strings.TrimSpace(name)) {+ case "local-zfs":+ return "service-pool"+ case "replica-zfs":+ return "dr-service-pool"+ default:+ return name+ }+}++func atoiSafe(raw string) int {+ raw = strings.TrimSpace(raw)+ if raw == "" {+ return 0+ }+ value := 0+ for _, r := range raw {+ if r < '0' || r > '9' {+ return value+ }+ value = value*10 + int(r-'0')+ }+ return value+}++func minInt(a, b int) int {+ if a < b {+ return a+ }+ return b+}diff --git a/internal/mock/demo_scenarios_test.go b/internal/mock/demo_scenarios_test.gonew file mode 100644index 0000000000..a5517c06a5--- /dev/null+++ b/internal/mock/demo_scenarios_test.go@@ -0,0 +1,208 @@+package mock++import (+ "strings"+ "testing"+ "time"+)++func TestBuildFixtureGraphAppliesCuratedDemoScenarioAcrossEstate(t *testing.T) {+ cfg := DefaultConfig+ cfg.RandomMetrics = false++ now := time.Date(2026, time.April, 1, 12, 0, 0, 0, time.UTC)+ graph := buildFixtureGraph(cfg, now)++ for _, want := range []string{"checkout-web-01", "orders-api-01"} {+ if !vmNameExists(graph, want) {+ t.Fatalf("expected curated vm %q in canonical demo graph", want)+ }+ }+ for _, want := range []string{"auth-service-01", "backup-orchestrator-01"} {+ if !containerNameExists(graph, want) {+ t.Fatalf("expected curated system container %q in canonical demo graph", want)+ }+ }+ for _, want := range []string{"edge-apps-01", "ops-services-01"} {+ if !dockerHostNameExists(graph, want) {+ t.Fatalf("expected curated docker host %q in canonical demo graph", want)+ }+ }+ for _, want := range []string{"customer-portal", "backup-coordinator"} {+ if !dockerContainerNameExists(graph, want) {+ t.Fatalf("expected curated app container %q in canonical demo graph", want)+ }+ }+ if !nodeDisplayNameExists(graph, "West Production A") {+ t.Fatal("expected curated infrastructure node display name in canonical demo graph")+ }+ if !kubernetesNodeExists(graph, "prod-euw1-k8s-01") {+ t.Fatal("expected curated kubernetes node in canonical demo graph")+ }+ for _, want := range []string{"checkout-web", "payments-worker"} {+ if !kubernetesDeploymentExists(graph, want) {+ t.Fatalf("expected curated kubernetes deployment %q in canonical demo graph", want)+ }+ }+ for _, want := range []string{"shared-backup-fabric", "service-pool"} {+ if !storageNameExists(graph, want) {+ t.Fatalf("expected curated storage name %q in canonical demo graph", want)+ }+ }+ if !pbsInstanceExists(graph, "backup-vault") {+ t.Fatal("expected curated PBS instance in canonical demo graph")+ }+ if !pmgInstanceExists(graph, "mail-gateway-eu") {+ t.Fatal("expected curated PMG instance in canonical demo graph")+ }+ if leak := firstLegacyMockClusterLeak(graph); leak != "" {+ t.Fatalf("expected demo scenario to replace legacy mock-cluster labels, found %s", leak)+ }+}++func TestFixtureGraphUpdateMetricsPreservesCuratedDemoScenario(t *testing.T) {+ cfg := DefaultConfig+ cfg.RandomMetrics = false++ start := time.Date(2026, time.April, 1, 12, 0, 0, 0, time.UTC)+ later := start.Add(45 * time.Minute)++ graph := buildFixtureGraph(cfg, start)+ graph.UpdateMetrics(cfg, later)++ if !vmNameExists(graph, "checkout-web-01") {+ t.Fatal("expected curated vm naming to survive metric refresh")+ }+ if !dockerContainerNameExists(graph, "customer-portal") {+ t.Fatal("expected curated docker container naming to survive metric refresh")+ }+ if !kubernetesNodeExists(graph, "prod-euw1-k8s-01") {+ t.Fatal("expected curated kubernetes node naming to survive metric refresh")+ }+ if !storageNameExists(graph, "shared-backup-fabric") {+ t.Fatal("expected curated storage naming to survive metric refresh")+ }+ if leak := firstLegacyMockClusterLeak(graph); leak != "" {+ t.Fatalf("expected metric refresh to preserve cluster aliasing, found %s", leak)+ }+}++func vmNameExists(graph FixtureGraph, want string) bool {+ for _, vm := range graph.State.VMs {+ if vm.Name == want {+ return true+ }+ }+ return false+}++func containerNameExists(graph FixtureGraph, want string) bool {+ for _, container := range graph.State.Containers {+ if container.Name == want {+ return true+ }+ }+ return false+}++func dockerHostNameExists(graph FixtureGraph, want string) bool {+ for _, host := range graph.State.DockerHosts {+ if host.Hostname == want || host.DisplayName == want {+ return true+ }+ }+ return false+}++func dockerContainerNameExists(graph FixtureGraph, want string) bool {+ for _, host := range graph.State.DockerHosts {+ for _, container := range host.Containers {+ if container.Name == want {+ return true+ }+ }+ }+ return false+}++func nodeDisplayNameExists(graph FixtureGraph, want string) bool {+ for _, node := range graph.State.Nodes {+ if node.DisplayName == want {+ return true+ }+ }+ return false+}++func kubernetesNodeExists(graph FixtureGraph, want string) bool {+ for _, cluster := range graph.State.KubernetesClusters {+ for _, node := range cluster.Nodes {+ if node.Name == want {+ return true+ }+ }+ }+ return false+}++func kubernetesDeploymentExists(graph FixtureGraph, want string) bool {+ for _, cluster := range graph.State.KubernetesClusters {+ for _, deployment := range cluster.Deployments {+ if deployment.Name == want {+ return true+ }+ }+ }+ return false+}++func storageNameExists(graph FixtureGraph, want string) bool {+ for _, storage := range graph.State.Storage {+ if storage.Name == want {+ return true+ }+ }+ return false+}++func pbsInstanceExists(graph FixtureGraph, want string) bool {+ for _, instance := range graph.State.PBSInstances {+ if instance.Name == want {+ return true+ }+ }+ return false+}++func pmgInstanceExists(graph FixtureGraph, want string) bool {+ for _, instance := range graph.State.PMGInstances {+ if instance.Name == want {+ return true+ }+ }+ return false+}++func firstLegacyMockClusterLeak(graph FixtureGraph) string {+ for _, node := range graph.State.Nodes {+ if strings.EqualFold(node.Instance, "mock-cluster") || strings.EqualFold(node.ClusterName, "mock-cluster") {+ return "node:" + firstNonEmptyTrimmed(node.DisplayName, node.Name, node.ID)+ }+ }+ for _, vm := range graph.State.VMs {+ if strings.EqualFold(vm.Instance, "mock-cluster") {+ return "vm:" + firstNonEmptyTrimmed(vm.Name, vm.ID)+ }+ }+ for _, container := range graph.State.Containers {+ if strings.EqualFold(container.Instance, "mock-cluster") {+ return "container:" + firstNonEmptyTrimmed(container.Name, container.ID)+ }+ }+ for _, storage := range graph.State.Storage {+ if strings.EqualFold(storage.Instance, "mock-cluster") {+ return "storage:" + firstNonEmptyTrimmed(storage.Name, storage.ID)+ }+ }+ return ""+}diff --git a/internal/mock/fixture_graph.go b/internal/mock/fixture_graph.goindex bbcd2dc207..ffd4e84740 100644--- a/internal/mock/fixture_graph.go+++ b/internal/mock/fixture_graph.go@@ -29,6 +29,7 @@ func buildFixtureGraph(cfg MockConfig, now time.Time) FixtureGraph {State: buildFixtureState(cfg),PlatformFixtures: defaultPlatformFixtures(),}+ applyDemoScenarioGraph(&graph, now)graph.UpdateMetrics(cfg, now)graph.AlertHistory = buildAlertHistory(graph.State.Nodes, graph.State.VMs, graph.State.Containers)syncMetricRoleRegistryFromGraph(graph)@@ -49,6 +50,8 @@ func (g *FixtureGraph) UpdateMetrics(cfg MockConfig, now time.Time) {}updateFixtureStateMetricsAt(&g.State, cfg, now)g.PlatformFixtures = rebasePlatformFixtures(g.PlatformFixtures, now)+ applyDemoScenarioGraph(g, now)+ syncMetricRoleRegistryFromGraph(*g)}func (g *FixtureGraph) UpdateAlertSnapshots(active []alerts.Alert, resolved []models.ResolvedAlert) {diff --git a/internal/mock/recovery_points.go b/internal/mock/recovery_points.goindex 23d3e772f9..06b49cbadb 100644--- a/internal/mock/recovery_points.go+++ b/internal/mock/recovery_points.go@@ -3,6 +3,7 @@ package mockimport ("crypto/sha256""encoding/hex"+ "fmt""sort""strings""time"@@ -109,7 +110,7 @@ func generateMockRecoveryPoints(snapshot models.StateSnapshot, fixtures PlatformType: "k8s-pvc",Namespace: s.namespace,Name: s.pvc,- UID: rpStableID("k8s", "pvc", s.clusterID, s.namespace, s.pvc),+ UID: mockRecoveryPVCUID(s.clusterName, s.namespace, s.pvc),},RepositoryRef: &recovery.ExternalRef{Type: "k8s-volume-snapshot-class",@@ -546,6 +547,18 @@ func recoveryKubernetesPVCSubjects(clusters []mockRecoveryCluster) []mockRecoverreturn subjects}+func mockRecoveryPVCUID(clusterName, namespace, pvc string) string {+ clusterName = strings.TrimSpace(strings.ToLower(clusterName))+ clusterName = strings.ReplaceAll(clusterName, " ", "-")+ namespace = strings.TrimSpace(strings.ToLower(namespace))+ pvc = strings.TrimSpace(strings.ToLower(pvc))+ return firstNonEmptyTrimmed(+ fmt.Sprintf("%s/%s/%s", clusterName, namespace, pvc),+ fmt.Sprintf("%s/%s", namespace, pvc),+ pvc,+ )+}+func recoveryProxmoxSubjects(snapshot models.StateSnapshot) []mockProxmoxRecoverySubject {subjects := make([]mockProxmoxRecoverySubject, 0, 3)seen := map[string]struct{}{}diff --git a/internal/mock/recovery_points_test.go b/internal/mock/recovery_points_test.goindex 4c63645991..fb7af29a93 100644--- a/internal/mock/recovery_points_test.go+++ b/internal/mock/recovery_points_test.go@@ -1,6 +1,7 @@package mockimport (+ "strings""testing""time"@@ -152,3 +153,60 @@ func TestFixtureGraphRecoveryPointsKeepTrueNASArtifactsFreshForDemoMode(t *testit.Fatalf("expected demo TrueNAS recovery artifacts within the last 24h, got newest %s", newest.UTC().Format(time.RFC3339))}}++func TestFixtureGraphRecoveryPointsUseReadableKubernetesPVCUIDs(t *testing.T) {+ previous := IsMockEnabled()+ SetEnabled(true)+ t.Cleanup(func() { SetEnabled(previous) })++ points := CurrentFixtureGraph().RecoveryPoints()+ if len(points) == 0 {+ t.Fatal("expected mock recovery points")+ }++ foundPVC := false+ foundPrometheus := false+ for _, point := range points {+ if point.Provider != recovery.ProviderKubernetes || point.SubjectRef == nil || point.SubjectRef.Type != "k8s-pvc" {+ continue+ }+ foundPVC = true++ uid := strings.TrimSpace(point.SubjectRef.UID)+ if uid == "" {+ t.Fatalf("expected readable kubernetes pvc uid for %q", point.SubjectRef.Name)+ }+ if !strings.Contains(uid, "/") {+ t.Fatalf("expected kubernetes pvc uid %q to preserve cluster/namespace context", uid)+ }+ if isHexToken(uid) && len(uid) >= 32 {+ t.Fatalf("expected kubernetes pvc uid %q to avoid opaque hashed identifiers", uid)+ }+ if point.SubjectRef.Name == "prometheus-pvc" {+ foundPrometheus = true+ if uid != "production/monitoring/prometheus-pvc" {+ t.Fatalf("expected prometheus pvc uid to stay human readable, got %q", uid)+ }+ }+ }++ if !foundPVC {+ t.Fatal("expected kubernetes pvc recovery points in canonical mock graph")+ }+ if !foundPrometheus {+ t.Fatal("expected prometheus pvc recovery point in canonical mock graph")+ }+}++func isHexToken(value string) bool {+ value = strings.TrimSpace(value)+ if value == "" {+ return false+ }+ for _, r := range value {+ if (r < '0' || r > '9') && (r < 'a' || r > 'f') && (r < 'A' || r > 'F') {+ return false+ }+ }+ return true+}diff --git a/tests/integration/tests/49-demo-scenario-curation.spec.ts b/tests/integration/tests/49-demo-scenario-curation.spec.tsnew file mode 100644index 0000000000..5113cf5f16--- /dev/null+++ b/tests/integration/tests/49-demo-scenario-curation.spec.ts@@ -0,0 +1,141 @@+import fs from "node:fs";+import path from "node:path";+import { fileURLToPath } from "node:url";+import { expect, test as base } from "@playwright/test";++import {+ createAuthenticatedStorageState,+ getMockMode,+ setMockMode,+} from "./helpers";++const __dirname = path.dirname(fileURLToPath(import.meta.url));++type WorkerFixtures = {+ authStorageStatePath: string;+};++let mockModeWasEnabled: boolean | null = null;++const test = base.extend<{}, WorkerFixtures>({+ storageState: async ({ authStorageStatePath }, use) => {+ await use(authStorageStatePath);+ },+ authStorageStatePath: [+ async ({ browser }, use, workerInfo) => {+ const storageStatePath = path.resolve(+ __dirname,+ "..",+ "..",+ "tmp",+ "playwright-auth",+ `demo-scenario-curation-${workerInfo.project.name}.json`,+ );+ fs.mkdirSync(path.dirname(storageStatePath), { recursive: true });+ await createAuthenticatedStorageState(browser, storageStatePath);+ try {+ await use(storageStatePath);+ } finally {+ fs.rmSync(storageStatePath, { force: true });+ }+ },+ { scope: "worker" },+ ],+});++async function ensureMockModeEnabled(+ page: import("@playwright/test").Page,+): Promise<void> {+ const state = await getMockMode(page);+ if (mockModeWasEnabled === null) {+ mockModeWasEnabled = state.enabled;+ }+ if (!state.enabled) {+ await setMockMode(page, true);+ }+}++async function tableRowsText(+ page: import("@playwright/test").Page,+): Promise<string[]> {+ return page+ .locator("table tbody tr")+ .evaluateAll((rows) =>+ rows.map((row) => row.innerText.replace(/\s+/g, " ").trim()),+ );+}++async function expectSomeRowContains(+ page: import("@playwright/test").Page,+ text: string,+): Promise<void> {+ await expect+ .poll(async () => {+ const rows = await tableRowsText(page);+ return rows.some((row) => row.includes(text));+ })+ .toBe(true);+}++async function expectNoRowContains(+ page: import("@playwright/test").Page,+ text: string,+): Promise<void> {+ await expect+ .poll(async () => {+ const rows = await tableRowsText(page);+ return rows.some((row) => row.includes(text));+ })+ .toBe(false);+}++test.describe.serial("Demo scenario curation", () => {+ test.setTimeout(180_000);++ test.afterAll(async ({ browser }) => {+ if (mockModeWasEnabled === null) return;++ const context = await browser.newContext();+ const page = await context.newPage();+ try {+ const current = await getMockMode(page);+ if (current.enabled !== mockModeWasEnabled) {+ await setMockMode(page, mockModeWasEnabled);+ }+ } finally {+ await context.close();+ }+ });++ test("renders the curated demo estate across infrastructure, workloads, storage, and recovery", async ({+ page,+ }, testInfo) => {+ test.skip(+ testInfo.project.name.startsWith("mobile-"),+ "Desktop runtime proof",+ );++ await ensureMockModeEnabled(page);++ await page.goto("/infrastructure", { waitUntil: "domcontentloaded" });+ await expect(page.getByTestId("infrastructure-summary")).toBeVisible();+ await expectSomeRowContains(page, "West Production A");+ await expectSomeRowContains(page, "Prod Euw1 K8s 01");+ await expectNoRowContains(page, "mock-cluster");++ await page.goto("/workloads", { waitUntil: "domcontentloaded" });+ await expect(page.getByTestId("workloads-summary")).toBeVisible();+ await expectSomeRowContains(page, "customer-portal");+ await expectSomeRowContains(page, "backup-coordinator");+ await expectSomeRowContains(page, "checkout-web-01");++ await page.goto("/storage", { waitUntil: "domcontentloaded" });+ await expect(page.getByTestId("storage-summary")).toBeVisible();+ await expectSomeRowContains(page, "shared-backup-fabric");+ await expectSomeRowContains(page, "service-pool");++ await page.goto("/recovery", { waitUntil: "domcontentloaded" });+ await expectSomeRowContains(page, "checkout-web-01");+ await expectSomeRowContains(page, "production/monitoring/prometheus-pvc");+ });+});