From 5d9a9107fad1b46dba3fe7b9b0ea41533f5dd938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Fri, 23 Oct 2026 14:58:14 +0200 Subject: [PATCH] test(import): record the status re-warm tail in the JSON import walk Run for real it is detached from the request but inside its context, so its annotate lands on the request's wide event on some runs and misses it on others. --- .../import-json.01-first-file.json.snap | 14 ++++++++++++++ .../import-json.02-same-file.json.snap | 14 ++++++++++++++ .../routes/parity/import-json.parity.test.ts | 15 +++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/tests/integration/routes/parity/__snapshots__/import-json.01-first-file.json.snap b/tests/integration/routes/parity/__snapshots__/import-json.01-first-file.json.snap index 6729dbe05..8662cf5e3 100644 --- a/tests/integration/routes/parity/__snapshots__/import-json.01-first-file.json.snap +++ b/tests/integration/routes/parity/__snapshots__/import-json.01-first-file.json.snap @@ -50,6 +50,20 @@ "2026-10-12T06:00:00.000Z" ] ] + }, + { + "effect": "invalidateStatusInsightsForTypes", + "args": [ + "", + [ + "WEIGHT", + "BLOOD_GLUCOSE", + "SLEEP_DURATION" + ], + { + "source": "manual" + } + ] } ], "stored": { diff --git a/tests/integration/routes/parity/__snapshots__/import-json.02-same-file.json.snap b/tests/integration/routes/parity/__snapshots__/import-json.02-same-file.json.snap index b7e74b5fe..845d804ef 100644 --- a/tests/integration/routes/parity/__snapshots__/import-json.02-same-file.json.snap +++ b/tests/integration/routes/parity/__snapshots__/import-json.02-same-file.json.snap @@ -35,6 +35,20 @@ "", [] ] + }, + { + "effect": "invalidateStatusInsightsForTypes", + "args": [ + "", + [ + "WEIGHT", + "BLOOD_GLUCOSE", + "SLEEP_DURATION" + ], + { + "source": "manual" + } + ] } ], "stored": { diff --git a/tests/integration/routes/parity/import-json.parity.test.ts b/tests/integration/routes/parity/import-json.parity.test.ts index 103565382..265de2378 100644 --- a/tests/integration/routes/parity/import-json.parity.test.ts +++ b/tests/integration/routes/parity/import-json.parity.test.ts @@ -72,6 +72,21 @@ vi.mock("@/lib/jobs/pr-detection", async (importOriginal) => { }; }); +vi.mock("@/lib/insights/status-invalidation", async (importOriginal) => { + const actual = + await importOriginal(); + const { effectRecorder } = await import("../../../kit/parity"); + return { + ...actual, + // Detached from the request but inside its context: run for real, its + // annotate can land on the request's wide event or miss it, depending on + // timing. Recorded instead, like the other tails. + invalidateStatusInsightsForTypes: async (...args: unknown[]) => { + effectRecorder.record("invalidateStatusInsightsForTypes", args); + }, + }; +}); + const prisma = getPrismaClient(); const NOW = new Date("2026-10-15T12:00:00.000Z");