refactor(semantics): migrate legacy @TIER to @COMPLEXITY annotations
- Replaced @TIER: TRIVIAL with @COMPLEXITY: 1 - Replaced @TIER: STANDARD with @COMPLEXITY: 3 - Replaced @TIER: CRITICAL with @COMPLEXITY: 5 - Manually elevated specific critical/complex components to levels 2 and 4 - Ignored legacy, specs, and node_modules directories - Updated generated semantic map
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# [DEF:AppModule:Module]
|
||||
# @TIER: CRITICAL
|
||||
# @COMPLEXITY: 5
|
||||
# @SEMANTICS: app, main, entrypoint, fastapi
|
||||
# @PURPOSE: The main entry point for the FastAPI application. It initializes the app, configures CORS, sets up dependencies, includes API routers, and defines the WebSocket endpoint for log streaming.
|
||||
# @LAYER: UI (API)
|
||||
@@ -32,7 +32,7 @@ from .api.routes import plugins, tasks, settings, environments, mappings, migrat
|
||||
from .api import auth
|
||||
|
||||
# [DEF:App:Global]
|
||||
# @TIER: TRIVIAL
|
||||
# @COMPLEXITY: 1
|
||||
# @SEMANTICS: app, fastapi, instance
|
||||
# @PURPOSE: The global FastAPI application instance.
|
||||
app = FastAPI(
|
||||
@@ -43,7 +43,7 @@ app = FastAPI(
|
||||
# [/DEF:App:Global]
|
||||
|
||||
# [DEF:startup_event:Function]
|
||||
# @TIER: STANDARD
|
||||
# @COMPLEXITY: 3
|
||||
# @PURPOSE: Handles application startup tasks, such as starting the scheduler.
|
||||
# @PRE: None.
|
||||
# @POST: Scheduler is started.
|
||||
@@ -57,7 +57,7 @@ async def startup_event():
|
||||
# [/DEF:startup_event:Function]
|
||||
|
||||
# [DEF:shutdown_event:Function]
|
||||
# @TIER: STANDARD
|
||||
# @COMPLEXITY: 3
|
||||
# @PURPOSE: Handles application shutdown tasks, such as stopping the scheduler.
|
||||
# @PRE: None.
|
||||
# @POST: Scheduler is stopped.
|
||||
@@ -84,7 +84,7 @@ app.add_middleware(
|
||||
|
||||
|
||||
# [DEF:network_error_handler:Function]
|
||||
# @TIER: TRIVIAL
|
||||
# @COMPLEXITY: 1
|
||||
# @PURPOSE: Global exception handler for NetworkError.
|
||||
# @PRE: request is a FastAPI Request object.
|
||||
# @POST: Returns 503 HTTP Exception.
|
||||
@@ -101,7 +101,7 @@ async def network_error_handler(request: Request, exc: NetworkError):
|
||||
# [/DEF:network_error_handler:Function]
|
||||
|
||||
# [DEF:log_requests:Function]
|
||||
# @TIER: STANDARD
|
||||
# @COMPLEXITY: 3
|
||||
# @PURPOSE: Middleware to log incoming HTTP requests and their response status.
|
||||
# @PRE: request is a FastAPI Request object.
|
||||
# @POST: Logs request and response details.
|
||||
@@ -153,14 +153,14 @@ app.include_router(health.router)
|
||||
|
||||
|
||||
# [DEF:api.include_routers:Action]
|
||||
# @TIER: TRIVIAL
|
||||
# @COMPLEXITY: 1
|
||||
# @PURPOSE: Registers all API routers with the FastAPI application.
|
||||
# @LAYER: API
|
||||
# @SEMANTICS: routes, registration, api
|
||||
# [/DEF:api.include_routers:Action]
|
||||
|
||||
# [DEF:websocket_endpoint:Function]
|
||||
# @TIER: CRITICAL
|
||||
# @COMPLEXITY: 5
|
||||
# @PURPOSE: Provides a WebSocket endpoint for real-time log streaming of a task with server-side filtering.
|
||||
# @PRE: task_id must be a valid task ID.
|
||||
# @POST: WebSocket connection is managed and logs are streamed until disconnect.
|
||||
@@ -280,7 +280,7 @@ async def websocket_endpoint(
|
||||
# [/DEF:websocket_endpoint:Function]
|
||||
|
||||
# [DEF:StaticFiles:Mount]
|
||||
# @TIER: TRIVIAL
|
||||
# @COMPLEXITY: 1
|
||||
# @SEMANTICS: static, frontend, spa
|
||||
# @PURPOSE: Mounts the frontend build directory to serve static assets.
|
||||
frontend_path = project_root / "frontend" / "build"
|
||||
@@ -288,7 +288,7 @@ if frontend_path.exists():
|
||||
app.mount("/_app", StaticFiles(directory=str(frontend_path / "_app")), name="static")
|
||||
|
||||
# [DEF:serve_spa:Function]
|
||||
# @TIER: TRIVIAL
|
||||
# @COMPLEXITY: 1
|
||||
# @PURPOSE: Serves the SPA frontend for any path not matched by API routes.
|
||||
# @PRE: frontend_path exists.
|
||||
# @POST: Returns the requested file or index.html.
|
||||
@@ -309,7 +309,7 @@ if frontend_path.exists():
|
||||
# [/DEF:serve_spa:Function]
|
||||
else:
|
||||
# [DEF:read_root:Function]
|
||||
# @TIER: TRIVIAL
|
||||
# @COMPLEXITY: 1
|
||||
# @PURPOSE: A simple root endpoint to confirm that the API is running when frontend is missing.
|
||||
# @PRE: None.
|
||||
# @POST: Returns a JSON message indicating API status.
|
||||
|
||||
Reference in New Issue
Block a user