Skip to content

test(db): serialize postgres migration fixup tests - #3307

Merged
serrrfirat merged 1 commit into
nearai:mainfrom
serrrfirat:fix/main-migration-fixup-flake
May 6, 2026
Merged

serrrfirat merged 1 commit into
nearai:mainfrom
serrrfirat:fix/main-migration-fixup-flake

Conversation

@serrrfirat

Copy link
Copy Markdown
Collaborator

Summary

  • serialize the two PostgreSQL migration-fixup integration tests that both create/use the shared refinery_schema_history table
  • avoids a CI race where concurrent CREATE TABLE IF NOT EXISTS refinery_schema_history can fail with a duplicate pg_type_typname_nsp_index error

Why

Main's Coverage (all-features) job failed on commit 576eb3bb7d6f01db6a92371243f838f059db11f1 in db::migration_fixup::tests::rejects_canonical_in_known_bad_checksums, not in the libSQL decimal parser test. The panic was:

duplicate key value violates unique constraint "pg_type_typname_nsp_index" ... refinery_schema_history

That points to an existing parallel Postgres DDL race, not a product-code regression.

Verification

  • cargo fmt --check
  • cargo test --lib --all-features db::migration_fixup::tests::rejects_canonical_in_known_bad_checksums -- --nocapture
  • cargo check --all-features -q
  • git diff --check

@github-actions github-actions Bot added size: XS < 10 changed lines (excluding docs) risk: medium Business logic, config, or moderate-risk modules contributor: core 20+ merged PRs labels May 6, 2026

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces a static mutex, POSTGRES_MIGRATION_FIXUP_TEST_LOCK, to synchronize integration tests within src/db/migration_fixup.rs. This change ensures that tests requiring the integration feature do not run concurrently, preventing potential race conditions during database migrations. I have no feedback to provide as there were no review comments.

@serrrfirat
serrrfirat merged commit b0b8d87 into nearai:main May 6, 2026
13 checks passed
@serrrfirat
serrrfirat deleted the fix/main-migration-fixup-flake branch May 6, 2026 20:07
theredspoon pushed a commit to theredspoon/ironclaw that referenced this pull request Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor: core 20+ merged PRs risk: medium Business logic, config, or moderate-risk modules size: XS < 10 changed lines (excluding docs)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant