Skip to content

fix(db): pin the primary-key plan in the search retirement read-bound test - #8556

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/search-retirement-test-flake
Oct 2, 2026
Merged

waleedlatif1 merged 1 commit into
stagingfrom
fix/search-retirement-test-flake

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Fix the flaky bounds the IDs each page reads by the row limit once the limit shrinks test in 0027_retire_search_embeddings.integration.ts (failing staging CI with expected 199619 to be less than 90000)
  • Root cause: the test disabled only sequential scans, so on its small fixture table the planner could still answer each page with a bitmap scan that reads every remaining row. Which plan it picked depended on whether autovacuum had analyzed the freshly inserted rows, so CI flipped between passing and a deterministic ~200k reads
  • Fix: ANALYZE document and also SET enable_bitmapscan = off (reset afterwards), pinning the primary-key walk production uses. Test-only; the migration is unchanged

Type of Change

  • Bug fix (test flake)

Testing

  • Reproduced the mechanism locally: forcing the planner off the ordered index scan gives the same failure (213355 reads)
  • Fixed test passes 5/5 repeated runs and the full packages/db integration suite (17 files) against a CI-equivalent pgvector pg17 database provisioned with db:push
  • Mutation check: making the migration use a fixed 25,000-ID scan window still fails the test (213499 reads), so it keeps guarding the real regression

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

🤖 Generated with Claude Code

… test

The test disabled only sequential scans, so the planner could still answer a page with a
bitmap scan that reads every remaining row. Which plan it chose depended on whether
autovacuum had analyzed the fresh fixture rows, making the read-count assertion flaky in CI.
Analyze the table and disable bitmap scans too, matching production's primary-key walk.
@vercel

vercel Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview Oct 2, 2026 3:01am UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Low risk] Test setup adjusts database query planner behavior.

The PR appears safe to merge.

Summary

The PR stabilizes the search-retirement read-bound integration test without changing the migration.

  • Analyzes the fixture table and disables bitmap scans so the test measures the primary-key walk.
  • Resets the added planner setting after the assertion.

Reviews (1) · Last reviewed commit: "fix(db): pin the primary-key plan in the..."

@waleedlatif1
waleedlatif1 merged commit 70412cc into staging Oct 2, 2026
33 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/search-retirement-test-flake branch October 2, 2026 06:42

This branch was successfully deployed

1 active deployment
Preview — 6c5fd37b Deployed Oct 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant