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:
2026-03-16 10:06:44 +03:00
parent 321e0eb2db
commit 274510fc38
321 changed files with 30101 additions and 58483 deletions

View File

@@ -1,5 +1,5 @@
# [DEF:backend.src.services.resource_service:Module]
# @TIER: STANDARD
# @COMPLEXITY: 3
# @SEMANTICS: service, resources, dashboards, datasets, tasks, git
# @PURPOSE: Shared service for fetching resource data with Git status and task status
# @LAYER: Service
@@ -19,12 +19,12 @@ from ..core.logger import logger, belief_scope
# [/SECTION]
# [DEF:backend.src.services.resource_service.ResourceService:Class]
# @TIER: STANDARD
# @COMPLEXITY: 3
# @PURPOSE: Provides centralized access to resource data with enhanced metadata
class ResourceService:
# [DEF:backend.src.services.resource_service.ResourceService.__init__:Function]
# @TIER: TRIVIAL
# @COMPLEXITY: 1
# @PURPOSE: Initialize the resource service with dependencies
# @PRE: None
# @POST: ResourceService is ready to fetch resources
@@ -35,7 +35,7 @@ class ResourceService:
# [/DEF:backend.src.services.resource_service.ResourceService.__init__:Function]
# [DEF:backend.src.services.resource_service.ResourceService.get_dashboards_with_status:Function]
# @TIER: STANDARD
# @COMPLEXITY: 3
# @PURPOSE: Fetch dashboards from environment with Git status and last task status
# @PRE: env is a valid Environment object
# @POST: Returns list of dashboards with enhanced metadata
@@ -85,7 +85,7 @@ class ResourceService:
# [/DEF:get_dashboards_with_status:Function]
# [DEF:get_dashboards_page_with_status:Function]
# @TIER: STANDARD
# @COMPLEXITY: 3
# @PURPOSE: Fetch one dashboard page from environment and enrich only that page with status metadata.
# @PRE: env is valid; page >= 1; page_size > 0.
# @POST: Returns page items plus total counters without scanning all pages locally.
@@ -149,7 +149,7 @@ class ResourceService:
# [/DEF:get_dashboards_page_with_status:Function]
# [DEF:_get_last_llm_task_for_dashboard:Function]
# @TIER: STANDARD
# @COMPLEXITY: 3
# @PURPOSE: Get most recent LLM validation task for a dashboard in an environment
# @PRE: dashboard_id is a valid integer identifier
# @POST: Returns the newest llm_dashboard_validation task summary or None
@@ -230,7 +230,7 @@ class ResourceService:
# [/DEF:_get_last_llm_task_for_dashboard:Function]
# [DEF:_normalize_task_status:Function]
# @TIER: STANDARD
# @COMPLEXITY: 3
# @PURPOSE: Normalize task status to stable uppercase values for UI/API projections
# @PRE: raw_status can be enum or string
# @POST: Returns uppercase status without enum class prefix
@@ -247,7 +247,7 @@ class ResourceService:
# [/DEF:_normalize_task_status:Function]
# [DEF:_normalize_validation_status:Function]
# @TIER: STANDARD
# @COMPLEXITY: 3
# @PURPOSE: Normalize LLM validation status to PASS/FAIL/WARN/UNKNOWN
# @PRE: raw_status can be any scalar type
# @POST: Returns normalized validation status token or None
@@ -263,7 +263,7 @@ class ResourceService:
# [/DEF:_normalize_validation_status:Function]
# [DEF:_normalize_datetime_for_compare:Function]
# @TIER: STANDARD
# @COMPLEXITY: 3
# @PURPOSE: Normalize datetime values to UTC-aware values for safe comparisons.
# @PRE: value may be datetime or any scalar.
# @POST: Returns UTC-aware datetime; non-datetime values map to minimal UTC datetime.
@@ -278,7 +278,7 @@ class ResourceService:
# [/DEF:_normalize_datetime_for_compare:Function]
# [DEF:get_datasets_with_status:Function]
# @TIER: STANDARD
# @COMPLEXITY: 3
# @PURPOSE: Fetch datasets from environment with mapping progress and last task status
# @PRE: env is a valid Environment object
# @POST: Returns list of datasets with enhanced metadata
@@ -317,7 +317,7 @@ class ResourceService:
# [/DEF:get_datasets_with_status:Function]
# [DEF:get_activity_summary:Function]
# @TIER: STANDARD
# @COMPLEXITY: 3
# @PURPOSE: Get summary of active and recent tasks for the activity indicator
# @PRE: tasks is a list of Task objects
# @POST: Returns summary with active_count and recent_tasks
@@ -357,7 +357,7 @@ class ResourceService:
# [/DEF:get_activity_summary:Function]
# [DEF:_get_git_status_for_dashboard:Function]
# @TIER: STANDARD
# @COMPLEXITY: 3
# @PURPOSE: Get Git sync status for a dashboard
# @PRE: dashboard_id is a valid integer
# @POST: Returns git status or None if no repo exists
@@ -417,7 +417,7 @@ class ResourceService:
# [/DEF:_get_git_status_for_dashboard:Function]
# [DEF:_get_last_task_for_resource:Function]
# @TIER: STANDARD
# @COMPLEXITY: 3
# @PURPOSE: Get the most recent task for a specific resource
# @PRE: resource_id is a valid string
# @POST: Returns task summary or None if no tasks found
@@ -455,7 +455,7 @@ class ResourceService:
# [/DEF:_get_last_task_for_resource:Function]
# [DEF:_extract_resource_name_from_task:Function]
# @TIER: STANDARD
# @COMPLEXITY: 3
# @PURPOSE: Extract resource name from task params
# @PRE: task is a valid Task object
# @POST: Returns resource name or task ID
@@ -467,7 +467,7 @@ class ResourceService:
# [/DEF:_extract_resource_name_from_task:Function]
# [DEF:_extract_resource_type_from_task:Function]
# @TIER: STANDARD
# @COMPLEXITY: 3
# @PURPOSE: Extract resource type from task params
# @PRE: task is a valid Task object
# @POST: Returns resource type or 'unknown'