Repository navigation
fix: initialize xpack before PostgreSQL denylist test imports - #1442
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Running the PostgreSQL denylist tests from #1439 on their own triggers a circular import through
assistant → aes_crypto → sqlbot_xpack → assistant, failing collection withImportError: 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. UsedLOG_FORMAT='%(levelname)s %(message)s', temporary logs, andSQLBOT_ALLOW_METADATA_QUERIES=false.67d213fc):python -m pytest -q tests/test_postgres_denylist.pyfails during collection with the circular-import error.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, andgit diff --check: passed.Merge Danger
Door: two-way
Blast Radius: tests
One import-order adjustment in the test module. No production code, dependencies, or safety assertions change.