From 016278ba247fe6e82a6cc1c03e9618dad9b7b6fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sun, 4 Oct 2026 19:21:01 +0200 Subject: [PATCH] test(mcp): analyze the seeded rows before the metric-series golden test The first case spent 14 s per full-snapshot build in the all-time pulse aggregate, planned against a table with no statistics, until autovacuum analyzed it; on a loaded runner that took it past its 60 s budget. Analyze measurements and rollups after seeding, as a production table would be. The cases and the comparison they make are unchanged. --- .../integration/mcp-metric-series-source-snapshot.test.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/integration/mcp-metric-series-source-snapshot.test.ts b/tests/integration/mcp-metric-series-source-snapshot.test.ts index 62294845a..3759189dc 100644 --- a/tests/integration/mcp-metric-series-source-snapshot.test.ts +++ b/tests/integration/mcp-metric-series-source-snapshot.test.ts @@ -218,6 +218,13 @@ beforeAll(async () => { // The mood feature warms its rollup tier fire-and-forget on first read; // settle it now so both builds read the same tier. await ensureUserMoodRollupsFresh(userId); + // Planner statistics for the rows just written. Without them the + // all-time pulse aggregate (`readAllTimeExtremes`, day-weighted for pulse) + // plans against an empty table and runs for ~14 s per call until + // autovacuum's analyze happens to land, which on a loaded runner took the + // first case past its 60 s budget. A production table always has + // statistics, so this measures what production runs. + await prisma.$executeRawUnsafe("ANALYZE measurements, measurement_rollups"); }, 120_000); describe("get_metric_series built from one source's rows", () => {