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.

Align CI guardrails with cached resource snapshots

rcourtman1d588af7d11d
diff --git a/frontend-modern/src/api/__tests__/resourcesHotPath.guardrails.test.ts b/frontend-modern/src/api/__tests__/resourcesHotPath.guardrails.test.ts
index 6fd02ea290..8ab2766732 100644
--- a/frontend-modern/src/api/__tests__/resourcesHotPath.guardrails.test.ts
+++ b/frontend-modern/src/api/__tests__/resourcesHotPath.guardrails.test.ts
@@ -8,18 +8,15 @@ const resourcesHandlerSource = readFileSync(
);
describe('resource API hot-path guardrails', () => {
- it('reuses one registry snapshot per request when deriving canonical by-type aggregations', () => {
- expect(resourcesHandlerSource.match(/allResources := registry\.List\(\)/g) ?? []).toHaveLength(
- 0,
- );
+ it('reuses the per-generation presentation snapshot across list and stats requests', () => {
expect(
- resourcesHandlerSource.match(
- /allResources := presentationResourcesFromRegistry\(registry\)/g,
- ) ?? [],
+ resourcesHandlerSource.match(/sharedPresentationResources\(orgID\)/g) ?? [],
).toHaveLength(2);
+ expect(resourcesHandlerSource).toContain('allResources := flatCopyResources(sharedResources)');
expect(
resourcesHandlerSource.match(/computeResourceContractStats\(allResources\)/g) ?? [],
).toHaveLength(2);
+ expect(resourcesHandlerSource).not.toContain('allResources := registry.List()');
expect(resourcesHandlerSource).not.toContain('computeResourceContractByType(registry.List())');
});
});
diff --git a/internal/monitoring/canonical_guardrails_test.go b/internal/monitoring/canonical_guardrails_test.go
index fd1f035e1d..f62b9b9eeb 100644
--- a/internal/monitoring/canonical_guardrails_test.go
+++ b/internal/monitoring/canonical_guardrails_test.go
@@ -1919,8 +1919,13 @@ func TestMockUnifiedStateViewUsesCanonicalMockFixtureGraph(t *testing.T) {
}
source := string(data)
requiredSnippets := []string{
+ "version := mock.FixtureDataVersion()",
+ "m.mockUnifiedViewValid && m.mockUnifiedViewVersion == version",
"resources, freshness := mock.UnifiedResourceSnapshot()",
- "return monitorUnifiedStateViewFromResources(resources, freshness)",
+ "view := monitorUnifiedStateViewFromResources(resources, freshness)",
+ "m.mockUnifiedView = view",
+ "m.mockUnifiedViewVersion = version",
+ "return view",
}
for _, snippet := range requiredSnippets {
if !strings.Contains(source, snippet) {
diff --git a/internal/unifiedresources/code_standards_test.go b/internal/unifiedresources/code_standards_test.go
index 845e3e5eae..9ef974fd81 100644
--- a/internal/unifiedresources/code_standards_test.go
+++ b/internal/unifiedresources/code_standards_test.go
@@ -2606,7 +2606,7 @@ func TestV6DirectHostAliasValidatorCoverage(t *testing.T) {
//
// Migration changelog preserved in git history (see commits SRC-03f → SRC-04g).
-func TestResourceAPIHotPathUsesSingleRegistryListSnapshot(t *testing.T) {
+func TestResourceAPIHotPathUsesSharedPresentationSnapshot(t *testing.T) {
repoRoot := filepath.Join("..", "..")
path := filepath.Join(repoRoot, "internal", "api", "resources.go")
@@ -2618,11 +2618,17 @@ func TestResourceAPIHotPathUsesSingleRegistryListSnapshot(t *testing.T) {
source := string(data)
normalizedPath := filepath.ToSlash(path)
- if strings.Count(source, "allResources := presentationResourcesFromRegistry(registry)") != 2 {
- t.Fatalf("%s: expected HandleListResources and HandleStats to each seed exactly one presentation resource snapshot", normalizedPath)
+ if strings.Count(source, "sharedPresentationResources(orgID)") != 2 {
+ t.Fatalf("%s: expected HandleListResources and HandleStats to share the cached presentation snapshot for the registry generation", normalizedPath)
+ }
+ if !strings.Contains(source, "allResources := flatCopyResources(sharedResources)") {
+ t.Fatalf("%s: expected HandleListResources to copy the shared presentation slice before request-local decoration", normalizedPath)
}
if strings.Count(source, "computeResourceContractStats(allResources)") != 2 {
- t.Fatalf("%s: expected canonical aggregations to reuse the seeded presentation snapshot in both handlers", normalizedPath)
+ t.Fatalf("%s: expected canonical aggregations to reuse the shared presentation snapshot in both handlers", normalizedPath)
+ }
+ if strings.Contains(source, "allResources := registry.List()") {
+ t.Fatalf("%s: direct registry.List() hot-path aggregation detected", normalizedPath)
}
if strings.Contains(source, "computeResourceContractByType(registry.List())") {
t.Fatalf("%s: duplicate registry.List() hot-path aggregation detected", normalizedPath)
diff --git a/tests/integration/playwright.config.ts b/tests/integration/playwright.config.ts
index 1b6867866f..c8469a7834 100644
--- a/tests/integration/playwright.config.ts
+++ b/tests/integration/playwright.config.ts
@@ -67,6 +67,9 @@ const PROBATION_SPECS = [
'**/59-workloads-column-layout.spec.ts',
'**/62-storage-growth-column.spec.ts',
'**/64-workloads-proxmox-refresh-stability.spec.ts',
+ // Demoted 2026-08-05: rate-limit/shared-state retry flake on main in
+ // run 31033254657; it must earn 10 consecutive green runs to return.
+ '**/68-infrastructure-onboarding.spec.ts',
'**/68-platform-pages-shell.spec.ts',
'**/77-msp-isolation.spec.ts',
'**/79-update-flow.spec.ts',