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,9 +1,9 @@
|
||||
# #region test_maintenance_api [C:3] [TYPE TestModule] [SEMANTICS test, maintenance, api, fastapi, pytest]
|
||||
# #region Test.MaintenanceApi.TestMaintenanceApi [C:3] [TYPE TestModule] [SEMANTICS test, maintenance, api, fastapi, pytest]
|
||||
# @BRIEF Contract tests for Maintenance Banner API endpoints — T016, T025.
|
||||
# Tests POST /start, POST /{id}/end, POST /end-all, GET /events, GET /dashboard-banners,
|
||||
# GET /settings, PUT /settings.
|
||||
# @LAYER Test
|
||||
# @RELATION BINDS_TO -> [MaintenanceRoutesModule]
|
||||
# @RELATION BINDS_TO -> [Api.Routes.MaintenanceRoutesModule]
|
||||
# @TEST_CONTRACT: POST /api/maintenance/start -> 202 {task_id, maintenance_id, status}
|
||||
# @TEST_CONTRACT: POST /api/maintenance/{id}/end -> 202 {task_id, status}
|
||||
# @TEST_CONTRACT: POST /api/maintenance/end-all -> 202 {task_id, status}
|
||||
@@ -166,7 +166,7 @@ def mock_task_manager():
|
||||
class TestStartEndpoint:
|
||||
"""Contract tests for POST /api/maintenance/start."""
|
||||
|
||||
# #region test_start_returns_202 [C:2] [TYPE Function]
|
||||
# #region Test.MaintenanceApi.TestStartReturns202 [C:2] [TYPE Function]
|
||||
# @BRIEF Valid request returns 202 with task_id and maintenance_id.
|
||||
def test_start_returns_202(self, client, mock_db, mock_task_manager):
|
||||
response = client.post(
|
||||
@@ -184,9 +184,9 @@ class TestStartEndpoint:
|
||||
assert "task_id" in data
|
||||
assert "maintenance_id" in data
|
||||
assert data["status"] == "pending"
|
||||
# #endregion test_start_returns_202
|
||||
# #endregion Test.MaintenanceApi.TestStartReturns202
|
||||
|
||||
# #region test_start_missing_tables [C:2] [TYPE Function]
|
||||
# #region Test.MaintenanceApi.TestStartMissingTables [C:2] [TYPE Function]
|
||||
# @BRIEF Missing tables field returns 422.
|
||||
def test_start_missing_tables(self, client, mock_db, mock_task_manager):
|
||||
response = client.post(
|
||||
@@ -196,9 +196,9 @@ class TestStartEndpoint:
|
||||
},
|
||||
)
|
||||
assert response.status_code == 422
|
||||
# #endregion test_start_missing_tables
|
||||
# #endregion Test.MaintenanceApi.TestStartMissingTables
|
||||
|
||||
# #region test_start_missing_environment_id [C:2] [TYPE Function]
|
||||
# #region Test.MaintenanceApi.TestStartMissingEnvironmentId [C:2] [TYPE Function]
|
||||
# @BRIEF Missing environment_id field returns 422.
|
||||
# @TEST_EDGE: missing_environment_id -> 422 validation error
|
||||
def test_start_missing_environment_id(self, client, mock_db, mock_task_manager):
|
||||
@@ -217,9 +217,9 @@ class TestStartEndpoint:
|
||||
"environment_id" in str(err.get("loc", []))
|
||||
for err in (data.get("detail", []) if isinstance(data.get("detail"), list) else [])
|
||||
)
|
||||
# #endregion test_start_missing_environment_id
|
||||
# #endregion Test.MaintenanceApi.TestStartMissingEnvironmentId
|
||||
|
||||
# #region test_start_end_time_before_start [C:2] [TYPE Function]
|
||||
# #region Test.MaintenanceApi.TestStartEndTimeBeforeStart [C:2] [TYPE Function]
|
||||
# @BRIEF end_time before start_time returns 400.
|
||||
def test_start_end_time_before_start(self, client, mock_db, mock_task_manager):
|
||||
response = client.post(
|
||||
@@ -232,9 +232,9 @@ class TestStartEndpoint:
|
||||
},
|
||||
)
|
||||
assert response.status_code == 400
|
||||
# #endregion test_start_end_time_before_start
|
||||
# #endregion Test.MaintenanceApi.TestStartEndTimeBeforeStart
|
||||
|
||||
# #region test_start_too_many_tables [C:2] [TYPE Function]
|
||||
# #region Test.MaintenanceApi.TestStartTooManyTables [C:2] [TYPE Function]
|
||||
# @BRIEF More than 100 tables returns 422 (Pydantic validation).
|
||||
def test_start_too_many_tables(self, client, mock_db, mock_task_manager):
|
||||
tables = [f"raw.table{i}" for i in range(101)]
|
||||
@@ -247,9 +247,9 @@ class TestStartEndpoint:
|
||||
},
|
||||
)
|
||||
assert response.status_code == 422
|
||||
# #endregion test_start_too_many_tables
|
||||
# #endregion Test.MaintenanceApi.TestStartTooManyTables
|
||||
|
||||
# #region test_start_idempotency [C:2] [TYPE Function]
|
||||
# #region Test.MaintenanceApi.TestStartIdempotency [C:2] [TYPE Function]
|
||||
# @BRIEF Same (tables, start, end) returns already_active.
|
||||
def test_start_idempotency(self, client, mock_db, mock_task_manager):
|
||||
from src.models.maintenance import MaintenanceEvent, MaintenanceEventStatus
|
||||
@@ -280,7 +280,7 @@ class TestStartEndpoint:
|
||||
data = response2.json()
|
||||
# Should have maintenance_id and status
|
||||
assert data.get("maintenance_id") or data.get("status")
|
||||
# #endregion test_start_idempotency
|
||||
# #endregion Test.MaintenanceApi.TestStartIdempotency
|
||||
|
||||
|
||||
# ── T025: POST /api/maintenance/{id}/end ──────────────────────
|
||||
@@ -288,7 +288,7 @@ class TestStartEndpoint:
|
||||
class TestEndEndpoint:
|
||||
"""Contract tests for POST /api/maintenance/{id}/end."""
|
||||
|
||||
# #region test_end_returns_202 [C:2] [TYPE Function]
|
||||
# #region Test.MaintenanceApi.TestEndReturns202 [C:2] [TYPE Function]
|
||||
# @BRIEF Valid maintenance_id returns 202.
|
||||
def test_end_returns_202(self, client, mock_db, mock_task_manager):
|
||||
from src.models.maintenance import MaintenanceEvent, MaintenanceEventStatus
|
||||
@@ -306,14 +306,14 @@ class TestEndEndpoint:
|
||||
assert response.status_code == 202
|
||||
data = response.json()
|
||||
assert "task_id" in data
|
||||
# #endregion test_end_returns_202
|
||||
# #endregion Test.MaintenanceApi.TestEndReturns202
|
||||
|
||||
# #region test_end_not_found [C:2] [TYPE Function]
|
||||
# #region Test.MaintenanceApi.TestEndNotFound [C:2] [TYPE Function]
|
||||
# @BRIEF Non-existent maintenance_id returns 404.
|
||||
def test_end_not_found(self, client, mock_db, mock_task_manager):
|
||||
response = client.post("/api/maintenance/nonexistent-id/end")
|
||||
assert response.status_code == 404
|
||||
# #endregion test_end_not_found
|
||||
# #endregion Test.MaintenanceApi.TestEndNotFound
|
||||
|
||||
|
||||
# ── POST /api/maintenance/end-all ─────────────────────────────
|
||||
@@ -321,7 +321,7 @@ class TestEndEndpoint:
|
||||
class TestEndAllEndpoint:
|
||||
"""Contract tests for POST /api/maintenance/end-all."""
|
||||
|
||||
# #region test_end_all_returns_202 [C:2] [TYPE Function]
|
||||
# #region Test.MaintenanceApi.TestEndAllReturns202 [C:2] [TYPE Function]
|
||||
# @BRIEF end-all returns 202.
|
||||
def test_end_all_returns_202(self, client, mock_db, mock_task_manager):
|
||||
response = client.post("/api/maintenance/end-all")
|
||||
@@ -329,7 +329,7 @@ class TestEndAllEndpoint:
|
||||
data = response.json()
|
||||
assert "task_id" in data
|
||||
assert data["status"] == "pending"
|
||||
# #endregion test_end_all_returns_202
|
||||
# #endregion Test.MaintenanceApi.TestEndAllReturns202
|
||||
|
||||
|
||||
# ── GET /api/maintenance/events ───────────────────────────────
|
||||
@@ -337,7 +337,7 @@ class TestEndAllEndpoint:
|
||||
class TestEventsEndpoint:
|
||||
"""Contract tests for GET /api/maintenance/events."""
|
||||
|
||||
# #region test_list_events [C:2] [TYPE Function]
|
||||
# #region Test.MaintenanceApi.TestListEvents [C:2] [TYPE Function]
|
||||
# @BRIEF Returns active and completed events.
|
||||
def test_list_events(self, client, mock_db, mock_task_manager):
|
||||
from src.models.maintenance import MaintenanceEvent, MaintenanceEventStatus
|
||||
@@ -364,9 +364,9 @@ class TestEventsEndpoint:
|
||||
data = response.json()
|
||||
assert "active" in data
|
||||
assert "completed" in data
|
||||
# #endregion test_list_events
|
||||
# #endregion Test.MaintenanceApi.TestListEvents
|
||||
|
||||
# #region test_expired_event_auto_ends [C:2] [TYPE Function]
|
||||
# #region Test.MaintenanceApi.TestExpiredEventAutoEnds [C:2] [TYPE Function]
|
||||
# @BRIEF Event past end_time with ACTIVE status → create_task called with auto-end params.
|
||||
def test_expired_event_auto_ends(self, client, mock_db, mock_task_manager):
|
||||
from datetime import timedelta
|
||||
@@ -396,9 +396,9 @@ class TestEventsEndpoint:
|
||||
"user": "system",
|
||||
},
|
||||
)
|
||||
# #endregion test_expired_event_auto_ends
|
||||
# #endregion Test.MaintenanceApi.TestExpiredEventAutoEnds
|
||||
|
||||
# #region test_future_end_time_skipped [C:2] [TYPE Function]
|
||||
# #region Test.MaintenanceApi.TestFutureEndTimeSkipped [C:2] [TYPE Function]
|
||||
# @BRIEF Event with future end_time → no task created, skipped by < now filter.
|
||||
def test_future_end_time_skipped(self, client, mock_db, mock_task_manager):
|
||||
from datetime import timedelta
|
||||
@@ -420,9 +420,9 @@ class TestEventsEndpoint:
|
||||
assert response.status_code == 200
|
||||
|
||||
mock_task_manager.create_task.assert_not_called()
|
||||
# #endregion test_future_end_time_skipped
|
||||
# #endregion Test.MaintenanceApi.TestFutureEndTimeSkipped
|
||||
|
||||
# #region test_no_end_time_skipped [C:2] [TYPE Function]
|
||||
# #region Test.MaintenanceApi.TestNoEndTimeSkipped [C:2] [TYPE Function]
|
||||
# @BRIEF Event with end_time=None → no task created, skipped by isnot(None) filter.
|
||||
def test_no_end_time_skipped(self, client, mock_db, mock_task_manager):
|
||||
from datetime import timedelta
|
||||
@@ -444,7 +444,7 @@ class TestEventsEndpoint:
|
||||
assert response.status_code == 200
|
||||
|
||||
mock_task_manager.create_task.assert_not_called()
|
||||
# #endregion test_no_end_time_skipped
|
||||
# #endregion Test.MaintenanceApi.TestNoEndTimeSkipped
|
||||
|
||||
|
||||
# ── GET /api/maintenance/dashboard-banners ────────────────────
|
||||
@@ -452,7 +452,7 @@ class TestEventsEndpoint:
|
||||
class TestDashboardBannersEndpoint:
|
||||
"""Contract tests for GET /api/maintenance/dashboard-banners."""
|
||||
|
||||
# #region test_list_banners [C:2] [TYPE Function]
|
||||
# #region Test.MaintenanceApi.TestListBanners [C:2] [TYPE Function]
|
||||
# @BRIEF Returns list of active banners.
|
||||
def test_list_banners(self, client, mock_db, mock_task_manager):
|
||||
from src.models.maintenance import (
|
||||
@@ -474,7 +474,7 @@ class TestDashboardBannersEndpoint:
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert isinstance(data, list)
|
||||
# #endregion test_list_banners
|
||||
# #endregion Test.MaintenanceApi.TestListBanners
|
||||
|
||||
|
||||
# ── GET /api/maintenance/settings ─────────────────────────────
|
||||
@@ -482,7 +482,7 @@ class TestDashboardBannersEndpoint:
|
||||
class TestSettingsEndpoint:
|
||||
"""Contract tests for GET/PUT /api/maintenance/settings."""
|
||||
|
||||
# #region test_get_settings [C:2] [TYPE Function]
|
||||
# #region Test.MaintenanceApi.TestGetSettings [C:2] [TYPE Function]
|
||||
# @BRIEF GET returns settings.
|
||||
def test_get_settings(self, client, mock_db, mock_task_manager):
|
||||
response = client.get("/api/maintenance/settings")
|
||||
@@ -490,9 +490,9 @@ class TestSettingsEndpoint:
|
||||
data = response.json()
|
||||
assert "target_environment_id" in data
|
||||
assert data["target_environment_id"] == "test-env"
|
||||
# #endregion test_get_settings
|
||||
# #endregion Test.MaintenanceApi.TestGetSettings
|
||||
|
||||
# #region test_put_settings [C:2] [TYPE Function]
|
||||
# #region Test.MaintenanceApi.TestPutSettings [C:2] [TYPE Function]
|
||||
# @BRIEF PUT updates settings.
|
||||
def test_put_settings(self, client, mock_db, mock_task_manager):
|
||||
response = client.put(
|
||||
@@ -502,5 +502,5 @@ class TestSettingsEndpoint:
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["display_timezone"] == "Europe/Moscow"
|
||||
# #endregion test_put_settings
|
||||
# #endregion test_maintenance_api
|
||||
# #endregion Test.MaintenanceApi.TestPutSettings
|
||||
# #endregion Test.MaintenanceApi.TestMaintenanceApi
|
||||
|
||||
Reference in New Issue
Block a user