From dbe05c958c17fd65f264be231d3503c7a3a17b55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sat, 24 Oct 2026 23:06:00 +0200 Subject: [PATCH] test(insights): hold the health ledger still in the status parity harness The batch golden lost a card's request about one run in eight. When the batched call fails, every pending card falls back to its own call at once, and each failure is recorded on the provider health ledger without being awaited. Background work leaves a provider out from its third failure in a row on, so a card that read the ledger after two of its siblings' writes had landed was benched and never reached the model. Which card, if any, was scheduling. The stored notes were the same either way, so only the request list moved. The parity harness now runs on a ledger that records and benches nothing; the bench keeps its own tests. Refs #1279 --- .../status-generator-parity.test.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/integration/status-generator-parity.test.ts b/tests/integration/status-generator-parity.test.ts index 2af0152b5..d34dfe364 100644 --- a/tests/integration/status-generator-parity.test.ts +++ b/tests/integration/status-generator-parity.test.ts @@ -73,6 +73,26 @@ vi.mock("@/lib/ai/provider", async (importOriginal) => ({ resolveProvider: async () => ({ type: "none" }), })); +/** + * The provider health ledger stands still. When the batch call fails, every + * pending card falls back to its own call at once, and each failure is + * written to the ledger without being awaited. Background work leaves out a + * provider from its third failure in a row on (#1279), so whether a card + * still reaches the model depends on how many of its siblings' writes landed + * before it read the ledger: scheduling, not code. A ledger that records + * nothing and benches nothing keeps every arm's request list exact. The bench + * has its own tests (`provider-runner-background-bench.test.ts`, and + * `provider-pause.test.ts` for the pause it reads). + */ +vi.mock("@/lib/ai/provider-health-ledger", async (importOriginal) => ({ + ...(await importOriginal()), + postgresProviderHealthLedger: { + getSkipHints: async () => new Map(), + recordSuccess: async () => {}, + recordFailure: async () => {}, + }, +})); + vi.mock( "@/lib/jobs/insight-status-generate-shared", async (importOriginal) => ({