semantics
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
# #region GitPackage [C:5] [TYPE Module] [SEMANTICS git, api, package, sync]
|
||||
# @BRIEF Package root for decomposed git routes. Re-exports all public symbols from submodules.
|
||||
# @LAYER: API
|
||||
# @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.
|
||||
# @PRE: Git service initialized
|
||||
# @POST: Git API package exported
|
||||
# @SIDE_EFFECT: Registers git route submodules
|
||||
# @DATA_CONTRACT: GitRequest -> GitResponse
|
||||
# @LAYER API
|
||||
# @RELATION CALLS -> [[EXT:list:GitPackage_all_routes]]
|
||||
# @INVARIANT git_service and os are module-level attributes for test monkeypatch compatibility.
|
||||
# @PRE Git service initialized
|
||||
# @POST Git API package exported
|
||||
# @SIDE_EFFECT Registers git route submodules
|
||||
# @DATA_CONTRACT GitRequest -> GitResponse
|
||||
# All route functions are re-exported for direct access via `from src.api.routes import git`.
|
||||
|
||||
import os
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# #region GitConfigRoutes [C:2] [TYPE Module] [SEMANTICS fastapi, git, api, search, connection]
|
||||
# @BRIEF FastAPI endpoints for Git server configuration CRUD and connection testing.
|
||||
# @LAYER: API
|
||||
# @LAYER API
|
||||
|
||||
|
||||
from fastapi import Depends, HTTPException
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# #region GitDeps [C:1] [TYPE Module] [SEMANTICS git, dependency, service, provider]
|
||||
# @BRIEF Shared dependency wiring for monkeypatch-safe git_service access and constants.
|
||||
# @LAYER: API
|
||||
# @INVARIANT: get_git_service() resolves from sys.modules at call time so test monkeypatching
|
||||
# @LAYER API
|
||||
# @INVARIANT get_git_service() resolves from sys.modules at call time so test monkeypatching
|
||||
# of git_routes.git_service (the __init__ attribute) takes effect across all submodules.
|
||||
|
||||
import sys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# #region GitEnvironmentRoutes [C:2] [TYPE Module] [SEMANTICS fastapi, git, environment, api]
|
||||
# @BRIEF FastAPI endpoint for listing deployment environments.
|
||||
# @LAYER: API
|
||||
# @LAYER API
|
||||
|
||||
|
||||
from fastapi import Depends
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# #region GitGiteaRoutes [C:2] [TYPE Module] [SEMANTICS fastapi, git, gitea, api]
|
||||
# @BRIEF FastAPI endpoints for Gitea-specific repository operations.
|
||||
# @LAYER: API
|
||||
# @LAYER API
|
||||
|
||||
|
||||
from fastapi import Depends, HTTPException
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# #region GitHelpers [C:3] [TYPE Module] [SEMANTICS fastapi, git, api]
|
||||
# @BRIEF Shared helper functions for Git route modules.
|
||||
# @LAYER: API
|
||||
# @RELATION USES -> [GitDeps]
|
||||
# @RELATION USES -> [SupersetClient]
|
||||
# @RELATION USES -> [UserDashboardPreference]
|
||||
# @LAYER API
|
||||
# @RELATION CALLS -> [GitDeps]
|
||||
# @RELATION CALLS -> [SupersetClient]
|
||||
# @RELATION CALLS -> [UserDashboardPreference]
|
||||
|
||||
import os
|
||||
|
||||
@@ -21,7 +21,7 @@ from ._deps import get_git_service
|
||||
|
||||
# #region _build_no_repo_status_payload [C:1] [TYPE Function]
|
||||
# @BRIEF Build a consistent status payload for dashboards without initialized repositories.
|
||||
# @POST: Returns a stable payload compatible with frontend repository status parsing.
|
||||
# @POST Returns a stable payload compatible with frontend repository status parsing.
|
||||
def _build_no_repo_status_payload() -> dict:
|
||||
return {
|
||||
"is_dirty": False,
|
||||
@@ -43,8 +43,8 @@ def _build_no_repo_status_payload() -> dict:
|
||||
|
||||
# #region _handle_unexpected_git_route_error [C:1] [TYPE Function]
|
||||
# @BRIEF Convert unexpected route-level exceptions to stable 500 API responses.
|
||||
# @PRE: `error` is a non-HTTPException instance.
|
||||
# @POST: Raises HTTPException(500) with route-specific context.
|
||||
# @PRE `error` is a non-HTTPException instance.
|
||||
# @POST Raises HTTPException(500) with route-specific context.
|
||||
def _handle_unexpected_git_route_error(route_name: str, error: Exception) -> None:
|
||||
logger.error(f"[{route_name}][Coherence:Failed] {error}")
|
||||
raise HTTPException(status_code=500, detail=f"{route_name} failed: {error!s}")
|
||||
@@ -53,8 +53,8 @@ def _handle_unexpected_git_route_error(route_name: str, error: Exception) -> Non
|
||||
|
||||
# #region _resolve_repository_status [C:2] [TYPE Function]
|
||||
# @BRIEF Resolve repository status for one dashboard with graceful NO_REPO semantics.
|
||||
# @PRE: `dashboard_id` is a valid integer.
|
||||
# @POST: Returns standard status payload or `NO_REPO` payload when repository path is absent.
|
||||
# @PRE `dashboard_id` is a valid integer.
|
||||
# @POST Returns standard status payload or `NO_REPO` payload when repository path is absent.
|
||||
def _resolve_repository_status(dashboard_id: int) -> dict:
|
||||
git_service = get_git_service()
|
||||
repo_path = git_service._get_repo_path(dashboard_id)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# #region GitMergeRoutes [C:3] [TYPE Module] [SEMANTICS fastapi, git, api]
|
||||
# @BRIEF FastAPI endpoints for merge operations (status, conflicts, resolve, abort, continue).
|
||||
# @LAYER: API
|
||||
# @LAYER API
|
||||
|
||||
|
||||
from fastapi import Depends, HTTPException
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# #region GitRepoLifecycleRoutes [C:3] [TYPE Module] [SEMANTICS fastapi, git, api, sync, deploy]
|
||||
# @BRIEF FastAPI endpoints for Git lifecycle operations (sync, promote, deploy).
|
||||
# @LAYER: API
|
||||
# @LAYER API
|
||||
|
||||
|
||||
from fastapi import Depends, HTTPException
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# #region GitRepoOperationsRoutes [C:3] [TYPE Module] [SEMANTICS fastapi, git, api, history, diff]
|
||||
# @BRIEF FastAPI endpoints for Git repository operations (commit, push, pull, status, diff, history).
|
||||
# @LAYER: API
|
||||
# @LAYER API
|
||||
|
||||
|
||||
from fastapi import Depends, HTTPException
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# #region GitRepoRoutes [C:3] [TYPE Module] [SEMANTICS fastapi, git, api, search]
|
||||
# @BRIEF FastAPI endpoints for core Git repository operations (init, binding, branches, checkout).
|
||||
# @LAYER: API
|
||||
# @LAYER API
|
||||
|
||||
|
||||
from fastapi import Depends, HTTPException
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# #region GitRouter [C:1] [TYPE Module] [SEMANTICS fastapi, git, api]
|
||||
# @BRIEF Shared APIRouter for all Git route modules.
|
||||
# @LAYER: API
|
||||
# @LAYER API
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
|
||||
Reference in New Issue
Block a user