032: Phase 3 US1 — 13 mixins migrated to async + dashboard routes

T011-T017: All SupersetClient mixins now async.
T018: _detail_routes.py uses registry/AsyncSupersetClient.
T019: Partial — routes/environments, settings, profile, listing async.

RATIONALE: Big-bang merge of sync+AsyncSupersetClient.
REJECTED: dual-stack.

Remaining T019: assistant/*, migration, datasets, git helpers still use sync.
This commit is contained in:
2026-06-04 19:55:43 +03:00
parent 496584e0da
commit 51afbee470
19 changed files with 422 additions and 214 deletions

View File

@@ -22,7 +22,7 @@ from ...core.config_manager import ConfigManager
from ...core.config_models import AppConfig, Environment, GlobalSettings, LoggingConfig
from ...core.database import get_db
from ...core.logger import belief_scope, logger
from ...core.superset_client import SupersetClient
from ...core.async_superset_client import AsyncSupersetClient
from ...dependencies import get_config_manager, has_permission
from ...models.config import AppConfigRecord
from ...models.llm import ValidationPolicy
@@ -73,12 +73,12 @@ def _normalize_superset_env_url(raw_url: str) -> str:
# @BRIEF Run lightweight Superset connectivity validation without full pagination scan.
# @PRE env contains valid URL and credentials.
# @POST Raises on auth/API failures; returns None on success.
def _validate_superset_connection_fast(env: Environment) -> None:
client = SupersetClient(env)
async def _validate_superset_connection_fast(env: Environment) -> None:
client = AsyncSupersetClient(env)
# 1) Explicit auth check
client.authenticate()
await client.authenticate()
# 2) Single lightweight API call to ensure read access
client.get_dashboards_page(
_, _ = await client.get_dashboards_page(
query={
"page": 0,
"page_size": 1,
@@ -238,7 +238,7 @@ async def add_environment(
# Validate connection before adding (fast path)
try:
_validate_superset_connection_fast(env)
await _validate_superset_connection_fast(env)
except Exception as e:
logger.error(
f"[add_environment][Coherence:Failed] Connection validation failed: {e}"
@@ -280,7 +280,7 @@ async def update_environment(
# Validate connection before updating (fast path)
try:
_validate_superset_connection_fast(env_to_validate)
await _validate_superset_connection_fast(env_to_validate)
except Exception as e:
logger.error(
f"[update_environment][Coherence:Failed] Connection validation failed: {e}"
@@ -331,7 +331,7 @@ async def test_environment_connection(
raise HTTPException(status_code=404, detail=f"Environment {id} not found")
try:
_validate_superset_connection_fast(env)
await _validate_superset_connection_fast(env)
logger.info(
f"[test_environment_connection][Coherence:OK] Connection successful for {id}"