Repository navigation
test(api): pin the alert history index in the query shape test - #3764
Conversation
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.
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🔵 Tier 2 — Low RiskSmall, isolated change with no API route or data model modifications. Why this tier:
Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns. Stats
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
PR Review
1 finding(s): 🔴 0 P0/P1 · 🟡 0 P2 · 🔵 1 P3 No inline comments. 1 P3 folded at the bottom. 🔵 1 P3 — no action needed before merge
Priority comes from a separate grading pass over the finished review. P3 is folded here instead of posted inline. No finding blocks merge automatically; a maintainer decides. |
Deep Review✅ No critical issues found. This is a focused, test-only change: it adds 🟡 P2 -- recommended
Reviewers (4): correctness, testing, maintainability, project-standards. Testing gaps: Natural (unhinted) index-selection for this query shape is no longer under test; the remaining assertions cover bound tightness and index existence only. No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
E2E Test Results✅ All tests passed • 471 passed • 1 skipped • 1092s
Tests ran across 4 shards in parallel. |
Summary
Fixes the integration shard flake in
checkAlerts › alert history query shape › scans the {alert, createdAt} index with tight createdAt bounds, added in #3702. It accounts for every failed integration job in the last 200main.ymlruns.alert_1_createdAt_-1, so the plan flips between runs depending on table stats left by earlier tests.totalKeysExamined <= 2assertion still checks that thecreatedAtbounds from perf(api): bound check-alerts history lookup by alert interval #3702 stay tight, andhintthrows if the index is ever renamed or dropped.How to reproduce
On
main: runmake dev-int FILE=checkAlerts.int.test.tsa few times. Some runs fail with aCOLLSCANwinning plan (example: Integration - Shard 4).On this branch: the same command passes (198/198 locally).
References