From db4ef39d8768c3af3b952140bfb6fd35734a0818 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Sun, 16 Aug 2026 22:01:55 +0100 Subject: [PATCH] Warm registry view caches before resolving mock metrics targets The mock unified snapshot resolved a metrics target per resource on a freshly ingested registry whose view caches were still dirty, so every resolution fell back to a scan over all source mappings, turning the loop quadratic at demo scale. One view read builds the caches first, making each resolution an index lookup. Contract-Neutral: performance-only cache warm before target resolution, resolved targets unchanged --- internal/mock/platform_fixtures.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/mock/platform_fixtures.go b/internal/mock/platform_fixtures.go index 8bf844c8d..96023a8d5 100644 --- a/internal/mock/platform_fixtures.go +++ b/internal/mock/platform_fixtures.go @@ -229,6 +229,11 @@ func (g FixtureGraph) UnifiedResourceSnapshot() ([]unifiedresources.Resource, ti } resources := registry.List() + // Force one view-cache build before resolving targets: on a freshly + // ingested registry the caches are dirty and every MetricsTarget call + // would fall back to a scan over all source mappings, which at demo + // scale turns this loop quadratic. + registry.VMs() for i := range resources { if target := registry.MetricsTarget(resources[i].ID); target != nil { resources[i].MetricsTarget = target