fix: remove broken dev_tools router references after API route migration

The dev_tools API routes were moved to the monitoring module, but several
files still tried to import the non-existent admin_router. This caused
warnings during app startup.

Changes:
- Remove _get_admin_router() from definition.py
- Clear routes/__init__.py and routes/api/__init__.py of broken imports
- Update exceptions.py to import from monitoring.exceptions
- Update code_quality_service.py to import from monitoring.exceptions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-31 21:18:02 +01:00
parent 7639ca602b
commit 66f9600286
6 changed files with 22 additions and 34 deletions

View File

@@ -16,14 +16,9 @@ from app.modules.base import ModuleDefinition
from models.database.admin_menu_config import FrontendType from models.database.admin_menu_config import FrontendType
def _get_admin_router():
"""Lazy import of admin router to avoid circular imports."""
from app.modules.dev_tools.routes.api.admin import admin_router
return admin_router
# Dev-Tools module definition # Dev-Tools module definition
# Note: API routes (code quality, tests) have been moved to monitoring module.
# This module retains models, services, and page routes only.
dev_tools_module = ModuleDefinition( dev_tools_module = ModuleDefinition(
code="dev-tools", code="dev-tools",
name="Developer Tools", name="Developer Tools",
@@ -81,13 +76,13 @@ dev_tools_module = ModuleDefinition(
def get_dev_tools_module_with_routers() -> ModuleDefinition: def get_dev_tools_module_with_routers() -> ModuleDefinition:
""" """
Get dev-tools module with routers attached. Get dev-tools module definition.
This function attaches the routers lazily to avoid circular imports Note: API routes have been moved to monitoring module.
during module initialization. This module has no routers to attach.
""" """
dev_tools_module.admin_router = _get_admin_router() # No routers - API routes are now in monitoring module
# No vendor router for internal modules dev_tools_module.admin_router = None
dev_tools_module.vendor_router = None dev_tools_module.vendor_router = None
return dev_tools_module return dev_tools_module

View File

@@ -12,9 +12,8 @@ from app.exceptions.base import (
ResourceNotFoundException, ResourceNotFoundException,
) )
# Re-export code quality exceptions from legacy location # Re-export code quality exceptions from their module location
# This avoids circular imports since app/exceptions/__init__.py imports code_quality.py from app.modules.monitoring.exceptions import (
from app.exceptions.code_quality import (
ViolationNotFoundException, ViolationNotFoundException,
ScanNotFoundException, ScanNotFoundException,
ScanExecutionException, ScanExecutionException,

View File

@@ -2,15 +2,15 @@
""" """
Dev-Tools module route registration. Dev-Tools module route registration.
This module provides dev-tools routes with module-based access control. This module provides dev-tools page routes for admin pages.
Structure: Structure:
- routes/api/ - REST API endpoints (code quality, tests)
- routes/pages/ - HTML page rendering (component library, icons) - routes/pages/ - HTML page rendering (component library, icons)
Note: Dev-tools is an internal module (admin-only), so there is no vendor router. Note: API routes (code quality, tests) have been moved to the monitoring module.
Dev-tools is an internal module (admin-only), so there is no vendor router.
""" """
from app.modules.dev_tools.routes.api import admin_router # No routers to export - API routes moved to monitoring module
# Page routes are auto-discovered from routes/pages/admin.py
__all__ = ["admin_router"] __all__ = []

View File

@@ -2,13 +2,9 @@
""" """
Dev-Tools module API routes. Dev-Tools module API routes.
Provides REST API endpoints for code quality and test running: Note: Code quality and test running routes have been moved to the monitoring module.
- Admin API: Code quality scans, violations, test execution The dev_tools module keeps models but routes are now in monitoring.
Note: Dev-tools is an internal module, so there are no vendor routes.
Currently re-exports routes from the legacy location.
""" """
from app.modules.dev_tools.routes.api.admin import admin_router # No routes exported - code quality and tests are in monitoring module
__all__ = []
__all__ = ["admin_router"]

View File

@@ -1,4 +1,2 @@
# Page routes will be added here # app/modules/dev_tools/routes/pages/__init__.py
# TODO: Add HTML page routes for admin/vendor dashboards """Dev tools module page routes."""
__all__ = []

View File

@@ -12,7 +12,7 @@ from datetime import datetime, UTC
from sqlalchemy import desc, func from sqlalchemy import desc, func
from sqlalchemy.orm import Session from sqlalchemy.orm import Session
from app.exceptions import ( from app.modules.monitoring.exceptions import (
ScanParseException, ScanParseException,
ScanTimeoutException, ScanTimeoutException,
ViolationNotFoundException, ViolationNotFoundException,