fix(final-phase): finalize dataset review audit blockers

This commit is contained in:
2026-03-17 18:23:02 +03:00
parent 8728756a3f
commit 3b22133d7a
3 changed files with 19 additions and 7 deletions

View File

@@ -3,8 +3,8 @@
# @SEMANTICS: dataset_review, superset, compatibility_matrix, preview, sql_lab, tests
# @PURPOSE: Verifies Superset preview and SQL Lab endpoint fallback strategy used by dataset-review orchestration.
# @LAYER: Tests
# @RELATION: [DEPENDS_ON] ->[backend.src.core.superset_client.SupersetClient]
# @RELATION: [DEPENDS_ON] ->[SupersetCompilationAdapter]
# @RELATION: [DEPENDS_ON] ->[SupersetClient]
from types import SimpleNamespace
from unittest.mock import MagicMock
@@ -23,6 +23,7 @@ from src.core.utils.superset_compilation_adapter import (
# [DEF:make_adapter:Function]
# @COMPLEXITY: 2
# @PURPOSE: Build an adapter with a mock Superset client and deterministic environment for compatibility tests.
# @RELATION: [DEPENDS_ON] ->[SupersetCompilationAdapter]
def make_adapter():
environment = SimpleNamespace(
id="env-1",
@@ -42,6 +43,7 @@ def make_adapter():
# [DEF:test_preview_prefers_supported_client_method_before_network_fallback:Function]
# @COMPLEXITY: 2
# @PURPOSE: Confirms preview compilation uses a supported client method first when the capability exists.
# @RELATION: [DEPENDS_ON] ->[SupersetCompilationAdapter]
def test_preview_prefers_supported_client_method_before_network_fallback():
adapter, client = make_adapter()
client.compile_preview = MagicMock(return_value={"compiled_sql": "SELECT 1"})
@@ -65,6 +67,7 @@ def test_preview_prefers_supported_client_method_before_network_fallback():
# [DEF:test_preview_falls_back_across_matrix_until_supported_endpoint_returns_sql:Function]
# @COMPLEXITY: 3
# @PURPOSE: Confirms preview fallback walks the compatibility matrix from preferred to legacy endpoints until one returns compiled SQL.
# @RELATION: [DEPENDS_ON] ->[SupersetCompilationAdapter]
def test_preview_falls_back_across_matrix_until_supported_endpoint_returns_sql():
adapter, client = make_adapter()
payload = PreviewCompilationPayload(
@@ -95,6 +98,7 @@ def test_preview_falls_back_across_matrix_until_supported_endpoint_returns_sql()
# [DEF:test_sql_lab_launch_falls_back_to_legacy_execute_endpoint:Function]
# @COMPLEXITY: 3
# @PURPOSE: Confirms SQL Lab launch falls back from modern to legacy execute endpoint and preserves canonical session reference extraction.
# @RELATION: [DEPENDS_ON] ->[SupersetCompilationAdapter]
def test_sql_lab_launch_falls_back_to_legacy_execute_endpoint():
adapter, client = make_adapter()
client.get_dataset.return_value = {