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.
This commit is contained in:
Marc-André Bombeck committed 2026-10-04 19:21:01 +02:00
1 parent 13ea849188
commit 016278ba24
1 file changed
+7
@@ -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", () => {