From 5573755f95c61abedfcf641c99d88911369a57e8 Mon Sep 17 00:00:00 2001 From: Jordan Simonovski Date: Mon, 23 Nov 2026 09:43:03 +1100 Subject: [PATCH] test(api): pin the alert history index in the query shape test DocumentDB's cost-based planner often chooses a seq scan over alert_1_createdAt_-1 on the test's 10-row collection, failing the integration shard. Hinting the index keeps the check on what matters: the createdAt bounds stay tight. --- .../src/tasks/checkAlerts/__tests__/checkAlerts.int.test.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/api/src/tasks/checkAlerts/__tests__/checkAlerts.int.test.ts b/packages/api/src/tasks/checkAlerts/__tests__/checkAlerts.int.test.ts index 1b56108acd..f7b93557a1 100644 --- a/packages/api/src/tasks/checkAlerts/__tests__/checkAlerts.int.test.ts +++ b/packages/api/src/tasks/checkAlerts/__tests__/checkAlerts.int.test.ts @@ -12786,7 +12786,10 @@ describe('checkAlerts', () => { $gte: new Date(now.getTime() - getAlertHistoryLookbackMs('5m')), }, state: { $ne: AlertState.ERROR }, - }).explain('executionStats'), + }) + // On 10 rows DocumentDB's planner often picks a seq scan; pin the index. + .hint('alert_1_createdAt_-1') + .explain('executionStats'), ); expect(JSON.stringify(explain.queryPlanner.winningPlan)).toContain(