Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

Fix backend release gate failures

rcourtmana45b568d796f
diff --git a/docs/release-control/v6/internal/status.json b/docs/release-control/v6/internal/status.json
index c12ab7951c..daaf7044d6 100644
--- a/docs/release-control/v6/internal/status.json
+++ b/docs/release-control/v6/internal/status.json
@@ -9178,16 +9178,16 @@
],
"work_claims": [
{
- "id": "codex-release-gate-stable-patch-unattended-release-path",
+ "id": "codex-release-gate-operational-trust-canonical-lifecycle",
"agent_id": "codex",
- "summary": "Prepare and publish v6.1.1 emergency stable patch with owner-approved unsigned Windows exception",
+ "summary": "Repair v6.1.1 backend release-gate failures in action admission and monitoring mock history",
"target_id": "v6-product-lane-expansion",
- "claimed_at": "2026-07-23T12:19:02Z",
- "heartbeat_at": "2026-07-23T12:19:02Z",
- "expires_at": "2026-07-23T16:19:02Z",
+ "claimed_at": "2026-07-23T12:59:07Z",
+ "heartbeat_at": "2026-07-23T12:59:07Z",
+ "expires_at": "2026-07-23T16:59:07Z",
"work_item": {
"kind": "release-gate",
- "id": "stable-patch-unattended-release-path"
+ "id": "operational-trust-canonical-lifecycle"
}
}
],
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 176e5dbc91..f4a8ef54ed 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -1993,6 +1993,9 @@ a new API state machine, queue contract, or verification-accounting field.
admission coordinator, binds it to a typed versioned lease, then persists
the `pulse_patrol_policy` / `policy` approval and `executing` transition in
one store CAS transaction. No reusable policy-approved state exists.
+ Lazy initialization of that shared coordinator must be concurrency-safe:
+ simultaneous first policy writers on one lifecycle service must converge on
+ one coordinator and cannot enter parallel admission or mutation sections.
Missing, malformed, stale, unreadable, or revoked policy records a stable
refused-before-dispatch failure with no executor call. Human approval stays
a distinct path: automatic-mode, allowlist, and recurring-window changes do
diff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.md
index fc2ee5c224..19372fca17 100644
--- a/docs/release-control/v6/internal/subsystems/monitoring.md
+++ b/docs/release-control/v6/internal/subsystems/monitoring.md
@@ -992,6 +992,9 @@ and curve shape from the same canonical resource-role registry, so database,
cache, backup, web, and storage workloads keep believable long-range behavior
instead of switching from one generic seeded pattern to a different recent
runtime pattern.
+Bounded plateau generation must preserve an exact constant when the lower and
+upper metric bounds are equal; interpolation and noise must not introduce
+floating-point drift into a synthetic flat series.
That same mock chart boundary also owns request-path efficiency. Demo chart
reads must reuse monitor-owned downsampled mock history for the current mock
sampler generation instead of regenerating or re-downsampling the same seeded
diff --git a/internal/actionlifecycle/service.go b/internal/actionlifecycle/service.go
index cd1948062f..20b5fa5fd1 100644
--- a/internal/actionlifecycle/service.go
+++ b/internal/actionlifecycle/service.go
@@ -102,6 +102,7 @@ type Service struct {
OnActionTransition func(orgID string, record unified.ActionAuditRecord)
Now func() time.Time
PolicyAdmission *PolicyAdmissionCoordinator
+ policyAdmissionMu sync.Mutex
}
type ActionDetail struct {
@@ -123,6 +124,8 @@ type PolicyAdmissionCoordinator struct{ mu sync.RWMutex }
var dispatchWorkerSequence atomic.Uint64
func (s *Service) admissionCoordinator() *PolicyAdmissionCoordinator {
+ s.policyAdmissionMu.Lock()
+ defer s.policyAdmissionMu.Unlock()
if s.PolicyAdmission == nil {
s.PolicyAdmission = &PolicyAdmissionCoordinator{}
}
diff --git a/internal/actionlifecycle/service_test.go b/internal/actionlifecycle/service_test.go
index 348d1cbba4..4612c213b5 100644
--- a/internal/actionlifecycle/service_test.go
+++ b/internal/actionlifecycle/service_test.go
@@ -4,6 +4,7 @@ import (
"context"
"errors"
"strings"
+ "sync"
"sync/atomic"
"testing"
"time"
@@ -70,6 +71,46 @@ func serviceForStore(t *testing.T, store unified.ResourceStore, resource unified
}
}
+func TestWithPolicyMutationConcurrentFirstUseSharesCoordinator(t *testing.T) {
+ const writers = 64
+
+ service := &Service{}
+ start := make(chan struct{})
+ coordinators := make(chan *PolicyAdmissionCoordinator, writers)
+ var ready sync.WaitGroup
+ var done sync.WaitGroup
+ ready.Add(writers)
+ done.Add(writers)
+
+ for range writers {
+ go func() {
+ defer done.Done()
+ ready.Done()
+ <-start
+ coordinators <- service.admissionCoordinator()
+ }()
+ }
+
+ ready.Wait()
+ close(start)
+ done.Wait()
+ close(coordinators)
+
+ var shared *PolicyAdmissionCoordinator
+ for coordinator := range coordinators {
+ if shared == nil {
+ shared = coordinator
+ continue
+ }
+ if coordinator != shared {
+ t.Fatal("concurrent first use returned more than one policy admission coordinator")
+ }
+ }
+ if shared == nil {
+ t.Fatal("concurrent first use did not initialize a policy admission coordinator")
+ }
+}
+
func testActionActor(subject, orgID string) unified.ActionActor {
if strings.TrimSpace(subject) == "" {
subject = "operator"
diff --git a/internal/monitoring/mock_metrics_history.go b/internal/monitoring/mock_metrics_history.go
index a21326b4fa..be1b91a59e 100644
--- a/internal/monitoring/mock_metrics_history.go
+++ b/internal/monitoring/mock_metrics_history.go
@@ -361,6 +361,14 @@ func generateSpikySeries(current float64, points int, seed uint64, min, max, spa
// generatePlateauSeries produces stable levels with slow transitions —
// matching how real memory usage behaves (applications hold allocations).
func generatePlateauSeries(current float64, points int, min, max, span float64, rng *rand.Rand) []float64 {
+ raw := make([]float64, points)
+ if min == max {
+ for i := range raw {
+ raw[i] = min
+ }
+ return raw
+ }
+
plateauCount := 3 + rng.Intn(4) // 3-6 plateaus
// Generate plateau levels near current.
@@ -371,7 +379,6 @@ func generatePlateauSeries(current float64, points int, min, max, span float64,
}
levels[plateauCount-1] = current + rng.NormFloat64()*span*0.01
- raw := make([]float64, points)
segmentLen := points / plateauCount
for i := 0; i < points; i++ {
diff --git a/internal/monitoring/mock_metrics_history_test.go b/internal/monitoring/mock_metrics_history_test.go
index 8de6f8c0e8..22246f52b2 100644
--- a/internal/monitoring/mock_metrics_history_test.go
+++ b/internal/monitoring/mock_metrics_history_test.go
@@ -3,6 +3,7 @@ package monitoring
import (
"context"
"math"
+ "math/rand"
"strings"
"testing"
"time"
@@ -75,6 +76,27 @@ func TestBuildTieredTimestamps_IncludesCanonicalTerminalNow(t *testing.T) {
}
}
+func TestGeneratePlateauSeriesPreservesCollapsedBoundsExactly(t *testing.T) {
+ const bound = 42.0
+ got := generatePlateauSeries(
+ bound,
+ 240,
+ bound,
+ bound,
+ 100,
+ rand.New(rand.NewSource(17)),
+ )
+
+ if len(got) != 240 {
+ t.Fatalf("series length = %d, want 240", len(got))
+ }
+ for i, value := range got {
+ if value != bound {
+ t.Fatalf("point %d = %v, want exact bound %v", i, value, bound)
+ }
+ }
+}
+
func TestSeedMockMetricsHistory_PopulatesSeries(t *testing.T) {
const interval = 30 * time.Second
now := time.Now()