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.
This commit is contained in:
Marc-André Bombeck committed 2026-10-23 14:58:14 +02:00
1 parent 7f06e28c37
commit 5d9a9107fa
3 files changed
+43

No files matched your search

@@ -50,6 +50,20 @@
"2026-10-12T06:00:00.000Z"
]
]
},
{
"effect": "invalidateStatusInsightsForTypes",
"args": [
"<id:1>",
[
"WEIGHT",
"BLOOD_GLUCOSE",
"SLEEP_DURATION"
],
{
"source": "manual"
}
]
}
],
"stored": {
@@ -35,6 +35,20 @@
"<id:1>",
[]
]
},
{
"effect": "invalidateStatusInsightsForTypes",
"args": [
"<id:1>",
[
"WEIGHT",
"BLOOD_GLUCOSE",
"SLEEP_DURATION"
],
{
"source": "manual"
}
]
}
],
"stored": {
@@ -72,6 +72,21 @@ vi.mock("@/lib/jobs/pr-detection", async (importOriginal) => {
};
});
vi.mock("@/lib/insights/status-invalidation", async (importOriginal) => {
const actual =
await importOriginal<typeof import("@/lib/insights/status-invalidation")>();
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");