Skip to content

fix: initialize xpack before PostgreSQL denylist test imports - #1442

Merged
ulleo merged 1 commit into
mainfrom
fix/postgres-denylist-test-import
Nov 5, 2026
Merged

ulleo merged 1 commit into
mainfrom
fix/postgres-denylist-test-import

Conversation

@ulleo

@ulleo ulleo commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Running the PostgreSQL denylist tests from #1439 on their own triggers a circular import through assistant → aes_crypto → sqlbot_xpack → assistant, failing collection with ImportError: cannot import name get_assistant_info.

Initialize the published xpack wheel before app imports, following the existing HTTP regression tests. All 17 assertions and the production guard remain unchanged.

+import sqlbot_xpack  # Initialize the published wheel before app imports.
 from apps.db.constant import DB
 from apps.db.db import (...)

Evidence

Tested from backend/ using the existing Python 3.11.17 environment, pytest 7.4.4, sqlglot 30.14.0, and the published sqlbot-xpack 0.0.5.40 wheel; no dependency sync. Used LOG_FORMAT='%(levelname)s %(message)s', temporary logs, and SQLBOT_ALLOW_METADATA_QUERIES=false.

  • Before (67d213fc): python -m pytest -q tests/test_postgres_denylist.py fails during collection with the circular-import error.
  • After (8be63235): the same command passes all 17 tests, without external pre-import setup.
  • python -m pytest -q tests/test_postgres_denylist.py tests/test_connection_pool_manager.py tests/test_sqlserver_pool_lifecycle.py tests/test_hive_fields.py: 36 passed.
  • ruff check tests/test_postgres_denylist.py, ruff format --check tests/test_postgres_denylist.py, and git diff --check: passed.
  • Offline tests only; no live database, API, browser, or deployment validation.

Merge Danger

Door: two-way

Blast Radius: tests

One import-order adjustment in the test module. No production code, dependencies, or safety assertions change.

@ulleo
ulleo merged commit 5841d5f into main Nov 5, 2026
3 checks passed
@ulleo
ulleo deleted the fix/postgres-denylist-test-import branch November 5, 2026 02:35
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