chore: migrate GRACE-Poly anchors to hierarchical dotted naming
Systematic rename of all semantic anchors (#region, [DEF], @RELATION) across 1400+ files — backend Python, frontend Svelte/TS, specs, docs: - Flat anchors become Namespace.Module.Entity - @RELATION references updated to match new anchor paths - Zero business logic changes
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# #region TestDashboardsApi [C:2] [TYPE Module]
|
||||
# @RELATION BINDS_TO ->[DashboardsApi]
|
||||
# #region Test.DashboardsApi.TestDashboardsApi [C:2] [TYPE Module]
|
||||
# @RELATION BINDS_TO ->[Api.Init.DashboardsApi]
|
||||
# @PURPOSE: Comprehensive contract-driven tests for Dashboard Hub API
|
||||
# @LAYER Tests
|
||||
# @SEMANTICS: tests, dashboards, api, contract, remediation
|
||||
@@ -74,8 +74,8 @@ client = TestClient(app)
|
||||
# --- 1. get_dashboards tests ---
|
||||
|
||||
|
||||
# #region test_get_dashboards_success [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[TestDashboardsApi]
|
||||
# #region Test.DashboardsApi.TestGetDashboardsSuccess [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[Test.DashboardsApi.TestDashboardsApi]
|
||||
def test_get_dashboards_success(mock_deps):
|
||||
"""Uses @TEST_FIXTURE: dashboard_list_happy data."""
|
||||
mock_env = MagicMock()
|
||||
@@ -113,11 +113,11 @@ def test_get_dashboards_success(mock_deps):
|
||||
DashboardsResponse(**data)
|
||||
|
||||
|
||||
# #endregion test_get_dashboards_success
|
||||
# #endregion Test.DashboardsApi.TestGetDashboardsSuccess
|
||||
|
||||
|
||||
# #region test_get_dashboards_with_search [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[TestDashboardsApi]
|
||||
# #region Test.DashboardsApi.TestGetDashboardsWithSearch [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[Test.DashboardsApi.TestDashboardsApi]
|
||||
def test_get_dashboards_with_search(mock_deps):
|
||||
mock_env = MagicMock()
|
||||
mock_env.id = "prod"
|
||||
@@ -137,11 +137,11 @@ def test_get_dashboards_with_search(mock_deps):
|
||||
assert data["dashboards"][0]["title"] == "Sales Report"
|
||||
|
||||
|
||||
# #endregion test_get_dashboards_with_search
|
||||
# #endregion Test.DashboardsApi.TestGetDashboardsWithSearch
|
||||
|
||||
|
||||
# #region test_get_dashboards_empty [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[TestDashboardsApi]
|
||||
# #region Test.DashboardsApi.TestGetDashboardsEmpty [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[Test.DashboardsApi.TestDashboardsApi]
|
||||
def test_get_dashboards_empty(mock_deps):
|
||||
"""@TEST_EDGE: empty_dashboards -> {env_id: 'empty_env', expected_total: 0}"""
|
||||
mock_env = MagicMock()
|
||||
@@ -159,11 +159,11 @@ def test_get_dashboards_empty(mock_deps):
|
||||
DashboardsResponse(**data)
|
||||
|
||||
|
||||
# #endregion test_get_dashboards_empty
|
||||
# #endregion Test.DashboardsApi.TestGetDashboardsEmpty
|
||||
|
||||
|
||||
# #region test_get_dashboards_superset_failure [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[TestDashboardsApi]
|
||||
# #region Test.DashboardsApi.TestGetDashboardsSupersetFailure [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[Test.DashboardsApi.TestDashboardsApi]
|
||||
def test_get_dashboards_superset_failure(mock_deps):
|
||||
"""@TEST_EDGE: external_superset_failure -> {env_id: 'bad_conn', status: 503}"""
|
||||
mock_env = MagicMock()
|
||||
@@ -179,11 +179,11 @@ def test_get_dashboards_superset_failure(mock_deps):
|
||||
assert "Failed to fetch dashboards" in response.json()["detail"]
|
||||
|
||||
|
||||
# #endregion test_get_dashboards_superset_failure
|
||||
# #endregion Test.DashboardsApi.TestGetDashboardsSupersetFailure
|
||||
|
||||
|
||||
# #region test_get_dashboards_env_not_found [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[TestDashboardsApi]
|
||||
# #region Test.DashboardsApi.TestGetDashboardsEnvNotFound [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[Test.DashboardsApi.TestDashboardsApi]
|
||||
def test_get_dashboards_env_not_found(mock_deps):
|
||||
mock_deps["config"].get_environments.return_value = []
|
||||
response = client.get("/api/dashboards?env_id=nonexistent")
|
||||
@@ -191,11 +191,11 @@ def test_get_dashboards_env_not_found(mock_deps):
|
||||
assert "Environment not found" in response.json()["detail"]
|
||||
|
||||
|
||||
# #endregion test_get_dashboards_env_not_found
|
||||
# #endregion Test.DashboardsApi.TestGetDashboardsEnvNotFound
|
||||
|
||||
|
||||
# #region test_get_dashboards_invalid_pagination [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[TestDashboardsApi]
|
||||
# #region Test.DashboardsApi.TestGetDashboardsInvalidPagination [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[Test.DashboardsApi.TestDashboardsApi]
|
||||
def test_get_dashboards_invalid_pagination(mock_deps):
|
||||
mock_env = MagicMock()
|
||||
mock_env.id = "prod"
|
||||
@@ -214,11 +214,11 @@ def test_get_dashboards_invalid_pagination(mock_deps):
|
||||
|
||||
# --- 2. get_database_mappings tests ---
|
||||
|
||||
# #endregion test_get_dashboards_invalid_pagination
|
||||
# #endregion Test.DashboardsApi.TestGetDashboardsInvalidPagination
|
||||
|
||||
|
||||
# #region test_get_database_mappings_success [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[TestDashboardsApi]
|
||||
# #region Test.DashboardsApi.TestGetDatabaseMappingsSuccess [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[Test.DashboardsApi.TestDashboardsApi]
|
||||
def test_get_database_mappings_success(mock_deps):
|
||||
mock_s = MagicMock()
|
||||
mock_s.id = "s"
|
||||
@@ -237,11 +237,11 @@ def test_get_database_mappings_success(mock_deps):
|
||||
DatabaseMappingsResponse(**data)
|
||||
|
||||
|
||||
# #endregion test_get_database_mappings_success
|
||||
# #endregion Test.DashboardsApi.TestGetDatabaseMappingsSuccess
|
||||
|
||||
|
||||
# #region test_get_database_mappings_env_not_found [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[TestDashboardsApi]
|
||||
# #region Test.DashboardsApi.TestGetDatabaseMappingsEnvNotFound [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[Test.DashboardsApi.TestDashboardsApi]
|
||||
def test_get_database_mappings_env_not_found(mock_deps):
|
||||
mock_deps["config"].get_environments.return_value = []
|
||||
response = client.get(
|
||||
@@ -252,11 +252,11 @@ def test_get_database_mappings_env_not_found(mock_deps):
|
||||
|
||||
# --- 3. get_dashboard_detail tests ---
|
||||
|
||||
# #endregion test_get_database_mappings_env_not_found
|
||||
# #endregion Test.DashboardsApi.TestGetDatabaseMappingsEnvNotFound
|
||||
|
||||
|
||||
# #region test_get_dashboard_detail_success [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[TestDashboardsApi]
|
||||
# #region Test.DashboardsApi.TestGetDashboardDetailSuccess [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[Test.DashboardsApi.TestDashboardsApi]
|
||||
def test_get_dashboard_detail_success(mock_deps):
|
||||
with patch("src.api.routes.dashboards._detail_routes.SupersetClient") as mock_client_cls:
|
||||
mock_env = MagicMock()
|
||||
@@ -288,11 +288,11 @@ def test_get_dashboard_detail_success(mock_deps):
|
||||
DashboardDetailResponse(**data)
|
||||
|
||||
|
||||
# #endregion test_get_dashboard_detail_success
|
||||
# #endregion Test.DashboardsApi.TestGetDashboardDetailSuccess
|
||||
|
||||
|
||||
# #region test_get_dashboard_detail_env_not_found [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[TestDashboardsApi]
|
||||
# #region Test.DashboardsApi.TestGetDashboardDetailEnvNotFound [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[Test.DashboardsApi.TestDashboardsApi]
|
||||
def test_get_dashboard_detail_env_not_found(mock_deps):
|
||||
mock_deps["config"].get_environments.return_value = []
|
||||
response = client.get("/api/dashboards/42?env_id=missing")
|
||||
@@ -301,11 +301,11 @@ def test_get_dashboard_detail_env_not_found(mock_deps):
|
||||
|
||||
# --- 4. get_dashboard_tasks_history tests ---
|
||||
|
||||
# #endregion test_get_dashboard_detail_env_not_found
|
||||
# #endregion Test.DashboardsApi.TestGetDashboardDetailEnvNotFound
|
||||
|
||||
|
||||
# #region test_get_dashboard_tasks_history_success [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[TestDashboardsApi]
|
||||
# #region Test.DashboardsApi.TestGetDashboardTasksHistorySuccess [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[Test.DashboardsApi.TestDashboardsApi]
|
||||
def test_get_dashboard_tasks_history_success(mock_deps):
|
||||
now = datetime.now(UTC)
|
||||
task1 = MagicMock(
|
||||
@@ -327,11 +327,11 @@ def test_get_dashboard_tasks_history_success(mock_deps):
|
||||
DashboardTaskHistoryResponse(**data)
|
||||
|
||||
|
||||
# #endregion test_get_dashboard_tasks_history_success
|
||||
# #endregion Test.DashboardsApi.TestGetDashboardTasksHistorySuccess
|
||||
|
||||
|
||||
# #region test_get_dashboard_tasks_history_sorting [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[TestDashboardsApi]
|
||||
# #region Test.DashboardsApi.TestGetDashboardTasksHistorySorting [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[Test.DashboardsApi.TestDashboardsApi]
|
||||
def test_get_dashboard_tasks_history_sorting(mock_deps):
|
||||
"""@POST: Response contains sorted task history (newest first)."""
|
||||
from datetime import timedelta
|
||||
@@ -373,11 +373,11 @@ def test_get_dashboard_tasks_history_sorting(mock_deps):
|
||||
|
||||
# --- 5. get_dashboard_thumbnail tests ---
|
||||
|
||||
# #endregion test_get_dashboard_tasks_history_sorting
|
||||
# #endregion Test.DashboardsApi.TestGetDashboardTasksHistorySorting
|
||||
|
||||
|
||||
# #region test_get_dashboard_thumbnail_success [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[TestDashboardsApi]
|
||||
# #region Test.DashboardsApi.TestGetDashboardThumbnailSuccess [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[Test.DashboardsApi.TestDashboardsApi]
|
||||
def test_get_dashboard_thumbnail_success(mock_deps):
|
||||
with (
|
||||
patch("src.api.routes.dashboards._detail_routes.SupersetClient") as mock_client_cls,
|
||||
@@ -410,22 +410,22 @@ def test_get_dashboard_thumbnail_success(mock_deps):
|
||||
assert response.content == b"img"
|
||||
|
||||
|
||||
# #endregion test_get_dashboard_thumbnail_success
|
||||
# #endregion Test.DashboardsApi.TestGetDashboardThumbnailSuccess
|
||||
|
||||
|
||||
# #region test_get_dashboard_thumbnail_env_not_found [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[TestDashboardsApi]
|
||||
# #region Test.DashboardsApi.TestGetDashboardThumbnailEnvNotFound [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[Test.DashboardsApi.TestDashboardsApi]
|
||||
def test_get_dashboard_thumbnail_env_not_found(mock_deps):
|
||||
mock_deps["config"].get_environments.return_value = []
|
||||
response = client.get("/api/dashboards/42/thumbnail?env_id=missing")
|
||||
assert response.status_code == 404
|
||||
|
||||
|
||||
# #endregion test_get_dashboard_thumbnail_env_not_found
|
||||
# #endregion Test.DashboardsApi.TestGetDashboardThumbnailEnvNotFound
|
||||
|
||||
|
||||
# #region test_get_dashboard_thumbnail_202 [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[TestDashboardsApi]
|
||||
# #region Test.DashboardsApi.TestGetDashboardThumbnail202 [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[Test.DashboardsApi.TestDashboardsApi]
|
||||
def test_get_dashboard_thumbnail_202(mock_deps):
|
||||
"""@POST: Returns 202 when thumbnail is being prepared by Superset."""
|
||||
with (
|
||||
@@ -462,11 +462,11 @@ def test_get_dashboard_thumbnail_202(mock_deps):
|
||||
|
||||
# --- 6. migrate_dashboards tests ---
|
||||
|
||||
# #endregion test_get_dashboard_thumbnail_202
|
||||
# #endregion Test.DashboardsApi.TestGetDashboardThumbnail202
|
||||
|
||||
|
||||
# #region test_migrate_dashboards_success [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[TestDashboardsApi]
|
||||
# #region Test.DashboardsApi.TestMigrateDashboardsSuccess [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[Test.DashboardsApi.TestDashboardsApi]
|
||||
def test_migrate_dashboards_success(mock_deps):
|
||||
mock_s = MagicMock()
|
||||
mock_s.id = "s"
|
||||
@@ -483,11 +483,11 @@ def test_migrate_dashboards_success(mock_deps):
|
||||
assert response.json()["task_id"] == "task-123"
|
||||
|
||||
|
||||
# #endregion test_migrate_dashboards_success
|
||||
# #endregion Test.DashboardsApi.TestMigrateDashboardsSuccess
|
||||
|
||||
|
||||
# #region test_migrate_dashboards_pre_checks [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[TestDashboardsApi]
|
||||
# #region Test.DashboardsApi.TestMigrateDashboardsPreChecks [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[Test.DashboardsApi.TestDashboardsApi]
|
||||
def test_migrate_dashboards_pre_checks(mock_deps):
|
||||
# Missing IDs
|
||||
response = client.post(
|
||||
@@ -498,11 +498,11 @@ def test_migrate_dashboards_pre_checks(mock_deps):
|
||||
assert "At least one dashboard ID must be provided" in response.json()["detail"]
|
||||
|
||||
|
||||
# #endregion test_migrate_dashboards_pre_checks
|
||||
# #endregion Test.DashboardsApi.TestMigrateDashboardsPreChecks
|
||||
|
||||
|
||||
# #region test_migrate_dashboards_env_not_found [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[TestDashboardsApi]
|
||||
# #region Test.DashboardsApi.TestMigrateDashboardsEnvNotFound [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[Test.DashboardsApi.TestDashboardsApi]
|
||||
def test_migrate_dashboards_env_not_found(mock_deps):
|
||||
"""@PRE: source_env_id and target_env_id are valid environment IDs."""
|
||||
mock_deps["config"].get_environments.return_value = []
|
||||
@@ -516,11 +516,11 @@ def test_migrate_dashboards_env_not_found(mock_deps):
|
||||
|
||||
# --- 7. backup_dashboards tests ---
|
||||
|
||||
# #endregion test_migrate_dashboards_env_not_found
|
||||
# #endregion Test.DashboardsApi.TestMigrateDashboardsEnvNotFound
|
||||
|
||||
|
||||
# #region test_backup_dashboards_success [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[TestDashboardsApi]
|
||||
# #region Test.DashboardsApi.TestBackupDashboardsSuccess [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[Test.DashboardsApi.TestDashboardsApi]
|
||||
def test_backup_dashboards_success(mock_deps):
|
||||
mock_env = MagicMock()
|
||||
mock_env.id = "prod"
|
||||
@@ -534,11 +534,11 @@ def test_backup_dashboards_success(mock_deps):
|
||||
assert response.json()["task_id"] == "backup-123"
|
||||
|
||||
|
||||
# #endregion test_backup_dashboards_success
|
||||
# #endregion Test.DashboardsApi.TestBackupDashboardsSuccess
|
||||
|
||||
|
||||
# #region test_backup_dashboards_pre_checks [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[TestDashboardsApi]
|
||||
# #region Test.DashboardsApi.TestBackupDashboardsPreChecks [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[Test.DashboardsApi.TestDashboardsApi]
|
||||
def test_backup_dashboards_pre_checks(mock_deps):
|
||||
response = client.post(
|
||||
"/api/dashboards/backup", json={"env_id": "prod", "dashboard_ids": []}
|
||||
@@ -546,11 +546,11 @@ def test_backup_dashboards_pre_checks(mock_deps):
|
||||
assert response.status_code == 400
|
||||
|
||||
|
||||
# #endregion test_backup_dashboards_pre_checks
|
||||
# #endregion Test.DashboardsApi.TestBackupDashboardsPreChecks
|
||||
|
||||
|
||||
# #region test_backup_dashboards_env_not_found [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[TestDashboardsApi]
|
||||
# #region Test.DashboardsApi.TestBackupDashboardsEnvNotFound [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[Test.DashboardsApi.TestDashboardsApi]
|
||||
def test_backup_dashboards_env_not_found(mock_deps):
|
||||
"""@PRE: env_id is a valid environment ID."""
|
||||
mock_deps["config"].get_environments.return_value = []
|
||||
@@ -561,11 +561,11 @@ def test_backup_dashboards_env_not_found(mock_deps):
|
||||
assert "Environment not found" in response.json()["detail"]
|
||||
|
||||
|
||||
# #endregion test_backup_dashboards_env_not_found
|
||||
# #endregion Test.DashboardsApi.TestBackupDashboardsEnvNotFound
|
||||
|
||||
|
||||
# #region test_backup_dashboards_with_schedule [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[TestDashboardsApi]
|
||||
# #region Test.DashboardsApi.TestBackupDashboardsWithSchedule [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[Test.DashboardsApi.TestDashboardsApi]
|
||||
def test_backup_dashboards_with_schedule(mock_deps):
|
||||
"""@POST: If schedule is provided, a scheduled task is created."""
|
||||
mock_env = MagicMock()
|
||||
@@ -587,13 +587,13 @@ def test_backup_dashboards_with_schedule(mock_deps):
|
||||
|
||||
|
||||
# --- 8. Internal logic: _task_matches_dashboard ---
|
||||
# #endregion test_backup_dashboards_with_schedule
|
||||
# #endregion Test.DashboardsApi.TestBackupDashboardsWithSchedule
|
||||
|
||||
from src.api.routes.dashboards._projection import _task_matches_dashboard
|
||||
|
||||
|
||||
# #region test_task_matches_dashboard_logic [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[TestDashboardsApi]
|
||||
# #region Test.DashboardsApi.TestTaskMatchesDashboardLogic [C:2] [TYPE Function]
|
||||
# @RELATION BINDS_TO ->[Test.DashboardsApi.TestDashboardsApi]
|
||||
def test_task_matches_dashboard_logic():
|
||||
task = MagicMock(
|
||||
plugin_id="superset-backup", params={"dashboards": [42], "env": "prod"}
|
||||
@@ -610,5 +610,5 @@ def test_task_matches_dashboard_logic():
|
||||
assert _task_matches_dashboard(llm_task, 42, None) is True
|
||||
|
||||
|
||||
# #endregion test_task_matches_dashboard_logic
|
||||
# #endregion TestDashboardsApi
|
||||
# #endregion Test.DashboardsApi.TestTaskMatchesDashboardLogic
|
||||
# #endregion Test.DashboardsApi.TestDashboardsApi
|
||||
|
||||
Reference in New Issue
Block a user