Decompose 6 large modules into packages with <400-line modules to satisfy INV_7: - superset_client.py (2145->0) -> superset_client/ package (12 modules) - assistant.py (2683->0) -> assistant/ package (12 modules) - git_service.py (2101->11 shim) -> services/git/ package (9 modules) - git.py (1757->0) -> routes/git/ package (11 modules) - dashboards.py (1619->0) -> routes/dashboards/ package (8 modules) - translate.py (1587->0) -> routes/translate/ package (11 modules) - superset_context_extractor.py (1397->0) -> utils/superset_context_extractor/ (7 modules) All modules <400 lines (INV_7). All 80 tests pass. All external imports preserved via __init__.py re-exports or shim. Semantic [DEF] contracts with @LAYER/@SEMANTICS added to all Module types.
45 lines
1.7 KiB
Python
45 lines
1.7 KiB
Python
# [DEF:DashboardsApi:Module]
|
|
#
|
|
# @COMPLEXITY: 5
|
|
# @SEMANTICS: api, dashboards, resources, hub
|
|
# @PURPOSE: API endpoints for the Dashboard Hub - listing dashboards with Git and task status
|
|
# @LAYER: API
|
|
# @RELATION: DEPENDS_ON ->[AppDependencies]
|
|
# @RELATION: DEPENDS_ON ->[ResourceService]
|
|
# @RELATION: DEPENDS_ON ->[SupersetClient]
|
|
#
|
|
# @INVARIANT: All dashboard responses include git_status and last_task metadata
|
|
#
|
|
# @PRE: Valid environment configurations exist in ConfigManager.
|
|
# @POST: Dashboard responses are projected into DashboardsResponse DTO.
|
|
# @SIDE_EFFECT: Performs external calls to Superset API and potentially Git providers.
|
|
# @DATA_CONTRACT: Input(env_id, filters) -> Output(DashboardsResponse)
|
|
#
|
|
# @TEST_CONTRACT: DashboardsAPI -> {
|
|
# required_fields: {env_id: string, page: integer, page_size: integer},
|
|
# optional_fields: {search: string},
|
|
# invariants: ["Pagination must be valid", "Environment must exist"]
|
|
# }
|
|
#
|
|
# @TEST_FIXTURE: dashboard_list_happy -> {
|
|
# "env_id": "prod",
|
|
# "expected_count": 1,
|
|
# "dashboards": [{"id": 1, "title": "Main Revenue"}]
|
|
# }
|
|
#
|
|
# @TEST_EDGE: pagination_zero_page -> {"env_id": "prod", "page": 0, "status": 400}
|
|
# @TEST_EDGE: pagination_oversize -> {"env_id": "prod", "page_size": 101, "status": 400}
|
|
# @TEST_EDGE: missing_env -> {"env_id": "ghost", "status": 404}
|
|
# @TEST_EDGE: empty_dashboards -> {"env_id": "empty_env", "expected_total": 0}
|
|
# @TEST_EDGE: external_superset_failure -> {"env_id": "bad_conn", "status": 503}
|
|
#
|
|
# @TEST_INVARIANT: metadata_consistency -> verifies: [dashboard_list_happy, empty_dashboards]
|
|
|
|
from ._router import router
|
|
from ._schemas import *
|
|
from ._listing_routes import *
|
|
from ._detail_routes import *
|
|
from ._action_routes import *
|
|
|
|
# [/DEF:DashboardsApi:Module]
|