Skip to content

fix(db): require explicit opt-in for destructive migration tests#2938

Draft
yinkev wants to merge 1 commit into
block:mainfrom
yinkev:fix/buzz-db-destructive-test-guard
Draft

fix(db): require explicit opt-in for destructive migration tests#2938
yinkev wants to merge 1 commit into
block:mainfrom
yinkev:fix/buzz-db-destructive-test-guard

Conversation

@yinkev

@yinkev yinkev commented Jul 26, 2026

Copy link
Copy Markdown

Summary

  • remove the silent fallback from schema-destructive migration tests to the default Buzz Desktop development database;
  • require both BUZZ_TEST_DESTRUCTIVE_DB=1 and an explicit non-empty BUZZ_TEST_DATABASE_URL before any test can drop the public schema;
  • rename the connection helper to make its destructive contract explicit and add a pure regression for every missing/invalid gate combination.

#[ignore] was not a sufficient boundary because cargo test -p buzz-db --lib -- --ignored is a natural way to request the Postgres-backed tests. Before this change, that command could resolve to postgres://buzz:buzz_dev@localhost:5432/buzz and execute DROP SCHEMA IF EXISTS public CASCADE against a developer's live Desktop database.

Related issue

Fixes #2916

No competing implementation was found before opening this PR.

Testing

  • cargo test -p buzz-db --lib85 passed, 121 intentionally ignored
  • cargo clippy -p buzz-db --all-targets -- -D warnings
  • cargo test -p buzz-db destructive_database_tests_require_explicit_opt_in_and_url --lib
  • disposable PostgreSQL database:
    • migrate with cargo run -p buzz-admin -- migrate;
    • run the ordinary buzz-db package suite;
    • run the three schema-reset tests with both required environment variables and --test-threads=13 passed;
    • drop the disposable database afterward.
  • git diff --check

just ci completed the workspace Rust formatting and clippy stages, then stopped at the existing file-size gate for untouched desktop/src-tauri/src/managed_agents/runtime.rs (current upstream is already above its configured ceiling). This PR does not modify that file.

Signed-off-by: Kevin Yin <182213728+yinkev@users.noreply.github.com>
@yinkev

yinkev commented Jul 26, 2026

Copy link
Copy Markdown
Author

@codex review

@yinkev
yinkev force-pushed the fix/buzz-db-destructive-test-guard branch from ca0d620 to 8d691a9 Compare July 26, 2026 09:17
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 8d691a9d5e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

buzz-db: bare --ignored test sweep drops the Buzz Desktop dev schema via hardcoded localhost:5432 fallback

1 participant