refactor: decompose 6 monolithic modules (>1000 LOC) into domain packages
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.
This commit is contained in:
44
backend/src/api/routes/git/__init__.py
Normal file
44
backend/src/api/routes/git/__init__.py
Normal file
@@ -0,0 +1,44 @@
|
||||
# [DEF:GitPackage:Module]
|
||||
# @COMPLEXITY: 3
|
||||
# @PURPOSE: Package root for decomposed git routes. Re-exports all public symbols from submodules.
|
||||
# @LAYER: API
|
||||
# @SEMANTICS: git, package, re-exports
|
||||
# @RELATION: USES -> [GitRouter, GitDeps, GitHelpers, GitConfigRoutes, GitGiteaRoutes,
|
||||
# GitRepoRoutes, GitRepoOperationsRoutes, GitRepoLifecycleRoutes,
|
||||
# GitMergeRoutes, GitEnvironmentRoutes]
|
||||
# @INVARIANT: git_service and os are module-level attributes for test monkeypatch compatibility.
|
||||
# All route functions are re-exported for direct access via `from src.api.routes import git`.
|
||||
|
||||
import os
|
||||
|
||||
from src.services.git_service import GitService
|
||||
|
||||
from ._router import router
|
||||
from ._deps import MAX_REPOSITORY_STATUS_BATCH
|
||||
|
||||
# -- git_service singleton (canonical instance; tests may monkeypatch git_routes.git_service) --
|
||||
git_service = GitService()
|
||||
|
||||
# -- Config routes --
|
||||
from ._config_routes import get_git_configs, create_git_config, update_git_config, delete_git_config, test_git_config # noqa: E501, F401
|
||||
|
||||
# -- Gitea routes --
|
||||
from ._gitea_routes import list_gitea_repositories, create_gitea_repository, delete_gitea_repository, create_remote_repository # noqa: E501, F401
|
||||
|
||||
# -- Repo routes (core) --
|
||||
from ._repo_routes import init_repository, get_repository_binding, delete_repository, get_branches, create_branch, checkout_branch # noqa: E501, F401
|
||||
from ._helpers import _resolve_dashboard_id_from_ref, _resolve_dashboard_id_from_ref_async, _resolve_repo_key_from_ref # noqa: E501, F401 — re-exported for test monkeypatch compatibility
|
||||
|
||||
# -- Repo operations routes (commit, push, pull, status, diff, history, generate-message) --
|
||||
from ._repo_operations_routes import commit_changes, push_changes, pull_changes, get_repository_status, get_repository_status_batch, get_repository_diff, get_history, generate_commit_message # noqa: E501, F401
|
||||
|
||||
# -- Repo lifecycle routes (sync, promote, deploy) --
|
||||
from ._repo_lifecycle_routes import sync_dashboard, promote_dashboard, deploy_dashboard # noqa: E501, F401
|
||||
|
||||
# -- Merge routes --
|
||||
from ._merge_routes import get_merge_status, get_merge_conflicts, resolve_merge_conflicts, abort_merge, continue_merge # noqa: E501, F401
|
||||
|
||||
# -- Environment routes --
|
||||
from ._environment_routes import get_environments # noqa: E501, F401
|
||||
|
||||
# [/DEF:GitPackage:Module]
|
||||
Reference in New Issue
Block a user