diff --git a/.ai/MODULE_MAP.md b/.ai/MODULE_MAP.md index bb5ed808..add275e0 100644 --- a/.ai/MODULE_MAP.md +++ b/.ai/MODULE_MAP.md @@ -2,31 +2,31 @@ > High-level module structure for AI Context. Generated automatically. -**Generated:** 2026-03-15T16:48:04.692685 +**Generated:** 2026-03-16T10:03:28.287790 ## Summary - **Total Modules:** 105 -- **Total Entities:** 3256 +- **Total Entities:** 3313 ## Module Hierarchy ### π `backend/` - ποΈ **Layers:** Utility -- π **Tiers:** STANDARD: 2 +- π **Tiers:** TRIVIAL: 2 - π **Files:** 1 - π¦ **Entities:** 2 **Key Entities:** - - π¦ **backend.delete_running_tasks** (Module) + - π¦ **backend.delete_running_tasks** (Module) `[TRIVIAL]` - Script to delete tasks with RUNNING status from the database... ### π `src/` - ποΈ **Layers:** API, Core, UI (API) - - π **Tiers:** CRITICAL: 2, STANDARD: 22, TRIVIAL: 2 + - π **Tiers:** CRITICAL: 2, STANDARD: 6, TRIVIAL: 18 - π **Files:** 3 - π¦ **Entities:** 26 @@ -34,25 +34,30 @@ - π¦ **AppModule** (Module) `[CRITICAL]` - The main entry point for the FastAPI application. It initial... - - π¦ **Dependencies** (Module) + - π¦ **backend.src.dependencies** (Module) - Manages creation and provision of shared application depende... + **Dependencies:** + + - π DEPENDS_ON -> backend.src.api.routes + - π DEPENDS_ON -> backend.src.dependencies + ### π `api/` - ποΈ **Layers:** API - - π **Tiers:** CRITICAL: 1, STANDARD: 7 + - π **Tiers:** STANDARD: 6, TRIVIAL: 2 - π **Files:** 2 - π¦ **Entities:** 8 **Key Entities:** - - π¦ **backend.src.api.auth** (Module) `[CRITICAL]` + - π¦ **backend.src.api.auth** (Module) - Authentication API endpoints. ### π `routes/` - ποΈ **Layers:** API, Infra, UI (API), UI/API - - π **Tiers:** CRITICAL: 5, STANDARD: 282, TRIVIAL: 15 + - π **Tiers:** CRITICAL: 7, STANDARD: 184, TRIVIAL: 111 - π **Files:** 21 - π¦ **Entities:** 302 @@ -64,33 +69,33 @@ - Input payload for assistant message endpoint. - β **AssistantMessageResponse** (Class) - Output payload contract for assistant interaction endpoints. - - β **BranchCheckout** (Class) + - β **BranchCheckout** (Class) `[TRIVIAL]` - Schema for branch checkout requests. - - β **BranchCreate** (Class) + - β **BranchCreate** (Class) `[TRIVIAL]` - Schema for branch creation requests. - - β **BranchSchema** (Class) + - β **BranchSchema** (Class) `[TRIVIAL]` - Schema for representing a Git branch metadata. - - β **BuildManifestRequest** (Class) + - β **BuildManifestRequest** (Class) `[TRIVIAL]` - Request schema for manifest build endpoint. - - β **CommitCreate** (Class) + - β **CommitCreate** (Class) `[TRIVIAL]` - Schema for staging and committing changes. - - β **CommitSchema** (Class) + - β **CommitSchema** (Class) `[TRIVIAL]` - Schema for representing Git commit details. - β **ConfirmationRecord** (Class) - In-memory confirmation token model for risky operation dispa... **Dependencies:** - - π DEPENDS_ON -> ConfigManager - - π DEPENDS_ON -> ConfigModels + - π DEPENDS_ON -> backend.src.core.config_manager.ConfigManager + - π DEPENDS_ON -> backend.src.core.config_models - π DEPENDS_ON -> backend.src.core.database - π DEPENDS_ON -> backend.src.core.database.get_db - - π DEPENDS_ON -> backend.src.core.mapping_service + - π DEPENDS_ON -> backend.src.core.mapping_service.IdMappingService ### π `__tests__/` - ποΈ **Layers:** API, Domain, Domain (Tests), Tests, UI (API Tests), Unknown - - π **Tiers:** STANDARD: 93, TRIVIAL: 198 + - π **Tiers:** STANDARD: 16, TRIVIAL: 275 - π **Files:** 18 - π¦ **Entities:** 291 @@ -125,51 +130,51 @@ ### π `core/` - ποΈ **Layers:** Core, Domain, Infra - - π **Tiers:** CRITICAL: 11, STANDARD: 150, TRIVIAL: 9 + - π **Tiers:** CRITICAL: 9, STANDARD: 66, TRIVIAL: 134 - π **Files:** 14 - - π¦ **Entities:** 170 + - π¦ **Entities:** 209 **Key Entities:** - - β **AsyncSupersetClient** (Class) - - Async sibling of SupersetClient for dashboard read paths. - β **AuthSessionLocal** (Class) `[TRIVIAL]` - A session factory for the authentication database. - - β **BeliefFormatter** (Class) + - β **BeliefFormatter** (Class) `[TRIVIAL]` - Custom logging formatter that adds belief state prefixes to ... - β **ConfigManager** (Class) `[CRITICAL]` - Handles application configuration load, validation, mutation... - β **IdMappingService** (Class) `[CRITICAL]` - Service handling the cataloging and retrieval of remote Supe... - - β **LogEntry** (Class) + - β **LogEntry** (Class) `[TRIVIAL]` - A Pydantic model representing a single, structured log entry... - β **MigrationEngine** (Class) `[CRITICAL]` - Engine for transforming Superset export ZIPs. - - β **PluginBase** (Class) + - β **PluginBase** (Class) `[TRIVIAL]` - Defines the abstract base class that all plugins must implem... - - β **PluginConfig** (Class) + - β **PluginConfig** (Class) `[TRIVIAL]` - A Pydantic model used to represent the validated configurati... - β **PluginLoader** (Class) - Scans a specified directory for Python modules, dynamically ... + - β **SchedulerService** (Class) + - Provides a service to manage scheduled backup tasks. **Dependencies:** - - π DEPENDS_ON -> AppConfigRecord - - π DEPENDS_ON -> ConfigModels - - π DEPENDS_ON -> SessionLocal - π DEPENDS_ON -> backend.src.core.auth.config + - π DEPENDS_ON -> backend.src.core.config_models.AppConfig + - π DEPENDS_ON -> backend.src.core.config_models.Environment + - π DEPENDS_ON -> backend.src.core.database.SessionLocal - π DEPENDS_ON -> backend.src.core.logger ### π `__tests__/` - ποΈ **Layers:** Domain - - π **Tiers:** STANDARD: 11, TRIVIAL: 7 + - π **Tiers:** STANDARD: 3, TRIVIAL: 15 - π **Files:** 3 - π¦ **Entities:** 18 **Key Entities:** - - β **_RecordingNetworkClient** (Class) + - β **_RecordingNetworkClient** (Class) `[TRIVIAL]` - Records request payloads and returns scripted responses for ... - π¦ **backend.src.core.__tests__.test_config_manager_compat** (Module) - Verifies ConfigManager compatibility wrappers preserve legac... @@ -181,7 +186,7 @@ ### π `auth/` - ποΈ **Layers:** Core, Domain - - π **Tiers:** CRITICAL: 8, STANDARD: 21 + - π **Tiers:** CRITICAL: 17, STANDARD: 2, TRIVIAL: 10 - π **Files:** 7 - π¦ **Entities:** 29 @@ -193,9 +198,9 @@ - Encapsulates database operations for authentication-related ... - π¦ **backend.src.core.auth.config** (Module) `[CRITICAL]` - Centralized configuration for authentication and authorizati... - - π¦ **backend.src.core.auth.jwt** (Module) `[CRITICAL]` + - π¦ **backend.src.core.auth.jwt** (Module) - JWT token generation and validation logic. - - π¦ **backend.src.core.auth.logger** (Module) `[CRITICAL]` + - π¦ **backend.src.core.auth.logger** (Module) - Audit logging for security-related events. - π¦ **backend.src.core.auth.oauth** (Module) `[CRITICAL]` - ADFS OIDC configuration and client using Authlib. @@ -227,7 +232,7 @@ ### π `__tests__/` - ποΈ **Layers:** Infra - - π **Tiers:** STANDARD: 11, TRIVIAL: 1 + - π **Tiers:** STANDARD: 1, TRIVIAL: 11 - π **Files:** 1 - π¦ **Entities:** 12 @@ -239,7 +244,7 @@ ### π `migration/` - ποΈ **Layers:** Core, Domain - - π **Tiers:** CRITICAL: 5, STANDARD: 15, TRIVIAL: 1 + - π **Tiers:** CRITICAL: 3, STANDARD: 2, TRIVIAL: 16 - π **Files:** 4 - π¦ **Entities:** 21 @@ -251,9 +256,9 @@ - Build deterministic diff/risk payload for migration pre-flig... - π¦ **backend.src.core.migration.__init__** (Module) `[TRIVIAL]` - Namespace package for migration pre-flight orchestration com... - - π¦ **backend.src.core.migration.archive_parser** (Module) `[CRITICAL]` + - π¦ **backend.src.core.migration.archive_parser** (Module) - Parse Superset export ZIP archives into normalized object ca... - - π¦ **backend.src.core.migration.dry_run_orchestrator** (Module) `[CRITICAL]` + - π¦ **backend.src.core.migration.dry_run_orchestrator** (Module) - Compute pre-flight migration diff and risk scoring without a... - π¦ **backend.src.core.migration.risk_assessor** (Module) `[CRITICAL]` - Compute deterministic migration risk items and aggregate sco... @@ -261,15 +266,15 @@ **Dependencies:** - π DEPENDS_ON -> backend.src.core.logger - - π DEPENDS_ON -> backend.src.core.migration.archive_parser + - π DEPENDS_ON -> backend.src.core.migration.archive_parser.MigrationArchiveParser - π DEPENDS_ON -> backend.src.core.migration.risk_assessor - - π DEPENDS_ON -> backend.src.core.migration_engine - - π DEPENDS_ON -> backend.src.core.superset_client + - π DEPENDS_ON -> backend.src.core.migration_engine.MigrationEngine + - π DEPENDS_ON -> backend.src.core.superset_client.SupersetClient ### π `task_manager/` - ποΈ **Layers:** Core - - π **Tiers:** CRITICAL: 10, STANDARD: 64, TRIVIAL: 6 + - π **Tiers:** CRITICAL: 11, STANDARD: 42, TRIVIAL: 27 - π **Files:** 7 - π¦ **Entities:** 80 @@ -290,7 +295,7 @@ - β **TaskLog** (Class) - A Pydantic model representing a persisted log entry from the... - β **TaskLogPersistenceService** (Class) `[CRITICAL]` - - Provides methods to save and query task logs from the task_l... + - Provides methods to store, query, summarize, and delete task... - β **TaskLogger** (Class) `[CRITICAL]` - A wrapper around TaskManager._add_log that carries task_id a... - β **TaskManager** (Class) `[CRITICAL]` @@ -298,14 +303,16 @@ **Dependencies:** + - π DEPENDS_ON -> Environment - π DEPENDS_ON -> TaskLogRecord - π DEPENDS_ON -> TaskLogger, USED_BY -> plugins - π DEPENDS_ON -> TaskManager, CALLS -> TaskManager._add_log + - π DEPENDS_ON -> TaskManagerModels ### π `__tests__/` - ποΈ **Layers:** Unknown - - π **Tiers:** STANDARD: 2, TRIVIAL: 9 + - π **Tiers:** STANDARD: 1, TRIVIAL: 10 - π **Files:** 2 - π¦ **Entities:** 11 @@ -319,31 +326,31 @@ ### π `utils/` - ποΈ **Layers:** Core, Domain, Infra - - π **Tiers:** CRITICAL: 1, STANDARD: 63, TRIVIAL: 5 + - π **Tiers:** CRITICAL: 1, STANDARD: 10, TRIVIAL: 61 - π **Files:** 6 - - π¦ **Entities:** 69 + - π¦ **Entities:** 72 **Key Entities:** - β **APIClient** (Class) - - ΠΠ½ΠΊΠ°ΠΏΡΡΠ»ΠΈΡΡΠ΅Ρ HTTP-Π»ΠΎΠ³ΠΈΠΊΡ Π΄Π»Ρ ΡΠ°Π±ΠΎΡΡ Ρ API, Π²ΠΊΠ»ΡΡΠ°Ρ ΡΠ΅ΡΡΠΈΠΈ, ... - - β **AsyncAPIClient** (Class) - - Async Superset API client backed by httpx.AsyncClient with s... - - β **AuthenticationError** (Class) + - Synchronous Superset API client with process-local auth toke... + - β **AuthenticationError** (Class) `[TRIVIAL]` - Exception raised when authentication fails. - - β **DashboardNotFoundError** (Class) + - β **DashboardNotFoundError** (Class) `[TRIVIAL]` - Exception raised when a dashboard cannot be found. - - β **DatasetMapper** (Class) + - β **DatasetMapper** (Class) `[TRIVIAL]` - ΠΠ»Π°ΡΡ Π΄Π»Ρ ΠΌΠ΅ΠΏΠΏΠΈΠ½Π³Π° ΠΈ ΠΎΠ±Π½ΠΎΠ²Π»Π΅Π½ΠΈΡ verbose_map Π² Π΄Π°ΡΠ°ΡΠ΅ΡΠ°Ρ Supe... - - β **InvalidZipFormatError** (Class) + - β **InvalidZipFormatError** (Class) `[TRIVIAL]` - Exception raised when a file is not a valid ZIP archive. - - β **NetworkError** (Class) + - β **NetworkError** (Class) `[TRIVIAL]` - Exception raised when a network level error occurs. - - β **PermissionDeniedError** (Class) + - β **PermissionDeniedError** (Class) `[TRIVIAL]` - Exception raised when access is denied. - - β **SupersetAPIError** (Class) + - β **SupersetAPIError** (Class) `[TRIVIAL]` - Base exception for all Superset API related errors. - - β **SupersetAuthCache** (Class) + - β **backend.src.core.utils.async_network.AsyncAPIClient** (Class) + - Async Superset API client backed by httpx.AsyncClient with s... + - β **network.SupersetAuthCache** (Class) `[TRIVIAL]` - Process-local cache for Superset access/csrf tokens keyed by... **Dependencies:** @@ -351,13 +358,13 @@ - π DEPENDS_ON -> backend.core.superset_client - π DEPENDS_ON -> backend.src.core.logger - π DEPENDS_ON -> backend.src.core.utils.network.SupersetAuthCache - - π DEPENDS_ON -> pandas - - π DEPENDS_ON -> psycopg2 + - π DEPENDS_ON -> logger + - π DEPENDS_ON -> network.SupersetAuthCache ### π `models/` - ποΈ **Layers:** Domain, Model - - π **Tiers:** CRITICAL: 18, STANDARD: 44, TRIVIAL: 29 + - π **Tiers:** CRITICAL: 17, STANDARD: 13, TRIVIAL: 61 - π **Files:** 14 - π¦ **Entities:** 91 @@ -367,7 +374,7 @@ - Maps an Active Directory group to a local System Role. - β **AppConfigRecord** (Class) `[CRITICAL]` - Stores persisted application configuration as a single autho... - - β **ApprovalDecision** (Class) + - β **ApprovalDecision** (Class) `[TRIVIAL]` - Approval or rejection bound to a candidate and report. - β **AssistantAuditRecord** (Class) - Store audit decisions and outcomes produced by assistant com... @@ -375,13 +382,13 @@ - Persist risky operation confirmation tokens with lifecycle s... - β **AssistantMessageRecord** (Class) - Persist chat history entries for assistant conversations. - - β **CandidateArtifact** (Class) + - β **CandidateArtifact** (Class) `[TRIVIAL]` - Represents one artifact associated with a release candidate. - - β **CheckFinalStatus** (Class) + - β **CheckFinalStatus** (Class) `[TRIVIAL]` - Backward-compatible final status enum for legacy TUI/orchest... - - β **CheckStageName** (Class) + - β **CheckStageName** (Class) `[TRIVIAL]` - Backward-compatible stage name enum for legacy TUI/orchestra... - - β **CheckStageResult** (Class) + - β **CheckStageResult** (Class) `[TRIVIAL]` - Backward-compatible stage result container for legacy TUI/or... **Dependencies:** @@ -395,7 +402,7 @@ ### π `__tests__/` - ποΈ **Layers:** Domain, Unknown - - π **Tiers:** STANDARD: 2, TRIVIAL: 38 + - π **Tiers:** STANDARD: 1, TRIVIAL: 39 - π **Files:** 3 - π¦ **Entities:** 40 @@ -411,29 +418,29 @@ ### π `plugins/` - ποΈ **Layers:** App, Plugin, Plugins - - π **Tiers:** CRITICAL: 2, STANDARD: 61 + - π **Tiers:** CRITICAL: 2, TRIVIAL: 61 - π **Files:** 7 - π¦ **Entities:** 63 **Key Entities:** - - β **BackupPlugin** (Class) + - β **BackupPlugin** (Class) `[TRIVIAL]` - Implementation of the backup plugin logic. - - β **DebugPlugin** (Class) + - β **DebugPlugin** (Class) `[TRIVIAL]` - Plugin for system diagnostics and debugging. - - β **GitPlugin** (Class) + - β **GitPlugin** (Class) `[TRIVIAL]` - Π Π΅Π°Π»ΠΈΠ·Π°ΡΠΈΡ ΠΏΠ»Π°Π³ΠΈΠ½Π° Git Integration Π΄Π»Ρ ΡΠΏΡΠ°Π²Π»Π΅Π½ΠΈΡ Π²Π΅ΡΡΠΈΡΠΌΠΈ Π΄... - - β **MapperPlugin** (Class) + - β **MapperPlugin** (Class) `[TRIVIAL]` - Plugin for mapping dataset columns verbose names. - β **MigrationPlugin** (Class) `[CRITICAL]` - Implementation of the migration plugin workflow and transfor... - - β **SearchPlugin** (Class) + - β **SearchPlugin** (Class) `[TRIVIAL]` - Plugin for searching text patterns in Superset datasets. - - π¦ **BackupPlugin** (Module) + - π¦ **BackupPlugin** (Module) `[TRIVIAL]` - A plugin that provides functionality to back up Superset das... - - π¦ **DebugPluginModule** (Module) + - π¦ **DebugPluginModule** (Module) `[TRIVIAL]` - Implements a plugin for system diagnostics and debugging Sup... - - π¦ **MapperPluginModule** (Module) + - π¦ **MapperPluginModule** (Module) `[TRIVIAL]` - Implements a plugin for mapping dataset columns using extern... - π¦ **MigrationPlugin** (Module) `[CRITICAL]` - Orchestrates export, DB-mapping transformation, and import o... @@ -449,13 +456,13 @@ ### π `git/` - ποΈ **Layers:** Unknown - - π **Tiers:** STANDARD: 3, TRIVIAL: 2 + - π **Tiers:** TRIVIAL: 5 - π **Files:** 2 - π¦ **Entities:** 5 **Key Entities:** - - β **GitLLMExtension** (Class) + - β **GitLLMExtension** (Class) `[TRIVIAL]` - Provides LLM capabilities to the Git plugin. - π¦ **llm_extension** (Module) `[TRIVIAL]` - Auto-generated module for backend/src/plugins/git/llm_extens... @@ -463,29 +470,29 @@ ### π `llm_analysis/` - ποΈ **Layers:** Unknown - - π **Tiers:** STANDARD: 32, TRIVIAL: 35 + - π **Tiers:** TRIVIAL: 67 - π **Files:** 4 - π¦ **Entities:** 67 **Key Entities:** - - β **DashboardValidationPlugin** (Class) + - β **DashboardValidationPlugin** (Class) `[TRIVIAL]` - Plugin for automated dashboard health analysis using LLMs. - - β **DetectedIssue** (Class) + - β **DetectedIssue** (Class) `[TRIVIAL]` - Model for a single issue detected during validation. - - β **DocumentationPlugin** (Class) + - β **DocumentationPlugin** (Class) `[TRIVIAL]` - Plugin for automated dataset documentation using LLMs. - - β **LLMClient** (Class) + - β **LLMClient** (Class) `[TRIVIAL]` - Wrapper for LLM provider APIs. - - β **LLMProviderConfig** (Class) + - β **LLMProviderConfig** (Class) `[TRIVIAL]` - Configuration for an LLM provider. - - β **LLMProviderType** (Class) + - β **LLMProviderType** (Class) `[TRIVIAL]` - Enum for supported LLM providers. - - β **ScreenshotService** (Class) + - β **ScreenshotService** (Class) `[TRIVIAL]` - Handles capturing screenshots of Superset dashboards. - - β **ValidationResult** (Class) + - β **ValidationResult** (Class) `[TRIVIAL]` - Model for dashboard validation result. - - β **ValidationStatus** (Class) + - β **ValidationStatus** (Class) `[TRIVIAL]` - Enum for dashboard validation status. - π¦ **plugin** (Module) `[TRIVIAL]` - Auto-generated module for backend/src/plugins/llm_analysis/p... @@ -496,7 +503,7 @@ ### π `__tests__/` - - π **Tiers:** STANDARD: 13, TRIVIAL: 43 + - π **Tiers:** STANDARD: 3, TRIVIAL: 53 - π **Files:** 3 - π¦ **Entities:** 56 @@ -512,15 +519,15 @@ ### π `storage/` - ποΈ **Layers:** App - - π **Tiers:** STANDARD: 18 + - π **Tiers:** TRIVIAL: 18 - π **Files:** 1 - π¦ **Entities:** 18 **Key Entities:** - - β **StoragePlugin** (Class) + - β **StoragePlugin** (Class) `[TRIVIAL]` - Implementation of the storage management plugin. - - π¦ **StoragePlugin** (Module) + - π¦ **StoragePlugin** (Module) `[TRIVIAL]` - Provides core filesystem operations for managing backups and... **Dependencies:** @@ -531,7 +538,7 @@ ### π `schemas/` - ποΈ **Layers:** API, Domain - - π **Tiers:** CRITICAL: 10, STANDARD: 19, TRIVIAL: 3 + - π **Tiers:** CRITICAL: 9, STANDARD: 12, TRIVIAL: 11 - π **Files:** 5 - π¦ **Entities:** 32 @@ -541,11 +548,11 @@ - Schema for creating an AD Group mapping. - β **ADGroupMappingSchema** (Class) `[CRITICAL]` - Represents an AD Group to Role mapping in API responses. - - β **DashboardHealthItem** (Class) + - β **DashboardHealthItem** (Class) `[TRIVIAL]` - Represents the latest health status of a single dashboard. - - β **HealthSummaryResponse** (Class) + - β **HealthSummaryResponse** (Class) `[TRIVIAL]` - Aggregated health summary for all dashboards. - - β **NotificationChannel** (Class) + - β **NotificationChannel** (Class) `[TRIVIAL]` - Structured notification channel definition for policy-level ... - β **PermissionSchema** (Class) `[TRIVIAL]` - Represents a permission in API responses. @@ -564,7 +571,7 @@ ### π `__tests__/` - - π **Tiers:** STANDARD: 4 + - π **Tiers:** STANDARD: 1, TRIVIAL: 3 - π **Files:** 1 - π¦ **Entities:** 4 @@ -576,15 +583,15 @@ ### π `scripts/` - ποΈ **Layers:** Scripts, UI, Unknown - - π **Tiers:** CRITICAL: 1, STANDARD: 45, TRIVIAL: 30 + - π **Tiers:** CRITICAL: 1, STANDARD: 6, TRIVIAL: 69 - π **Files:** 9 - π¦ **Entities:** 76 **Key Entities:** - - β **CleanReleaseTUI** (Class) + - β **CleanReleaseTUI** (Class) `[TRIVIAL]` - Curses-based application for compliance monitoring. - - β **TuiFacadeAdapter** (Class) + - β **TuiFacadeAdapter** (Class) `[TRIVIAL]` - Thin TUI adapter that routes business mutations through appl... - π¦ **backend.src.scripts.clean_release_cli** (Module) - Provide headless CLI commands for candidate registration, ar... @@ -596,7 +603,7 @@ - Initializes the auth database and creates the necessary tabl... - π¦ **backend.src.scripts.migrate_sqlite_to_postgres** (Module) - Migrates legacy config and task history from SQLite/file sto... - - π¦ **backend.src.scripts.seed_permissions** (Module) + - π¦ **backend.src.scripts.seed_permissions** (Module) `[TRIVIAL]` - Populates the auth database with initial system permissions. - π¦ **backend.src.scripts.seed_superset_load_test** (Module) - Creates randomized load-test data in Superset by cloning cha... @@ -611,25 +618,23 @@ ### π `services/` - ποΈ **Layers:** Core, Domain, Domain/Service, Service - - π **Tiers:** CRITICAL: 6, STANDARD: 133, TRIVIAL: 20 + - π **Tiers:** CRITICAL: 5, STANDARD: 47, TRIVIAL: 118 - π **Files:** 10 - - π¦ **Entities:** 159 + - π¦ **Entities:** 170 **Key Entities:** - - β **AuthService** (Class) `[CRITICAL]` + - β **AuthService** (Class) - Provides high-level authentication services. - β **EncryptionManager** (Class) `[CRITICAL]` - Handles encryption and decryption of sensitive data like API... - β **EnvironmentNotFoundError** (Class) - Raised when environment_id from lookup request is unknown in... - - β **GitService** (Class) - - Wrapper for GitPython operations with semantic logging and e... - β **HealthService** (Class) - Aggregate latest dashboard validation state and manage persi... - β **LLMProviderService** (Class) - Service to manage LLM provider lifecycle. - - β **MappingService** (Class) + - β **MappingService** (Class) `[TRIVIAL]` - Service for handling database mapping logic. - β **ProfileAuthorizationError** (Class) - Raised when caller attempts cross-user preference mutation. @@ -637,29 +642,31 @@ - Implements profile preference read/update flow and Superset ... - β **ProfileValidationError** (Class) - Domain validation error for profile preference update reques... + - β **backend.src.services.git_service.GitService** (Class) + - Wrapper for GitPython operations with semantic logging and e... **Dependencies:** - - π DEPENDS_ON -> ValidationRecord + - π DEPENDS_ON -> TaskManagerModels + - π DEPENDS_ON -> TaskManagerPackage - π DEPENDS_ON -> backend.src.core.auth.jwt.create_access_token - π DEPENDS_ON -> backend.src.core.auth.repository - π DEPENDS_ON -> backend.src.core.auth.repository.AuthRepository - - π DEPENDS_ON -> backend.src.core.auth.security.verify_password ### π `__tests__/` - ποΈ **Layers:** Domain, Domain Tests, Service, Service Tests, Unknown - - π **Tiers:** STANDARD: 40, TRIVIAL: 46 + - π **Tiers:** STANDARD: 12, TRIVIAL: 74 - π **Files:** 7 - π¦ **Entities:** 86 **Key Entities:** - - β **TestEncryptionManager** (Class) + - β **TestEncryptionManager** (Class) `[TRIVIAL]` - Validate EncryptionManager encrypt/decrypt roundtrip, unique... - - β **_DummyLogger** (Class) + - β **_DummyLogger** (Class) `[TRIVIAL]` - Minimal logger shim for TaskContext-like objects used in tes... - - β **_FakeDBSession** (Class) + - β **_FakeDBSession** (Class) `[TRIVIAL]` - Captures persisted records for assertion and mimics SQLAlche... - π¦ **backend.src.services.__tests__.test_llm_plugin_persistence** (Module) - Regression test for ValidationRecord persistence fields popu... @@ -683,20 +690,20 @@ ### π `clean_release/` - ποΈ **Layers:** Application, Domain, Infra - - π **Tiers:** CRITICAL: 9, STANDARD: 48, TRIVIAL: 50 + - π **Tiers:** CRITICAL: 9, STANDARD: 13, TRIVIAL: 85 - π **Files:** 22 - π¦ **Entities:** 107 **Key Entities:** - - β **CleanComplianceOrchestrator** (Class) + - β **CleanComplianceOrchestrator** (Class) `[TRIVIAL]` - Coordinate clean-release compliance verification stages. - - β **CleanPolicyEngine** (Class) - - β **CleanReleaseRepository** (Class) + - β **CleanPolicyEngine** (Class) `[TRIVIAL]` + - β **CleanReleaseRepository** (Class) `[TRIVIAL]` - Data access object for clean release lifecycle. - - β **ComplianceExecutionResult** (Class) + - β **ComplianceExecutionResult** (Class) `[TRIVIAL]` - Return envelope for compliance execution with run/report and... - - β **ComplianceExecutionService** (Class) + - β **ComplianceExecutionService** (Class) `[TRIVIAL]` - Execute clean-release compliance lifecycle over trusted snap... - π¦ **backend.src.services.clean_release.approval_service** (Module) `[CRITICAL]` - Enforce approval/rejection gates over immutable compliance r... @@ -720,7 +727,7 @@ ### π `__tests__/` - ποΈ **Layers:** Domain, Infra, Unknown - - π **Tiers:** STANDARD: 25, TRIVIAL: 25 + - π **Tiers:** STANDARD: 7, TRIVIAL: 43 - π **Files:** 8 - π¦ **Entities:** 50 @@ -780,25 +787,25 @@ ### π `stages/` - ποΈ **Layers:** Domain - - π **Tiers:** STANDARD: 19, TRIVIAL: 5 + - π **Tiers:** STANDARD: 6, TRIVIAL: 18 - π **Files:** 6 - π¦ **Entities:** 24 **Key Entities:** - - β **ComplianceStage** (Class) + - β **ComplianceStage** (Class) `[TRIVIAL]` - Protocol for pluggable stage implementations. - - β **ComplianceStageContext** (Class) + - β **ComplianceStageContext** (Class) `[TRIVIAL]` - Immutable input envelope passed to each compliance stage. - - β **DataPurityStage** (Class) + - β **DataPurityStage** (Class) `[TRIVIAL]` - Validate manifest summary for prohibited artifacts. - - β **InternalSourcesOnlyStage** (Class) + - β **InternalSourcesOnlyStage** (Class) `[TRIVIAL]` - Enforce internal-source-only policy from trusted registry sn... - - β **ManifestConsistencyStage** (Class) + - β **ManifestConsistencyStage** (Class) `[TRIVIAL]` - Validate run/manifest linkage consistency. - - β **NoExternalEndpointsStage** (Class) + - β **NoExternalEndpointsStage** (Class) `[TRIVIAL]` - Validate endpoint references from manifest against trusted r... - - β **StageExecutionResult** (Class) + - β **StageExecutionResult** (Class) `[TRIVIAL]` - Structured stage output containing decision, details and vio... - π¦ **backend.src.services.clean_release.stages** (Module) - Define compliance stage order and helper functions for deter... @@ -816,21 +823,21 @@ ### π `notifications/` - ποΈ **Layers:** Domain, Infra - - π **Tiers:** CRITICAL: 2, STANDARD: 6, TRIVIAL: 14 + - π **Tiers:** CRITICAL: 2, TRIVIAL: 20 - π **Files:** 3 - π¦ **Entities:** 22 **Key Entities:** - - β **NotificationProvider** (Class) + - β **NotificationProvider** (Class) `[TRIVIAL]` - Abstract base class for all notification providers. - - β **NotificationService** (Class) + - β **NotificationService** (Class) `[TRIVIAL]` - Routes validation reports to appropriate users and channels. - - β **SMTPProvider** (Class) + - β **SMTPProvider** (Class) `[TRIVIAL]` - Delivers notifications via SMTP. - - β **SlackProvider** (Class) + - β **SlackProvider** (Class) `[TRIVIAL]` - Delivers notifications via Slack Webhooks or API. - - β **TelegramProvider** (Class) + - β **TelegramProvider** (Class) `[TRIVIAL]` - Delivers notifications via Telegram Bot API. - π¦ **backend.src.services.notifications.providers** (Module) `[CRITICAL]` - Defines abstract base and concrete implementations for exter... @@ -857,7 +864,7 @@ ### π `reports/` - ποΈ **Layers:** Domain - - π **Tiers:** CRITICAL: 5, STANDARD: 16 + - π **Tiers:** CRITICAL: 5, TRIVIAL: 16 - π **Files:** 4 - π¦ **Entities:** 21 @@ -899,7 +906,7 @@ ### π `tests/` - ποΈ **Layers:** Core, Domain (Tests), Logging (Tests), Test, Unknown - - π **Tiers:** STANDARD: 87, TRIVIAL: 91 + - π **Tiers:** STANDARD: 11, TRIVIAL: 167 - π **Files:** 10 - π¦ **Entities:** 178 @@ -929,7 +936,7 @@ ### π `core/` - ποΈ **Layers:** Domain, Unknown - - π **Tiers:** STANDARD: 6, TRIVIAL: 46 + - π **Tiers:** STANDARD: 3, TRIVIAL: 49 - π **Files:** 4 - π¦ **Entities:** 52 @@ -977,15 +984,15 @@ ### π `clean_release/` - ποΈ **Layers:** Tests - - π **Tiers:** STANDARD: 40, TRIVIAL: 16 + - π **Tiers:** STANDARD: 8, TRIVIAL: 48 - π **Files:** 8 - π¦ **Entities:** 56 **Key Entities:** - - β **CleanReleaseCompliancePlugin** (Class) + - β **CleanReleaseCompliancePlugin** (Class) `[TRIVIAL]` - TaskManager plugin shim that executes clean release complian... - - β **_PluginLoaderStub** (Class) + - β **_PluginLoaderStub** (Class) `[TRIVIAL]` - Provide minimal plugin loader contract used by TaskManager i... - π¦ **backend.tests.services.clean_release.test_approval_service** (Module) - Define approval gate contracts for approve/reject operations... @@ -1014,7 +1021,7 @@ ### π `components/` - ποΈ **Layers:** Component, Feature, UI, UI -->, Unknown - - π **Tiers:** STANDARD: 74, TRIVIAL: 13 + - π **Tiers:** STANDARD: 6, TRIVIAL: 81 - π **Files:** 15 - π¦ **Entities:** 87 @@ -1024,19 +1031,19 @@ - Displays a grid of dashboards with selection and pagination. - π§© **DashboardGrid** (Component) - Displays a grid of dashboards with selection and pagination. - - π§© **DynamicForm** (Component) + - π§© **DynamicForm** (Component) `[TRIVIAL]` - Generates a form dynamically based on a JSON schema. - - π§© **EnvSelector** (Component) + - π§© **EnvSelector** (Component) `[TRIVIAL]` - Provides a UI component for selecting source and target envi... - π§© **Footer** (Component) `[TRIVIAL]` - Displays the application footer with copyright information. - - π§© **MappingTable** (Component) + - π§© **MappingTable** (Component) `[TRIVIAL]` - Displays and allows editing of database mappings. - - π§© **MissingMappingModal** (Component) + - π§© **MissingMappingModal** (Component) `[TRIVIAL]` - Prompts the user to provide a database mapping when one is m... - π§© **Navbar** (Component) - Main navigation bar for the application. - - π§© **PasswordPrompt** (Component) + - π§© **PasswordPrompt** (Component) `[TRIVIAL]` - A modal component to prompt the user for database passwords ... - π§© **StartupEnvironmentWizard** (Component) - Blocking startup wizard for creating the first Superset envi... @@ -1061,13 +1068,13 @@ ### π `auth/` - ποΈ **Layers:** UI - - π **Tiers:** STANDARD: 3 + - π **Tiers:** STANDARD: 1, TRIVIAL: 2 - π **Files:** 1 - π¦ **Entities:** 3 **Key Entities:** - - π§© **ProtectedRoute** (Component) + - π§© **ProtectedRoute** (Component) `[TRIVIAL]` - Wraps protected slot content with session and permission ver... - π¦ **ProtectedRoute.svelte** (Module) - Enforces authenticated and authorized access before protecte... @@ -1079,23 +1086,23 @@ ### π `git/` - ποΈ **Layers:** Component, Unknown - - π **Tiers:** STANDARD: 47, TRIVIAL: 12 + - π **Tiers:** STANDARD: 1, TRIVIAL: 58 - π **Files:** 6 - π¦ **Entities:** 59 **Key Entities:** - - π§© **BranchSelector** (Component) + - π§© **BranchSelector** (Component) `[TRIVIAL]` - UI Π΄Π»Ρ Π²ΡΠ±ΠΎΡΠ° ΠΈ ΡΠΎΠ·Π΄Π°Π½ΠΈΡ Π²Π΅ΡΠΎΠΊ Git. - - π§© **CommitHistory** (Component) + - π§© **CommitHistory** (Component) `[TRIVIAL]` - Displays the commit history for a specific dashboard. - π§© **CommitModal** (Component) - ΠΠΎΠ΄Π°Π»ΡΠ½ΠΎΠ΅ ΠΎΠΊΠ½ΠΎ Π΄Π»Ρ ΡΠΎΠ·Π΄Π°Π½ΠΈΡ ΠΊΠΎΠΌΠΌΠΈΡΠ° Ρ ΠΏΡΠΎΡΠΌΠΎΡΡΠΎΠΌ ΠΈΠ·ΠΌΠ΅Π½Π΅Π½ΠΈΠΉ (... - - π§© **ConflictResolver** (Component) + - π§© **ConflictResolver** (Component) `[TRIVIAL]` - UI for resolving merge conflicts (Keep Mine / Keep Theirs). - - π§© **DeploymentModal** (Component) + - π§© **DeploymentModal** (Component) `[TRIVIAL]` - Modal for deploying a dashboard to a target environment. - - π§© **GitManager** (Component) + - π§© **GitManager** (Component) `[TRIVIAL]` - Π¦Π΅Π½ΡΡΠ°Π»ΡΠ½ΡΠΉ UI ΡΠΏΡΠ°Π²Π»Π΅Π½ΠΈΡ Git Ρ ΡΠΎΠΊΡΡΠΎΠΌ Π½Π° ΡΠ°Π±ΠΎΡΠΈΠΉ ΠΏΠΎΡΠΎΠΊ Π°Π½Π°... - π¦ **GitManager** (Module) `[TRIVIAL]` - Auto-generated module for frontend/src/components/git/GitMan... @@ -1152,7 +1159,7 @@ ### π `storage/` - ποΈ **Layers:** UI - - π **Tiers:** STANDARD: 8 + - π **Tiers:** STANDARD: 2, TRIVIAL: 6 - π **Files:** 2 - π¦ **Entities:** 8 @@ -1170,7 +1177,7 @@ ### π `tasks/` - ποΈ **Layers:** UI, Unknown - - π **Tiers:** STANDARD: 4, TRIVIAL: 12 + - π **Tiers:** STANDARD: 3, TRIVIAL: 13 - π **Files:** 4 - π¦ **Entities:** 16 @@ -1192,19 +1199,19 @@ ### π `tools/` - ποΈ **Layers:** UI, Unknown - - π **Tiers:** STANDARD: 14, TRIVIAL: 2 + - π **Tiers:** TRIVIAL: 16 - π **Files:** 4 - π¦ **Entities:** 16 **Key Entities:** - - π§© **ConnectionForm** (Component) + - π§© **ConnectionForm** (Component) `[TRIVIAL]` - UI component for creating a new database connection configur... - - π§© **ConnectionList** (Component) + - π§© **ConnectionList** (Component) `[TRIVIAL]` - UI component for listing and deleting saved database connect... - - π§© **DebugTool** (Component) + - π§© **DebugTool** (Component) `[TRIVIAL]` - UI component for system diagnostics and debugging API respon... - - π§© **MapperTool** (Component) + - π§© **MapperTool** (Component) `[TRIVIAL]` - UI component for mapping dataset column verbose names using ... - π¦ **MapperTool** (Module) `[TRIVIAL]` - Auto-generated module for frontend/src/components/tools/Mapp... @@ -1212,7 +1219,7 @@ ### π `lib/` - ποΈ **Layers:** Infra, Infra-API, UI, UI-State - - π **Tiers:** STANDARD: 24, TRIVIAL: 5 + - π **Tiers:** STANDARD: 2, TRIVIAL: 27 - π **Files:** 5 - π¦ **Entities:** 29 @@ -1226,13 +1233,13 @@ - Handles all communication with the backend API. - π¦ **stores_module** (Module) - Global state management using Svelte stores. - - π¦ **toasts_module** (Module) + - π¦ **toasts_module** (Module) `[TRIVIAL]` - Manages toast notifications using a Svelte writable store. ### π `api/` - ποΈ **Layers:** Infra, Infra-API - - π **Tiers:** CRITICAL: 1, STANDARD: 11 + - π **Tiers:** CRITICAL: 1, STANDARD: 1, TRIVIAL: 10 - π **Files:** 2 - π¦ **Entities:** 12 @@ -1251,17 +1258,17 @@ ### π `__tests__/` - ποΈ **Layers:** Infra (Tests) - - π **Tiers:** STANDARD: 4 + - π **Tiers:** STANDARD: 1, TRIVIAL: 3 - π **Files:** 1 - π¦ **Entities:** 4 **Key Entities:** - - β **TestBuildReportQueryString** (Class) + - β **TestBuildReportQueryString** (Class) `[TRIVIAL]` - Validate query string construction from filter options. - - β **TestGetReportsAsync** (Class) + - β **TestGetReportsAsync** (Class) `[TRIVIAL]` - Validate getReports and getReportDetail with mocked api.fetc... - - β **TestNormalizeApiError** (Class) + - β **TestNormalizeApiError** (Class) `[TRIVIAL]` - Validate error normalization for UI-state mapping. - π¦ **frontend.src.lib.api.__tests__.reports_api** (Module) - Unit tests for reports API client functions: query string bu... @@ -1269,15 +1276,15 @@ ### π `auth/` - ποΈ **Layers:** Domain, Feature - - π **Tiers:** CRITICAL: 2, STANDARD: 9, TRIVIAL: 1 + - π **Tiers:** STANDARD: 2, TRIVIAL: 10 - π **Files:** 2 - π¦ **Entities:** 12 **Key Entities:** - - π¦ **frontend.src.lib.auth.permissions** (Module) `[CRITICAL]` + - π¦ **frontend.src.lib.auth.permissions** (Module) - Shared frontend RBAC utilities for route guards and menu vis... - - ποΈ **authStore** (Store) `[CRITICAL]` + - ποΈ **authStore** (Store) - Manages the global authentication state on the frontend. ### π `__tests__/` @@ -1295,7 +1302,7 @@ ### π `assistant/` - ποΈ **Layers:** UI, Unknown - - π **Tiers:** STANDARD: 14, TRIVIAL: 5 + - π **Tiers:** STANDARD: 1, TRIVIAL: 18 - π **Files:** 1 - π¦ **Entities:** 19 @@ -1309,7 +1316,7 @@ ### π `__tests__/` - ποΈ **Layers:** UI Tests - - π **Tiers:** STANDARD: 5 + - π **Tiers:** STANDARD: 3, TRIVIAL: 2 - π **Files:** 2 - π¦ **Entities:** 5 @@ -1339,7 +1346,7 @@ ### π `layout/` - ποΈ **Layers:** UI, Unknown - - π **Tiers:** STANDARD: 11, TRIVIAL: 50 + - π **Tiers:** STANDARD: 7, TRIVIAL: 54 - π **Files:** 5 - π¦ **Entities:** 61 @@ -1386,7 +1393,7 @@ ### π `reports/` - ποΈ **Layers:** UI, Unknown - - π **Tiers:** CRITICAL: 1, STANDARD: 4, TRIVIAL: 10 + - π **Tiers:** CRITICAL: 1, STANDARD: 3, TRIVIAL: 11 - π **Files:** 4 - π¦ **Entities:** 15 @@ -1451,7 +1458,7 @@ ### π `i18n/` - ποΈ **Layers:** Infra - - π **Tiers:** STANDARD: 4 + - π **Tiers:** STANDARD: 1, TRIVIAL: 3 - π **Files:** 1 - π¦ **Entities:** 4 @@ -1459,9 +1466,9 @@ - π¦ **i18n** (Module) - Determines the starting locale. - - ποΈ **locale** (Store) + - ποΈ **locale** (Store) `[TRIVIAL]` - Holds the current active locale string. - - ποΈ **t** (Store) + - ποΈ **t** (Store) `[TRIVIAL]` - Derived store providing the translation dictionary. **Dependencies:** @@ -1472,7 +1479,7 @@ ### π `stores/` - ποΈ **Layers:** UI, UI-State, Unknown - - π **Tiers:** CRITICAL: 1, STANDARD: 9, TRIVIAL: 28 + - π **Tiers:** CRITICAL: 1, STANDARD: 5, TRIVIAL: 32 - π **Files:** 6 - π¦ **Entities:** 38 @@ -1507,7 +1514,7 @@ ### π `__tests__/` - ποΈ **Layers:** Domain (Tests), UI, UI Tests - - π **Tiers:** STANDARD: 11 + - π **Tiers:** STANDARD: 7, TRIVIAL: 4 - π **Files:** 6 - π¦ **Entities:** 11 @@ -1534,7 +1541,7 @@ ### π `mocks/` - ποΈ **Layers:** UI (Tests) - - π **Tiers:** STANDARD: 4 + - π **Tiers:** STANDARD: 1, TRIVIAL: 3 - π **Files:** 4 - π¦ **Entities:** 4 @@ -1582,15 +1589,15 @@ ### π `pages/` - ποΈ **Layers:** UI - - π **Tiers:** STANDARD: 11 + - π **Tiers:** TRIVIAL: 11 - π **Files:** 2 - π¦ **Entities:** 11 **Key Entities:** - - π§© **Dashboard** (Component) + - π§© **Dashboard** (Component) `[TRIVIAL]` - Displays the list of available plugins and allows selecting ... - - π§© **Settings** (Component) + - π§© **Settings** (Component) `[TRIVIAL]` - The main settings page for the application, allowing managem... **Dependencies:** @@ -1600,7 +1607,7 @@ ### π `routes/` - ποΈ **Layers:** Infra, UI, Unknown - - π **Tiers:** CRITICAL: 1, STANDARD: 3, TRIVIAL: 5 + - π **Tiers:** CRITICAL: 1, STANDARD: 2, TRIVIAL: 6 - π **Files:** 5 - π¦ **Entities:** 9 @@ -1616,7 +1623,7 @@ ### π `roles/` - ποΈ **Layers:** Domain - - π **Tiers:** STANDARD: 6 + - π **Tiers:** STANDARD: 1, TRIVIAL: 5 - π **Files:** 1 - π¦ **Entities:** 6 @@ -1633,7 +1640,7 @@ ### π `settings/` - ποΈ **Layers:** Feature - - π **Tiers:** STANDARD: 5 + - π **Tiers:** STANDARD: 1, TRIVIAL: 4 - π **Files:** 1 - π¦ **Entities:** 5 @@ -1664,13 +1671,13 @@ ### π `users/` - ποΈ **Layers:** Feature - - π **Tiers:** STANDARD: 6 + - π **Tiers:** TRIVIAL: 6 - π **Files:** 1 - π¦ **Entities:** 6 **Key Entities:** - - π§© **AdminUsersPage** (Component) + - π§© **AdminUsersPage** (Component) `[TRIVIAL]` - UI for managing system users and their roles. **Dependencies:** @@ -1681,7 +1688,7 @@ ### π `dashboards/` - ποΈ **Layers:** UI, Unknown - - π **Tiers:** STANDARD: 26, TRIVIAL: 66 + - π **Tiers:** STANDARD: 1, TRIVIAL: 91 - π **Files:** 1 - π¦ **Entities:** 92 @@ -1717,7 +1724,7 @@ ### π `health/` - ποΈ **Layers:** UI/Page - - π **Tiers:** STANDARD: 4 + - π **Tiers:** STANDARD: 1, TRIVIAL: 3 - π **Files:** 1 - π¦ **Entities:** 4 @@ -1769,19 +1776,19 @@ ### π `git/` - ποΈ **Layers:** Page - - π **Tiers:** STANDARD: 3 + - π **Tiers:** TRIVIAL: 3 - π **Files:** 1 - π¦ **Entities:** 3 **Key Entities:** - - π§© **GitDashboardPage** (Component) + - π§© **GitDashboardPage** (Component) `[TRIVIAL]` - Dashboard management page for Git integration. ### π `login/` - ποΈ **Layers:** UI - - π **Tiers:** STANDARD: 3 + - π **Tiers:** STANDARD: 1, TRIVIAL: 2 - π **Files:** 1 - π¦ **Entities:** 3 @@ -1792,19 +1799,19 @@ ### π `migration/` - - π **Tiers:** STANDARD: 21 + - π **Tiers:** TRIVIAL: 21 - π **Files:** 1 - π¦ **Entities:** 21 **Key Entities:** - - π§© **DashboardSelectionSection** (Component) - - π§© **MigrationDashboard** (Component) + - π§© **DashboardSelectionSection** (Component) `[TRIVIAL]` + - π§© **MigrationDashboard** (Component) `[TRIVIAL]` - Orchestrate migration UI workflow and route user actions to ... ### π `mappings/` - - π **Tiers:** CRITICAL: 1, STANDARD: 7 + - π **Tiers:** CRITICAL: 1, TRIVIAL: 7 - π **Files:** 1 - π¦ **Entities:** 8 @@ -1815,13 +1822,15 @@ ### π `profile/` - - ποΈ **Layers:** Unknown - - π **Tiers:** TRIVIAL: 16 + - ποΈ **Layers:** UI, Unknown + - π **Tiers:** CRITICAL: 1, TRIVIAL: 16 - π **Files:** 1 - - π¦ **Entities:** 16 + - π¦ **Entities:** 17 **Key Entities:** + - π§© **ProfilePage** (Component) `[CRITICAL]` + - Manage user profile sections for read-only security access, ... - π¦ **+page** (Module) `[TRIVIAL]` - Auto-generated module for frontend/src/routes/profile/+page.... @@ -1886,7 +1895,7 @@ ### π `settings/` - ποΈ **Layers:** UI, Unknown - - π **Tiers:** CRITICAL: 1, STANDARD: 1, TRIVIAL: 33 + - π **Tiers:** CRITICAL: 1, TRIVIAL: 34 - π **Files:** 2 - π¦ **Entities:** 35 @@ -1912,36 +1921,36 @@ ### π `connections/` - ποΈ **Layers:** UI - - π **Tiers:** STANDARD: 2 + - π **Tiers:** TRIVIAL: 2 - π **Files:** 1 - π¦ **Entities:** 2 **Key Entities:** - - π§© **ConnectionsSettingsPage** (Component) + - π§© **ConnectionsSettingsPage** (Component) `[TRIVIAL]` - Page for managing database connection configurations. ### π `git/` - ποΈ **Layers:** Page - - π **Tiers:** STANDARD: 10 + - π **Tiers:** TRIVIAL: 10 - π **Files:** 1 - π¦ **Entities:** 10 **Key Entities:** - - π§© **GitSettingsPage** (Component) + - π§© **GitSettingsPage** (Component) `[TRIVIAL]` - Manage Git server configurations for dashboard versioning. ### π `__tests__/` - - π **Tiers:** STANDARD: 1 + - π **Tiers:** TRIVIAL: 1 - π **Files:** 1 - π¦ **Entities:** 1 **Key Entities:** - - π¦ **frontend.src.routes.settings.git.__tests__.git_settings_page_ux_test** (Module) + - π¦ **frontend.src.routes.settings.git.__tests__.git_settings_page_ux_test** (Module) `[TRIVIAL]` - Test UX states and transitions for the Git Settings page ### π `notifications/` @@ -1967,7 +1976,7 @@ ### π `repos/` - - π **Tiers:** STANDARD: 4 + - π **Tiers:** TRIVIAL: 4 - π **Files:** 1 - π¦ **Entities:** 4 @@ -1998,7 +2007,7 @@ ### π `storage/` - ποΈ **Layers:** UI - - π **Tiers:** STANDARD: 7 + - π **Tiers:** STANDARD: 1, TRIVIAL: 6 - π **Files:** 1 - π¦ **Entities:** 7 @@ -2014,7 +2023,7 @@ ### π `services/` - ποΈ **Layers:** Service - - π **Tiers:** STANDARD: 35, TRIVIAL: 1 + - π **Tiers:** STANDARD: 3, TRIVIAL: 33 - π **Files:** 6 - π¦ **Entities:** 36 @@ -2034,13 +2043,13 @@ ### π `__tests__/` - - π **Tiers:** STANDARD: 1 + - π **Tiers:** TRIVIAL: 1 - π **Files:** 1 - π¦ **Entities:** 1 **Key Entities:** - - π¦ **frontend.src.services.__tests__.gitService_test** (Module) + - π¦ **frontend.src.services.__tests__.gitService_test** (Module) `[TRIVIAL]` - API client tests ensuring correct endpoints are called per c... ### π `types/` @@ -2058,12 +2067,14 @@ ### π `root/` - ποΈ **Layers:** DevOps/Tooling -- π **Tiers:** CRITICAL: 11, STANDARD: 18, TRIVIAL: 8 +- π **Tiers:** CRITICAL: 11, STANDARD: 18, TRIVIAL: 11 - π **Files:** 1 -- π¦ **Entities:** 37 +- π¦ **Entities:** 40 **Key Entities:** + - β **Complexity** (Class) `[TRIVIAL]` + - Adaptive semantic complexity scale used for validation stric... - β **ComplianceIssue** (Class) `[TRIVIAL]` - Represents a single compliance issue with severity. - β **SemanticEntity** (Class) `[CRITICAL]` @@ -2073,7 +2084,7 @@ - β **Severity** (Class) `[TRIVIAL]` - Severity levels for compliance issues. - β **Tier** (Class) `[TRIVIAL]` - - Enumeration of semantic tiers defining validation strictness... + - Legacy tier buckets retained for backward-compatible reporti... - π¦ **generate_semantic_map** (Module) - Scans the codebase to generate a Semantic Map, Module Map, a... @@ -2081,13 +2092,26 @@ ```mermaid graph TD + src-->|DEPENDS_ON|backend + src-->|DEPENDS_ON|backend api-->|USES|backend api-->|USES|backend routes-->|DEPENDS_ON|backend routes-->|DEPENDS_ON|backend routes-->|DEPENDS_ON|backend routes-->|CALLS|backend + routes-->|DISPATCHES|backend routes-->|CALLS|backend + routes-->|DISPATCHES|backend + routes-->|CALLS|backend + routes-->|CALLS|backend + routes-->|USES|backend + routes-->|USES|backend + routes-->|USES|backend + routes-->|CALLS|backend + routes-->|CALLS|backend + routes-->|DEPENDS_ON|backend + routes-->|DEPENDS_ON|backend routes-->|DEPENDS_ON|backend routes-->|DEPENDS_ON|backend routes-->|DEPENDS_ON|backend @@ -2111,7 +2135,12 @@ graph TD routes-->|DEPENDS_ON|backend routes-->|DEPENDS_ON|backend routes-->|DEPENDS_ON|backend + routes-->|CALLS|backend + routes-->|CALLS|backend + routes-->|CALLS|backend + routes-->|CALLS|backend routes-->|CALLS|root + routes-->|CALLS|backend routes-->|DEPENDS_ON|backend routes-->|DEPENDS_ON|backend routes-->|DEPENDS_ON|backend @@ -2122,6 +2151,10 @@ graph TD routes-->|DEPENDS_ON|backend routes-->|DEPENDS_ON|backend routes-->|DEPENDS_ON|backend + routes-->|DEPENDS_ON|backend + routes-->|DEPENDS_ON|backend + routes-->|DEPENDS_ON|backend + routes-->|CALLS|backend __tests__-->|TESTS|backend __tests__-->|TESTS|backend __tests__-->|TESTS|backend @@ -2144,6 +2177,16 @@ graph TD core-->|DEPENDS_ON|backend core-->|DEPENDS_ON|backend core-->|DEPENDS_ON|backend + core-->|CALLS|backend + core-->|CALLS|backend + core-->|DEPENDS_ON|backend + core-->|DEPENDS_ON|backend + core-->|DEPENDS_ON|backend + core-->|DEPENDS_ON|backend + core-->|INHERITS|backend + core-->|DEPENDS_ON|backend + core-->|CALLS|backend + core-->|DEPENDS_ON|backend core-->|DEPENDS_ON|backend __tests__-->|TESTS|backend auth-->|USES|backend @@ -2159,8 +2202,17 @@ graph TD migration-->|DEPENDS_ON|backend migration-->|DEPENDS_ON|backend migration-->|DISPATCHES|backend + task_manager-->|USED_BY|backend + task_manager-->|USED_BY|backend + task_manager-->|USED_BY|backend + task_manager-->|DEPENDS_ON|backend + task_manager-->|DEPENDS_ON|backend + task_manager-->|DEPENDS_ON|backend utils-->|DEPENDS_ON|backend utils-->|DEPENDS_ON|backend + utils-->|CALLS|backend + utils-->|CALLS|backend + utils-->|DEPENDS_ON|backend utils-->|DEPENDS_ON|backend utils-->|DEPENDS_ON|backend models-->|DEPENDS_ON|backend @@ -2194,10 +2246,18 @@ graph TD services-->|DEPENDS_ON|backend services-->|DEPENDS_ON|backend services-->|DEPENDS_ON|backend + services-->|CALLS|backend + services-->|CALLS|backend + services-->|CALLS|backend services-->|DEPENDS_ON|backend services-->|DEPENDS_ON|backend services-->|DEPENDS_ON|backend services-->|DEPENDS_ON|backend + services-->|DEPENDS_ON|backend + services-->|DEPENDS_ON|backend + services-->|DEPENDS_ON|backend + services-->|CALLS|backend + services-->|CALLS|backend services-->|CALLS|backend services-->|CALLS|backend services-->|DEPENDS_ON|backend @@ -2209,6 +2269,11 @@ graph TD services-->|DEPENDS_ON|backend services-->|DEPENDS_ON|backend services-->|DEPENDS_ON|backend + services-->|USED_BY|backend + services-->|USED_BY|backend + services-->|DEPENDS_ON|backend + services-->|DEPENDS_ON|backend + services-->|DEPENDS_ON|backend services-->|DEPENDS_ON|backend services-->|DEPENDS_ON|backend __tests__-->|TESTS|backend diff --git a/.ai/PROJECT_MAP.md b/.ai/PROJECT_MAP.md index 98f7b49b..159c569e 100644 --- a/.ai/PROJECT_MAP.md +++ b/.ai/PROJECT_MAP.md @@ -13,72 +13,22 @@ - Ζ **__exit__** (`Function`) `[TRIVIAL]` - π Mock exit. - β **Tier** (`Class`) `[TRIVIAL]` - - π Enumeration of semantic tiers defining validation strictness. + - π Legacy tier buckets retained for backward-compatible reporting. + - β **Complexity** (`Class`) `[TRIVIAL]` + - π Adaptive semantic complexity scale used for validation strictness. - β **Severity** (`Class`) `[TRIVIAL]` - π Severity levels for compliance issues. - β **ComplianceIssue** (`Class`) `[TRIVIAL]` - π Represents a single compliance issue with severity. - β **SemanticEntity** (`Class`) `[CRITICAL]` - π Represents a code entity (Module, Function, Component) found during parsing. - - π Invariant: start_line is always set; end_line is set upon closure; tier defaults to STANDARD. + - π Invariant: start_line is always set; end_line is set upon closure; complexity defaults to 1 unless explicitly raised. - Ζ **__init__** (`Function`) - π Initializes a new SemanticEntity instance. - - Ζ **get_tier** (`Function`) - - π Returns the tier of the entity, defaulting to STANDARD. - - Ζ **to_dict** (`Function`) - - π Serializes the entity to a dictionary for JSON output. - - Ζ **validate** (`Function`) `[CRITICAL]` - - π Checks for semantic compliance based on TIER requirements. - - Ζ **get_score** (`Function`) - - π Calculates a compliance score (0.0 to 1.0) based on tier requirements. - - Ζ **get_patterns** (`Function`) - - π Returns regex patterns for a specific language. - - Ζ **extract_svelte_props** (`Function`) - - π Extracts props from Svelte component script section. - - Ζ **extract_svelte_events** (`Function`) - - π Extracts dispatched events from Svelte component. - - Ζ **extract_data_flow** (`Function`) - - π Extracts store subscriptions and data flow from Svelte component. - - Ζ **parse_file** (`Function`) `[CRITICAL]` - - π Parses a single file to extract semantic entities with tier awareness and enhanced Svelte analysis. - - π Invariant: Every opened anchor must have a matching closing anchor for valid compliance. - - β **SemanticMapGenerator** (`Class`) `[CRITICAL]` - - π Orchestrates the mapping process with tier-based validation. - - π Invariant: All entities are validated according to their TIER requirements. - - Ζ **__init__** (`Function`) - - π Initializes the generator with a root directory. - - Ζ **_load_gitignore** (`Function`) - - π Loads patterns from .gitignore file. - - Ζ **_is_ignored** (`Function`) - - π Checks if a path should be ignored based on .gitignore or hardcoded defaults. - - Ζ **run** (`Function`) `[CRITICAL]` - - π Main execution flow. - - π CALLS -> `_walk_and_parse` - - π CALLS -> `_generate_artifacts` - - Ζ **_walk_and_parse** (`Function`) `[CRITICAL]` - - π Recursively walks directories and triggers parsing. - - Ζ **_process_file_results** (`Function`) - - π Validates entities and calculates file scores with tier awareness. - - Ζ **validate_recursive** (`Function`) - - π Calculate score and determine module's max tier for weighted global score - - Ζ **_generate_artifacts** (`Function`) `[CRITICAL]` - - π Writes output files with tier-based compliance data. - - Ζ **_print_agent_report** (`Function`) - - π Prints a JSON report optimized for AI agent orchestration and control. - - Ζ **_generate_report** (`Function`) `[CRITICAL]` - - π Generates the Markdown compliance report with severity levels. - - Ζ **_collect_issues** (`Function`) - - π Helper to collect issues for a specific file from the entity tree. - - Ζ **_generate_compressed_map** (`Function`) `[CRITICAL]` - - π Generates the token-optimized project map with enhanced Svelte details. - - Ζ **_write_entity_md** (`Function`) `[CRITICAL]` - - π Recursive helper to write entity tree to Markdown with tier badges and enhanced details. - - Ζ **_generate_module_map** (`Function`) `[CRITICAL]` - - π Generates a module-centric map grouping entities by directory structure. - - Ζ **_get_module_path** (`Function`) - - π Extracts the module path from a file path. - - Ζ **_collect_all_entities** (`Function`) - - π Flattens entity tree for easier grouping. + - Ζ **has_explicit_complexity** (`Function`) `[TRIVIAL]` + - π Returns whether the entity explicitly declares complexity metadata. + - Ζ **get_complexity** (`Function`) `[TRIVIAL]` + - π Returns effective complexity with backward compatibility for legacy tiers. - Ζ **to_dict** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) - Ζ **collect_recursive** (`Function`) `[TRIVIAL]` @@ -93,30 +43,30 @@ - π¦ **stores_module** (`Module`) - π Global state management using Svelte stores. - ποΈ Layer: UI-State - - π¦ **plugins** (`Data`) + - π¦ **plugins** (`Data`) `[TRIVIAL]` - π Store for the list of available plugins. - - π¦ **tasks** (`Data`) + - π¦ **tasks** (`Data`) `[TRIVIAL]` - π Store for the list of tasks. - - π¦ **selectedPlugin** (`Data`) + - π¦ **selectedPlugin** (`Data`) `[TRIVIAL]` - π Store for the currently selected plugin. - - π¦ **selectedTask** (`Data`) + - π¦ **selectedTask** (`Data`) `[TRIVIAL]` - π Store for the currently selected task. - - π¦ **currentPage** (`Data`) + - π¦ **currentPage** (`Data`) `[TRIVIAL]` - π Store for the current page. - - π¦ **taskLogs** (`Data`) + - π¦ **taskLogs** (`Data`) `[TRIVIAL]` - π Store for the logs of the currently selected task. - - Ζ **fetchPlugins** (`Function`) + - Ζ **fetchPlugins** (`Function`) `[TRIVIAL]` - π Fetches plugins from the API and updates the plugins store. - - Ζ **fetchTasks** (`Function`) + - Ζ **fetchTasks** (`Function`) `[TRIVIAL]` - π Fetches tasks from the API and updates the tasks store. -- π¦ **toasts_module** (`Module`) +- π¦ **toasts_module** (`Module`) `[TRIVIAL]` - π Manages toast notifications using a Svelte writable store. - ποΈ Layer: UI-State - - π¦ **toasts** (`Data`) + - π¦ **toasts** (`Data`) `[TRIVIAL]` - π Writable store containing the list of active toasts. - - Ζ **addToast** (`Function`) + - Ζ **addToast** (`Function`) `[TRIVIAL]` - π Adds a new toast message. - - Ζ **removeToast** (`Function`) + - Ζ **removeToast** (`Function`) `[TRIVIAL]` - π Removes a toast message by ID. - Ζ **buildToastKey** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -125,56 +75,56 @@ - π¦ **api_module** (`Module`) - π Handles all communication with the backend API. - ποΈ Layer: Infra-API - - Ζ **buildApiError** (`Function`) + - Ζ **buildApiError** (`Function`) `[TRIVIAL]` - π Creates a normalized Error object for failed API responses. - - Ζ **notifyApiError** (`Function`) + - Ζ **notifyApiError** (`Function`) `[TRIVIAL]` - π Shows toast for API errors with explicit handling of critical statuses. - - Ζ **shouldSuppressApiErrorToast** (`Function`) + - Ζ **shouldSuppressApiErrorToast** (`Function`) `[TRIVIAL]` - π Avoid noisy toasts for expected non-critical API failures. - - Ζ **getWsUrl** (`Function`) + - Ζ **getWsUrl** (`Function`) `[TRIVIAL]` - π Returns the WebSocket URL for a specific task, with fallback logic. - - Ζ **getAuthHeaders** (`Function`) + - Ζ **getAuthHeaders** (`Function`) `[TRIVIAL]` - π Returns headers with Authorization if token exists. - - Ζ **fetchApi** (`Function`) + - Ζ **fetchApi** (`Function`) `[TRIVIAL]` - π Generic GET request wrapper. - - Ζ **fetchApiBlob** (`Function`) + - Ζ **fetchApiBlob** (`Function`) `[TRIVIAL]` - π Generic GET wrapper for binary payloads. - - Ζ **postApi** (`Function`) + - Ζ **postApi** (`Function`) `[TRIVIAL]` - π Generic POST request wrapper. - - Ζ **requestApi** (`Function`) + - Ζ **requestApi** (`Function`) `[TRIVIAL]` - π Generic request wrapper. - - π¦ **api** (`Data`) + - π¦ **api** (`Data`) `[TRIVIAL]` - π API client object with specific methods. - π¦ **Utils** (`Module`) `[TRIVIAL]` - π General utility functions (class merging) - ποΈ Layer: Infra - Ζ **cn** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- ποΈ **authStore** (`Store`) `[CRITICAL]` +- ποΈ **authStore** (`Store`) - π Manages the global authentication state on the frontend. - ποΈ Layer: Feature - π BINDS_TO -> `Navbar, ProtectedRoute` - - π¦ **AuthState** (`Interface`) + - π¦ **AuthState** (`Interface`) `[TRIVIAL]` - π Defines the structure of the authentication state. - - Ζ **createAuthStore** (`Function`) + - Ζ **createAuthStore** (`Function`) `[TRIVIAL]` - π Creates and configures the auth store with helper methods. - - Ζ **setToken** (`Function`) + - Ζ **setToken** (`Function`) `[TRIVIAL]` - π Updates the store with a new JWT token. - - Ζ **setUser** (`Function`) + - Ζ **setUser** (`Function`) `[TRIVIAL]` - π Sets the current user profile data. - - Ζ **logout** (`Function`) + - Ζ **logout** (`Function`) `[TRIVIAL]` - π Clears authentication state and storage. - - Ζ **setLoading** (`Function`) + - Ζ **setLoading** (`Function`) `[TRIVIAL]` - π Updates the loading state. -- π¦ **frontend.src.lib.auth.permissions** (`Module`) `[CRITICAL]` +- π¦ **frontend.src.lib.auth.permissions** (`Module`) - π Shared frontend RBAC utilities for route guards and menu visibility. - ποΈ Layer: Domain - π Invariant: Admin role always bypasses explicit permission checks. - - Ζ **normalizePermissionRequirement** (`Function`) + - Ζ **normalizePermissionRequirement** (`Function`) `[TRIVIAL]` - π Convert permission requirement string to canonical resource/action tuple. - - Ζ **isAdminUser** (`Function`) + - Ζ **isAdminUser** (`Function`) `[TRIVIAL]` - π Determine whether user has Admin role. - - Ζ **hasPermission** (`Function`) + - Ζ **hasPermission** (`Function`) `[TRIVIAL]` - π Check if user has a required resource/action permission. - Ζ **normalizeAction** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -202,13 +152,13 @@ - ποΈ Layer: UI - π Invariant: conversationId persists while panel toggles unless explicitly reset. - π BINDS_TO -> `AssistantChatPanel` - - Ζ **toggleAssistantChat** (`Function`) + - Ζ **toggleAssistantChat** (`Function`) `[TRIVIAL]` - π Toggle assistant panel visibility. - - Ζ **openAssistantChat** (`Function`) + - Ζ **openAssistantChat** (`Function`) `[TRIVIAL]` - π Open assistant panel. - - Ζ **closeAssistantChat** (`Function`) + - Ζ **closeAssistantChat** (`Function`) `[TRIVIAL]` - π Close assistant panel. - - Ζ **setAssistantConversationId** (`Function`) + - Ζ **setAssistantConversationId** (`Function`) `[TRIVIAL]` - π Bind current conversation id in UI state. - ποΈ **taskDrawer** (`Store`) `[CRITICAL]` - π Manage Task Drawer visibility and resource-to-task mapping @@ -285,12 +235,12 @@ - π Unit tests for sidebar store - ποΈ Layer: Domain (Tests) - π Invariant: Sidebar store transitions must be deterministic across desktop/mobile toggles. - - Ζ **test_sidebar_initial_state** (`Function`) + - Ζ **test_sidebar_initial_state** (`Function`) `[TRIVIAL]` - π Verify initial sidebar store values when no persisted state is available. - - Ζ **test_toggleSidebar** (`Function`) + - Ζ **test_toggleSidebar** (`Function`) `[TRIVIAL]` - π Verify desktop sidebar expansion toggles deterministically. - - Ζ **test_setActiveItem** (`Function`) - - Ζ **test_mobile_functions** (`Function`) + - Ζ **test_setActiveItem** (`Function`) `[TRIVIAL]` + - Ζ **test_mobile_functions** (`Function`) `[TRIVIAL]` - π¦ **frontend.src.lib.stores.__tests__.test_activity** (`Module`) - π Unit tests for activity store - ποΈ Layer: UI @@ -309,11 +259,11 @@ - π DEPENDS_ON -> `assistantChatStore` - Ζ **assistantChatStore_tests** (`Function`) - π Group store unit scenarios for assistant panel behavior. -- π¦ **navigation** (`Mock`) +- π¦ **navigation** (`Mock`) `[TRIVIAL]` - π Mock for $app/navigation in tests -- π¦ **stores** (`Mock`) +- π¦ **stores** (`Mock`) `[TRIVIAL]` - π Mock for $app/stores in tests -- π¦ **environment** (`Mock`) +- π¦ **environment** (`Mock`) `[TRIVIAL]` - π Mock for $app/environment in tests - π¦ **mock_env_public** (`Module`) - π Mock for $env/static/public SvelteKit module in vitest @@ -323,40 +273,40 @@ - ποΈ Layer: Infra - π Invariant: Uses existing api wrapper methods and returns structured errors for UI-state mapping. - π DEPENDS_ON -> `DEF:api_module` - - Ζ **buildReportQueryString** (`Function`) + - Ζ **buildReportQueryString** (`Function`) `[TRIVIAL]` - π Build query string for reports list endpoint from filter options. - - Ζ **normalizeApiError** (`Function`) + - Ζ **normalizeApiError** (`Function`) `[TRIVIAL]` - π Convert unknown API exceptions into deterministic UI-consumable error objects. - - Ζ **getReports** (`Function`) + - Ζ **getReports** (`Function`) `[TRIVIAL]` - π Fetch unified report list using existing request wrapper. - - Ζ **getReportDetail** (`Function`) + - Ζ **getReportDetail** (`Function`) `[TRIVIAL]` - π Fetch one report detail by report_id. - π¦ **frontend.src.lib.api.assistant** (`Module`) - π API client wrapper for assistant chat, confirmation actions, and history retrieval. - ποΈ Layer: Infra-API - π Invariant: All assistant requests must use requestApi wrapper (no native fetch). - π DEPENDS_ON -> `frontend.src.lib.api.api_module` - - Ζ **sendAssistantMessage** (`Function`) + - Ζ **sendAssistantMessage** (`Function`) `[TRIVIAL]` - π Send a user message to assistant orchestrator endpoint. - - Ζ **confirmAssistantOperation** (`Function`) + - Ζ **confirmAssistantOperation** (`Function`) `[TRIVIAL]` - π Confirm a pending risky assistant operation. - - Ζ **cancelAssistantOperation** (`Function`) + - Ζ **cancelAssistantOperation** (`Function`) `[TRIVIAL]` - π Cancel a pending risky assistant operation. - - Ζ **getAssistantHistory** (`Function`) + - Ζ **getAssistantHistory** (`Function`) `[TRIVIAL]` - π Retrieve paginated assistant conversation history. - - Ζ **getAssistantConversations** (`Function`) + - Ζ **getAssistantConversations** (`Function`) `[TRIVIAL]` - π Retrieve paginated conversation list for assistant sidebar/history switcher. - - Ζ **deleteAssistantConversation** (`Function`) + - Ζ **deleteAssistantConversation** (`Function`) `[TRIVIAL]` - π Soft-delete or hard-delete a conversation. - π¦ **frontend.src.lib.api.__tests__.reports_api** (`Module`) - π Unit tests for reports API client functions: query string building, error normalization, and fetch wrappers. - ποΈ Layer: Infra (Tests) - π Invariant: Pure functions produce deterministic output. Async wrappers propagate structured errors. - - β **TestBuildReportQueryString** (`Class`) + - β **TestBuildReportQueryString** (`Class`) `[TRIVIAL]` - π Validate query string construction from filter options. - - β **TestNormalizeApiError** (`Class`) + - β **TestNormalizeApiError** (`Class`) `[TRIVIAL]` - π Validate error normalization for UI-state mapping. - - β **TestGetReportsAsync** (`Class`) + - β **TestGetReportsAsync** (`Class`) `[TRIVIAL]` - π Validate getReports and getReportDetail with mocked api.fetchApi. - π§© **Select** (`Component`) `[TRIVIAL]` - π Standardized dropdown selection component. @@ -403,11 +353,11 @@ - π Invariant: Persistence is handled via LocalStorage. - π DEPENDS_ON -> `locales/ru.json` - π DEPENDS_ON -> `locales/en.json` - - ποΈ **locale** (`Store`) + - ποΈ **locale** (`Store`) `[TRIVIAL]` - π Holds the current active locale string. - - ποΈ **t** (`Store`) + - ποΈ **t** (`Store`) `[TRIVIAL]` - π Derived store providing the translation dictionary. - - Ζ **_** (`Function`) + - Ζ **_** (`Function`) `[TRIVIAL]` - π Get translation by key path. - π§© **AssistantChatPanel** (`Component`) - π Slide-out assistant chat panel for natural language command execution and task tracking. @@ -419,31 +369,31 @@ - π BINDS_TO -> `assistantChatStore` - π CALLS -> `frontend.src.lib.api.assistant` - π DISPATCHES -> `taskDrawerStore` - - Ζ **loadHistory** (`Function`) + - Ζ **loadHistory** (`Function`) `[TRIVIAL]` - π Load current conversation history when panel becomes visible. - - Ζ **loadConversations** (`Function`) + - Ζ **loadConversations** (`Function`) `[TRIVIAL]` - π Load paginated conversation summaries for quick switching UI. - - Ζ **removeConversation** (`Function`) + - Ζ **removeConversation** (`Function`) `[TRIVIAL]` - π Removes a conversation from the list and deletes it from the backend. - - Ζ **loadOlderMessages** (`Function`) + - Ζ **loadOlderMessages** (`Function`) `[TRIVIAL]` - π Lazy-load older messages for active conversation when user scrolls to top. - - Ζ **appendLocalUserMessage** (`Function`) + - Ζ **appendLocalUserMessage** (`Function`) `[TRIVIAL]` - π Add optimistic local user message before backend response. - - Ζ **appendAssistantResponse** (`Function`) + - Ζ **appendAssistantResponse** (`Function`) `[TRIVIAL]` - π Normalize and append assistant response payload to chat list. - - Ζ **handleSend** (`Function`) + - Ζ **handleSend** (`Function`) `[TRIVIAL]` - π Submit user command to assistant orchestration API. - - Ζ **selectConversation** (`Function`) + - Ζ **selectConversation** (`Function`) `[TRIVIAL]` - π Switch active chat context to selected conversation item. - - Ζ **startNewConversation** (`Function`) + - Ζ **startNewConversation** (`Function`) `[TRIVIAL]` - π Create local empty chat context that will be persisted on first message. - - Ζ **handleAction** (`Function`) + - Ζ **handleAction** (`Function`) `[TRIVIAL]` - π Execute assistant action button behavior (open task/reports, confirm, cancel). - - Ζ **handleKeydown** (`Function`) + - Ζ **handleKeydown** (`Function`) `[TRIVIAL]` - π Submit command by Enter while preserving multiline input with Shift+Enter. - - Ζ **stateClass** (`Function`) + - Ζ **stateClass** (`Function`) `[TRIVIAL]` - π Map assistant state to visual badge style class. - - Ζ **handleHistoryScroll** (`Function`) + - Ζ **handleHistoryScroll** (`Function`) `[TRIVIAL]` - π Trigger lazy history fetch when user scroll reaches top boundary. - π¦ **AssistantChatPanel** (`Module`) `[TRIVIAL]` - π Auto-generated module for frontend/src/lib/components/assistant/AssistantChatPanel.svelte @@ -466,9 +416,9 @@ - π Contract-level integration checks for assistant chat panel implementation and localization wiring. - ποΈ Layer: UI Tests - π Invariant: Critical assistant UX states and action hooks remain present in component source. - - Ζ **readJson** (`Function`) + - Ζ **readJson** (`Function`) `[TRIVIAL]` - π Read and parse JSON fixture file from disk. - - Ζ **assistant_chat_contract_tests** (`Function`) + - Ζ **assistant_chat_contract_tests** (`Function`) `[TRIVIAL]` - π Validate assistant chat component contract and locale integration without DOM runtime dependency. - π§© **HealthMatrix** (`Component`) - π Visual grid/matrix representing the health status of dashboards. @@ -531,7 +481,7 @@ - ποΈ Layer: UI - π Invariant: Unknown type always resolves to fallback profile. - π DEPENDS_ON -> `frontend/src/lib/i18n/index.ts` - - Ζ **getReportTypeProfile** (`Function`) + - Ζ **getReportTypeProfile** (`Function`) `[TRIVIAL]` - π Resolve visual profile by task type with guaranteed fallback. - π§© **ReportDetailPanel** (`Component`) - π Display detailed report context with diagnostics and actionable recovery guidance. @@ -680,9 +630,9 @@ - π BINDS_TO -> `taskDrawerStore, assistantChatStore, WebSocket` - Ζ **disconnectWebSocket** (`Function`) - π Disconnects the active WebSocket connection - - Ζ **loadRecentTasks** (`Function`) + - Ζ **loadRecentTasks** (`Function`) `[TRIVIAL]` - π Load recent tasks for list mode display - - Ζ **selectTask** (`Function`) + - Ζ **selectTask** (`Function`) `[TRIVIAL]` - π Select a task from list to view details - Ζ **goBackToList** (`Function`) - π Return to task list view from task details @@ -734,9 +684,9 @@ - ποΈ Layer: UI - π Invariant: Admin role can access all categories and subitems through permission utility. - π DEPENDS_ON -> `frontend.src.lib.auth.permissions.hasPermission` - - Ζ **isItemAllowed** (`Function`) + - Ζ **isItemAllowed** (`Function`) `[TRIVIAL]` - π Check whether a single menu node can be shown for a given user. - - Ζ **buildSidebarCategories** (`Function`) + - Ζ **buildSidebarCategories** (`Function`) `[TRIVIAL]` - π Build translated sidebar categories and filter them by RBAC permissions. - π¦ **test_breadcrumbs.svelte** (`Module`) `[TRIVIAL]` - π Auto-generated module for frontend/src/lib/components/layout/__tests__/test_breadcrumbs.svelte.js @@ -769,7 +719,7 @@ - π Auto-detected function (orphan) - Ζ **redirectToStartPage** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- Ζ **load** (`Function`) +- Ζ **load** (`Function`) `[TRIVIAL]` - π Loads initial plugin data for the dashboard. - π¦ **layout** (`Module`) - π Bind global layout shell and conditional login/full-app rendering. @@ -890,75 +840,75 @@ - β¬ οΈ READS_FROM `lib` - β‘οΈ WRITES_TO `t` - π CALLS -> `api.auth.login` - - Ζ **handleLogin** (`Function`) + - Ζ **handleLogin** (`Function`) `[TRIVIAL]` - π Submits the local login form to the backend. - - Ζ **handleADFSLogin** (`Function`) + - Ζ **handleADFSLogin** (`Function`) `[TRIVIAL]` - π Redirects the user to the ADFS login endpoint. - π¦ **StorageIndexPage** (`Page`) `[TRIVIAL]` - π Redirect to the backups page as the default storage view. - ποΈ Layer: Page - π Invariant: Always redirects to /storage/backups. -- π¦ **StorageReposPage** (`Page`) - - Ζ **fetchEnvironments** (`Function`) +- π¦ **StorageReposPage** (`Page`) `[TRIVIAL]` + - Ζ **fetchEnvironments** (`Function`) `[TRIVIAL]` - π Fetches the list of available environments. - - Ζ **fetchDashboards** (`Function`) + - Ζ **fetchDashboards** (`Function`) `[TRIVIAL]` - π Fetches dashboards for a specific environment. - - Ζ **filterDashboardsWithRepositories** (`Function`) + - Ζ **filterDashboardsWithRepositories** (`Function`) `[TRIVIAL]` - π Keep only dashboards that already have initialized Git repositories. - π¦ **DashboardHub** (`Page`) - π Dashboard Hub - Central hub for managing dashboards with Git status and task actions - ποΈ Layer: UI - π Invariant: Always shows dashboards for the active environment from context store - π BINDS_TO -> `sidebarStore, taskDrawerStore` - - Ζ **DashboardHub.normalizeTaskStatus** (`Function`) + - Ζ **DashboardHub.normalizeTaskStatus** (`Function`) `[TRIVIAL]` - π Normalize raw task status to stable lowercase token for UI. - - Ζ **DashboardHub.normalizeValidationStatus** (`Function`) + - Ζ **DashboardHub.normalizeValidationStatus** (`Function`) `[TRIVIAL]` - π Normalize validation status to pass/fail/warn/unknown. - - Ζ **DashboardHub.getValidationBadgeClass** (`Function`) + - Ζ **DashboardHub.getValidationBadgeClass** (`Function`) `[TRIVIAL]` - π Map validation level to badge class tuple. - - Ζ **DashboardHub.getValidationLabel** (`Function`) + - Ζ **DashboardHub.getValidationLabel** (`Function`) `[TRIVIAL]` - π Map normalized validation level to compact UI label. - - Ζ **DashboardHub.normalizeOwners** (`Function`) + - Ζ **DashboardHub.normalizeOwners** (`Function`) `[TRIVIAL]` - π Normalize owners payload to unique non-empty display labels. - - Ζ **DashboardHub.loadDashboards** (`Function`) + - Ζ **DashboardHub.loadDashboards** (`Function`) `[TRIVIAL]` - π Load full dashboard dataset for current environment and hydrate grid projection. - - Ζ **DashboardHub.handleTemporaryShowAll** (`Function`) + - Ζ **DashboardHub.handleTemporaryShowAll** (`Function`) `[TRIVIAL]` - π Temporarily disable profile-default dashboard filter for current page context. - - Ζ **DashboardHub.handleRestoreProfileFilter** (`Function`) + - Ζ **DashboardHub.handleRestoreProfileFilter** (`Function`) `[TRIVIAL]` - π Re-enable persisted profile-default filtering after temporary override. - - Ζ **DashboardHub.formatDate** (`Function`) + - Ζ **DashboardHub.formatDate** (`Function`) `[TRIVIAL]` - π Convert ISO timestamp to locale date string. - - Ζ **DashboardHub.getGitSummaryLabel** (`Function`) + - Ζ **DashboardHub.getGitSummaryLabel** (`Function`) `[TRIVIAL]` - π Compute stable text label for git state column. - - Ζ **DashboardHub.getLlmSummaryLabel** (`Function`) + - Ζ **DashboardHub.getLlmSummaryLabel** (`Function`) `[TRIVIAL]` - π Compute normalized LLM validation summary label. - - Ζ **DashboardHub.getColumnCellValue** (`Function`) + - Ζ **DashboardHub.getColumnCellValue** (`Function`) `[TRIVIAL]` - π Resolve comparable/filterable display value for any grid column. - - Ζ **DashboardHub.getFilterOptions** (`Function`) + - Ζ **DashboardHub.getFilterOptions** (`Function`) `[TRIVIAL]` - π Build unique sorted value list for a column filter dropdown. - - Ζ **DashboardHub.getVisibleFilterOptions** (`Function`) + - Ζ **DashboardHub.getVisibleFilterOptions** (`Function`) `[TRIVIAL]` - π Apply in-dropdown search over full filter options. - - Ζ **DashboardHub.toggleFilterDropdown** (`Function`) + - Ζ **DashboardHub.toggleFilterDropdown** (`Function`) `[TRIVIAL]` - π Toggle active column filter popover. - - Ζ **DashboardHub.toggleFilterValue** (`Function`) + - Ζ **DashboardHub.toggleFilterValue** (`Function`) `[TRIVIAL]` - π Add/remove specific filter value and reapply projection. - - Ζ **DashboardHub.clearColumnFilter** (`Function`) + - Ζ **DashboardHub.clearColumnFilter** (`Function`) `[TRIVIAL]` - π Reset selected values for one column. - - Ζ **DashboardHub.selectAllColumnFilterValues** (`Function`) + - Ζ **DashboardHub.selectAllColumnFilterValues** (`Function`) `[TRIVIAL]` - π Select all currently visible values in filter popover. - - Ζ **DashboardHub.updateColumnFilterSearch** (`Function`) + - Ζ **DashboardHub.updateColumnFilterSearch** (`Function`) `[TRIVIAL]` - π Update local search token for one filter popover. - - Ζ **DashboardHub.hasColumnFilter** (`Function`) + - Ζ **DashboardHub.hasColumnFilter** (`Function`) `[TRIVIAL]` - π Determine if column has active selected values. - - Ζ **DashboardHub.doesDashboardPassColumnFilters** (`Function`) + - Ζ **DashboardHub.doesDashboardPassColumnFilters** (`Function`) `[TRIVIAL]` - π Evaluate dashboard row against all active column filters. - - Ζ **DashboardHub.getSortValue** (`Function`) + - Ζ **DashboardHub.getSortValue** (`Function`) `[TRIVIAL]` - π Compute stable comparable sort key for chosen column. - - Ζ **DashboardHub.handleSort** (`Function`) + - Ζ **DashboardHub.handleSort** (`Function`) `[TRIVIAL]` - π Toggle or switch sort order and reapply grid projection. - - Ζ **DashboardHub.getSortIndicator** (`Function`) + - Ζ **DashboardHub.getSortIndicator** (`Function`) `[TRIVIAL]` - π Return visual indicator for active/inactive sort header. - - Ζ **DashboardHub.applyGridTransforms** (`Function`) + - Ζ **DashboardHub.applyGridTransforms** (`Function`) `[TRIVIAL]` - π Apply search + column filters + sort + pagination to grid data. - π¦ **+page** (`Module`) `[TRIVIAL]` - π Auto-generated module for frontend/src/routes/dashboards/+page.svelte @@ -1108,11 +1058,11 @@ - β¬ οΈ READS_FROM `lib` - π DEPENDS_ON -> `frontend.src.lib.components.health.HealthMatrix` - π CALLS -> `frontend.src.lib.api.api_module` - - Ζ **loadData** (`Function`) + - Ζ **loadData** (`Function`) `[TRIVIAL]` - π Load health summary rows and environment options for the current filter. - - Ζ **handleEnvChange** (`Function`) + - Ζ **handleEnvChange** (`Function`) `[TRIVIAL]` - π Apply environment filter and trigger health summary reload. - - Ζ **handleDeleteReport** (`Function`) + - Ζ **handleDeleteReport** (`Function`) `[TRIVIAL]` - π Delete one health report row with confirmation and optimistic button lock. - π¦ **frontend.src.routes.dashboards.health.__tests__.health_page_integration** (`Module`) - π Lock dashboard health page contract for slug navigation and report deletion. @@ -1188,17 +1138,17 @@ - β¬ οΈ READS_FROM `t` - π DEPENDS_ON -> `frontend.src.services.adminService` - π DEPENDS_ON -> `frontend.src.components.auth.ProtectedRoute` - - Ζ **loadData** (`Function`) + - Ζ **loadData** (`Function`) `[TRIVIAL]` - π Fetches roles and available permissions. - - Ζ **openCreateModal** (`Function`) + - Ζ **openCreateModal** (`Function`) `[TRIVIAL]` - π Initializes state for creating a new role. - - Ζ **openEditModal** (`Function`) + - Ζ **openEditModal** (`Function`) `[TRIVIAL]` - π Initializes state for editing an existing role. - - Ζ **handleSaveRole** (`Function`) + - Ζ **handleSaveRole** (`Function`) `[TRIVIAL]` - π Submits role data (create or update). - - Ζ **handleDeleteRole** (`Function`) + - Ζ **handleDeleteRole** (`Function`) `[TRIVIAL]` - π Deletes a role after confirmation. -- π§© **AdminUsersPage** (`Component`) +- π§© **AdminUsersPage** (`Component`) `[TRIVIAL]` - π UI for managing system users and their roles. - ποΈ Layer: Feature - π Invariant: Only accessible by users with "admin:users" permission. @@ -1207,15 +1157,15 @@ - β¬ οΈ READS_FROM `t` - π DEPENDS_ON -> `frontend.src.services.adminService` - π DEPENDS_ON -> `frontend.src.components.auth.ProtectedRoute` - - Ζ **loadData** (`Function`) + - Ζ **loadData** (`Function`) `[TRIVIAL]` - π Fetches users and roles from the backend. - - Ζ **openCreateModal** (`Function`) + - Ζ **openCreateModal** (`Function`) `[TRIVIAL]` - π Prepares the form for creating a new user. - - Ζ **openEditModal** (`Function`) + - Ζ **openEditModal** (`Function`) `[TRIVIAL]` - π Prepares the form for editing an existing user. - - Ζ **handleSaveUser** (`Function`) + - Ζ **handleSaveUser** (`Function`) `[TRIVIAL]` - π Submits user data to the backend (create or update). - - Ζ **handleDeleteUser** (`Function`) + - Ζ **handleDeleteUser** (`Function`) `[TRIVIAL]` - π Deletes a user after confirmation. - π§© **AdminSettingsPage** (`Component`) - π UI for configuring Active Directory Group to local Role mappings for ADFS SSO and logging settings. @@ -1226,13 +1176,13 @@ - β¬ οΈ READS_FROM `t` - π DEPENDS_ON -> `frontend.src.services.adminService` - π DEPENDS_ON -> `frontend.src.components.auth.ProtectedRoute` - - Ζ **loadData** (`Function`) + - Ζ **loadData** (`Function`) `[TRIVIAL]` - π Fetches AD mappings and roles from the backend to populate the UI. - - Ζ **handleCreateMapping** (`Function`) + - Ζ **handleCreateMapping** (`Function`) `[TRIVIAL]` - π Submits a new AD Group to Role mapping to the backend. - - Ζ **loadLoggingConfig** (`Function`) + - Ζ **loadLoggingConfig** (`Function`) `[TRIVIAL]` - π Fetches current logging configuration from the backend. - - Ζ **saveLoggingConfig** (`Function`) + - Ζ **saveLoggingConfig** (`Function`) `[TRIVIAL]` - π Saves logging configuration to the backend. - π§© **LLMSettingsPage** (`Component`) - π Admin settings page for LLM provider configuration. @@ -1251,61 +1201,72 @@ - π Auto-detected function (orphan) - Ζ **saveSettings** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- π§© **MigrationDashboard** (`Component`) +- π§© **MigrationDashboard** (`Component`) `[TRIVIAL]` - π Orchestrate migration UI workflow and route user actions to backend APIs and task store. - β¬ οΈ READS_FROM `lib` - β‘οΈ WRITES_TO `state` - β¬ οΈ READS_FROM `effect` - - Ζ **fetchEnvironments** (`Function`) + - Ζ **fetchEnvironments** (`Function`) `[TRIVIAL]` - π Fetches the list of environments from the API. - - Ζ **fetchDashboards** (`Function`) + - Ζ **fetchDashboards** (`Function`) `[TRIVIAL]` - π Fetches dashboards for the selected source environment. - - β¦ **ReactiveDashboardFetch** (`Block`) + - β¦ **ReactiveDashboardFetch** (`Block`) `[TRIVIAL]` - π Automatically fetch dashboards when the source environment is changed. - - Ζ **fetchDatabases** (`Function`) + - Ζ **fetchDatabases** (`Function`) `[TRIVIAL]` - π Fetches databases from both environments and gets suggestions. - - Ζ **handleMappingUpdate** (`Function`) + - Ζ **handleMappingUpdate** (`Function`) `[TRIVIAL]` - π Saves a mapping to the backend. - - Ζ **handleViewLogs** (`Function`) + - Ζ **handleViewLogs** (`Function`) `[TRIVIAL]` - π Opens the log viewer for a specific task. - - Ζ **handlePasswordPrompt** (`Function`) + - Ζ **handlePasswordPrompt** (`Function`) `[TRIVIAL]` - π Reactive logic to show password prompt when a task is awaiting input. - - β¦ **ReactivePasswordPrompt** (`Block`) + - β¦ **ReactivePasswordPrompt** (`Block`) `[TRIVIAL]` - π Monitor selected task for input requests and trigger password prompt. - - Ζ **handleResumeMigration** (`Function`) + - Ζ **handleResumeMigration** (`Function`) `[TRIVIAL]` - π Resumes a migration task with provided passwords. - - Ζ **startMigration** (`Function`) + - Ζ **startMigration** (`Function`) `[TRIVIAL]` - π Initiates the migration process by sending the selection to the backend. - - Ζ **startDryRun** (`Function`) + - Ζ **startDryRun** (`Function`) `[TRIVIAL]` - π Performs a dry-run migration to identify potential risks and changes. -- β¦ **MigrationDashboardView** (`Block`) +- β¦ **MigrationDashboardView** (`Block`) `[TRIVIAL]` - π Render migration configuration controls, action CTAs, dry-run results, and modal entry points. - - β¦ **MigrationHeader** (`Block`) - - β¦ **TaskHistorySection** (`Block`) - - β¦ **ActiveTaskSection** (`Block`) - - β¦ **EnvironmentSelectionSection** (`Block`) - - π§© **DashboardSelectionSection** (`Component`) - - β¦ **MigrationOptionsSection** (`Block`) - - β¦ **DryRunResultsSection** (`Block`) - - β¦ **MigrationModals** (`Block`) + - β¦ **MigrationHeader** (`Block`) `[TRIVIAL]` + - β¦ **TaskHistorySection** (`Block`) `[TRIVIAL]` + - β¦ **ActiveTaskSection** (`Block`) `[TRIVIAL]` + - β¦ **EnvironmentSelectionSection** (`Block`) `[TRIVIAL]` + - π§© **DashboardSelectionSection** (`Component`) `[TRIVIAL]` + - β¦ **MigrationOptionsSection** (`Block`) `[TRIVIAL]` + - β¦ **DryRunResultsSection** (`Block`) `[TRIVIAL]` + - β¦ **MigrationModals** (`Block`) `[TRIVIAL]` - π Render overlay components for log viewing and password entry. -- β¦ **MappingsPageScript** (`Block`) +- β¦ **MappingsPageScript** (`Block`) `[TRIVIAL]` - π Define imports, state, and handlers that drive migration mappings page FSM. - π CALLS -> `fetchEnvironments` - π CALLS -> `fetchDatabases` - π CALLS -> `handleUpdate` - - β¦ **Imports** (`Block`) + - β¦ **Imports** (`Block`) `[TRIVIAL]` - ποΈ **UiState** (`Store`) `[CRITICAL]` - π Maintain local page state for environments, fetched databases, mappings, suggestions, and UX messages. - - Ζ **belief_scope** (`Function`) + - Ζ **belief_scope** (`Function`) `[TRIVIAL]` - π Frontend semantic scope wrapper for CRITICAL trace boundaries without changing business behavior. - - Ζ **fetchEnvironments** (`Function`) + - Ζ **fetchEnvironments** (`Function`) `[TRIVIAL]` - π Load environment options for source/target selectors on initial mount. - - Ζ **fetchDatabases** (`Function`) + - Ζ **fetchDatabases** (`Function`) `[TRIVIAL]` - π Fetch both environment database catalogs, existing mappings, and suggested matches. - - Ζ **handleUpdate** (`Function`) + - Ζ **handleUpdate** (`Function`) `[TRIVIAL]` - π Persist a selected mapping pair and reconcile local mapping list by source database UUID. -- β¦ **MappingsPageTemplate** (`Block`) +- β¦ **MappingsPageTemplate** (`Block`) `[TRIVIAL]` +- π§© **ProfilePage** (`Component`) `[CRITICAL]` + - π Manage user profile sections for read-only security access, Git identity/token configuration, and UI preferences with resilient save/cancel UX. + - ποΈ Layer: UI + - π Invariant: Save operations mutate only current user's preference payload via profile API. + - β¬ οΈ READS_FROM `lib` + - β‘οΈ WRITES_TO `state` + - β‘οΈ WRITES_TO `derived` + - π BINDS_TO -> `i18n` + - π BINDS_TO -> `api_module` + - π BINDS_TO -> `environmentContext` + - π BINDS_TO -> `taskDrawer` - π¦ **+page** (`Module`) `[TRIVIAL]` - π Auto-generated module for frontend/src/routes/profile/+page.svelte - ποΈ Layer: Unknown @@ -1355,17 +1316,17 @@ - β‘οΈ WRITES_TO `state` - β¬ οΈ READS_FROM `t` - π DEPENDS_ON -> `storageService` - - Ζ **loadFiles** (`Function`) + - Ζ **loadFiles** (`Function`) `[TRIVIAL]` - π Fetches the list of files from the server. - - Ζ **resolveStorageQueryFromPath** (`Function`) + - Ζ **resolveStorageQueryFromPath** (`Function`) `[TRIVIAL]` - π Splits UI path into storage API category and category-local subpath. - - Ζ **handleDelete** (`Function`) + - Ζ **handleDelete** (`Function`) `[TRIVIAL]` - π Handles the file deletion process. - - Ζ **handleNavigate** (`Function`) + - Ζ **handleNavigate** (`Function`) `[TRIVIAL]` - π Updates the current path and reloads files when navigating into a directory. - - Ζ **navigateUp** (`Function`) + - Ζ **navigateUp** (`Function`) `[TRIVIAL]` - π Navigates one level up in the directory structure. - - Ζ **updateUploadCategory** (`Function`) + - Ζ **updateUploadCategory** (`Function`) `[TRIVIAL]` - π Keeps upload category aligned with the currently viewed top-level folder. - π§© **MapperPage** (`Component`) `[TRIVIAL]` - π Page for the dataset column mapper tool. @@ -1449,7 +1410,7 @@ - π Auto-detected function (orphan) - Ζ **normalizeSupersetBaseUrl** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- Ζ **load** (`Function`) +- Ζ **load** (`Function`) `[TRIVIAL]` - π Loads application settings and environment list. - π§© **NotificationSettingsPage** (`Component`) - π Manage global notification provider configurations (SMTP, Telegram, Slack). @@ -1464,39 +1425,39 @@ - π Auto-detected function (orphan) - Ζ **handleSave** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- π§© **ConnectionsSettingsPage** (`Component`) +- π§© **ConnectionsSettingsPage** (`Component`) `[TRIVIAL]` - π Page for managing database connection configurations. - ποΈ Layer: UI - β¬ οΈ READS_FROM `lib` - β‘οΈ WRITES_TO `t` - - Ζ **handleSuccess** (`Function`) + - Ζ **handleSuccess** (`Function`) `[TRIVIAL]` - π Refreshes the connection list after a successful creation. -- π§© **GitSettingsPage** (`Component`) +- π§© **GitSettingsPage** (`Component`) `[TRIVIAL]` - π Manage Git server configurations for dashboard versioning. - ποΈ Layer: Page - π Invariant: All configurations must be validated via connection test. - β¬ οΈ READS_FROM `lib` - β‘οΈ WRITES_TO `state` - β¬ οΈ READS_FROM `t` - - Ζ **loadConfigs** (`Function`) + - Ζ **loadConfigs** (`Function`) `[TRIVIAL]` - π Fetches existing git configurations. - - Ζ **handleTest** (`Function`) + - Ζ **handleTest** (`Function`) `[TRIVIAL]` - π Tests connection to a git server with current form data. - - Ζ **handleSave** (`Function`) + - Ζ **handleSave** (`Function`) `[TRIVIAL]` - π Saves a new git configuration. - - Ζ **handleEdit** (`Function`) + - Ζ **handleEdit** (`Function`) `[TRIVIAL]` - π Populates the form with an existing config to edit. - - Ζ **resetForm** (`Function`) + - Ζ **resetForm** (`Function`) `[TRIVIAL]` - π Resets the configuration form. - - Ζ **handleDelete** (`Function`) + - Ζ **handleDelete** (`Function`) `[TRIVIAL]` - π Deletes a git configuration by ID. - - Ζ **loadGiteaRepos** (`Function`) + - Ζ **loadGiteaRepos** (`Function`) `[TRIVIAL]` - π Loads repositories from selected Gitea config. - - Ζ **handleCreateGiteaRepo** (`Function`) + - Ζ **handleCreateGiteaRepo** (`Function`) `[TRIVIAL]` - π Creates new repository on selected Gitea server. - - Ζ **handleDeleteGiteaRepo** (`Function`) + - Ζ **handleDeleteGiteaRepo** (`Function`) `[TRIVIAL]` - π Deletes repository from selected Gitea server. -- π¦ **frontend.src.routes.settings.git.__tests__.git_settings_page_ux_test** (`Module`) +- π¦ **frontend.src.routes.settings.git.__tests__.git_settings_page_ux_test** (`Module`) `[TRIVIAL]` - π Test UX states and transitions for the Git Settings page - π§© **AutomationSettingsPage** (`Component`) - π Settings page for managing validation policies. @@ -1519,125 +1480,125 @@ - π Auto-detected function (orphan) - Ζ **getEnvName** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- π§© **GitDashboardPage** (`Component`) +- π§© **GitDashboardPage** (`Component`) `[TRIVIAL]` - π Dashboard management page for Git integration. - ποΈ Layer: Page - β¬ οΈ READS_FROM `lib` - β‘οΈ WRITES_TO `state` - β‘οΈ WRITES_TO `derived` - - Ζ **fetchEnvironments** (`Function`) + - Ζ **fetchEnvironments** (`Function`) `[TRIVIAL]` - π Fetches the list of deployment environments from the API. - - Ζ **fetchDashboards** (`Function`) + - Ζ **fetchDashboards** (`Function`) `[TRIVIAL]` - π Fetches dashboards for a specific environment. -- π§© **Dashboard** (`Component`) +- π§© **Dashboard** (`Component`) `[TRIVIAL]` - π Displays the list of available plugins and allows selecting one. - ποΈ Layer: UI - β¬ οΈ READS_FROM `plugins` - π DEPENDS_ON -> `frontend/src/lib/stores.js` - - Ζ **onMount** (`Function`) + - Ζ **onMount** (`Function`) `[TRIVIAL]` - π Fetch plugins when the component mounts. - - Ζ **selectPlugin** (`Function`) + - Ζ **selectPlugin** (`Function`) `[TRIVIAL]` - π Selects a plugin to display its form. -- π§© **Settings** (`Component`) +- π§© **Settings** (`Component`) `[TRIVIAL]` - π The main settings page for the application, allowing management of environments and global settings. - ποΈ Layer: UI - π Invariant: Settings changes must be saved to the backend. - β¬ οΈ READS_FROM `t` - β‘οΈ WRITES_TO `t` - π CALLS -> `api.js` - - Ζ **loadSettings** (`Function`) + - Ζ **loadSettings** (`Function`) `[TRIVIAL]` - π Loads settings from the backend. - - Ζ **handleSaveGlobal** (`Function`) + - Ζ **handleSaveGlobal** (`Function`) `[TRIVIAL]` - π Saves global settings to the backend. - - Ζ **handleAddOrUpdateEnv** (`Function`) + - Ζ **handleAddOrUpdateEnv** (`Function`) `[TRIVIAL]` - π Adds or updates an environment. - - Ζ **handleDeleteEnv** (`Function`) + - Ζ **handleDeleteEnv** (`Function`) `[TRIVIAL]` - π Deletes an environment. - - Ζ **handleTestEnv** (`Function`) + - Ζ **handleTestEnv** (`Function`) `[TRIVIAL]` - π Tests the connection to an environment. - - Ζ **editEnv** (`Function`) + - Ζ **editEnv** (`Function`) `[TRIVIAL]` - π Sets the form to edit an existing environment. - - Ζ **resetEnvForm** (`Function`) + - Ζ **resetEnvForm** (`Function`) `[TRIVIAL]` - π Resets the environment form. -- Ζ **getConnections** (`Function`) +- Ζ **getConnections** (`Function`) `[TRIVIAL]` - π Fetch a list of saved connections. -- Ζ **createConnection** (`Function`) +- Ζ **createConnection** (`Function`) `[TRIVIAL]` - π Create a new connection configuration. -- Ζ **deleteConnection** (`Function`) +- Ζ **deleteConnection** (`Function`) `[TRIVIAL]` - π Delete a connection configuration. - π¦ **GitServiceClient** (`Module`) - π API client for Git operations, managing the communication between frontend and backend. - ποΈ Layer: Service - π DEPENDS_ON -> `specs/011-git-integration-dashboard/contracts/api.md` - - π¦ **gitService** (`Action`) + - π¦ **gitService** (`Action`) `[TRIVIAL]` - π Promotes changes between branches via MR or direct merge. - Ζ **buildDashboardRepoEndpoint** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- Ζ **runTask** (`Function`) +- Ζ **runTask** (`Function`) `[TRIVIAL]` - π Start a new task for a given plugin. -- Ζ **getTaskStatus** (`Function`) +- Ζ **getTaskStatus** (`Function`) `[TRIVIAL]` - π Fetch details for a specific task (to poll status or get result). - π¦ **adminService** (`Module`) - π Service for Admin-related API calls (User and Role management). - ποΈ Layer: Service - π Invariant: All requests must include valid Admin JWT token (handled by api client). - π DEPENDS_ON -> `frontend.src.lib.api` - - Ζ **getUsers** (`Function`) + - Ζ **getUsers** (`Function`) `[TRIVIAL]` - π Fetches all registered users from the backend. - - Ζ **createUser** (`Function`) + - Ζ **createUser** (`Function`) `[TRIVIAL]` - π Creates a new local user. - - Ζ **getRoles** (`Function`) + - Ζ **getRoles** (`Function`) `[TRIVIAL]` - π Fetches all available system roles. - - Ζ **getADGroupMappings** (`Function`) + - Ζ **getADGroupMappings** (`Function`) `[TRIVIAL]` - π Fetches mappings between AD groups and local roles. - - Ζ **createADGroupMapping** (`Function`) + - Ζ **createADGroupMapping** (`Function`) `[TRIVIAL]` - π Creates or updates an AD group to Role mapping. - - Ζ **updateUser** (`Function`) + - Ζ **updateUser** (`Function`) `[TRIVIAL]` - π Updates an existing user. - - Ζ **deleteUser** (`Function`) + - Ζ **deleteUser** (`Function`) `[TRIVIAL]` - π Deletes a user. - - Ζ **createRole** (`Function`) + - Ζ **createRole** (`Function`) `[TRIVIAL]` - π Creates a new role. - - Ζ **updateRole** (`Function`) + - Ζ **updateRole** (`Function`) `[TRIVIAL]` - π Updates an existing role. - - Ζ **deleteRole** (`Function`) + - Ζ **deleteRole** (`Function`) `[TRIVIAL]` - π Deletes a role. - - Ζ **getPermissions** (`Function`) + - Ζ **getPermissions** (`Function`) `[TRIVIAL]` - π Fetches all available permissions. - - Ζ **getLoggingConfig** (`Function`) + - Ζ **getLoggingConfig** (`Function`) `[TRIVIAL]` - π Fetches current logging configuration. - - Ζ **updateLoggingConfig** (`Function`) + - Ζ **updateLoggingConfig** (`Function`) `[TRIVIAL]` - π Updates logging configuration. -- Ζ **getTasks** (`Function`) +- Ζ **getTasks** (`Function`) `[TRIVIAL]` - π Fetch a list of tasks with pagination and optional status filter. -- Ζ **getTask** (`Function`) +- Ζ **getTask** (`Function`) `[TRIVIAL]` - π Fetch details for a specific task. -- Ζ **getTaskLogs** (`Function`) +- Ζ **getTaskLogs** (`Function`) `[TRIVIAL]` - π Fetch logs for a specific task. -- Ζ **resumeTask** (`Function`) +- Ζ **resumeTask** (`Function`) `[TRIVIAL]` - π Resume a task that is awaiting input (e.g., passwords). -- Ζ **resolveTask** (`Function`) +- Ζ **resolveTask** (`Function`) `[TRIVIAL]` - π Resolve a task that is awaiting mapping. -- Ζ **clearTasks** (`Function`) +- Ζ **clearTasks** (`Function`) `[TRIVIAL]` - π Clear tasks based on status. - π¦ **storageService** (`Module`) - π Frontend API client for file storage management. - ποΈ Layer: Service - - Ζ **getStorageAuthHeaders** (`Function`) + - Ζ **getStorageAuthHeaders** (`Function`) `[TRIVIAL]` - π Returns headers with Authorization for storage API calls. - - Ζ **encodeStoragePath** (`Function`) + - Ζ **encodeStoragePath** (`Function`) `[TRIVIAL]` - π Encodes a storage-relative path preserving slash separators. - - Ζ **listFiles** (`Function`) + - Ζ **listFiles** (`Function`) `[TRIVIAL]` - π Fetches the list of files for a given category and subpath. - - Ζ **uploadFile** (`Function`) + - Ζ **uploadFile** (`Function`) `[TRIVIAL]` - π Uploads a file to the storage system. - - Ζ **deleteFile** (`Function`) + - Ζ **deleteFile** (`Function`) `[TRIVIAL]` - π Deletes a file or directory from storage. - - Ζ **downloadFileUrl** (`Function`) + - Ζ **downloadFileUrl** (`Function`) `[TRIVIAL]` - π Returns the URL for downloading a file. - - Ζ **downloadFile** (`Function`) + - Ζ **downloadFile** (`Function`) `[TRIVIAL]` - π Downloads a file using authenticated fetch and saves it in browser. -- π¦ **frontend.src.services.__tests__.gitService_test** (`Module`) +- π¦ **frontend.src.services.__tests__.gitService_test** (`Module`) `[TRIVIAL]` - π API client tests ensuring correct endpoints are called per contract - π§© **DashboardGrid** (`Component`) - π Displays a grid of dashboards with selection and pagination. @@ -1646,47 +1607,47 @@ - β‘οΈ WRITES_TO `props` - β‘οΈ WRITES_TO `state` - β‘οΈ WRITES_TO `derived` - - Ζ **handleSort** (`Function`) + - Ζ **handleSort** (`Function`) `[TRIVIAL]` - π Toggles sort direction or changes sort column. - - Ζ **handleSelectionChange** (`Function`) + - Ζ **handleSelectionChange** (`Function`) `[TRIVIAL]` - π Handles individual checkbox changes. - - Ζ **handleSelectAll** (`Function`) + - Ζ **handleSelectAll** (`Function`) `[TRIVIAL]` - π Handles select all checkbox. - - Ζ **goToPage** (`Function`) + - Ζ **goToPage** (`Function`) `[TRIVIAL]` - π Changes current page. - - Ζ **getRepositoryStatusToken** (`Function`) + - Ζ **getRepositoryStatusToken** (`Function`) `[TRIVIAL]` - π Returns normalized repository status token for a dashboard. - - Ζ **isRepositoryReady** (`Function`) + - Ζ **isRepositoryReady** (`Function`) `[TRIVIAL]` - π Determines whether git actions can run for a dashboard. - - Ζ **invalidateRepositoryStatuses** (`Function`) + - Ζ **invalidateRepositoryStatuses** (`Function`) `[TRIVIAL]` - π Marks dashboard statuses as loading so they are refetched. - - Ζ **resolveRepositoryStatusToken** (`Function`) + - Ζ **resolveRepositoryStatusToken** (`Function`) `[TRIVIAL]` - π Converts git status payload into a stable UI status token. - - Ζ **loadRepositoryStatuses** (`Function`) + - Ζ **loadRepositoryStatuses** (`Function`) `[TRIVIAL]` - π Hydrates repository status map for dashboards in repository mode. - - Ζ **runBulkGitAction** (`Function`) + - Ζ **runBulkGitAction** (`Function`) `[TRIVIAL]` - π Executes git action for selected dashboards with limited parallelism. - - Ζ **handleBulkSync** (`Function`) - - Ζ **handleBulkCommit** (`Function`) - - Ζ **handleBulkPull** (`Function`) - - Ζ **handleBulkPush** (`Function`) - - Ζ **handleBulkDelete** (`Function`) + - Ζ **handleBulkSync** (`Function`) `[TRIVIAL]` + - Ζ **handleBulkCommit** (`Function`) `[TRIVIAL]` + - Ζ **handleBulkPull** (`Function`) `[TRIVIAL]` + - Ζ **handleBulkPush** (`Function`) `[TRIVIAL]` + - Ζ **handleBulkDelete** (`Function`) `[TRIVIAL]` - π Removes selected repositories from storage and binding table. - - Ζ **handleManageSelected** (`Function`) + - Ζ **handleManageSelected** (`Function`) `[TRIVIAL]` - π Opens Git manager for exactly one selected dashboard. - - Ζ **resolveDashboardRef** (`Function`) + - Ζ **resolveDashboardRef** (`Function`) `[TRIVIAL]` - π Resolves dashboard slug from payload fields. - - Ζ **openGitManagerForDashboard** (`Function`) + - Ζ **openGitManagerForDashboard** (`Function`) `[TRIVIAL]` - π Opens Git manager for provided dashboard metadata. - - Ζ **handleInitializeRepositories** (`Function`) + - Ζ **handleInitializeRepositories** (`Function`) `[TRIVIAL]` - π Opens Git manager from bulk actions to initialize selected repository. - - Ζ **getSortStatusValue** (`Function`) + - Ζ **getSortStatusValue** (`Function`) `[TRIVIAL]` - π Returns sort value for status column based on mode. - - Ζ **getStatusLabel** (`Function`) + - Ζ **getStatusLabel** (`Function`) `[TRIVIAL]` - π Returns localized label for status column. - - Ζ **getStatusBadgeClass** (`Function`) + - Ζ **getStatusBadgeClass** (`Function`) `[TRIVIAL]` - π Returns badge style for status column. -- π§© **PasswordPrompt** (`Component`) +- π§© **PasswordPrompt** (`Component`) `[TRIVIAL]` - π A modal component to prompt the user for database passwords when a migration task is paused. - ποΈ Layer: UI - β‘οΈ WRITES_TO `props` @@ -1694,11 +1655,11 @@ - β¬ οΈ READS_FROM `effect` - π BINDS_TO -> `onresume` - π BINDS_TO -> `oncancel` - - Ζ **handleSubmit** (`Function`) + - Ζ **handleSubmit** (`Function`) `[TRIVIAL]` - π Validates and forwards passwords to resume the task. - - Ζ **handleCancel** (`Function`) + - Ζ **handleCancel** (`Function`) `[TRIVIAL]` - π Cancels the password prompt. -- π§© **MappingTable** (`Component`) +- π§© **MappingTable** (`Component`) `[TRIVIAL]` - π Displays and allows editing of database mappings. - ποΈ Layer: Feature - π Invariant: Each source database can be mapped to one target database. @@ -1706,9 +1667,9 @@ - β‘οΈ WRITES_TO `props` - β‘οΈ WRITES_TO `t` - π BINDS_TO -> `mappings state` - - Ζ **updateMapping** (`Function`) + - Ζ **updateMapping** (`Function`) `[TRIVIAL]` - π Updates a mapping for a specific source database. - - Ζ **getSuggestion** (`Function`) + - Ζ **getSuggestion** (`Function`) `[TRIVIAL]` - π Finds a suggestion for a source database. - π§© **TaskLogViewer** (`Component`) - π Displays detailed logs for a specific task inline or in a modal using TaskLogPanel. @@ -1717,24 +1678,24 @@ - β‘οΈ WRITES_TO `bindable` - β‘οΈ WRITES_TO `props` - β‘οΈ WRITES_TO `state` - - π¦ **handleRealTimeLogs** (`Action`) + - π¦ **handleRealTimeLogs** (`Action`) `[TRIVIAL]` - π Sync real-time logs to the current log list - - Ζ **fetchLogs** (`Function`) + - Ζ **fetchLogs** (`Function`) `[TRIVIAL]` - π Fetches logs for a given task ID - - Ζ **handleFilterChange** (`Function`) + - Ζ **handleFilterChange** (`Function`) `[TRIVIAL]` - π Updates filter conditions for the log viewer - - Ζ **handleRefresh** (`Function`) + - Ζ **handleRefresh** (`Function`) `[TRIVIAL]` - π Refreshes the logs by polling the API - - π§© **showInline** (`Component`) + - π§© **showInline** (`Component`) `[TRIVIAL]` - π Shows inline logs --> - ποΈ Layer: UI --> - - π§© **showModal** (`Component`) + - π§© **showModal** (`Component`) `[TRIVIAL]` - π Shows modal logs --> - ποΈ Layer: UI --> - π§© **Footer** (`Component`) `[TRIVIAL]` - π Displays the application footer with copyright information. - ποΈ Layer: UI -- π§© **MissingMappingModal** (`Component`) +- π§© **MissingMappingModal** (`Component`) `[TRIVIAL]` - π Prompts the user to provide a database mapping when one is missing during migration. - ποΈ Layer: Feature - π Invariant: Modal blocks migration progress until resolved or cancelled. @@ -1742,9 +1703,9 @@ - β‘οΈ WRITES_TO `state` - π BINDS_TO -> `onresolve` - π BINDS_TO -> `oncancel` - - Ζ **resolve** (`Function`) + - Ζ **resolve** (`Function`) `[TRIVIAL]` - π Resolves the missing mapping via callback prop. - - Ζ **cancel** (`Function`) + - Ζ **cancel** (`Function`) `[TRIVIAL]` - π Cancels the mapping resolution modal. - π§© **DashboardGrid** (`Component`) - π Displays a grid of dashboards with selection and pagination. @@ -1753,17 +1714,17 @@ - β‘οΈ WRITES_TO `props` - β‘οΈ WRITES_TO `state` - β‘οΈ WRITES_TO `derived` - - Ζ **handleValidate** (`Function`) + - Ζ **handleValidate** (`Function`) `[TRIVIAL]` - π Triggers dashboard validation task. - - Ζ **handleSort** (`Function`) + - Ζ **handleSort** (`Function`) `[TRIVIAL]` - π Toggles sort direction or changes sort column. - - Ζ **handleSelectionChange** (`Function`) + - Ζ **handleSelectionChange** (`Function`) `[TRIVIAL]` - π Handles individual checkbox changes. - - Ζ **handleSelectAll** (`Function`) + - Ζ **handleSelectAll** (`Function`) `[TRIVIAL]` - π Handles select all checkbox. - - Ζ **goToPage** (`Function`) + - Ζ **goToPage** (`Function`) `[TRIVIAL]` - π Changes current page. - - Ζ **openGit** (`Function`) + - Ζ **openGit** (`Function`) `[TRIVIAL]` - π Opens the Git management modal for a dashboard. - π§© **Navbar** (`Component`) - π Main navigation bar for the application. @@ -1776,23 +1737,23 @@ - ποΈ Layer: Unknown - Ζ **handleLogout** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- π§© **TaskHistory** (`Component`) +- π§© **TaskHistory** (`Component`) `[TRIVIAL]` - π Displays a list of recent tasks with their status and allows selecting them for viewing logs. - ποΈ Layer: UI - β¬ οΈ READS_FROM `selectedTask` - β‘οΈ WRITES_TO `selectedTask` - β¬ οΈ READS_FROM `t` - - Ζ **fetchTasks** (`Function`) + - Ζ **fetchTasks** (`Function`) `[TRIVIAL]` - π Fetches the list of recent tasks from the API. - - Ζ **clearTasks** (`Function`) + - Ζ **clearTasks** (`Function`) `[TRIVIAL]` - π Clears tasks from the history, optionally filtered by status. - - Ζ **selectTask** (`Function`) + - Ζ **selectTask** (`Function`) `[TRIVIAL]` - π Selects a task and fetches its full details. - - Ζ **getStatusColor** (`Function`) + - Ζ **getStatusColor** (`Function`) `[TRIVIAL]` - π Returns the CSS color class for a given task status. - - Ζ **onMount** (`Function`) + - Ζ **onMount** (`Function`) `[TRIVIAL]` - π Initializes the component by fetching tasks and starting polling. - - Ζ **onDestroy** (`Function`) + - Ζ **onDestroy** (`Function`) `[TRIVIAL]` - π Cleans up the polling interval when the component is destroyed. - π§© **Toast** (`Component`) `[TRIVIAL]` - π Displays transient notifications (toasts) in the bottom-right corner. @@ -1806,52 +1767,52 @@ - β¬ οΈ READS_FROM `selectedTask` - β‘οΈ WRITES_TO `t` - π DEPENDS_ON -> `frontend/src/lib/stores.js, frontend/src/components/tasks/TaskLogPanel.svelte` - - Ζ **connect** (`Function`) + - Ζ **connect** (`Function`) `[TRIVIAL]` - π Establishes WebSocket connection with exponential backoff and filter parameters. - - Ζ **handleFilterChange** (`Function`) + - Ζ **handleFilterChange** (`Function`) `[TRIVIAL]` - π Handles filter changes and reconnects WebSocket with new parameters. - - Ζ **fetchTargetDatabases** (`Function`) + - Ζ **fetchTargetDatabases** (`Function`) `[TRIVIAL]` - π Fetches available databases from target environment for mapping. - - Ζ **handleMappingResolve** (`Function`) + - Ζ **handleMappingResolve** (`Function`) `[TRIVIAL]` - π Resolves missing database mapping and continues migration. - - Ζ **handlePasswordResume** (`Function`) + - Ζ **handlePasswordResume** (`Function`) `[TRIVIAL]` - π Submits passwords and resumes paused migration task. - - Ζ **startDataTimeout** (`Function`) + - Ζ **startDataTimeout** (`Function`) `[TRIVIAL]` - π Starts timeout timer to detect idle connection. - - Ζ **resetDataTimeout** (`Function`) + - Ζ **resetDataTimeout** (`Function`) `[TRIVIAL]` - π Resets data timeout timer when new data arrives. - - Ζ **onMount** (`Function`) + - Ζ **onMount** (`Function`) `[TRIVIAL]` - π Initializes WebSocket connection when component mounts. - - Ζ **onDestroy** (`Function`) -- π§© **TaskList** (`Component`) + - Ζ **onDestroy** (`Function`) `[TRIVIAL]` +- π§© **TaskList** (`Component`) `[TRIVIAL]` - π Displays a list of tasks with their status and execution details. - ποΈ Layer: Component - β‘οΈ WRITES_TO `props` - β‘οΈ WRITES_TO `t` - β¬ οΈ READS_FROM `t` - - Ζ **getStatusColor** (`Function`) + - Ζ **getStatusColor** (`Function`) `[TRIVIAL]` - π Returns the CSS color class for a given task status. - - Ζ **formatTime** (`Function`) + - Ζ **formatTime** (`Function`) `[TRIVIAL]` - π Formats a date string using date-fns. - - Ζ **handleTaskClick** (`Function`) + - Ζ **handleTaskClick** (`Function`) `[TRIVIAL]` - π Forwards the selected task through a callback prop. -- π§© **DynamicForm** (`Component`) +- π§© **DynamicForm** (`Component`) `[TRIVIAL]` - π Generates a form dynamically based on a JSON schema. - ποΈ Layer: UI - β‘οΈ WRITES_TO `props` - π BINDS_TO -> `onsubmit callback` - - Ζ **handleSubmit** (`Function`) + - Ζ **handleSubmit** (`Function`) `[TRIVIAL]` - π Emits submitted form data via callback prop. - - Ζ **initializeForm** (`Function`) + - Ζ **initializeForm** (`Function`) `[TRIVIAL]` - π Initialize form data with default values from the schema. -- π§© **EnvSelector** (`Component`) +- π§© **EnvSelector** (`Component`) `[TRIVIAL]` - π Provides a UI component for selecting source and target environments. - ποΈ Layer: Feature - π Invariant: Source and target environments must be selectable from the list of configured environments. - β‘οΈ WRITES_TO `props` - β‘οΈ WRITES_TO `t` - π BINDS_TO -> `environments store` - - Ζ **handleSelect** (`Function`) + - Ζ **handleSelect** (`Function`) `[TRIVIAL]` - π Propagates the selection change through a callback prop. - π§© **StartupEnvironmentWizard** (`Component`) - π Blocking startup wizard for creating the first Superset environment from zero-state screens. @@ -1889,9 +1850,9 @@ - π CALLS -> `$app/navigation.goto` - π DEPENDS_ON -> `$lib/auth/permissions.hasPermission` - π CALLS -> `frontend.src.lib.api.api.fetchApi` - - π§© **ProtectedRoute** (`Component`) + - π§© **ProtectedRoute** (`Component`) `[TRIVIAL]` - π Wraps protected slot content with session and permission verification guards. - - Ζ **verifySessionAndAccess** (`Function`) + - Ζ **verifySessionAndAccess** (`Function`) `[TRIVIAL]` - π Validates session and optional permission gate before allowing protected content render. - π§© **TaskLogPanel** (`Component`) - π Combines log filtering and display into a single cohesive dark-themed panel. @@ -1933,7 +1894,7 @@ - ποΈ Layer: UI - β‘οΈ WRITES_TO `props` - β‘οΈ WRITES_TO `derived` - - Ζ **formatTime** (`Function`) + - Ζ **formatTime** (`Function`) `[TRIVIAL]` - π Format ISO timestamp to HH:MM:SS */ - π¦ **TaskResultPanel** (`Module`) `[TRIVIAL]` - π Auto-generated module for frontend/src/components/tasks/TaskResultPanel.svelte @@ -1951,13 +1912,13 @@ - β‘οΈ WRITES_TO `t` - β¬ οΈ READS_FROM `t` - π DEPENDS_ON -> `storageService` - - Ζ **isDirectory** (`Function`) + - Ζ **isDirectory** (`Function`) `[TRIVIAL]` - π Checks if a file object represents a directory. - - Ζ **formatSize** (`Function`) + - Ζ **formatSize** (`Function`) `[TRIVIAL]` - π Formats file size in bytes into a human-readable string. - - Ζ **formatDate** (`Function`) + - Ζ **formatDate** (`Function`) `[TRIVIAL]` - π Formats an ISO date string into a localized readable format. - - Ζ **handleDownload** (`Function`) + - Ζ **handleDownload** (`Function`) `[TRIVIAL]` - π Downloads selected file through authenticated API request. - π§© **FileUpload** (`Component`) - π Provides a form for uploading files to a specific category. @@ -1966,69 +1927,69 @@ - β‘οΈ WRITES_TO `state` - β¬ οΈ READS_FROM `t` - π DEPENDS_ON -> `storageService` - - Ζ **handleUpload** (`Function`) + - Ζ **handleUpload** (`Function`) `[TRIVIAL]` - π Handles the file upload process. - - Ζ **handleDrop** (`Function`) + - Ζ **handleDrop** (`Function`) `[TRIVIAL]` - π Handles the file drop event for drag-and-drop. -- π§© **ConnectionForm** (`Component`) +- π§© **ConnectionForm** (`Component`) `[TRIVIAL]` - π UI component for creating a new database connection configuration. - ποΈ Layer: UI - β‘οΈ WRITES_TO `props` - β‘οΈ WRITES_TO `state` - β¬ οΈ READS_FROM `t` - - Ζ **handleSubmit** (`Function`) + - Ζ **handleSubmit** (`Function`) `[TRIVIAL]` - π Submits the connection form to the backend. - - Ζ **resetForm** (`Function`) + - Ζ **resetForm** (`Function`) `[TRIVIAL]` - π Resets the connection form fields to their default values. -- π§© **ConnectionList** (`Component`) +- π§© **ConnectionList** (`Component`) `[TRIVIAL]` - π UI component for listing and deleting saved database connection configurations. - ποΈ Layer: UI - β‘οΈ WRITES_TO `state` - β¬ οΈ READS_FROM `t` - β‘οΈ WRITES_TO `t` - - Ζ **fetchConnections** (`Function`) + - Ζ **fetchConnections** (`Function`) `[TRIVIAL]` - π Fetches the list of connections from the backend. - - Ζ **handleDelete** (`Function`) + - Ζ **handleDelete** (`Function`) `[TRIVIAL]` - π Deletes a connection configuration. -- π§© **MapperTool** (`Component`) +- π§© **MapperTool** (`Component`) `[TRIVIAL]` - π UI component for mapping dataset column verbose names using the MapperPlugin. - ποΈ Layer: UI - β¬ οΈ READS_FROM `t` - β‘οΈ WRITES_TO `t` - - Ζ **fetchData** (`Function`) + - Ζ **fetchData** (`Function`) `[TRIVIAL]` - π Fetches environments and saved connections. - - Ζ **handleRunMapper** (`Function`) + - Ζ **handleRunMapper** (`Function`) `[TRIVIAL]` - π Triggers the MapperPlugin task. - - Ζ **handleGenerateDocs** (`Function`) + - Ζ **handleGenerateDocs** (`Function`) `[TRIVIAL]` - π Triggers the LLM Documentation task. - π¦ **MapperTool** (`Module`) `[TRIVIAL]` - π Auto-generated module for frontend/src/components/tools/MapperTool.svelte - ποΈ Layer: Unknown - Ζ **handleApplyDoc** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- π§© **DebugTool** (`Component`) +- π§© **DebugTool** (`Component`) `[TRIVIAL]` - π UI component for system diagnostics and debugging API responses. - ποΈ Layer: UI - β¬ οΈ READS_FROM `t` - β‘οΈ WRITES_TO `t` - - Ζ **fetchEnvironments** (`Function`) + - Ζ **fetchEnvironments** (`Function`) `[TRIVIAL]` - π Fetches available environments. - - Ζ **handleRunDebug** (`Function`) + - Ζ **handleRunDebug** (`Function`) `[TRIVIAL]` - π Triggers the debug task. - - Ζ **startPolling** (`Function`) + - Ζ **startPolling** (`Function`) `[TRIVIAL]` - π Polls for task completion. -- π§© **CommitHistory** (`Component`) +- π§© **CommitHistory** (`Component`) `[TRIVIAL]` - π Displays the commit history for a specific dashboard. - ποΈ Layer: Component - β‘οΈ WRITES_TO `props` - β‘οΈ WRITES_TO `state` - β¬ οΈ READS_FROM `t` - π CALLS -> `gitService.getHistory` - - Ζ **onMount** (`Function`) + - Ζ **onMount** (`Function`) `[TRIVIAL]` - π Load history when component is mounted. - - Ζ **loadHistory** (`Function`) + - Ζ **loadHistory** (`Function`) `[TRIVIAL]` - π Fetch commit history from the backend. -- π§© **DeploymentModal** (`Component`) +- π§© **DeploymentModal** (`Component`) `[TRIVIAL]` - π Modal for deploying a dashboard to a target environment. - ποΈ Layer: Component - π Invariant: Cannot deploy without a selected environment. @@ -2037,16 +1998,16 @@ - β‘οΈ WRITES_TO `state` - π CALLS -> `frontend/src/services/gitService.js` - π DISPATCHES -> `deploy` - - π¦ **loadStatus** (`Watcher`) - - Ζ **normalizeEnvStage** (`Function`) + - π¦ **loadStatus** (`Watcher`) `[TRIVIAL]` + - Ζ **normalizeEnvStage** (`Function`) `[TRIVIAL]` - π Normalize environment stage with legacy production fallback. - - Ζ **resolveEnvUrl** (`Function`) + - Ζ **resolveEnvUrl** (`Function`) `[TRIVIAL]` - π Resolve environment URL from consolidated or git-specific payload shape. - - Ζ **loadEnvironments** (`Function`) + - Ζ **loadEnvironments** (`Function`) `[TRIVIAL]` - π Fetch available environments from API. - - Ζ **handleDeploy** (`Function`) + - Ζ **handleDeploy** (`Function`) `[TRIVIAL]` - π Trigger deployment to selected environment. -- π§© **ConflictResolver** (`Component`) +- π§© **ConflictResolver** (`Component`) `[TRIVIAL]` - π UI for resolving merge conflicts (Keep Mine / Keep Theirs). - ποΈ Layer: Component - π Invariant: User must resolve all conflicts before saving. @@ -2054,9 +2015,9 @@ - β‘οΈ WRITES_TO `props` - β‘οΈ WRITES_TO `state` - π BINDS_TO -> `onresolve` - - Ζ **resolve** (`Function`) + - Ζ **resolve** (`Function`) `[TRIVIAL]` - π Set resolution strategy for a file. - - Ζ **handleSave** (`Function`) + - Ζ **handleSave** (`Function`) `[TRIVIAL]` - π Validate and submit resolutions. - π§© **CommitModal** (`Component`) - π ΠΠΎΠ΄Π°Π»ΡΠ½ΠΎΠ΅ ΠΎΠΊΠ½ΠΎ Π΄Π»Ρ ΡΠΎΠ·Π΄Π°Π½ΠΈΡ ΠΊΠΎΠΌΠΌΠΈΡΠ° Ρ ΠΏΡΠΎΡΠΌΠΎΡΡΠΎΠΌ ΠΈΠ·ΠΌΠ΅Π½Π΅Π½ΠΈΠΉ (diff). @@ -2068,13 +2029,13 @@ - π CALLS -> `gitService.getStatus` - π CALLS -> `gitService.getDiff` - π DISPATCHES -> `commit` - - Ζ **handleGenerateMessage** (`Function`) + - Ζ **handleGenerateMessage** (`Function`) `[TRIVIAL]` - π Generates a commit message using LLM. - - Ζ **loadStatus** (`Function`) + - Ζ **loadStatus** (`Function`) `[TRIVIAL]` - π ΠΠ°Π³ΡΡΠΆΠ°Π΅Ρ ΡΠ΅ΠΊΡΡΠΈΠΉ ΡΡΠ°ΡΡΡ ΡΠ΅ΠΏΠΎΠ·ΠΈΡΠΎΡΠΈΡ ΠΈ diff. - - Ζ **handleCommit** (`Function`) + - Ζ **handleCommit** (`Function`) `[TRIVIAL]` - π Π‘ΠΎΠ·Π΄Π°Π΅Ρ ΠΊΠΎΠΌΠΌΠΈΡ Ρ ΡΠΊΠ°Π·Π°Π½Π½ΡΠΌ ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΠ΅ΠΌ. -- π§© **BranchSelector** (`Component`) +- π§© **BranchSelector** (`Component`) `[TRIVIAL]` - π UI Π΄Π»Ρ Π²ΡΠ±ΠΎΡΠ° ΠΈ ΡΠΎΠ·Π΄Π°Π½ΠΈΡ Π²Π΅ΡΠΎΠΊ Git. - ποΈ Layer: Component - β‘οΈ WRITES_TO `bindable` @@ -2084,70 +2045,70 @@ - π CALLS -> `gitService.checkoutBranch` - π CALLS -> `gitService.createBranch` - π BINDS_TO -> `onchange` - - Ζ **onMount** (`Function`) + - Ζ **onMount** (`Function`) `[TRIVIAL]` - π Load branches when component is mounted. - - Ζ **loadBranches** (`Function`) + - Ζ **loadBranches** (`Function`) `[TRIVIAL]` - π ΠΠ°Π³ΡΡΠΆΠ°Π΅Ρ ΡΠΏΠΈΡΠΎΠΊ Π²Π΅ΡΠΎΠΊ Π΄Π»Ρ Π΄Π°ΡΠ±ΠΎΡΠ΄Π°. - - Ζ **handleSelect** (`Function`) + - Ζ **handleSelect** (`Function`) `[TRIVIAL]` - π Handles branch selection from dropdown. - - Ζ **handleCheckout** (`Function`) + - Ζ **handleCheckout** (`Function`) `[TRIVIAL]` - π ΠΠ΅ΡΠ΅ΠΊΠ»ΡΡΠ°Π΅Ρ ΡΠ΅ΠΊΡΡΡΡ Π²Π΅ΡΠΊΡ. - - Ζ **handleCreate** (`Function`) + - Ζ **handleCreate** (`Function`) `[TRIVIAL]` - π Π‘ΠΎΠ·Π΄Π°Π΅Ρ Π½ΠΎΠ²ΡΡ Π²Π΅ΡΠΊΡ. -- π§© **GitManager** (`Component`) +- π§© **GitManager** (`Component`) `[TRIVIAL]` - π Π¦Π΅Π½ΡΡΠ°Π»ΡΠ½ΡΠΉ UI ΡΠΏΡΠ°Π²Π»Π΅Π½ΠΈΡ Git Ρ ΡΠΎΠΊΡΡΠΎΠΌ Π½Π° ΡΠ°Π±ΠΎΡΠΈΠΉ ΠΏΠΎΡΠΎΠΊ Π°Π½Π°Π»ΠΈΡΠΈΠΊΠ° (commit -> promote -> deploy). - ποΈ Layer: Component - β‘οΈ WRITES_TO `bindable` - β‘οΈ WRITES_TO `props` - β‘οΈ WRITES_TO `state` - π CALLS -> `gitService` - - Ζ **normalizeEnvStage** (`Function`) + - Ζ **normalizeEnvStage** (`Function`) `[TRIVIAL]` - π Normalize environment stage with legacy fallback. - - Ζ **stageBadgeClass** (`Function`) + - Ζ **stageBadgeClass** (`Function`) `[TRIVIAL]` - π Return visual class for environment stage badges. - - Ζ **resolveCurrentEnvironmentId** (`Function`) + - Ζ **resolveCurrentEnvironmentId** (`Function`) `[TRIVIAL]` - π Resolve active environment id for current dashboard session. - - Ζ **applyGitflowStageDefaults** (`Function`) + - Ζ **applyGitflowStageDefaults** (`Function`) `[TRIVIAL]` - π Apply GitFlow defaults by current environment stage. - - Ζ **loadCurrentEnvironmentStage** (`Function`) + - Ζ **loadCurrentEnvironmentStage** (`Function`) `[TRIVIAL]` - π Detect current environment stage and bind GitFlow defaults. - - Ζ **isNumericDashboardRef** (`Function`) + - Ζ **isNumericDashboardRef** (`Function`) `[TRIVIAL]` - π Checks whether current dashboard reference is numeric ID. - - Ζ **checkStatus** (`Function`) + - Ζ **checkStatus** (`Function`) `[TRIVIAL]` - π Verify repository initialization for dashboard slug. - - Ζ **loadWorkspace** (`Function`) + - Ζ **loadWorkspace** (`Function`) `[TRIVIAL]` - π Load current git status and combined diff for workspace tab. - - Ζ **handleSync** (`Function`) + - Ζ **handleSync** (`Function`) `[TRIVIAL]` - π Sync latest dashboard config from Superset to git workspace. - - Ζ **handleGenerateMessage** (`Function`) + - Ζ **handleGenerateMessage** (`Function`) `[TRIVIAL]` - π Generate commit message from diff using LLM. - - Ζ **handleCommit** (`Function`) + - Ζ **handleCommit** (`Function`) `[TRIVIAL]` - π Commit current workspace changes with provided message. - - Ζ **handlePull** (`Function`) + - Ζ **handlePull** (`Function`) `[TRIVIAL]` - π Pull remote changes for current branch. - - Ζ **handlePush** (`Function`) + - Ζ **handlePush** (`Function`) `[TRIVIAL]` - π Push local commits to remote repository. - - Ζ **handlePromote** (`Function`) + - Ζ **handlePromote** (`Function`) `[TRIVIAL]` - π Promote branch to the next stage via MR or unsafe direct mode. - - Ζ **openDeployModal** (`Function`) + - Ζ **openDeployModal** (`Function`) `[TRIVIAL]` - π Open deploy modal with extra confirmation for PROD context. - - Ζ **getSelectedConfig** (`Function`) + - Ζ **getSelectedConfig** (`Function`) `[TRIVIAL]` - π Return currently selected git server config. - - Ζ **resolveDefaultConfig** (`Function`) + - Ζ **resolveDefaultConfig** (`Function`) `[TRIVIAL]` - π Resolve default git config for current session. - - Ζ **resolvePushProviderLabel** (`Function`) + - Ζ **resolvePushProviderLabel** (`Function`) `[TRIVIAL]` - π Resolve lower-case provider label for auto-push checkbox. - - Ζ **extractHttpHost** (`Function`) + - Ζ **extractHttpHost** (`Function`) `[TRIVIAL]` - π Extract comparable host[:port] from URL string. - - Ζ **buildSuggestedRepoName** (`Function`) + - Ζ **buildSuggestedRepoName** (`Function`) `[TRIVIAL]` - π Build deterministic repository name from dashboard title/id. - - Ζ **handleCreateRemoteRepo** (`Function`) + - Ζ **handleCreateRemoteRepo** (`Function`) `[TRIVIAL]` - π Create remote repository on selected Git provider. - - Ζ **handleInit** (`Function`) + - Ζ **handleInit** (`Function`) `[TRIVIAL]` - π Initialize git repository for dashboard. - - Ζ **closeModal** (`Function`) + - Ζ **closeModal** (`Function`) `[TRIVIAL]` - π Close git manager modal. - - Ζ **handleBackdropClick** (`Function`) + - Ζ **handleBackdropClick** (`Function`) `[TRIVIAL]` - π Close modal on backdrop click. - π¦ **GitManager** (`Module`) `[TRIVIAL]` - π Auto-generated module for frontend/src/components/git/GitManager.svelte @@ -2224,58 +2185,60 @@ - π Invariant: Edit action keeps explicit click handler and opens normalized edit form. - Ζ **provider_config_edit_contract_tests** (`Function`) - π Validate edit and delete handler wiring plus normalized edit form state mapping. -- π¦ **backend.delete_running_tasks** (`Module`) +- π¦ **backend.delete_running_tasks** (`Module`) `[TRIVIAL]` - π Script to delete tasks with RUNNING status from the database. - ποΈ Layer: Utility - - Ζ **delete_running_tasks** (`Function`) + - Ζ **delete_running_tasks** (`Function`) `[TRIVIAL]` - π Delete all tasks with RUNNING status from the database. - π¦ **AppModule** (`Module`) `[CRITICAL]` - π 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) - π Invariant: All WebSocket connections must be properly cleaned up on disconnect. - - π¦ **App** (`Global`) + - π DEPENDS_ON -> `backend.src.dependencies` + - π DEPENDS_ON -> `backend.src.api.routes` + - π¦ **App** (`Global`) `[TRIVIAL]` - π The global FastAPI application instance. - Ζ **startup_event** (`Function`) - π Handles application startup tasks, such as starting the scheduler. - Ζ **shutdown_event** (`Function`) - π Handles application shutdown tasks, such as stopping the scheduler. - - Ζ **network_error_handler** (`Function`) + - Ζ **network_error_handler** (`Function`) `[TRIVIAL]` - π Global exception handler for NetworkError. - Ζ **log_requests** (`Function`) - π Middleware to log incoming HTTP requests and their response status. - - π¦ **api.include_routers** (`Action`) + - π¦ **api.include_routers** (`Action`) `[TRIVIAL]` - π Registers all API routers with the FastAPI application. - ποΈ Layer: API - Ζ **websocket_endpoint** (`Function`) `[CRITICAL]` - π Provides a WebSocket endpoint for real-time log streaming of a task with server-side filtering. - - π¦ **StaticFiles** (`Mount`) + - π¦ **StaticFiles** (`Mount`) `[TRIVIAL]` - π Mounts the frontend build directory to serve static assets. - - Ζ **serve_spa** (`Function`) + - Ζ **serve_spa** (`Function`) `[TRIVIAL]` - π Serves the SPA frontend for any path not matched by API routes. - - Ζ **read_root** (`Function`) + - Ζ **read_root** (`Function`) `[TRIVIAL]` - π A simple root endpoint to confirm that the API is running when frontend is missing. - Ζ **matches_filters** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- π¦ **Dependencies** (`Module`) +- π¦ **backend.src.dependencies** (`Module`) - π Manages creation and provision of shared application dependencies, such as PluginLoader and TaskManager, to avoid circular imports. - ποΈ Layer: Core - - Ζ **get_config_manager** (`Function`) + - Ζ **get_config_manager** (`Function`) `[TRIVIAL]` - π Dependency injector for ConfigManager. - - Ζ **get_plugin_loader** (`Function`) + - Ζ **get_plugin_loader** (`Function`) `[TRIVIAL]` - π Dependency injector for PluginLoader. - - Ζ **get_task_manager** (`Function`) + - Ζ **get_task_manager** (`Function`) `[TRIVIAL]` - π Dependency injector for TaskManager. - - Ζ **get_scheduler_service** (`Function`) + - Ζ **get_scheduler_service** (`Function`) `[TRIVIAL]` - π Dependency injector for SchedulerService. - - Ζ **get_resource_service** (`Function`) + - Ζ **get_resource_service** (`Function`) `[TRIVIAL]` - π Dependency injector for ResourceService. - - Ζ **get_mapping_service** (`Function`) + - Ζ **get_mapping_service** (`Function`) `[TRIVIAL]` - π Dependency injector for MappingService. - - Ζ **get_clean_release_repository** (`Function`) + - Ζ **get_clean_release_repository** (`Function`) `[TRIVIAL]` - π Legacy compatibility shim for CleanReleaseRepository. - - Ζ **get_clean_release_facade** (`Function`) + - Ζ **get_clean_release_facade** (`Function`) `[TRIVIAL]` - π Dependency injector for CleanReleaseFacade. - - π¦ **oauth2_scheme** (`Variable`) + - π¦ **oauth2_scheme** (`Variable`) `[TRIVIAL]` - π OAuth2 password bearer scheme for token extraction. - Ζ **get_current_user** (`Function`) - π Dependency for retrieving currently authenticated user from a JWT. @@ -2283,27 +2246,27 @@ - π Dependency for checking if the current user has a specific permission. - Ζ **permission_checker** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- π¦ **src** (`Package`) +- π¦ **src** (`Package`) `[TRIVIAL]` - π Canonical backend package root for application, scripts, and tests. - π¦ **backend.src.scripts.seed_superset_load_test** (`Module`) - π Creates randomized load-test data in Superset by cloning chart configurations and creating dashboards in target environments. - ποΈ Layer: Scripts - π Invariant: Created chart and dashboard names are globally unique for one script run. - - Ζ **_parse_args** (`Function`) + - Ζ **_parse_args** (`Function`) `[TRIVIAL]` - π Parses CLI arguments for load-test data generation. - - Ζ **_extract_result_payload** (`Function`) + - Ζ **_extract_result_payload** (`Function`) `[TRIVIAL]` - π Normalizes Superset API payloads that may be wrapped in `result`. - - Ζ **_extract_created_id** (`Function`) + - Ζ **_extract_created_id** (`Function`) `[TRIVIAL]` - π Extracts object ID from create/update API response. - - Ζ **_generate_unique_name** (`Function`) + - Ζ **_generate_unique_name** (`Function`) `[TRIVIAL]` - π Generates globally unique random names for charts/dashboards. - - Ζ **_resolve_target_envs** (`Function`) + - Ζ **_resolve_target_envs** (`Function`) `[TRIVIAL]` - π Resolves requested environment IDs from configuration. - - Ζ **_build_chart_template_pool** (`Function`) + - Ζ **_build_chart_template_pool** (`Function`) `[TRIVIAL]` - π Builds a pool of source chart templates to clone in one environment. - - Ζ **seed_superset_load_data** (`Function`) + - Ζ **seed_superset_load_data** (`Function`) `[TRIVIAL]` - π Creates dashboards and cloned charts for load testing across target environments. - - Ζ **main** (`Function`) + - Ζ **main** (`Function`) `[TRIVIAL]` - π CLI entrypoint for Superset load-test data seeding. - π¦ **test_dataset_dashboard_relations** (`Module`) `[TRIVIAL]` - π Auto-generated module for backend/src/scripts/test_dataset_dashboard_relations.py @@ -2316,11 +2279,11 @@ - π Invariant: TUI refuses startup in non-TTY environments; headless flow is CLI/API only. - π DEPENDS_ON -> `backend.src.services.clean_release.compliance_orchestrator` - π DEPENDS_ON -> `backend.src.services.clean_release.repository` - - β **TuiFacadeAdapter** (`Class`) + - β **TuiFacadeAdapter** (`Class`) `[TRIVIAL]` - π Thin TUI adapter that routes business mutations through application services. - - β **CleanReleaseTUI** (`Class`) + - β **CleanReleaseTUI** (`Class`) `[TRIVIAL]` - π Curses-based application for compliance monitoring. - - Ζ **run_checks** (`Function`) + - Ζ **run_checks** (`Function`) `[TRIVIAL]` - π Execute compliance run via facade adapter and update UI state. - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -2380,99 +2343,99 @@ - π Migrates legacy config and task history from SQLite/file storage to PostgreSQL. - ποΈ Layer: Scripts - π Invariant: Script is idempotent for task_records and app_configurations. - - π¦ **Constants** (`Section`) + - π¦ **Constants** (`Section`) `[TRIVIAL]` - Ζ **_json_load_if_needed** (`Function`) - π Parses JSON-like values from SQLite TEXT/JSON columns to Python objects. - - Ζ **_find_legacy_config_path** (`Function`) + - Ζ **_find_legacy_config_path** (`Function`) `[TRIVIAL]` - π Resolves the existing legacy config.json path from candidates. - - Ζ **_connect_sqlite** (`Function`) + - Ζ **_connect_sqlite** (`Function`) `[TRIVIAL]` - π Opens a SQLite connection with row factory. - - Ζ **_ensure_target_schema** (`Function`) + - Ζ **_ensure_target_schema** (`Function`) `[TRIVIAL]` - π Ensures required PostgreSQL tables exist before migration. - - Ζ **_migrate_config** (`Function`) + - Ζ **_migrate_config** (`Function`) `[TRIVIAL]` - π Migrates legacy config.json into app_configurations(global). - - Ζ **_migrate_tasks_and_logs** (`Function`) + - Ζ **_migrate_tasks_and_logs** (`Function`) `[TRIVIAL]` - π Migrates task_records and task_logs from SQLite into PostgreSQL. - - Ζ **run_migration** (`Function`) + - Ζ **run_migration** (`Function`) `[TRIVIAL]` - π Orchestrates migration from SQLite/file to PostgreSQL. - - Ζ **main** (`Function`) + - Ζ **main** (`Function`) `[TRIVIAL]` - π CLI entrypoint. - π¦ **backend.src.scripts.clean_release_cli** (`Module`) - π Provide headless CLI commands for candidate registration, artifact import and manifest build. - ποΈ Layer: Scripts - - Ζ **build_parser** (`Function`) + - Ζ **build_parser** (`Function`) `[TRIVIAL]` - π Build argparse parser for clean release CLI. - - Ζ **run_candidate_register** (`Function`) + - Ζ **run_candidate_register** (`Function`) `[TRIVIAL]` - π Register candidate in repository via CLI command. - - Ζ **run_artifact_import** (`Function`) + - Ζ **run_artifact_import** (`Function`) `[TRIVIAL]` - π Import single artifact for existing candidate. - - Ζ **run_manifest_build** (`Function`) + - Ζ **run_manifest_build** (`Function`) `[TRIVIAL]` - π Build immutable manifest snapshot for candidate. - - Ζ **run_compliance_run** (`Function`) + - Ζ **run_compliance_run** (`Function`) `[TRIVIAL]` - π Execute compliance run for candidate with optional manifest fallback. - - Ζ **run_compliance_status** (`Function`) + - Ζ **run_compliance_status** (`Function`) `[TRIVIAL]` - π Read run status by run id. - - Ζ **_to_payload** (`Function`) + - Ζ **_to_payload** (`Function`) `[TRIVIAL]` - π Serialize domain models for CLI JSON output across SQLAlchemy/Pydantic variants. - - Ζ **run_compliance_report** (`Function`) + - Ζ **run_compliance_report** (`Function`) `[TRIVIAL]` - π Read immutable report by run id. - - Ζ **run_compliance_violations** (`Function`) + - Ζ **run_compliance_violations** (`Function`) `[TRIVIAL]` - π Read run violations by run id. - - Ζ **run_approve** (`Function`) + - Ζ **run_approve** (`Function`) `[TRIVIAL]` - π Approve candidate based on immutable PASSED report. - - Ζ **run_reject** (`Function`) + - Ζ **run_reject** (`Function`) `[TRIVIAL]` - π Reject candidate without mutating compliance evidence. - - Ζ **run_publish** (`Function`) + - Ζ **run_publish** (`Function`) `[TRIVIAL]` - π Publish approved candidate to target channel. - - Ζ **run_revoke** (`Function`) + - Ζ **run_revoke** (`Function`) `[TRIVIAL]` - π Revoke active publication record. - - Ζ **main** (`Function`) + - Ζ **main** (`Function`) `[TRIVIAL]` - π CLI entrypoint for clean release commands. - Ζ **_normalize** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- π¦ **backend.src.scripts.seed_permissions** (`Module`) +- π¦ **backend.src.scripts.seed_permissions** (`Module`) `[TRIVIAL]` - π Populates the auth database with initial system permissions. - ποΈ Layer: Scripts - π Invariant: Safe to run multiple times (idempotent). - - π¦ **INITIAL_PERMISSIONS** (`Constant`) - - Ζ **seed_permissions** (`Function`) + - π¦ **INITIAL_PERMISSIONS** (`Constant`) `[TRIVIAL]` + - Ζ **seed_permissions** (`Function`) `[TRIVIAL]` - π Inserts missing permissions into the database. - π¦ **backend.src.scripts.init_auth_db** (`Module`) `[CRITICAL]` - π Initializes the auth database and creates the necessary tables. - ποΈ Layer: Scripts - π Invariant: Safe to run multiple times (idempotent). - π CALLS -> `backend.src.core.database.init_db` - - Ζ **run_init** (`Function`) + - Ζ **run_init** (`Function`) `[TRIVIAL]` - π Main entry point for the initialization script. - π¦ **backend.src.scripts.create_admin** (`Module`) - π CLI tool for creating the initial admin user. - ποΈ Layer: Scripts - π Invariant: Admin user must have the "Admin" role. - - Ζ **create_admin** (`Function`) + - Ζ **create_admin** (`Function`) `[TRIVIAL]` - π Creates an admin user and necessary roles/permissions. -- π¦ **src.scripts** (`Package`) +- π¦ **src.scripts** (`Package`) `[TRIVIAL]` - π Script entrypoint package root. - π¦ **backend.src.schemas.health** (`Module`) - π Pydantic schemas for dashboard health summary. - ποΈ Layer: Domain - - β **DashboardHealthItem** (`Class`) + - β **DashboardHealthItem** (`Class`) `[TRIVIAL]` - π Represents the latest health status of a single dashboard. - - β **HealthSummaryResponse** (`Class`) + - β **HealthSummaryResponse** (`Class`) `[TRIVIAL]` - π Aggregated health summary for all dashboards. - π¦ **backend.src.schemas.settings** (`Module`) - π Pydantic schemas for application settings and automation policies. - ποΈ Layer: Domain - - β **NotificationChannel** (`Class`) + - β **NotificationChannel** (`Class`) `[TRIVIAL]` - π Structured notification channel definition for policy-level custom routing. - - β **ValidationPolicyBase** (`Class`) + - β **ValidationPolicyBase** (`Class`) `[TRIVIAL]` - π Base schema for validation policy data. - - β **ValidationPolicyCreate** (`Class`) + - β **ValidationPolicyCreate** (`Class`) `[TRIVIAL]` - π Schema for creating a new validation policy. - - β **ValidationPolicyUpdate** (`Class`) + - β **ValidationPolicyUpdate** (`Class`) `[TRIVIAL]` - π Schema for updating an existing validation policy. - - β **ValidationPolicyResponse** (`Class`) + - β **ValidationPolicyResponse** (`Class`) `[TRIVIAL]` - π Schema for validation policy response data. -- π¦ **backend.src.schemas.auth** (`Module`) `[CRITICAL]` +- π¦ **backend.src.schemas.auth** (`Module`) - π Pydantic schemas for authentication requests and responses. - ποΈ Layer: API - π Invariant: Sensitive fields like password must not be included in response schemas. @@ -2522,15 +2485,15 @@ - π Canonical account candidate projected from Superset users payload. - β **SupersetAccountLookupResponse** (`Class`) - π Response envelope for Superset account lookup (success or degraded mode). -- π¦ **src.schemas** (`Package`) +- π¦ **src.schemas** (`Package`) `[TRIVIAL]` - π API schema package root. - π¦ **backend.src.schemas.__tests__.test_settings_and_health_schemas** (`Module`) - π Regression tests for settings and health schema contracts updated in 026 fix batch. - - Ζ **test_validation_policy_create_accepts_structured_custom_channels** (`Function`) + - Ζ **test_validation_policy_create_accepts_structured_custom_channels** (`Function`) `[TRIVIAL]` - π Ensure policy schema accepts structured custom channel objects with type/target fields. - - Ζ **test_validation_policy_create_rejects_legacy_string_custom_channels** (`Function`) + - Ζ **test_validation_policy_create_rejects_legacy_string_custom_channels** (`Function`) `[TRIVIAL]` - π Ensure legacy list[str] custom channel payload is rejected by typed channel contract. - - Ζ **test_dashboard_health_item_status_accepts_only_whitelisted_values** (`Function`) + - Ζ **test_dashboard_health_item_status_accepts_only_whitelisted_values** (`Function`) `[TRIVIAL]` - π Verify strict grouped regex only accepts PASS/WARN/FAIL/UNKNOWN exact statuses. - π¦ **backend.src.core.superset_profile_lookup** (`Module`) - π Provides environment-scoped Superset account lookup adapter with stable normalized output. @@ -2540,120 +2503,124 @@ - π DEPENDS_ON -> `backend.src.core.logger` - β **SupersetAccountLookupAdapter** (`Class`) - π Lookup Superset users and normalize candidates for profile binding. - - Ζ **__init__** (`Function`) + - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Initializes lookup adapter with authenticated API client and environment context. - - Ζ **get_users_page** (`Function`) + - Ζ **get_users_page** (`Function`) `[TRIVIAL]` - π Fetch one users page from Superset with passthrough search/sort parameters. - - Ζ **_normalize_lookup_payload** (`Function`) + - Ζ **_normalize_lookup_payload** (`Function`) `[TRIVIAL]` - π Convert Superset users response variants into stable candidates payload. - - Ζ **normalize_user_payload** (`Function`) + - Ζ **normalize_user_payload** (`Function`) `[TRIVIAL]` - π Project raw Superset user object to canonical candidate shape. - π¦ **backend.src.core.superset_client** (`Module`) - π ΠΡΠ΅Π΄ΠΎΡΡΠ°Π²Π»ΡΠ΅Ρ Π²ΡΡΠΎΠΊΠΎΡΡΠΎΠ²Π½Π΅Π²ΡΠΉ ΠΊΠ»ΠΈΠ΅Π½Ρ Π΄Π»Ρ Π²Π·Π°ΠΈΠΌΠΎΠ΄Π΅ΠΉΡΡΠ²ΠΈΡ Ρ Superset REST API, ΠΈΠ½ΠΊΠ°ΠΏΡΡΠ»ΠΈΡΡΡ Π»ΠΎΠ³ΠΈΠΊΡ Π·Π°ΠΏΡΠΎΡΠΎΠ², ΠΎΠ±ΡΠ°Π±ΠΎΡΠΊΡ ΠΎΡΠΈΠ±ΠΎΠΊ ΠΈ ΠΏΠ°Π³ΠΈΠ½Π°ΡΠΈΡ. - ποΈ Layer: Core - π Invariant: All network operations must use the internal APIClient instance. - - β **SupersetClient** (`Class`) + - β **backend.src.core.superset_client.SupersetClient** (`Class`) - π ΠΠ»Π°ΡΡ-ΠΎΠ±ΡΡΡΠΊΠ° Π½Π°Π΄ Superset REST API, ΠΏΡΠ΅Π΄ΠΎΡΡΠ°Π²Π»ΡΡΡΠΈΠΉ ΠΌΠ΅ΡΠΎΠ΄Ρ Π΄Π»Ρ ΡΠ°Π±ΠΎΡΡ Ρ Π΄Π°ΡΠ±ΠΎΡΠ΄Π°ΠΌΠΈ ΠΈ Π΄Π°ΡΠ°ΡΠ΅ΡΠ°ΠΌΠΈ. - - Ζ **__init__** (`Function`) + - π DEPENDS_ON -> `backend.src.core.utils.network.APIClient` + - π DEPENDS_ON -> `backend.src.core.config_models.Environment` + - Ζ **backend.src.core.superset_client.SupersetClient.__init__** (`Function`) - π ΠΠ½ΠΈΡΠΈΠ°Π»ΠΈΠ·ΠΈΡΡΠ΅Ρ ΠΊΠ»ΠΈΠ΅Π½Ρ, ΠΏΡΠΎΠ²Π΅ΡΡΠ΅Ρ ΠΊΠΎΠ½ΡΠΈΠ³ΡΡΠ°ΡΠΈΡ ΠΈ ΡΠΎΠ·Π΄Π°Π΅Ρ ΡΠ΅ΡΠ΅Π²ΠΎΠΉ ΠΊΠ»ΠΈΠ΅Π½Ρ. - - Ζ **authenticate** (`Function`) - - π Authenticates the client using the configured credentials. - - Ζ **headers** (`Function`) - - π ΠΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ Π±Π°Π·ΠΎΠ²ΡΠ΅ HTTP-Π·Π°Π³ΠΎΠ»ΠΎΠ²ΠΊΠΈ, ΠΈΡΠΏΠΎΠ»ΡΠ·ΡΠ΅ΠΌΡΠ΅ ΡΠ΅ΡΠ΅Π²ΡΠΌ ΠΊΠ»ΠΈΠ΅Π½ΡΠΎΠΌ. - - Ζ **get_dashboards** (`Function`) - - π ΠΠΎΠ»ΡΡΠ°Π΅Ρ ΠΏΠΎΠ»Π½ΡΠΉ ΡΠΏΠΈΡΠΎΠΊ Π΄Π°ΡΠ±ΠΎΡΠ΄ΠΎΠ², Π°Π²ΡΠΎΠΌΠ°ΡΠΈΡΠ΅ΡΠΊΠΈ ΠΎΠ±ΡΠ°Π±Π°ΡΡΠ²Π°Ρ ΠΏΠ°Π³ΠΈΠ½Π°ΡΠΈΡ. - - Ζ **get_dashboards_page** (`Function`) - - π Fetches a single dashboards page from Superset without iterating all pages. - - Ζ **get_dashboards_summary** (`Function`) - - π Fetches dashboard metadata optimized for the grid. - - Ζ **get_dashboards_summary_page** (`Function`) - - π Fetches one page of dashboard metadata optimized for the grid. - - Ζ **_extract_owner_labels** (`Function`) - - π Normalize dashboard owners payload to stable display labels. - - Ζ **_extract_user_display** (`Function`) - - π Normalize user payload to a stable display name. - - Ζ **_sanitize_user_text** (`Function`) - - π Convert scalar value to non-empty user-facing text. - - Ζ **get_dashboard** (`Function`) - - π Fetches a single dashboard by ID. - - Ζ **get_chart** (`Function`) - - π Fetches a single chart by ID. - - Ζ **get_dashboard_detail** (`Function`) - - π Fetches detailed dashboard information including related charts and datasets. - - Ζ **get_charts** (`Function`) - - π Fetches all charts with pagination support. - - Ζ **_extract_chart_ids_from_layout** (`Function`) - - π Traverses dashboard layout metadata and extracts chart IDs from common keys. - - Ζ **export_dashboard** (`Function`) - - π ΠΠΊΡΠΏΠΎΡΡΠΈΡΡΠ΅Ρ Π΄Π°ΡΠ±ΠΎΡΠ΄ Π² Π²ΠΈΠ΄Π΅ ZIP-Π°ΡΡ ΠΈΠ²Π°. - - Ζ **import_dashboard** (`Function`) - - π ΠΠΌΠΏΠΎΡΡΠΈΡΡΠ΅Ρ Π΄Π°ΡΠ±ΠΎΡΠ΄ ΠΈΠ· ZIP-ΡΠ°ΠΉΠ»Π°. - - Ζ **delete_dashboard** (`Function`) - - π Π£Π΄Π°Π»ΡΠ΅Ρ Π΄Π°ΡΠ±ΠΎΡΠ΄ ΠΏΠΎ Π΅Π³ΠΎ ID ΠΈΠ»ΠΈ slug. - - Ζ **get_datasets** (`Function`) - - π ΠΠΎΠ»ΡΡΠ°Π΅Ρ ΠΏΠΎΠ»Π½ΡΠΉ ΡΠΏΠΈΡΠΎΠΊ Π΄Π°ΡΠ°ΡΠ΅ΡΠΎΠ², Π°Π²ΡΠΎΠΌΠ°ΡΠΈΡΠ΅ΡΠΊΠΈ ΠΎΠ±ΡΠ°Π±Π°ΡΡΠ²Π°Ρ ΠΏΠ°Π³ΠΈΠ½Π°ΡΠΈΡ. - - Ζ **get_datasets_summary** (`Function`) - - π Fetches dataset metadata optimized for the Dataset Hub grid. - - Ζ **get_dataset_detail** (`Function`) - - π Fetches detailed dataset information including columns and linked dashboards - - π CALLS -> `self.get_dataset` - - π CALLS -> `self.network.request (for related_objects)` - - Ζ **get_dataset** (`Function`) - - π ΠΠΎΠ»ΡΡΠ°Π΅Ρ ΠΈΠ½ΡΠΎΡΠΌΠ°ΡΠΈΡ ΠΎ ΠΊΠΎΠ½ΠΊΡΠ΅ΡΠ½ΠΎΠΌ Π΄Π°ΡΠ°ΡΠ΅ΡΠ΅ ΠΏΠΎ Π΅Π³ΠΎ ID. - - Ζ **update_dataset** (`Function`) - - π ΠΠ±Π½ΠΎΠ²Π»ΡΠ΅Ρ Π΄Π°Π½Π½ΡΠ΅ Π΄Π°ΡΠ°ΡΠ΅ΡΠ° ΠΏΠΎ Π΅Π³ΠΎ ID. - - Ζ **get_databases** (`Function`) - - π ΠΠΎΠ»ΡΡΠ°Π΅Ρ ΠΏΠΎΠ»Π½ΡΠΉ ΡΠΏΠΈΡΠΎΠΊ Π±Π°Π· Π΄Π°Π½Π½ΡΡ . - - Ζ **get_database** (`Function`) - - π ΠΠΎΠ»ΡΡΠ°Π΅Ρ ΠΈΠ½ΡΠΎΡΠΌΠ°ΡΠΈΡ ΠΎ ΠΊΠΎΠ½ΠΊΡΠ΅ΡΠ½ΠΎΠΉ Π±Π°Π·Π΅ Π΄Π°Π½Π½ΡΡ ΠΏΠΎ Π΅Ρ ID. - - Ζ **get_databases_summary** (`Function`) - - π Fetch a summary of databases including uuid, name, and engine. - - Ζ **get_database_by_uuid** (`Function`) - - π Find a database by its UUID. - - Ζ **_resolve_target_id_for_delete** (`Function`) - - π Resolves a dashboard ID from either an ID or a slug. - - Ζ **_do_import** (`Function`) - - π Performs the actual multipart upload for import. - - Ζ **_validate_export_response** (`Function`) - - π Validates that the export response is a non-empty ZIP archive. - - Ζ **_resolve_export_filename** (`Function`) - - π Determines the filename for an exported dashboard. - - Ζ **_validate_query_params** (`Function`) - - π Ensures query parameters have default page and page_size. - - Ζ **_fetch_total_object_count** (`Function`) - - π Fetches the total number of items for a given endpoint. - - Ζ **_fetch_all_pages** (`Function`) - - π Iterates through all pages to collect all data items. - - Ζ **_validate_import_file** (`Function`) - - π Validates that the file to be imported is a valid ZIP with metadata.yaml. - - Ζ **get_all_resources** (`Function`) - - π Fetches all resources of a given type with id, uuid, and name columns. + - Ζ **backend.src.core.superset_client.SupersetClient.authenticate** (`Function`) + - π Authenticates the client using the configured credentials. + - π CALLS -> `self.network.authenticate` + - Ζ **__init__** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **authenticate** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **headers** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **get_dashboards** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **get_dashboards_page** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **get_dashboards_summary** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **get_dashboards_summary_page** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_extract_owner_labels** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_extract_user_display** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_sanitize_user_text** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **get_dashboard** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **get_chart** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **get_dashboard_detail** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - Ζ **extract_dataset_id_from_form_data** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) + - Ζ **get_charts** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_extract_chart_ids_from_layout** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - Ζ **walk** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) + - Ζ **export_dashboard** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **import_dashboard** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **delete_dashboard** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **get_datasets** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **get_datasets_summary** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **get_dataset_detail** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - Ζ **as_bool** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) + - Ζ **get_dataset** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **update_dataset** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **get_databases** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **get_database** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **get_databases_summary** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **get_database_by_uuid** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_resolve_target_id_for_delete** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_do_import** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_validate_export_response** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_resolve_export_filename** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_validate_query_params** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_fetch_total_object_count** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_fetch_all_pages** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_validate_import_file** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **get_all_resources** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - π¦ **backend.src.core.encryption_key** (`Module`) `[CRITICAL]` - π Resolve and persist the Fernet encryption key required by runtime services. - ποΈ Layer: Infra - π Invariant: Runtime key resolution never falls back to an ephemeral secret. - π DEPENDS_ON -> `backend.src.core.logger` - - Ζ **ensure_encryption_key** (`Function`) + - Ζ **ensure_encryption_key** (`Function`) `[TRIVIAL]` - π Ensure backend runtime has a persistent valid Fernet key. - π¦ **ConfigManagerModule** (`Module`) `[CRITICAL]` - π Manages application configuration persistence in DB with one-time migration from legacy JSON. - ποΈ Layer: Domain - π Invariant: Configuration must always be representable by AppConfig and persisted under global record id. - - π DEPENDS_ON -> `ConfigModels` - - π DEPENDS_ON -> `SessionLocal` - - π DEPENDS_ON -> `AppConfigRecord` - - π CALLS -> `logger` - - π CALLS -> `configure_logger` - - π BINDS_TO -> `ConfigManager` + - π DEPENDS_ON -> `backend.src.core.config_models.AppConfig` + - π DEPENDS_ON -> `backend.src.core.database.SessionLocal` + - π DEPENDS_ON -> `backend.src.models.config.AppConfigRecord` + - π CALLS -> `backend.src.core.logger.logger` + - π CALLS -> `backend.src.core.logger.configure_logger` - β **ConfigManager** (`Class`) `[CRITICAL]` - π Handles application configuration load, validation, mutation, and persistence lifecycle. - - Ζ **__init__** (`Function`) + - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Initialize manager state from persisted or migrated configuration. - Ζ **_default_config** (`Function`) - π Build default application configuration fallback. @@ -2696,58 +2663,58 @@ - ποΈ Layer: Core - β **SchedulerService** (`Class`) - π Provides a service to manage scheduled backup tasks. - - Ζ **__init__** (`Function`) + - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Initializes the scheduler service with task and config managers. - - Ζ **start** (`Function`) + - Ζ **start** (`Function`) `[TRIVIAL]` - π Starts the background scheduler and loads initial schedules. - - Ζ **stop** (`Function`) + - Ζ **stop** (`Function`) `[TRIVIAL]` - π Stops the background scheduler. - - Ζ **load_schedules** (`Function`) + - Ζ **load_schedules** (`Function`) `[TRIVIAL]` - π Loads backup schedules from configuration and registers them. - - Ζ **add_backup_job** (`Function`) + - Ζ **add_backup_job** (`Function`) `[TRIVIAL]` - π Adds a scheduled backup job for an environment. - - Ζ **_trigger_backup** (`Function`) + - Ζ **_trigger_backup** (`Function`) `[TRIVIAL]` - π Triggered by the scheduler to start a backup task. - β **ThrottledSchedulerConfigurator** (`Class`) `[CRITICAL]` - π Distributes validation tasks evenly within an execution window. - - Ζ **calculate_schedule** (`Function`) + - Ζ **calculate_schedule** (`Function`) `[TRIVIAL]` - π Calculates execution times for N tasks within a window. - π Invariant: Tasks are distributed with near-even spacing. -- π¦ **ConfigModels** (`Module`) `[CRITICAL]` +- π¦ **backend.src.core.config_models** (`Module`) - π Defines the data models for application configuration using Pydantic. - ποΈ Layer: Core - - π¦ **Schedule** (`DataClass`) + - π¦ **Schedule** (`DataClass`) `[TRIVIAL]` - π Represents a backup schedule configuration. - - π¦ **Environment** (`DataClass`) + - π¦ **backend.src.core.config_models.Environment** (`DataClass`) `[TRIVIAL]` - π Represents a Superset environment configuration. - - π¦ **LoggingConfig** (`DataClass`) + - π¦ **LoggingConfig** (`DataClass`) `[TRIVIAL]` - π Defines the configuration for the application's logging system. - - π¦ **CleanReleaseConfig** (`DataClass`) + - π¦ **CleanReleaseConfig** (`DataClass`) `[TRIVIAL]` - π Configuration for clean release compliance subsystem. - - π¦ **GlobalSettings** (`DataClass`) + - π¦ **GlobalSettings** (`DataClass`) `[TRIVIAL]` - π Represents global application settings. - - π¦ **AppConfig** (`DataClass`) + - π¦ **AppConfig** (`DataClass`) `[TRIVIAL]` - π The root configuration model containing all application settings. -- π¦ **backend.src.core.database** (`Module`) `[CRITICAL]` +- π¦ **backend.src.core.database** (`Module`) - π Configures database connection and session management (PostgreSQL-first). - ποΈ Layer: Core - π Invariant: A single engine instance is used for the entire application. - π DEPENDS_ON -> `sqlalchemy` - π DEPENDS_ON -> `backend.src.models.mapping` - π DEPENDS_ON -> `backend.src.core.auth.config` - - π¦ **BASE_DIR** (`Variable`) + - π¦ **BASE_DIR** (`Variable`) `[TRIVIAL]` - π Base directory for the backend. - - π¦ **DATABASE_URL** (`Constant`) + - π¦ **DATABASE_URL** (`Constant`) `[TRIVIAL]` - π URL for the main application database. - - π¦ **TASKS_DATABASE_URL** (`Constant`) + - π¦ **TASKS_DATABASE_URL** (`Constant`) `[TRIVIAL]` - π URL for the tasks execution database. - - π¦ **AUTH_DATABASE_URL** (`Constant`) + - π¦ **AUTH_DATABASE_URL** (`Constant`) `[TRIVIAL]` - π URL for the authentication database. - - π¦ **engine** (`Variable`) + - π¦ **engine** (`Variable`) `[TRIVIAL]` - π SQLAlchemy engine for mappings database. - - π¦ **tasks_engine** (`Variable`) + - π¦ **tasks_engine** (`Variable`) `[TRIVIAL]` - π SQLAlchemy engine for tasks database. - - π¦ **auth_engine** (`Variable`) + - π¦ **auth_engine** (`Variable`) `[TRIVIAL]` - π SQLAlchemy engine for authentication database. - β **SessionLocal** (`Class`) `[TRIVIAL]` - π A session factory for the main mappings database. @@ -2775,59 +2742,59 @@ - π Dependency for getting an authentication database session. - Ζ **_build_engine** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- π¦ **LoggerModule** (`Module`) +- π¦ **LoggerModule** (`Module`) `[TRIVIAL]` - π Configures the application's logging system, including a custom handler for buffering logs and streaming them over WebSockets. - ποΈ Layer: Core - - β **BeliefFormatter** (`Class`) + - β **BeliefFormatter** (`Class`) `[TRIVIAL]` - π Custom logging formatter that adds belief state prefixes to log messages. - - Ζ **format** (`Function`) + - Ζ **format** (`Function`) `[TRIVIAL]` - π Formats the log record, adding belief state context if available. - - β **LogEntry** (`Class`) + - β **LogEntry** (`Class`) `[TRIVIAL]` - π A Pydantic model representing a single, structured log entry. This is a re-definition for consistency, as it's also defined in task_manager.py. - - Ζ **belief_scope** (`Function`) + - Ζ **belief_scope** (`Function`) `[TRIVIAL]` - π Context manager for structured Belief State logging. - - Ζ **configure_logger** (`Function`) + - Ζ **configure_logger** (`Function`) `[TRIVIAL]` - π Configures the logger with the provided logging settings. - - Ζ **get_task_log_level** (`Function`) + - Ζ **get_task_log_level** (`Function`) `[TRIVIAL]` - π Returns the current task log level filter. - - Ζ **should_log_task_level** (`Function`) + - Ζ **should_log_task_level** (`Function`) `[TRIVIAL]` - π Checks if a log level should be recorded based on task_log_level setting. - - β **WebSocketLogHandler** (`Class`) + - β **WebSocketLogHandler** (`Class`) `[TRIVIAL]` - π A custom logging handler that captures log records into a buffer. It is designed to be extended for real-time log streaming over WebSockets. - - Ζ **__init__** (`Function`) + - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Initializes the handler with a fixed-capacity buffer. - - Ζ **emit** (`Function`) + - Ζ **emit** (`Function`) `[TRIVIAL]` - π Captures a log record, formats it, and stores it in the buffer. - - Ζ **get_recent_logs** (`Function`) + - Ζ **get_recent_logs** (`Function`) `[TRIVIAL]` - π Returns a list of recent log entries from the buffer. - - π¦ **Logger** (`Global`) + - π¦ **Logger** (`Global`) `[TRIVIAL]` - π The global logger instance for the application, configured with both a console handler and the custom WebSocket handler. - - Ζ **believed** (`Function`) + - Ζ **believed** (`Function`) `[TRIVIAL]` - π A decorator that wraps a function in a belief scope. - - Ζ **decorator** (`Function`) + - Ζ **decorator** (`Function`) `[TRIVIAL]` - π Internal decorator for belief scope. - - Ζ **explore** (`Function`) + - Ζ **explore** (`Function`) `[TRIVIAL]` - π Logs an EXPLORE message (Van der Waals force) for searching, alternatives, and hypotheses. - - Ζ **reason** (`Function`) + - Ζ **reason** (`Function`) `[TRIVIAL]` - π Logs a REASON message (Covalent bond) for strict deduction and core logic. - - Ζ **reflect** (`Function`) + - Ζ **reflect** (`Function`) `[TRIVIAL]` - π Logs a REFLECT message (Hydrogen bond) for self-check and structural validation. - β **PluginLoader** (`Class`) - π Scans a specified directory for Python modules, dynamically loads them, and registers any classes that are valid implementations of the PluginBase interface. - ποΈ Layer: Core - - Ζ **__init__** (`Function`) + - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Initializes the PluginLoader with a directory to scan. - - Ζ **_load_plugins** (`Function`) + - Ζ **_load_plugins** (`Function`) `[TRIVIAL]` - π Scans the plugin directory and loads all valid plugins. - - Ζ **_load_module** (`Function`) + - Ζ **_load_module** (`Function`) `[TRIVIAL]` - π Loads a single Python module and discovers PluginBase implementations. - - Ζ **_register_plugin** (`Function`) + - Ζ **_register_plugin** (`Function`) `[TRIVIAL]` - π Registers a PluginBase instance and its configuration. - - Ζ **get_plugin** (`Function`) + - Ζ **get_plugin** (`Function`) `[TRIVIAL]` - π Retrieves a loaded plugin instance by its ID. - - Ζ **get_all_plugin_configs** (`Function`) + - Ζ **get_all_plugin_configs** (`Function`) `[TRIVIAL]` - π Returns a list of all registered plugin configurations. - - Ζ **has_plugin** (`Function`) + - Ζ **has_plugin** (`Function`) `[TRIVIAL]` - π Checks if a plugin with the given ID is registered. - π¦ **backend.src.core.migration_engine** (`Module`) `[CRITICAL]` - π Transforms Superset export ZIP archives while preserving archive integrity and patching mapped identifiers. @@ -2839,15 +2806,15 @@ - π DEPENDS_ON -> `yaml` - β **MigrationEngine** (`Class`) `[CRITICAL]` - π Engine for transforming Superset export ZIPs. - - Ζ **__init__** (`Function`) + - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Initializes migration orchestration dependencies for ZIP/YAML metadata transformations. - - Ζ **transform_zip** (`Function`) + - Ζ **transform_zip** (`Function`) `[TRIVIAL]` - π Extracts ZIP, replaces database UUIDs in YAMLs, patches cross-filters, and re-packages. - - Ζ **_transform_yaml** (`Function`) + - Ζ **_transform_yaml** (`Function`) `[TRIVIAL]` - π Replaces database_uuid in a single YAML file. - - Ζ **_extract_chart_uuids_from_archive** (`Function`) + - Ζ **_extract_chart_uuids_from_archive** (`Function`) `[TRIVIAL]` - π Scans extracted chart YAML files and builds a source chart ID to UUID lookup map. - - Ζ **_patch_dashboard_metadata** (`Function`) + - Ζ **_patch_dashboard_metadata** (`Function`) `[TRIVIAL]` - π Rewrites dashboard json_metadata chart/dataset integer identifiers using target environment mappings. - π¦ **backend.src.core.async_superset_client** (`Module`) `[CRITICAL]` - π Async Superset client for dashboard hot-path requests without blocking FastAPI event loop. @@ -2855,46 +2822,57 @@ - π Invariant: Async dashboard operations reuse shared auth cache and avoid sync requests in async routes. - π DEPENDS_ON -> `backend.src.core.superset_client` - π DEPENDS_ON -> `backend.src.core.utils.async_network.AsyncAPIClient` - - β **AsyncSupersetClient** (`Class`) + - β **backend.src.core.async_superset_client.AsyncSupersetClient** (`Class`) - π Async sibling of SupersetClient for dashboard read paths. - - Ζ **__init__** (`Function`) + - π INHERITS -> `backend.src.core.superset_client.SupersetClient` + - π DEPENDS_ON -> `backend.src.core.utils.async_network.AsyncAPIClient` + - π CALLS -> `backend.src.core.utils.async_network.AsyncAPIClient.request` + - Ζ **backend.src.core.async_superset_client.AsyncSupersetClient.__init__** (`Function`) - π Initialize async Superset client with AsyncAPIClient transport. - - Ζ **aclose** (`Function`) + - Ζ **backend.src.core.async_superset_client.AsyncSupersetClient.aclose** (`Function`) - π Close async transport resources. - - Ζ **get_dashboards_page_async** (`Function`) + - Ζ **backend.src.core.async_superset_client.AsyncSupersetClient.get_dashboards_page_async** (`Function`) - π Fetch one dashboards page asynchronously. - - Ζ **get_dashboard_async** (`Function`) - - π Fetch one dashboard payload asynchronously. - - Ζ **get_chart_async** (`Function`) - - π Fetch one chart payload asynchronously. - - Ζ **get_dashboard_detail_async** (`Function`) - - π Fetch dashboard detail asynchronously with concurrent charts/datasets requests. + - Ζ **get_dashboard_async** (`Function`) + - π Fetch one dashboard payload asynchronously. + - Ζ **get_chart_async** (`Function`) + - π Fetch one chart payload asynchronously. + - Ζ **get_dashboard_detail_async** (`Function`) + - π Fetch dashboard detail asynchronously with concurrent charts/datasets requests. + - π CALLS -> `self.get_dashboard_async` + - π CALLS -> `self.get_chart_async` + - Ζ **__init__** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **aclose** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **get_dashboards_page_async** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - Ζ **extract_dataset_id_from_form_data** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- β **PluginBase** (`Class`) +- β **PluginBase** (`Class`) `[TRIVIAL]` - π Defines the abstract base class that all plugins must implement to be recognized by the system. It enforces a common structure for plugin metadata and execution. - ποΈ Layer: Core - π Invariant: All plugins MUST inherit from this class. - - Ζ **id** (`Function`) + - Ζ **id** (`Function`) `[TRIVIAL]` - π Returns the unique identifier for the plugin. - - Ζ **name** (`Function`) + - Ζ **name** (`Function`) `[TRIVIAL]` - π Returns the human-readable name of the plugin. - - Ζ **description** (`Function`) + - Ζ **description** (`Function`) `[TRIVIAL]` - π Returns a brief description of the plugin. - - Ζ **version** (`Function`) + - Ζ **version** (`Function`) `[TRIVIAL]` - π Returns the version of the plugin. - - Ζ **required_permission** (`Function`) + - Ζ **required_permission** (`Function`) `[TRIVIAL]` - π Returns the required permission string to execute this plugin. - - Ζ **ui_route** (`Function`) + - Ζ **ui_route** (`Function`) `[TRIVIAL]` - π Returns the frontend route for the plugin's UI, if applicable. - - Ζ **get_schema** (`Function`) + - Ζ **get_schema** (`Function`) `[TRIVIAL]` - π Returns the JSON schema for the plugin's input parameters. - - Ζ **execute** (`Function`) + - Ζ **execute** (`Function`) `[TRIVIAL]` - π Executes the plugin's core logic. -- β **PluginConfig** (`Class`) +- β **PluginConfig** (`Class`) `[TRIVIAL]` - π A Pydantic model used to represent the validated configuration and metadata of a loaded plugin. This object is what gets exposed to the API layer. - ποΈ Layer: Core -- π¦ **src.core** (`Package`) +- π¦ **src.core** (`Package`) `[TRIVIAL]` - π Backend core services and infrastructure package root. - π¦ **backend.src.core.mapping_service** (`Module`) `[CRITICAL]` - π Service for tracking and synchronizing Superset Resource IDs (UUID <-> Integer ID) @@ -2904,15 +2882,15 @@ - π DEPENDS_ON -> `backend.src.core.logger` - β **IdMappingService** (`Class`) `[CRITICAL]` - π Service handling the cataloging and retrieval of remote Superset Integer IDs. - - Ζ **__init__** (`Function`) + - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Initializes the mapping service. - - Ζ **start_scheduler** (`Function`) + - Ζ **start_scheduler** (`Function`) `[TRIVIAL]` - π Starts the background scheduler with a given cron string. - - Ζ **sync_environment** (`Function`) + - Ζ **sync_environment** (`Function`) `[TRIVIAL]` - π Fully synchronizes mapping for a specific environment. - - Ζ **get_remote_id** (`Function`) + - Ζ **get_remote_id** (`Function`) `[TRIVIAL]` - π Retrieves the remote integer ID for a given universal UUID. - - Ζ **get_remote_ids_batch** (`Function`) + - Ζ **get_remote_ids_batch** (`Function`) `[TRIVIAL]` - π Retrieves remote integer IDs for a list of universal UUIDs efficiently. - Ζ **sync_all** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -2923,42 +2901,42 @@ - π DEPENDS_ON -> `pydantic` - β **AuthConfig** (`Class`) `[CRITICAL]` - π Holds authentication-related settings. - - π¦ **auth_config** (`Variable`) + - π¦ **auth_config** (`Variable`) `[TRIVIAL]` - π Singleton instance of AuthConfig. -- π¦ **backend.src.core.auth.jwt** (`Module`) `[CRITICAL]` +- π¦ **backend.src.core.auth.jwt** (`Module`) - π JWT token generation and validation logic. - ποΈ Layer: Core - π Invariant: Tokens must include expiration time and user identifier. - π DEPENDS_ON -> `jose` - - Ζ **create_access_token** (`Function`) + - Ζ **create_access_token** (`Function`) `[TRIVIAL]` - π Generates a new JWT access token. - - Ζ **decode_token** (`Function`) + - Ζ **decode_token** (`Function`) `[TRIVIAL]` - π Decodes and validates a JWT token. - π¦ **backend.src.core.auth.oauth** (`Module`) `[CRITICAL]` - π ADFS OIDC configuration and client using Authlib. - ποΈ Layer: Core - π Invariant: Must use secure OIDC flows. - π DEPENDS_ON -> `authlib` - - π¦ **oauth** (`Variable`) + - π¦ **oauth** (`Variable`) `[TRIVIAL]` - π Global Authlib OAuth registry. - - Ζ **register_adfs** (`Function`) + - Ζ **register_adfs** (`Function`) `[TRIVIAL]` - π Registers the ADFS OIDC client. - - Ζ **is_adfs_configured** (`Function`) + - Ζ **is_adfs_configured** (`Function`) `[TRIVIAL]` - π Checks if ADFS is properly configured. -- π¦ **backend.src.core.auth.logger** (`Module`) `[CRITICAL]` +- π¦ **backend.src.core.auth.logger** (`Module`) - π Audit logging for security-related events. - ποΈ Layer: Core - π Invariant: Must not log sensitive data like passwords or full tokens. - - Ζ **log_security_event** (`Function`) + - Ζ **log_security_event** (`Function`) `[TRIVIAL]` - π Logs a security-related event for audit trails. - π¦ **backend.src.core.auth.security** (`Module`) `[CRITICAL]` - π Utility for password hashing and verification using Passlib. - ποΈ Layer: Core - π Invariant: Uses bcrypt for hashing with standard work factor. - π DEPENDS_ON -> `passlib` - - Ζ **verify_password** (`Function`) + - Ζ **verify_password** (`Function`) `[TRIVIAL]` - π Verifies a plain password against a hashed password. - - Ζ **get_password_hash** (`Function`) + - Ζ **get_password_hash** (`Function`) `[TRIVIAL]` - π Generates a bcrypt hash for a plain password. - π¦ **backend.src.core.auth.repository** (`Module`) `[CRITICAL]` - π Data access layer for authentication and user preference entities. @@ -2971,29 +2949,29 @@ - β **AuthRepository** (`Class`) `[CRITICAL]` - π Encapsulates database operations for authentication-related entities. - π DEPENDS_ON -> `sqlalchemy.orm.Session` - - Ζ **__init__** (`Function`) + - Ζ **__init__** (`Function`) `[CRITICAL]` - π Bind repository instance to an existing SQLAlchemy session. - - Ζ **get_user_by_username** (`Function`) + - Ζ **get_user_by_username** (`Function`) `[CRITICAL]` - π Retrieve a user entity by unique username. - - Ζ **get_user_by_id** (`Function`) + - Ζ **get_user_by_id** (`Function`) `[CRITICAL]` - π Retrieve a user entity by identifier. - - Ζ **get_role_by_name** (`Function`) + - Ζ **get_role_by_name** (`Function`) `[CRITICAL]` - π Retrieve a role entity by role name. - - Ζ **update_last_login** (`Function`) + - Ζ **update_last_login** (`Function`) `[CRITICAL]` - π Update last_login timestamp for the provided user entity. - - Ζ **get_role_by_id** (`Function`) + - Ζ **get_role_by_id** (`Function`) `[CRITICAL]` - π Retrieve a role entity by identifier. - - Ζ **get_permission_by_id** (`Function`) + - Ζ **get_permission_by_id** (`Function`) `[CRITICAL]` - π Retrieve a permission entity by identifier. - - Ζ **get_permission_by_resource_action** (`Function`) + - Ζ **get_permission_by_resource_action** (`Function`) `[CRITICAL]` - π Retrieve a permission entity by resource and action pair. - - Ζ **get_user_dashboard_preference** (`Function`) + - Ζ **get_user_dashboard_preference** (`Function`) `[CRITICAL]` - π Retrieve dashboard preference entity owned by specified user. - - Ζ **save_user_dashboard_preference** (`Function`) + - Ζ **save_user_dashboard_preference** (`Function`) `[CRITICAL]` - π Persist dashboard preference entity and return refreshed persistent row. - - Ζ **list_permissions** (`Function`) + - Ζ **list_permissions** (`Function`) `[CRITICAL]` - π List all permission entities available in storage. -- π¦ **src.core.auth** (`Package`) +- π¦ **src.core.auth** (`Package`) `[TRIVIAL]` - π Authentication and authorization package root. - π¦ **test_auth** (`Module`) - π Unit tests for authentication module @@ -3031,123 +3009,88 @@ - ποΈ Layer: Infra - π Invariant: Async client reuses cached auth tokens per environment credentials and invalidates on 401. - π DEPENDS_ON -> `backend.src.core.utils.network.SupersetAuthCache` - - β **AsyncAPIClient** (`Class`) + - β **backend.src.core.utils.async_network.AsyncAPIClient** (`Class`) - π Async Superset API client backed by httpx.AsyncClient with shared auth cache. - - Ζ **__init__** (`Function`) + - π DEPENDS_ON -> `backend.src.core.utils.network.SupersetAuthCache` + - π CALLS -> `backend.src.core.utils.network.SupersetAuthCache.get` + - π CALLS -> `backend.src.core.utils.network.SupersetAuthCache.set` + - Ζ **backend.src.core.utils.async_network.AsyncAPIClient.__init__** (`Function`) - π Initialize async API client for one environment. - - Ζ **_normalize_base_url** (`Function`) - - π Normalize base URL for Superset API root construction. - - Ζ **_build_api_url** (`Function`) - - π Build full API URL from relative Superset endpoint. - - Ζ **_get_auth_lock** (`Function`) - - π Return per-cache-key async lock to serialize fresh login attempts. - - Ζ **authenticate** (`Function`) - - π Authenticate against Superset and cache access/csrf tokens. - - Ζ **get_headers** (`Function`) - - π Return authenticated Superset headers for async requests. - - Ζ **request** (`Function`) - - π Perform one authenticated async Superset API request. - - Ζ **_handle_http_error** (`Function`) - - π Translate upstream HTTP errors into stable domain exceptions. - - Ζ **_handle_network_error** (`Function`) - - π Translate generic httpx errors into NetworkError. - - Ζ **aclose** (`Function`) - - π Close underlying httpx client. -- π¦ **backend.core.utils.fileio** (`Module`) + - Ζ **backend.src.core.utils.async_network.AsyncAPIClient._normalize_base_url** (`Function`) `[TRIVIAL]` + - π Normalize base URL for Superset API root construction. + - Ζ **__init__** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_normalize_base_url** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) +- π¦ **backend.core.utils.fileio** (`Module`) `[TRIVIAL]` - π ΠΡΠ΅Π΄ΠΎΡΡΠ°Π²Π»ΡΠ΅Ρ Π½Π°Π±ΠΎΡ ΡΡΠΈΠ»ΠΈΡ Π΄Π»Ρ ΡΠΏΡΠ°Π²Π»Π΅Π½ΠΈΡ ΡΠ°ΠΉΠ»ΠΎΠ²ΡΠΌΠΈ ΠΎΠΏΠ΅ΡΠ°ΡΠΈΡΠΌΠΈ, Π²ΠΊΠ»ΡΡΠ°Ρ ΡΠ°Π±ΠΎΡΡ Ρ Π²ΡΠ΅ΠΌΠ΅Π½Π½ΡΠΌΠΈ ΡΠ°ΠΉΠ»Π°ΠΌΠΈ, Π°ΡΡ ΠΈΠ²Π°ΠΌΠΈ ZIP, ΡΠ°ΠΉΠ»Π°ΠΌΠΈ YAML ΠΈ ΠΎΡΠΈΡΡΠΊΡ Π΄ΠΈΡΠ΅ΠΊΡΠΎΡΠΈΠΉ. - ποΈ Layer: Infra - π DEPENDS_ON -> `backend.src.core.logger` - π DEPENDS_ON -> `pyyaml` - - β **InvalidZipFormatError** (`Class`) + - β **InvalidZipFormatError** (`Class`) `[TRIVIAL]` - π Exception raised when a file is not a valid ZIP archive. - - Ζ **create_temp_file** (`Function`) + - Ζ **create_temp_file** (`Function`) `[TRIVIAL]` - π ΠΠΎΠ½ΡΠ΅ΠΊΡΡΠ½ΡΠΉ ΠΌΠ΅Π½Π΅Π΄ΠΆΠ΅Ρ Π΄Π»Ρ ΡΠΎΠ·Π΄Π°Π½ΠΈΡ Π²ΡΠ΅ΠΌΠ΅Π½Π½ΠΎΠ³ΠΎ ΡΠ°ΠΉΠ»Π° ΠΈΠ»ΠΈ Π΄ΠΈΡΠ΅ΠΊΡΠΎΡΠΈΠΈ Ρ Π³Π°ΡΠ°Π½ΡΠΈΡΠΎΠ²Π°Π½Π½ΡΠΌ ΡΠ΄Π°Π»Π΅Π½ΠΈΠ΅ΠΌ. - - Ζ **remove_empty_directories** (`Function`) + - Ζ **remove_empty_directories** (`Function`) `[TRIVIAL]` - π Π Π΅ΠΊΡΡΡΠΈΠ²Π½ΠΎ ΡΠ΄Π°Π»ΡΠ΅Ρ Π²ΡΠ΅ ΠΏΡΡΡΡΠ΅ ΠΏΠΎΠ΄Π΄ΠΈΡΠ΅ΠΊΡΠΎΡΠΈΠΈ, Π½Π°ΡΠΈΠ½Π°Ρ Ρ ΡΠΊΠ°Π·Π°Π½Π½ΠΎΠ³ΠΎ ΠΏΡΡΠΈ. - - Ζ **read_dashboard_from_disk** (`Function`) + - Ζ **read_dashboard_from_disk** (`Function`) `[TRIVIAL]` - π Π§ΠΈΡΠ°Π΅Ρ Π±ΠΈΠ½Π°ΡΠ½ΠΎΠ΅ ΡΠΎΠ΄Π΅ΡΠΆΠΈΠΌΠΎΠ΅ ΡΠ°ΠΉΠ»Π° Ρ Π΄ΠΈΡΠΊΠ°. - - Ζ **calculate_crc32** (`Function`) + - Ζ **calculate_crc32** (`Function`) `[TRIVIAL]` - π ΠΡΡΠΈΡΠ»ΡΠ΅Ρ ΠΊΠΎΠ½ΡΡΠΎΠ»ΡΠ½ΡΡ ΡΡΠΌΠΌΡ CRC32 Π΄Π»Ρ ΡΠ°ΠΉΠ»Π°. - - π¦ **RetentionPolicy** (`DataClass`) + - π¦ **RetentionPolicy** (`DataClass`) `[TRIVIAL]` - π ΠΠΏΡΠ΅Π΄Π΅Π»ΡΠ΅Ρ ΠΏΠΎΠ»ΠΈΡΠΈΠΊΡ Ρ ΡΠ°Π½Π΅Π½ΠΈΡ Π΄Π»Ρ Π°ΡΡ ΠΈΠ²ΠΎΠ² (Π΅ΠΆΠ΅Π΄Π½Π΅Π²Π½ΡΠ΅, Π΅ΠΆΠ΅Π½Π΅Π΄Π΅Π»ΡΠ½ΡΠ΅, Π΅ΠΆΠ΅ΠΌΠ΅ΡΡΡΠ½ΡΠ΅). - - Ζ **archive_exports** (`Function`) + - Ζ **archive_exports** (`Function`) `[TRIVIAL]` - π Π£ΠΏΡΠ°Π²Π»ΡΠ΅Ρ Π°ΡΡ ΠΈΠ²ΠΎΠΌ ΡΠΊΡΠΏΠΎΡΡΠΈΡΠΎΠ²Π°Π½Π½ΡΡ ΡΠ°ΠΉΠ»ΠΎΠ², ΠΏΡΠΈΠΌΠ΅Π½ΡΡ ΠΏΠΎΠ»ΠΈΡΠΈΠΊΡ Ρ ΡΠ°Π½Π΅Π½ΠΈΡ ΠΈ Π΄Π΅Π΄ΡΠΏΠ»ΠΈΠΊΠ°ΡΠΈΡ. - π CALLS -> `apply_retention_policy` - π CALLS -> `calculate_crc32` - - Ζ **apply_retention_policy** (`Function`) + - Ζ **apply_retention_policy** (`Function`) `[TRIVIAL]` - π (Helper) ΠΡΠΈΠΌΠ΅Π½ΡΠ΅Ρ ΠΏΠΎΠ»ΠΈΡΠΈΠΊΡ Ρ ΡΠ°Π½Π΅Π½ΠΈΡ ΠΊ ΡΠΏΠΈΡΠΊΡ ΡΠ°ΠΉΠ»ΠΎΠ², Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Ρ ΡΠ΅, ΡΡΠΎ Π½ΡΠΆΠ½ΠΎ ΡΠΎΡ ΡΠ°Π½ΠΈΡΡ. - - Ζ **save_and_unpack_dashboard** (`Function`) + - Ζ **save_and_unpack_dashboard** (`Function`) `[TRIVIAL]` - π Π‘ΠΎΡ ΡΠ°Π½ΡΠ΅Ρ Π±ΠΈΠ½Π°ΡΠ½ΠΎΠ΅ ΡΠΎΠ΄Π΅ΡΠΆΠΈΠΌΠΎΠ΅ ZIP-Π°ΡΡ ΠΈΠ²Π° Π½Π° Π΄ΠΈΡΠΊ ΠΈ ΠΎΠΏΡΠΈΠΎΠ½Π°Π»ΡΠ½ΠΎ ΡΠ°ΡΠΏΠ°ΠΊΠΎΠ²ΡΠ²Π°Π΅Ρ Π΅Π³ΠΎ. - - Ζ **update_yamls** (`Function`) + - Ζ **update_yamls** (`Function`) `[TRIVIAL]` - π ΠΠ±Π½ΠΎΠ²Π»ΡΠ΅Ρ ΠΊΠΎΠ½ΡΠΈΠ³ΡΡΠ°ΡΠΈΠΈ Π² YAML-ΡΠ°ΠΉΠ»Π°Ρ , Π·Π°ΠΌΠ΅Π½ΡΡ Π·Π½Π°ΡΠ΅Π½ΠΈΡ ΠΈΠ»ΠΈ ΠΏΡΠΈΠΌΠ΅Π½ΡΡ regex. - π CALLS -> `_update_yaml_file` - - Ζ **_update_yaml_file** (`Function`) + - Ζ **_update_yaml_file** (`Function`) `[TRIVIAL]` - π (Helper) ΠΠ±Π½ΠΎΠ²Π»ΡΠ΅Ρ ΠΎΠ΄ΠΈΠ½ YAML ΡΠ°ΠΉΠ». - - Ζ **replacer** (`Function`) + - Ζ **replacer** (`Function`) `[TRIVIAL]` - π Π€ΡΠ½ΠΊΡΠΈΡ Π·Π°ΠΌΠ΅Π½Ρ, ΡΠΎΡ ΡΠ°Π½ΡΡΡΠ°Ρ ΠΊΠ°Π²ΡΡΠΊΠΈ Π΅ΡΠ»ΠΈ ΠΎΠ½ΠΈ Π±ΡΠ»ΠΈ. - - Ζ **create_dashboard_export** (`Function`) + - Ζ **create_dashboard_export** (`Function`) `[TRIVIAL]` - π Π‘ΠΎΠ·Π΄Π°Π΅Ρ ZIP-Π°ΡΡ ΠΈΠ² ΠΈΠ· ΡΠΊΠ°Π·Π°Π½Π½ΡΡ ΠΈΡΡ ΠΎΠ΄Π½ΡΡ ΠΏΡΡΠ΅ΠΉ. - - Ζ **sanitize_filename** (`Function`) + - Ζ **sanitize_filename** (`Function`) `[TRIVIAL]` - π ΠΡΠΈΡΠ°Π΅Ρ ΡΡΡΠΎΠΊΡ ΠΎΡ ΡΠΈΠΌΠ²ΠΎΠ»ΠΎΠ², Π½Π΅Π΄ΠΎΠΏΡΡΡΠΈΠΌΡΡ Π² ΠΈΠΌΠ΅Π½Π°Ρ ΡΠ°ΠΉΠ»ΠΎΠ². - - Ζ **get_filename_from_headers** (`Function`) + - Ζ **get_filename_from_headers** (`Function`) `[TRIVIAL]` - π ΠΠ·Π²Π»Π΅ΠΊΠ°Π΅Ρ ΠΈΠΌΡ ΡΠ°ΠΉΠ»Π° ΠΈΠ· HTTP Π·Π°Π³ΠΎΠ»ΠΎΠ²ΠΊΠ° 'Content-Disposition'. - - Ζ **consolidate_archive_folders** (`Function`) + - Ζ **consolidate_archive_folders** (`Function`) `[TRIVIAL]` - π ΠΠΎΠ½ΡΠΎΠ»ΠΈΠ΄ΠΈΡΡΠ΅Ρ Π΄ΠΈΡΠ΅ΠΊΡΠΎΡΠΈΠΈ Π°ΡΡ ΠΈΠ²ΠΎΠ² Π½Π° ΠΎΡΠ½ΠΎΠ²Π΅ ΠΎΠ±ΡΠ΅Π³ΠΎ ΡΠ»Π°Π³Π° Π² ΠΈΠΌΠ΅Π½ΠΈ. -- π¦ **backend.core.utils.network** (`Module`) +- π¦ **network** (`Module`) - π ΠΠ½ΠΊΠ°ΠΏΡΡΠ»ΠΈΡΡΠ΅Ρ Π½ΠΈΠ·ΠΊΠΎΡΡΠΎΠ²Π½Π΅Π²ΡΡ HTTP-Π»ΠΎΠ³ΠΈΠΊΡ Π΄Π»Ρ Π²Π·Π°ΠΈΠΌΠΎΠ΄Π΅ΠΉΡΡΠ²ΠΈΡ Ρ Superset API, Π²ΠΊΠ»ΡΡΠ°Ρ Π°ΡΡΠ΅Π½ΡΠΈΡΠΈΠΊΠ°ΡΠΈΡ, ΡΠΏΡΠ°Π²Π»Π΅Π½ΠΈΠ΅ ΡΠ΅ΡΡΠΈΠ΅ΠΉ, retry-Π»ΠΎΠ³ΠΈΠΊΡ ΠΈ ΠΎΠ±ΡΠ°Π±ΠΎΡΠΊΡ ΠΎΡΠΈΠ±ΠΎΠΊ. - ποΈ Layer: Infra - π DEPENDS_ON -> `backend.src.core.logger` - π DEPENDS_ON -> `requests` - - β **SupersetAPIError** (`Class`) + - β **SupersetAPIError** (`Class`) `[TRIVIAL]` - π Base exception for all Superset API related errors. - - Ζ **__init__** (`Function`) + - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Initializes the exception with a message and context. - - β **AuthenticationError** (`Class`) + - β **AuthenticationError** (`Class`) `[TRIVIAL]` - π Exception raised when authentication fails. - - Ζ **__init__** (`Function`) + - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Initializes the authentication error. - - β **PermissionDeniedError** (`Class`) + - β **PermissionDeniedError** (`Class`) `[TRIVIAL]` - π Exception raised when access is denied. - - Ζ **__init__** (`Function`) + - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Initializes the permission denied error. - - β **DashboardNotFoundError** (`Class`) + - β **DashboardNotFoundError** (`Class`) `[TRIVIAL]` - π Exception raised when a dashboard cannot be found. - - Ζ **__init__** (`Function`) + - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Initializes the not found error with resource ID. - - β **NetworkError** (`Class`) + - β **NetworkError** (`Class`) `[TRIVIAL]` - π Exception raised when a network level error occurs. - - Ζ **__init__** (`Function`) + - Ζ **network.APIClient.__init__** (`Function`) `[TRIVIAL]` - π Initializes the network error. - - β **SupersetAuthCache** (`Class`) - - π Process-local cache for Superset access/csrf tokens keyed by environment credentials. - - β **APIClient** (`Class`) - - π ΠΠ½ΠΊΠ°ΠΏΡΡΠ»ΠΈΡΡΠ΅Ρ HTTP-Π»ΠΎΠ³ΠΈΠΊΡ Π΄Π»Ρ ΡΠ°Π±ΠΎΡΡ Ρ API, Π²ΠΊΠ»ΡΡΠ°Ρ ΡΠ΅ΡΡΠΈΠΈ, Π°ΡΡΠ΅Π½ΡΠΈΡΠΈΠΊΠ°ΡΠΈΡ, ΠΈ ΠΎΠ±ΡΠ°Π±ΠΎΡΠΊΡ Π·Π°ΠΏΡΠΎΡΠΎΠ². - - Ζ **__init__** (`Function`) - - π ΠΠ½ΠΈΡΠΈΠ°Π»ΠΈΠ·ΠΈΡΡΠ΅Ρ API ΠΊΠ»ΠΈΠ΅Π½Ρ Ρ ΠΊΠΎΠ½ΡΠΈΠ³ΡΡΠ°ΡΠΈΠ΅ΠΉ, ΡΠ΅ΡΡΠΈΠ΅ΠΉ ΠΈ Π»ΠΎΠ³Π³Π΅ΡΠΎΠΌ. - - Ζ **_init_session** (`Function`) - - π Π‘ΠΎΠ·Π΄Π°Π΅Ρ ΠΈ Π½Π°ΡΡΡΠ°ΠΈΠ²Π°Π΅Ρ `requests.Session` Ρ retry-Π»ΠΎΠ³ΠΈΠΊΠΎΠΉ. - - Ζ **_normalize_base_url** (`Function`) - - π Normalize Superset environment URL to base host/path without trailing slash and /api/v1 suffix. - - Ζ **_build_api_url** (`Function`) - - π Build absolute Superset API URL for endpoint using canonical /api/v1 base. - - Ζ **authenticate** (`Function`) - - π ΠΡΠΏΠΎΠ»Π½ΡΠ΅Ρ Π°ΡΡΠ΅Π½ΡΠΈΡΠΈΠΊΠ°ΡΠΈΡ Π² Superset API ΠΈ ΠΏΠΎΠ»ΡΡΠ°Π΅Ρ access ΠΈ CSRF ΡΠΎΠΊΠ΅Π½Ρ. - - Ζ **headers** (`Function`) - - π ΠΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ HTTP-Π·Π°Π³ΠΎΠ»ΠΎΠ²ΠΊΠΈ Π΄Π»Ρ Π°ΡΡΠ΅Π½ΡΠΈΡΠΈΡΠΈΡΠΎΠ²Π°Π½Π½ΡΡ Π·Π°ΠΏΡΠΎΡΠΎΠ². - - Ζ **request** (`Function`) - - π ΠΡΠΏΠΎΠ»Π½ΡΠ΅Ρ ΡΠ½ΠΈΠ²Π΅ΡΡΠ°Π»ΡΠ½ΡΠΉ HTTP-Π·Π°ΠΏΡΠΎΡ ΠΊ API. - - Ζ **_handle_http_error** (`Function`) - - π (Helper) ΠΡΠ΅ΠΎΠ±ΡΠ°Π·ΡΠ΅Ρ HTTP ΠΎΡΠΈΠ±ΠΊΠΈ Π² ΠΊΠ°ΡΡΠΎΠΌΠ½ΡΠ΅ ΠΈΡΠΊΠ»ΡΡΠ΅Π½ΠΈΡ. - - Ζ **_handle_network_error** (`Function`) - - π (Helper) ΠΡΠ΅ΠΎΠ±ΡΠ°Π·ΡΠ΅Ρ ΡΠ΅ΡΠ΅Π²ΡΠ΅ ΠΎΡΠΈΠ±ΠΊΠΈ Π² `NetworkError`. - - Ζ **upload_file** (`Function`) - - π ΠΠ°Π³ΡΡΠΆΠ°Π΅Ρ ΡΠ°ΠΉΠ» Π½Π° ΡΠ΅ΡΠ²Π΅Ρ ΡΠ΅ΡΠ΅Π· multipart/form-data. - - Ζ **_perform_upload** (`Function`) - - π (Helper) ΠΡΠΏΠΎΠ»Π½ΡΠ΅Ρ POST Π·Π°ΠΏΡΠΎΡ Ρ ΡΠ°ΠΉΠ»ΠΎΠΌ. - - Ζ **fetch_paginated_count** (`Function`) - - π ΠΠΎΠ»ΡΡΠ°Π΅Ρ ΠΎΠ±ΡΠ΅Π΅ ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² Π΄Π»Ρ ΠΏΠ°Π³ΠΈΠ½Π°ΡΠΈΠΈ. - - Ζ **fetch_paginated_data** (`Function`) - - π ΠΠ²ΡΠΎΠΌΠ°ΡΠΈΡΠ΅ΡΠΊΠΈ ΡΠΎΠ±ΠΈΡΠ°Π΅Ρ Π΄Π°Π½Π½ΡΠ΅ ΡΠΎ Π²ΡΠ΅Ρ ΡΡΡΠ°Π½ΠΈΡ ΠΏΠ°Π³ΠΈΠ½ΠΈΡΠΎΠ²Π°Π½Π½ΠΎΠ³ΠΎ ΡΠ½Π΄ΠΏΠΎΠΈΠ½ΡΠ°. + - β **network.SupersetAuthCache** (`Class`) `[TRIVIAL]` + - π Process-local cache for Superset access/csrf tokens keyed by environment credentials. + - Ζ **__init__** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - Ζ **build_key** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) - Ζ **get** (`Function`) `[TRIVIAL]` @@ -3158,49 +3101,49 @@ - π Auto-detected function (orphan) - Ζ **init_poolmanager** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- π¦ **backend.src.core.utils.matching** (`Module`) +- π¦ **backend.src.core.utils.matching** (`Module`) `[TRIVIAL]` - π Provides utility functions for fuzzy matching database names. - ποΈ Layer: Core - π Invariant: Confidence scores are returned as floats between 0.0 and 1.0. - π DEPENDS_ON -> `rapidfuzz` - - Ζ **suggest_mappings** (`Function`) + - Ζ **suggest_mappings** (`Function`) `[TRIVIAL]` - π Suggests mappings between source and target databases using fuzzy matching. -- π¦ **backend.core.utils.dataset_mapper** (`Module`) +- π¦ **backend.core.utils.dataset_mapper** (`Module`) `[TRIVIAL]` - π ΠΡΠΎΡ ΠΌΠΎΠ΄ΡΠ»Ρ ΠΎΡΠ²Π΅ΡΠ°Π΅Ρ Π·Π° ΠΎΠ±Π½ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΌΠ΅ΡΠ°Π΄Π°Π½Π½ΡΡ (verbose_map) Π² Π΄Π°ΡΠ°ΡΠ΅ΡΠ°Ρ Superset, ΠΈΠ·Π²Π»Π΅ΠΊΠ°Ρ ΠΈΡ ΠΈΠ· PostgreSQL ΠΈΠ»ΠΈ XLSX-ΡΠ°ΠΉΠ»ΠΎΠ². - ποΈ Layer: Domain - π DEPENDS_ON -> `backend.core.superset_client` - π DEPENDS_ON -> `pandas` - π DEPENDS_ON -> `psycopg2` - - β **DatasetMapper** (`Class`) + - β **DatasetMapper** (`Class`) `[TRIVIAL]` - π ΠΠ»Π°ΡΡ Π΄Π»Ρ ΠΌΠ΅ΠΏΠΏΠΈΠ½Π³Π° ΠΈ ΠΎΠ±Π½ΠΎΠ²Π»Π΅Π½ΠΈΡ verbose_map Π² Π΄Π°ΡΠ°ΡΠ΅ΡΠ°Ρ Superset. - - Ζ **__init__** (`Function`) + - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Initializes the mapper. - - Ζ **get_postgres_comments** (`Function`) + - Ζ **get_postgres_comments** (`Function`) `[TRIVIAL]` - π ΠΠ·Π²Π»Π΅ΠΊΠ°Π΅Ρ ΠΊΠΎΠΌΠΌΠ΅Π½ΡΠ°ΡΠΈΠΈ ΠΊ ΠΊΠΎΠ»ΠΎΠ½ΠΊΠ°ΠΌ ΠΈΠ· ΡΠΈΡΡΠ΅ΠΌΠ½ΠΎΠ³ΠΎ ΠΊΠ°ΡΠ°Π»ΠΎΠ³Π° PostgreSQL. - - Ζ **load_excel_mappings** (`Function`) + - Ζ **load_excel_mappings** (`Function`) `[TRIVIAL]` - π ΠΠ°Π³ΡΡΠΆΠ°Π΅Ρ ΠΌΠ΅ΠΏΠΏΠΈΠ½Π³ΠΈ 'column_name' -> 'column_comment' ΠΈΠ· XLSX ΡΠ°ΠΉΠ»Π°. - - Ζ **run_mapping** (`Function`) + - Ζ **run_mapping** (`Function`) `[TRIVIAL]` - π ΠΡΠ½ΠΎΠ²Π½Π°Ρ ΡΡΠ½ΠΊΡΠΈΡ Π΄Π»Ρ Π²ΡΠΏΠΎΠ»Π½Π΅Π½ΠΈΡ ΠΌΠ΅ΠΏΠΏΠΈΠ½Π³Π° ΠΈ ΠΎΠ±Π½ΠΎΠ²Π»Π΅Π½ΠΈΡ verbose_map Π΄Π°ΡΠ°ΡΠ΅ΡΠ° Π² Superset. - π CALLS -> `self.get_postgres_comments` - π CALLS -> `self.load_excel_mappings` - π CALLS -> `superset_client.get_dataset` - π CALLS -> `superset_client.update_dataset` -- π¦ **src.core.utils** (`Package`) +- π¦ **src.core.utils** (`Package`) `[TRIVIAL]` - π Shared utility package root. - π¦ **backend.src.core.__tests__.test_superset_profile_lookup** (`Module`) - π Verifies Superset profile lookup adapter payload normalization and fallback error precedence. - ποΈ Layer: Domain - - β **_RecordingNetworkClient** (`Class`) + - β **_RecordingNetworkClient** (`Class`) `[TRIVIAL]` - π Records request payloads and returns scripted responses for deterministic adapter tests. - - Ζ **__init__** (`Function`) + - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Initializes scripted network responses. - - Ζ **request** (`Function`) + - Ζ **request** (`Function`) `[TRIVIAL]` - π Mimics APIClient.request while capturing call arguments. - - Ζ **test_get_users_page_sends_lowercase_order_direction** (`Function`) + - Ζ **test_get_users_page_sends_lowercase_order_direction** (`Function`) `[TRIVIAL]` - π Ensures adapter sends lowercase order_direction compatible with Superset rison schema. - - Ζ **test_get_users_page_preserves_primary_schema_error_over_fallback_auth_error** (`Function`) + - Ζ **test_get_users_page_preserves_primary_schema_error_over_fallback_auth_error** (`Function`) `[TRIVIAL]` - π Ensures fallback auth error does not mask primary schema/query failure. - - Ζ **test_get_users_page_uses_fallback_endpoint_when_primary_fails** (`Function`) + - Ζ **test_get_users_page_uses_fallback_endpoint_when_primary_fails** (`Function`) `[TRIVIAL]` - π Verifies adapter retries second users endpoint and succeeds when fallback is healthy. - π¦ **test_throttled_scheduler** (`Module`) - π Unit tests for ThrottledSchedulerConfigurator distribution logic. @@ -3219,75 +3162,75 @@ - π¦ **backend.src.core.__tests__.test_config_manager_compat** (`Module`) - π Verifies ConfigManager compatibility wrappers preserve legacy payload sections. - ποΈ Layer: Domain - - Ζ **test_get_payload_preserves_legacy_sections** (`Function`) + - Ζ **test_get_payload_preserves_legacy_sections** (`Function`) `[TRIVIAL]` - π Ensure get_payload merges typed config into raw payload without dropping legacy sections. - - Ζ **test_save_config_accepts_raw_payload_and_keeps_extras** (`Function`) + - Ζ **test_save_config_accepts_raw_payload_and_keeps_extras** (`Function`) `[TRIVIAL]` - π Ensure save_config accepts raw dict payload, refreshes typed config, and preserves extra sections. - Ζ **_capture_save** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) - π¦ **test_logger** (`Module`) - π Unit tests for logger module - ποΈ Layer: Infra - - Ζ **test_belief_scope_logs_entry_action_exit_at_debug** (`Function`) + - Ζ **test_belief_scope_logs_entry_action_exit_at_debug** (`Function`) `[TRIVIAL]` - π Test that belief_scope generates [ID][Entry], [ID][Action], and [ID][Exit] logs at DEBUG level. - - Ζ **test_belief_scope_error_handling** (`Function`) + - Ζ **test_belief_scope_error_handling** (`Function`) `[TRIVIAL]` - π Test that belief_scope logs Coherence:Failed on exception. - - Ζ **test_belief_scope_success_coherence** (`Function`) + - Ζ **test_belief_scope_success_coherence** (`Function`) `[TRIVIAL]` - π Test that belief_scope logs Coherence:OK on success. - - Ζ **test_belief_scope_not_visible_at_info** (`Function`) + - Ζ **test_belief_scope_not_visible_at_info** (`Function`) `[TRIVIAL]` - π Test that belief_scope Entry/Exit/Coherence logs are NOT visible at INFO level. - - Ζ **test_task_log_level_default** (`Function`) + - Ζ **test_task_log_level_default** (`Function`) `[TRIVIAL]` - π Test that default task log level is INFO. - - Ζ **test_should_log_task_level** (`Function`) + - Ζ **test_should_log_task_level** (`Function`) `[TRIVIAL]` - π Test that should_log_task_level correctly filters log levels. - - Ζ **test_configure_logger_task_log_level** (`Function`) + - Ζ **test_configure_logger_task_log_level** (`Function`) `[TRIVIAL]` - π Test that configure_logger updates task_log_level. - - Ζ **test_enable_belief_state_flag** (`Function`) + - Ζ **test_enable_belief_state_flag** (`Function`) `[TRIVIAL]` - π Test that enable_belief_state flag controls belief_scope logging. - - Ζ **test_belief_scope_missing_anchor** (`Function`) + - Ζ **test_belief_scope_missing_anchor** (`Function`) `[TRIVIAL]` - π Test @PRE condition: anchor_id must be provided - - Ζ **test_configure_logger_post_conditions** (`Function`) + - Ζ **test_configure_logger_post_conditions** (`Function`) `[TRIVIAL]` - π Test @POST condition: Logger level, handlers, belief state flag, and task log level are updated. - Ζ **reset_logger_state** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- π¦ **backend.src.core.migration.dry_run_orchestrator** (`Module`) `[CRITICAL]` +- π¦ **backend.src.core.migration.dry_run_orchestrator** (`Module`) - π Compute pre-flight migration diff and risk scoring without apply. - ποΈ Layer: Core - π Invariant: Dry run is informative only and must not mutate target environment. - - π DEPENDS_ON -> `backend.src.core.superset_client` - - π DEPENDS_ON -> `backend.src.core.migration_engine` - - π DEPENDS_ON -> `backend.src.core.migration.archive_parser` + - π DEPENDS_ON -> `backend.src.core.superset_client.SupersetClient` + - π DEPENDS_ON -> `backend.src.core.migration_engine.MigrationEngine` + - π DEPENDS_ON -> `backend.src.core.migration.archive_parser.MigrationArchiveParser` - π DEPENDS_ON -> `backend.src.core.migration.risk_assessor` - β **MigrationDryRunService** (`Class`) `[CRITICAL]` - π Build deterministic diff/risk payload for migration pre-flight. - - Ζ **__init__** (`Function`) + - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Wire parser dependency for archive object extraction. - - Ζ **run** (`Function`) + - Ζ **run** (`Function`) `[TRIVIAL]` - π Execute full dry-run computation for selected dashboards. - - Ζ **_load_db_mapping** (`Function`) + - Ζ **_load_db_mapping** (`Function`) `[TRIVIAL]` - π Resolve UUID mapping for optional DB config replacement. - - Ζ **_accumulate_objects** (`Function`) + - Ζ **_accumulate_objects** (`Function`) `[TRIVIAL]` - π Merge extracted resources by UUID to avoid duplicates. - - Ζ **_index_by_uuid** (`Function`) + - Ζ **_index_by_uuid** (`Function`) `[TRIVIAL]` - π Build UUID-index map for normalized resources. - - Ζ **_build_object_diff** (`Function`) + - Ζ **_build_object_diff** (`Function`) `[TRIVIAL]` - π Compute create/update/delete buckets by UUID+signature. - - Ζ **_build_target_signatures** (`Function`) + - Ζ **_build_target_signatures** (`Function`) `[TRIVIAL]` - π Pull target metadata and normalize it into comparable signatures. - - Ζ **_build_risks** (`Function`) + - Ζ **_build_risks** (`Function`) `[TRIVIAL]` - π Build risk items for missing datasource, broken refs, overwrite, owner mismatch. -- π¦ **backend.src.core.migration.archive_parser** (`Module`) `[CRITICAL]` +- π¦ **backend.src.core.migration.archive_parser** (`Module`) - π Parse Superset export ZIP archives into normalized object catalogs for diffing. - ποΈ Layer: Core - π Invariant: Parsing is read-only and never mutates archive files. - π DEPENDS_ON -> `backend.src.core.logger` - β **MigrationArchiveParser** (`Class`) `[CRITICAL]` - π Extract normalized dashboards/charts/datasets metadata from ZIP archives. - - Ζ **extract_objects_from_zip** (`Function`) + - Ζ **extract_objects_from_zip** (`Function`) `[TRIVIAL]` - π Extract object catalogs from Superset archive. - - Ζ **_collect_yaml_objects** (`Function`) + - Ζ **_collect_yaml_objects** (`Function`) `[TRIVIAL]` - π Read and normalize YAML manifests for one object type. - - Ζ **_normalize_object_payload** (`Function`) + - Ζ **_normalize_object_payload** (`Function`) `[TRIVIAL]` - π Convert raw YAML payload to stable diff signature shape. - π¦ **backend.src.core.migration.risk_assessor** (`Module`) `[CRITICAL]` - π Compute deterministic migration risk items and aggregate score for dry-run reporting. @@ -3295,13 +3238,13 @@ - π Invariant: Risk scoring must remain bounded to [0,100] and preserve severity-to-weight mapping. - π DEPENDS_ON -> `backend.src.core.superset_client.SupersetClient` - π DISPATCHES -> `backend.src.core.migration.dry_run_orchestrator.MigrationDryRunService.run` - - Ζ **index_by_uuid** (`Function`) + - Ζ **index_by_uuid** (`Function`) `[TRIVIAL]` - π Build UUID-index from normalized objects. - - Ζ **extract_owner_identifiers** (`Function`) + - Ζ **extract_owner_identifiers** (`Function`) `[TRIVIAL]` - π Normalize owner payloads for stable comparison. - - Ζ **build_risks** (`Function`) + - Ζ **build_risks** (`Function`) `[TRIVIAL]` - π Build risk list from computed diffs and target catalog state. - - Ζ **score_risks** (`Function`) + - Ζ **score_risks** (`Function`) `[TRIVIAL]` - π Aggregate risk list into score and level. - π¦ **backend.src.core.migration.__init__** (`Module`) `[TRIVIAL]` - π Namespace package for migration pre-flight orchestration components. @@ -3314,32 +3257,36 @@ - β **TaskLogger** (`Class`) `[CRITICAL]` - π A wrapper around TaskManager._add_log that carries task_id and source context. - π Invariant: All log calls include the task_id and source. - - Ζ **__init__** (`Function`) + - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Initialize the TaskLogger with task context. - - Ζ **with_source** (`Function`) + - Ζ **with_source** (`Function`) `[TRIVIAL]` - π Create a sub-logger with a different default source. - - Ζ **_log** (`Function`) + - Ζ **_log** (`Function`) `[TRIVIAL]` - π Internal method to log a message at a given level. - - Ζ **debug** (`Function`) + - Ζ **debug** (`Function`) `[TRIVIAL]` - π Log a DEBUG level message. - - Ζ **info** (`Function`) + - Ζ **info** (`Function`) `[TRIVIAL]` - π Log an INFO level message. - - Ζ **warning** (`Function`) + - Ζ **warning** (`Function`) `[TRIVIAL]` - π Log a WARNING level message. - - Ζ **error** (`Function`) + - Ζ **error** (`Function`) `[TRIVIAL]` - π Log an ERROR level message. - - Ζ **progress** (`Function`) + - Ζ **progress** (`Function`) `[TRIVIAL]` - π Log a progress update with percentage. - π¦ **TaskPersistenceModule** (`Module`) `[CRITICAL]` - π Handles the persistence of tasks using SQLAlchemy and the tasks.db database. - ποΈ Layer: Core - π Invariant: Database schema must match the TaskRecord model structure. + - π DEPENDS_ON -> `TasksSessionLocal` - β **TaskPersistenceService** (`Class`) `[CRITICAL]` - - π Provides methods to save and load tasks from the tasks.db database using SQLAlchemy. + - π Provides methods to save, load, and delete task records in tasks.db using SQLAlchemy models. - π Invariant: Persistence must handle potentially missing task fields natively. - - Ζ **_json_load_if_needed** (`Function`) + - π DEPENDS_ON -> `TasksSessionLocal` + - π DEPENDS_ON -> `TaskRecord` + - π DEPENDS_ON -> `Environment` + - Ζ **_json_load_if_needed** (`Function`) `[TRIVIAL]` - π Safely load JSON strings from DB if necessary - - Ζ **_parse_datetime** (`Function`) + - Ζ **_parse_datetime** (`Function`) `[TRIVIAL]` - π Safely parse a datetime string from the database - Ζ **_resolve_environment_id** (`Function`) - π Resolve environment id into existing environments.id value to satisfy FK constraints. @@ -3347,16 +3294,21 @@ - π Initializes the persistence service. - Ζ **persist_task** (`Function`) - π Persists or updates a single task in the database. + - π CALLS -> `_resolve_environment_id` - Ζ **persist_tasks** (`Function`) - π Persists multiple tasks. + - π CALLS -> `persist_task` - Ζ **load_tasks** (`Function`) - π Loads tasks from the database. + - π CALLS -> `_json_load_if_needed` + - π CALLS -> `_parse_datetime` - Ζ **delete_tasks** (`Function`) - π Deletes specific tasks from the database. - β **TaskLogPersistenceService** (`Class`) `[CRITICAL]` - - π Provides methods to save and query task logs from the task_logs table. + - π Provides methods to store, query, summarize, and delete task log rows in the task_logs table. - π Invariant: Log entries are batch-inserted for performance. - π DEPENDS_ON -> `TaskLogRecord` + - π DEPENDS_ON -> `TasksSessionLocal` - Ζ **__init__** (`Function`) - π Initializes the TaskLogPersistenceService - Ζ **add_logs** (`Function`) @@ -3379,10 +3331,12 @@ - π Manages the lifecycle of tasks, including their creation, execution, and state tracking. It uses a thread pool to run plugins asynchronously. - ποΈ Layer: Core - π Invariant: Task IDs are unique. + - π DEPENDS_ON -> `backend.src.core.plugin_loader` + - π DEPENDS_ON -> `backend.src.core.task_manager.persistence` - β **TaskManager** (`Class`) `[CRITICAL]` - π Manages the lifecycle of tasks, including their creation, execution, and state tracking. - π Invariant: Log entries are never deleted after being added to a task. - - Ζ **__init__** (`Function`) + - Ζ **__init__** (`Function`) `[CRITICAL]` - π Initialize the TaskManager with dependencies. - Ζ **_flusher_loop** (`Function`) - π Background thread that periodically flushes log buffer to database. @@ -3447,22 +3401,26 @@ - π Statistics about log entries for a task. - β **Task** (`Class`) - π A Pydantic model representing a single execution instance of a plugin, including its status, parameters, and logs. - - Ζ **__init__** (`Function`) + - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Initializes the Task model and validates input_request for AWAITING_INPUT status. - π¦ **TaskCleanupModule** (`Module`) - π Implements task cleanup and retention policies, including associated logs. - ποΈ Layer: Core - β **TaskCleanupService** (`Class`) - π Provides methods to clean up old task records and their associated logs. - - Ζ **__init__** (`Function`) + - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Initializes the cleanup service with dependencies. - - Ζ **run_cleanup** (`Function`) + - Ζ **run_cleanup** (`Function`) `[TRIVIAL]` - π Deletes tasks older than the configured retention period and their logs. - - Ζ **delete_task_with_logs** (`Function`) + - Ζ **delete_task_with_logs** (`Function`) `[TRIVIAL]` - π Delete a single task and all its associated logs. - π¦ **TaskManagerPackage** (`Module`) `[TRIVIAL]` - π Exports the public API of the task manager package. - ποΈ Layer: Core + - π Invariant: Package exports stay aligned with manager and models contracts. + - π DEPENDS_ON -> `TaskManagerModels` + - π DEPENDS_ON -> `TaskManagerModule` + - π DEPENDS_ON -> `backend.src.core.task_manager.manager.TaskManager` - π¦ **TaskContextModule** (`Module`) `[CRITICAL]` - π Provides execution context passed to plugins during task execution. - ποΈ Layer: Core @@ -3471,19 +3429,19 @@ - β **TaskContext** (`Class`) `[CRITICAL]` - π A container passed to plugin.execute() providing the logger and other task-specific utilities. - π Invariant: logger is always a valid TaskLogger instance. - - Ζ **__init__** (`Function`) + - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Initialize the TaskContext with task-specific resources. - - Ζ **task_id** (`Function`) + - Ζ **task_id** (`Function`) `[TRIVIAL]` - π Get the task ID. - - Ζ **logger** (`Function`) + - Ζ **logger** (`Function`) `[TRIVIAL]` - π Get the TaskLogger instance for this context. - - Ζ **params** (`Function`) + - Ζ **params** (`Function`) `[TRIVIAL]` - π Get the task parameters. - - Ζ **background_tasks** (`Function`) + - Ζ **background_tasks** (`Function`) `[TRIVIAL]` - π Expose optional background task scheduler for plugins that dispatch deferred side effects. - - Ζ **get_param** (`Function`) + - Ζ **get_param** (`Function`) `[TRIVIAL]` - π Get a specific parameter value with optional default. - - Ζ **create_sub_context** (`Function`) + - Ζ **create_sub_context** (`Function`) `[TRIVIAL]` - π Create a sub-context with a different default source. - Ζ **execute** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -3508,13 +3466,13 @@ - π Auto-detected function (orphan) - π¦ **backend.src.core.task_manager.__tests__.test_context** (`Module`) - π Verify TaskContext preserves optional background task scheduler across sub-context creation. - - Ζ **test_task_context_preserves_background_tasks_across_sub_context** (`Function`) + - Ζ **test_task_context_preserves_background_tasks_across_sub_context** (`Function`) `[TRIVIAL]` - π Plugins must be able to access background_tasks from both root and sub-context loggers. -- π¦ **backend.src.api.auth** (`Module`) `[CRITICAL]` +- π¦ **backend.src.api.auth** (`Module`) - π Authentication API endpoints. - ποΈ Layer: API - π Invariant: All auth endpoints must return consistent error codes. - - π¦ **router** (`Variable`) + - π¦ **router** (`Variable`) `[TRIVIAL]` - π APIRouter instance for authentication routes. - Ζ **login_for_access_token** (`Function`) - π Authenticates a user and returns a JWT access token. @@ -3526,67 +3484,77 @@ - π Initiates the ADFS OIDC login flow. - Ζ **auth_callback_adfs** (`Function`) - π Handles the callback from ADFS after successful authentication. -- π¦ **src.api** (`Package`) +- π¦ **src.api** (`Package`) `[TRIVIAL]` - π Backend API package root. -- π¦ **router** (`Global`) +- π¦ **router** (`Global`) `[TRIVIAL]` - π APIRouter instance for LLM routes. -- Ζ **_is_valid_runtime_api_key** (`Function`) +- Ζ **_is_valid_runtime_api_key** (`Function`) `[TRIVIAL]` - π Validate decrypted runtime API key presence/shape. -- Ζ **get_providers** (`Function`) +- Ζ **get_providers** (`Function`) `[TRIVIAL]` - π Retrieve all LLM provider configurations. -- Ζ **get_llm_status** (`Function`) +- Ζ **get_llm_status** (`Function`) `[TRIVIAL]` - π Returns whether LLM runtime is configured for dashboard validation. -- Ζ **create_provider** (`Function`) +- Ζ **create_provider** (`Function`) `[TRIVIAL]` - π Create a new LLM provider configuration. -- Ζ **update_provider** (`Function`) +- Ζ **update_provider** (`Function`) `[TRIVIAL]` - π Update an existing LLM provider configuration. -- Ζ **delete_provider** (`Function`) +- Ζ **delete_provider** (`Function`) `[TRIVIAL]` - π Delete an LLM provider configuration. -- Ζ **test_connection** (`Function`) +- Ζ **test_connection** (`Function`) `[TRIVIAL]` - π Test connection to an LLM provider. -- Ζ **test_provider_config** (`Function`) +- Ζ **test_provider_config** (`Function`) `[TRIVIAL]` - π Test connection with a provided configuration (not yet saved). - π¦ **backend.src.api.routes.datasets** (`Module`) - π API endpoints for the Dataset Hub - listing datasets with mapping progress - ποΈ Layer: API - π Invariant: All dataset responses include last_task metadata - π DEPENDS_ON -> `backend.src.dependencies` - - π DEPENDS_ON -> `backend.src.services.resource_service` - - π DEPENDS_ON -> `backend.src.core.superset_client` - - π¦ **MappedFields** (`DataClass`) - - π¦ **LastTask** (`DataClass`) - - π¦ **DatasetItem** (`DataClass`) - - π¦ **LinkedDashboard** (`DataClass`) - - π¦ **DatasetColumn** (`DataClass`) - - π¦ **DatasetDetailResponse** (`DataClass`) - - π¦ **DatasetsResponse** (`DataClass`) - - π¦ **TaskResponse** (`DataClass`) + - π DEPENDS_ON -> `backend.src.services.resource_service.ResourceService` + - π DEPENDS_ON -> `backend.src.core.superset_client.SupersetClient` + - π¦ **MappedFields** (`DataClass`) `[TRIVIAL]` + - π DTO for dataset mapping progress statistics + - π¦ **LastTask** (`DataClass`) `[TRIVIAL]` + - π DTO for the most recent task associated with a dataset + - π¦ **DatasetItem** (`DataClass`) `[TRIVIAL]` + - π Summary DTO for a dataset in the hub listing + - π¦ **LinkedDashboard** (`DataClass`) `[TRIVIAL]` + - π DTO for a dashboard linked to a dataset + - π¦ **DatasetColumn** (`DataClass`) `[TRIVIAL]` + - π DTO for a single dataset column's metadata + - π¦ **DatasetDetailResponse** (`DataClass`) `[TRIVIAL]` + - π Detailed DTO for a dataset including columns and links + - π¦ **DatasetsResponse** (`DataClass`) `[TRIVIAL]` + - π Paginated response DTO for dataset listings + - π¦ **TaskResponse** (`DataClass`) `[TRIVIAL]` + - π Response DTO containing a task ID for tracking - Ζ **get_dataset_ids** (`Function`) - π Fetch list of all dataset IDs from a specific environment (without pagination) - - π CALLS -> `ResourceService.get_datasets_with_status` + - π CALLS -> `get_datasets_with_status` - Ζ **get_datasets** (`Function`) - π Fetch list of datasets from a specific environment with mapping progress - - π CALLS -> `ResourceService.get_datasets_with_status` - - π¦ **MapColumnsRequest** (`DataClass`) + - π CALLS -> `backend.src.services.resource_service.ResourceService.get_datasets_with_status` + - π¦ **MapColumnsRequest** (`DataClass`) `[TRIVIAL]` + - π Request DTO for initiating column mapping - Ζ **map_columns** (`Function`) - π Trigger bulk column mapping for datasets - - π DISPATCHES -> `MapperPlugin` - - π CALLS -> `task_manager.create_task` - - π¦ **GenerateDocsRequest** (`DataClass`) + - π DISPATCHES -> `backend.src.plugins.mapper.MapperPlugin` + - π CALLS -> `backend.src.core.task_manager.manager.TaskManager:create_task` + - π¦ **GenerateDocsRequest** (`DataClass`) `[TRIVIAL]` + - π Request DTO for initiating documentation generation - Ζ **generate_docs** (`Function`) - π Trigger bulk documentation generation for datasets - - π DISPATCHES -> `LLMAnalysisPlugin` - - π CALLS -> `task_manager.create_task` + - π DISPATCHES -> `backend.src.plugins.llm_analysis.plugin.DocumentationPlugin` + - π CALLS -> `backend.src.core.task_manager.manager.TaskManager:create_task` - Ζ **get_dataset_detail** (`Function`) - π Get detailed dataset information including columns and linked dashboards - - π CALLS -> `SupersetClient.get_dataset_detail` + - π CALLS -> `backend.src.core.superset_client.SupersetClient:get_dataset_detail` - π¦ **backend.src.api.routes.git** (`Module`) - π Provides FastAPI endpoints for Git integration operations. - ποΈ Layer: API - π Invariant: All Git operations must be routed through GitService. - - Ζ **_build_no_repo_status_payload** (`Function`) + - Ζ **_build_no_repo_status_payload** (`Function`) `[TRIVIAL]` - π Build a consistent status payload for dashboards without initialized repositories. - - Ζ **_handle_unexpected_git_route_error** (`Function`) + - Ζ **_handle_unexpected_git_route_error** (`Function`) `[TRIVIAL]` - π Convert unexpected route-level exceptions to stable 500 API responses. - Ζ **_resolve_repository_status** (`Function`) - π Resolve repository status for one dashboard with graceful NO_REPO semantics. @@ -3602,7 +3570,7 @@ - π Resolve dashboard ID asynchronously from slug-or-id reference for hot Git routes. - Ζ **_resolve_repo_key_from_ref** (`Function`) - π Resolve repository folder key with slug-first strategy and deterministic fallback. - - Ζ **_sanitize_optional_identity_value** (`Function`) + - Ζ **_sanitize_optional_identity_value** (`Function`) `[TRIVIAL]` - π Normalize optional identity value into trimmed string or None. - Ζ **_resolve_current_user_git_identity** (`Function`) - π Resolve configured Git username/email from current user's profile preferences. @@ -3672,29 +3640,29 @@ - π Get Git diff for a dashboard repository. - Ζ **generate_commit_message** (`Function`) - π Generate a suggested commit message using LLM. -- π¦ **ConnectionsRouter** (`Module`) +- π¦ **ConnectionsRouter** (`Module`) `[TRIVIAL]` - π Defines the FastAPI router for managing external database connections. - ποΈ Layer: UI (API) - - Ζ **_ensure_connections_schema** (`Function`) + - Ζ **_ensure_connections_schema** (`Function`) `[TRIVIAL]` - π Ensures the connection_configs table exists before CRUD access. - - β **ConnectionSchema** (`Class`) + - β **ConnectionSchema** (`Class`) `[TRIVIAL]` - π Pydantic model for connection response. - - β **ConnectionCreate** (`Class`) + - β **ConnectionCreate** (`Class`) `[TRIVIAL]` - π Pydantic model for creating a connection. - - Ζ **list_connections** (`Function`) + - Ζ **list_connections** (`Function`) `[TRIVIAL]` - π Lists all saved connections. - - Ζ **create_connection** (`Function`) + - Ζ **create_connection** (`Function`) `[TRIVIAL]` - π Creates a new connection configuration. - - Ζ **delete_connection** (`Function`) + - Ζ **delete_connection** (`Function`) `[TRIVIAL]` - π Deletes a connection configuration. - π¦ **health_router** (`Module`) - π API endpoints for dashboard health monitoring and status aggregation. - ποΈ Layer: UI/API - π DEPENDS_ON -> `health_service` - - Ζ **get_health_summary** (`Function`) + - Ζ **get_health_summary** (`Function`) `[TRIVIAL]` - π Get aggregated health status for all dashboards. - π CALLS -> `backend.src.services.health_service.HealthService` - - Ζ **delete_health_report** (`Function`) + - Ζ **delete_health_report** (`Function`) `[TRIVIAL]` - π Delete one persisted dashboard validation report from health summary. - π CALLS -> `backend.src.services.health_service.HealthService` - π¦ **backend.src.api.routes.environments** (`Module`) @@ -3703,18 +3671,18 @@ - π Invariant: Environment IDs must exist in the configuration. - π DEPENDS_ON -> `backend.src.dependencies` - π DEPENDS_ON -> `backend.src.core.superset_client` - - Ζ **_normalize_superset_env_url** (`Function`) + - Ζ **_normalize_superset_env_url** (`Function`) `[TRIVIAL]` - π Canonicalize Superset environment URL to base host/path without trailing /api/v1. - - π¦ **ScheduleSchema** (`DataClass`) - - π¦ **EnvironmentResponse** (`DataClass`) - - π¦ **DatabaseResponse** (`DataClass`) - - Ζ **get_environments** (`Function`) + - π¦ **ScheduleSchema** (`DataClass`) `[TRIVIAL]` + - π¦ **EnvironmentResponse** (`DataClass`) `[TRIVIAL]` + - π¦ **DatabaseResponse** (`DataClass`) `[TRIVIAL]` + - Ζ **get_environments** (`Function`) `[TRIVIAL]` - π List all configured environments. - ποΈ Layer: API - - Ζ **update_environment_schedule** (`Function`) + - Ζ **update_environment_schedule** (`Function`) `[TRIVIAL]` - π Update backup schedule for an environment. - ποΈ Layer: API - - Ζ **get_environment_databases** (`Function`) + - Ζ **get_environment_databases** (`Function`) `[TRIVIAL]` - π Fetch the list of databases from a specific environment. - ποΈ Layer: API - π¦ **backend.src.api.routes.migration** (`Module`) `[CRITICAL]` @@ -3723,16 +3691,16 @@ - π Invariant: Migration endpoints never execute with invalid environment references and always return explicit HTTP errors on guard failures. - π DEPENDS_ON -> `backend.src.dependencies` - π DEPENDS_ON -> `backend.src.core.database` - - π DEPENDS_ON -> `backend.src.core.superset_client` - - π DEPENDS_ON -> `backend.src.core.migration.dry_run_orchestrator` - - π DEPENDS_ON -> `backend.src.core.mapping_service` + - π DEPENDS_ON -> `backend.src.core.superset_client.SupersetClient` + - π DEPENDS_ON -> `backend.src.core.migration.dry_run_orchestrator.MigrationDryRunService` + - π DEPENDS_ON -> `backend.src.core.mapping_service.IdMappingService` - π DEPENDS_ON -> `backend.src.models.dashboard` - π DEPENDS_ON -> `backend.src.models.mapping` - Ζ **get_dashboards** (`Function`) - π Fetch dashboard metadata from a requested environment for migration selection UI. - - Ζ **execute_migration** (`Function`) + - Ζ **execute_migration** (`Function`) `[CRITICAL]` - π Validate migration selection and enqueue asynchronous migration task execution. - - Ζ **dry_run_migration** (`Function`) + - Ζ **dry_run_migration** (`Function`) `[CRITICAL]` - π Build pre-flight migration diff and risk summary without mutating target systems. - Ζ **get_migration_settings** (`Function`) - π Read and return configured migration synchronization cron expression. @@ -3745,7 +3713,7 @@ - π¦ **PluginsRouter** (`Module`) - π Defines the FastAPI router for plugin-related endpoints, allowing clients to list available plugins. - ποΈ Layer: UI (API) - - Ζ **list_plugins** (`Function`) + - Ζ **list_plugins** (`Function`) `[TRIVIAL]` - π Retrieve a list of all available plugins. - π¦ **backend.src.api.routes.clean_release_v2** (`Module`) - π Redesigned clean release API for headless candidate lifecycle. @@ -3771,24 +3739,24 @@ - π DEPENDS_ON -> `backend.src.dependencies` - π DEPENDS_ON -> `backend.src.core.database` - π DEPENDS_ON -> `backend.src.services.mapping_service` - - π¦ **MappingCreate** (`DataClass`) - - π¦ **MappingResponse** (`DataClass`) - - π¦ **SuggestRequest** (`DataClass`) - - Ζ **get_mappings** (`Function`) + - π¦ **MappingCreate** (`DataClass`) `[TRIVIAL]` + - π¦ **MappingResponse** (`DataClass`) `[TRIVIAL]` + - π¦ **SuggestRequest** (`DataClass`) `[TRIVIAL]` + - Ζ **get_mappings** (`Function`) `[TRIVIAL]` - π List all saved database mappings. - - Ζ **create_mapping** (`Function`) + - Ζ **create_mapping** (`Function`) `[TRIVIAL]` - π Create or update a database mapping. - - Ζ **suggest_mappings_api** (`Function`) + - Ζ **suggest_mappings_api** (`Function`) `[TRIVIAL]` - π Get suggested mappings based on fuzzy matching. - π¦ **SettingsRouter** (`Module`) - π Provides API endpoints for managing application settings and Superset environments. - ποΈ Layer: UI (API) - π Invariant: All settings changes must be persisted via ConfigManager. - - π DEPENDS_ON -> `ConfigManager` - - π DEPENDS_ON -> `ConfigModels` - - β **LoggingConfigResponse** (`Class`) + - π DEPENDS_ON -> `backend.src.core.config_manager.ConfigManager` + - π DEPENDS_ON -> `backend.src.core.config_models` + - β **LoggingConfigResponse** (`Class`) `[TRIVIAL]` - π Response model for logging configuration with current task log level. - - Ζ **_normalize_superset_env_url** (`Function`) + - Ζ **_normalize_superset_env_url** (`Function`) `[TRIVIAL]` - π Canonicalize Superset environment URL to base host/path without trailing /api/v1. - Ζ **_validate_superset_connection_fast** (`Function`) - π Run lightweight Superset connectivity validation without full pagination scan. @@ -3814,7 +3782,8 @@ - π Retrieves current logging configuration. - Ζ **update_logging_config** (`Function`) - π Updates logging configuration. - - β **ConsolidatedSettingsResponse** (`Class`) + - β **ConsolidatedSettingsResponse** (`Class`) `[TRIVIAL]` + - π Response model for consolidated application settings. - Ζ **get_consolidated_settings** (`Function`) - π Retrieves all settings categories in a single call - Ζ **update_consolidated_settings** (`Function`) @@ -3831,7 +3800,7 @@ - π Admin API endpoints for user and role management. - ποΈ Layer: API - π Invariant: All endpoints in this module require 'Admin' role or 'admin' scope. - - π¦ **router** (`Variable`) + - π¦ **router** (`Variable`) `[TRIVIAL]` - π APIRouter instance for admin routes. - Ζ **list_users** (`Function`) - π Lists all registered users. @@ -3867,63 +3836,63 @@ - π DEPENDS_ON -> `backend.src.models.git` - β **GitServerConfigBase** (`Class`) `[TRIVIAL]` - π Base schema for Git server configuration attributes. - - β **GitServerConfigUpdate** (`Class`) + - β **GitServerConfigUpdate** (`Class`) `[TRIVIAL]` - π Schema for updating an existing Git server configuration. - - β **GitServerConfigCreate** (`Class`) + - β **GitServerConfigCreate** (`Class`) `[TRIVIAL]` - π Schema for creating a new Git server configuration. - - β **GitServerConfigSchema** (`Class`) + - β **GitServerConfigSchema** (`Class`) `[TRIVIAL]` - π Schema for representing a Git server configuration with metadata. - - β **GitRepositorySchema** (`Class`) + - β **GitRepositorySchema** (`Class`) `[TRIVIAL]` - π Schema for tracking a local Git repository linked to a dashboard. - - β **BranchSchema** (`Class`) + - β **BranchSchema** (`Class`) `[TRIVIAL]` - π Schema for representing a Git branch metadata. - - β **CommitSchema** (`Class`) + - β **CommitSchema** (`Class`) `[TRIVIAL]` - π Schema for representing Git commit details. - - β **BranchCreate** (`Class`) + - β **BranchCreate** (`Class`) `[TRIVIAL]` - π Schema for branch creation requests. - - β **BranchCheckout** (`Class`) + - β **BranchCheckout** (`Class`) `[TRIVIAL]` - π Schema for branch checkout requests. - - β **CommitCreate** (`Class`) + - β **CommitCreate** (`Class`) `[TRIVIAL]` - π Schema for staging and committing changes. - - β **ConflictResolution** (`Class`) + - β **ConflictResolution** (`Class`) `[TRIVIAL]` - π Schema for resolving merge conflicts. - - β **MergeStatusSchema** (`Class`) + - β **MergeStatusSchema** (`Class`) `[TRIVIAL]` - π Schema representing unfinished merge status for repository. - - β **MergeConflictFileSchema** (`Class`) + - β **MergeConflictFileSchema** (`Class`) `[TRIVIAL]` - π Schema describing one conflicted file with optional side snapshots. - - β **MergeResolveRequest** (`Class`) + - β **MergeResolveRequest** (`Class`) `[TRIVIAL]` - π Request schema for resolving one or multiple merge conflicts. - - β **MergeContinueRequest** (`Class`) + - β **MergeContinueRequest** (`Class`) `[TRIVIAL]` - π Request schema for finishing merge with optional explicit commit message. - - β **DeploymentEnvironmentSchema** (`Class`) + - β **DeploymentEnvironmentSchema** (`Class`) `[TRIVIAL]` - π Schema for representing a target deployment environment. - - β **DeployRequest** (`Class`) + - β **DeployRequest** (`Class`) `[TRIVIAL]` - π Schema for dashboard deployment requests. - - β **RepoInitRequest** (`Class`) + - β **RepoInitRequest** (`Class`) `[TRIVIAL]` - π Schema for repository initialization requests. - - β **RepositoryBindingSchema** (`Class`) + - β **RepositoryBindingSchema** (`Class`) `[TRIVIAL]` - π Schema describing repository-to-config binding and provider metadata. - - β **RepoStatusBatchRequest** (`Class`) + - β **RepoStatusBatchRequest** (`Class`) `[TRIVIAL]` - π Schema for requesting repository statuses for multiple dashboards in a single call. - - β **RepoStatusBatchResponse** (`Class`) + - β **RepoStatusBatchResponse** (`Class`) `[TRIVIAL]` - π Schema for returning repository statuses keyed by dashboard ID. - - β **GiteaRepoSchema** (`Class`) + - β **GiteaRepoSchema** (`Class`) `[TRIVIAL]` - π Schema describing a Gitea repository. - - β **GiteaRepoCreateRequest** (`Class`) + - β **GiteaRepoCreateRequest** (`Class`) `[TRIVIAL]` - π Request schema for creating a Gitea repository. - - β **RemoteRepoSchema** (`Class`) + - β **RemoteRepoSchema** (`Class`) `[TRIVIAL]` - π Provider-agnostic remote repository payload. - - β **RemoteRepoCreateRequest** (`Class`) + - β **RemoteRepoCreateRequest** (`Class`) `[TRIVIAL]` - π Provider-agnostic repository creation request. - - β **PromoteRequest** (`Class`) + - β **PromoteRequest** (`Class`) `[TRIVIAL]` - π Request schema for branch promotion workflow. - - β **PromoteResponse** (`Class`) + - β **PromoteResponse** (`Class`) `[TRIVIAL]` - π Response schema for promotion operation result. - π¦ **backend.src.api.routes.assistant** (`Module`) - π API routes for LLM assistant command parsing and safe execution orchestration. - ποΈ Layer: API - π Invariant: Risky operations are never executed without valid confirmation token. - - π DEPENDS_ON -> `backend.src.core.task_manager` + - π DEPENDS_ON -> `backend.src.core.task_manager.manager.TaskManager` - π DEPENDS_ON -> `backend.src.models.assistant` - β **AssistantMessageRequest** (`Class`) `[TRIVIAL]` - π Input payload for assistant message endpoint. @@ -4007,9 +3976,9 @@ - π Return paginated conversation list for current user with archived flag and last message preview. - Ζ **delete_conversation** (`Function`) - π Soft-delete or hard-delete a conversation and clear its in-memory trace. - - Ζ **get_history** (`Function`) + - Ζ **get_history** (`Function`) `[TRIVIAL]` - π Retrieve paginated assistant conversation history for current user. - - Ζ **get_assistant_audit** (`Function`) + - Ζ **get_assistant_audit** (`Function`) `[TRIVIAL]` - π Return assistant audit decisions for current user from persistent and in-memory stores. - Ζ **_async_confirmation_summary** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -4022,53 +3991,53 @@ - π DEPENDS_ON -> `backend.src.models.storage` - Ζ **list_files** (`Function`) - π List all files and directories in the storage system. - - π CALLS -> `StoragePlugin.list_files` + - π CALLS -> `backend.src.plugins.storage.plugin.StoragePlugin.list_files` - Ζ **upload_file** (`Function`) - π Upload a file to the storage system. - - π CALLS -> `StoragePlugin.save_file` + - π CALLS -> `backend.src.plugins.storage.plugin.StoragePlugin.save_file` - Ζ **delete_file** (`Function`) - π Delete a specific file or directory. - - π CALLS -> `StoragePlugin.delete_file` + - π CALLS -> `backend.src.plugins.storage.plugin.StoragePlugin.delete_file` - Ζ **download_file** (`Function`) - π Retrieve a file for download. - - π CALLS -> `StoragePlugin.get_file_path` + - π CALLS -> `backend.src.plugins.storage.plugin.StoragePlugin.get_file_path` - Ζ **get_file_by_path** (`Function`) - π Retrieve a file by validated absolute/relative path under storage root. - - π CALLS -> `StoragePlugin.get_storage_root` - - π CALLS -> `StoragePlugin.validate_path` + - π CALLS -> `backend.src.plugins.storage.plugin.StoragePlugin.get_storage_root` + - π CALLS -> `backend.src.plugins.storage.plugin.StoragePlugin.validate_path` - π¦ **backend.src.api.routes.clean_release** (`Module`) - π Expose clean release endpoints for candidate preparation and subsequent compliance flow. - ποΈ Layer: API - π Invariant: API never reports prepared status if preparation errors are present. - π DEPENDS_ON -> `backend.src.dependencies.get_clean_release_repository` - π DEPENDS_ON -> `backend.src.services.clean_release.preparation_service` - - β **PrepareCandidateRequest** (`Class`) + - β **PrepareCandidateRequest** (`Class`) `[TRIVIAL]` - π Request schema for candidate preparation endpoint. - - β **StartCheckRequest** (`Class`) + - β **StartCheckRequest** (`Class`) `[TRIVIAL]` - π Request schema for clean compliance check run startup. - - β **RegisterCandidateRequest** (`Class`) + - β **RegisterCandidateRequest** (`Class`) `[TRIVIAL]` - π Request schema for candidate registration endpoint. - - β **ImportArtifactsRequest** (`Class`) + - β **ImportArtifactsRequest** (`Class`) `[TRIVIAL]` - π Request schema for candidate artifact import endpoint. - - β **BuildManifestRequest** (`Class`) + - β **BuildManifestRequest** (`Class`) `[TRIVIAL]` - π Request schema for manifest build endpoint. - - β **CreateComplianceRunRequest** (`Class`) + - β **CreateComplianceRunRequest** (`Class`) `[TRIVIAL]` - π Request schema for compliance run creation with optional manifest pinning. - - Ζ **register_candidate_v2_endpoint** (`Function`) + - Ζ **register_candidate_v2_endpoint** (`Function`) `[TRIVIAL]` - π Register a clean-release candidate for headless lifecycle. - - Ζ **import_candidate_artifacts_v2_endpoint** (`Function`) + - Ζ **import_candidate_artifacts_v2_endpoint** (`Function`) `[TRIVIAL]` - π Import candidate artifacts in headless flow. - - Ζ **build_candidate_manifest_v2_endpoint** (`Function`) + - Ζ **build_candidate_manifest_v2_endpoint** (`Function`) `[TRIVIAL]` - π Build immutable manifest snapshot for prepared candidate. - - Ζ **get_candidate_overview_v2_endpoint** (`Function`) + - Ζ **get_candidate_overview_v2_endpoint** (`Function`) `[TRIVIAL]` - π Return expanded candidate overview DTO for headless lifecycle visibility. - - Ζ **prepare_candidate_endpoint** (`Function`) + - Ζ **prepare_candidate_endpoint** (`Function`) `[TRIVIAL]` - π Prepare candidate with policy evaluation and deterministic manifest generation. - - Ζ **start_check** (`Function`) + - Ζ **start_check** (`Function`) `[TRIVIAL]` - π Start and finalize a clean compliance check run and persist report artifacts. - - Ζ **get_check_status** (`Function`) + - Ζ **get_check_status** (`Function`) `[TRIVIAL]` - π Return terminal/intermediate status payload for a check run. - - Ζ **get_report** (`Function`) + - Ζ **get_report** (`Function`) `[TRIVIAL]` - π Return persisted compliance report by report_id. - π¦ **ReportsRouter** (`Module`) `[CRITICAL]` - π FastAPI router for unified task report list and detail retrieval endpoints. @@ -4076,7 +4045,7 @@ - π Invariant: Endpoints are read-only and do not trigger long-running tasks. - π DEPENDS_ON -> `backend.src.services.reports.report_service.ReportsService` - π DEPENDS_ON -> `backend.src.dependencies` - - Ζ **_parse_csv_enum_list** (`Function`) + - Ζ **_parse_csv_enum_list** (`Function`) `[TRIVIAL]` - π Parse comma-separated query value into enum list. - Ζ **list_reports** (`Function`) - π Return paginated unified reports list. @@ -4089,13 +4058,13 @@ - π DEPENDS_ON -> `backend.src.services.profile_service` - π DEPENDS_ON -> `backend.src.dependencies.get_current_user` - π DEPENDS_ON -> `backend.src.core.database.get_db` - - Ζ **_get_profile_service** (`Function`) + - Ζ **_get_profile_service** (`Function`) `[TRIVIAL]` - π Build profile service for current request scope. - - Ζ **get_preferences** (`Function`) + - Ζ **get_preferences** (`Function`) `[TRIVIAL]` - π Get authenticated user's dashboard filter preference. - - Ζ **update_preferences** (`Function`) + - Ζ **update_preferences** (`Function`) `[TRIVIAL]` - π Update authenticated user's dashboard filter preference. - - Ζ **lookup_superset_accounts** (`Function`) + - Ζ **lookup_superset_accounts** (`Function`) `[TRIVIAL]` - π Lookup Superset account candidates in selected environment. - π¦ **backend.src.api.routes.__init__** (`Module`) - π Provide lazy route module loading to avoid heavyweight imports during tests. @@ -4107,6 +4076,9 @@ - π¦ **TasksRouter** (`Module`) - π Defines the FastAPI router for task-related endpoints, allowing clients to create, list, and get the status of tasks. - ποΈ Layer: UI (API) + - π DEPENDS_ON -> `backend.src.core.task_manager.manager.TaskManager` + - π DEPENDS_ON -> `backend.src.core.config_manager.ConfigManager` + - π DEPENDS_ON -> `backend.src.services.llm_provider.LLMProviderService` - Ζ **create_task** (`Function`) - π Create and start a new task for a given plugin. - Ζ **list_tasks** (`Function`) @@ -4130,20 +4102,32 @@ - ποΈ Layer: API - π Invariant: All dashboard responses include git_status and last_task metadata - π DEPENDS_ON -> `backend.src.dependencies` - - π DEPENDS_ON -> `backend.src.services.resource_service` - - π DEPENDS_ON -> `backend.src.core.superset_client` + - π DEPENDS_ON -> `backend.src.services.resource_service.ResourceService` + - π DEPENDS_ON -> `backend.src.core.superset_client.SupersetClient` - π¦ **GitStatus** (`DataClass`) + - π DTO for dashboard Git synchronization status. - π¦ **LastTask** (`DataClass`) + - π DTO for the most recent background task associated with a dashboard. - π¦ **DashboardItem** (`DataClass`) + - π DTO representing a single dashboard with projected metadata. - π¦ **EffectiveProfileFilter** (`DataClass`) + - π Metadata about applied profile filters for UI context. - π¦ **DashboardsResponse** (`DataClass`) + - π Envelope DTO for paginated dashboards list. - π¦ **DashboardChartItem** (`DataClass`) + - π DTO for a chart linked to a dashboard. - π¦ **DashboardDatasetItem** (`DataClass`) + - π DTO for a dataset associated with a dashboard. - π¦ **DashboardDetailResponse** (`DataClass`) + - π Detailed dashboard metadata including children. - π¦ **DashboardTaskHistoryItem** (`DataClass`) + - π Individual history record entry. - π¦ **DashboardTaskHistoryResponse** (`DataClass`) + - π Collection DTO for task history. - π¦ **DatabaseMapping** (`DataClass`) + - π DTO for cross-environment database ID mapping. - π¦ **DatabaseMappingsResponse** (`DataClass`) + - π Wrapper for database mappings. - Ζ **_find_dashboard_id_by_slug** (`Function`) - π Resolve dashboard numeric ID by slug using Superset list endpoint. - Ζ **_resolve_dashboard_id_from_ref** (`Function`) @@ -4170,13 +4154,13 @@ - π Apply profile actor matching against multiple aliases (username + optional display name). - Ζ **get_dashboards** (`Function`) - π Fetch list of dashboards from a specific environment with Git status and last task status - - π CALLS -> `ResourceService.get_dashboards_with_status` + - π CALLS -> `get_dashboards_with_status` - Ζ **get_database_mappings** (`Function`) - π Get database mapping suggestions between source and target environments - - π CALLS -> `MappingService.get_suggestions` + - π CALLS -> `MappingService:get_suggestions` - Ζ **get_dashboard_detail** (`Function`) - π Fetch detailed dashboard info with related charts and datasets - - π CALLS -> `SupersetClient.get_dashboard_detail` + - π CALLS -> `backend.src.core.async_superset_client.AsyncSupersetClient.get_dashboard_detail_async` - Ζ **_task_matches_dashboard** (`Function`) - π Checks whether task params are tied to a specific dashboard and environment. - Ζ **get_dashboard_tasks_history** (`Function`) @@ -4184,16 +4168,19 @@ - Ζ **get_dashboard_thumbnail** (`Function`) - π Proxies Superset dashboard thumbnail with cache support. - π¦ **MigrateRequest** (`DataClass`) + - π DTO for dashboard migration requests. - π¦ **TaskResponse** (`DataClass`) + - π DTO for async task ID return. - Ζ **migrate_dashboards** (`Function`) - π Trigger bulk migration of dashboards from source to target environment - - π DISPATCHES -> `MigrationPlugin` - - π CALLS -> `task_manager.create_task` + - π DISPATCHES -> `MigrationPlugin:execute` + - π CALLS -> `task_manager:create_task` - π¦ **BackupRequest** (`DataClass`) + - π DTO for dashboard backup requests. - Ζ **backup_dashboards** (`Function`) - π Trigger bulk backup of dashboards with optional cron schedule - - π DISPATCHES -> `BackupPlugin` - - π CALLS -> `task_manager.create_task` + - π DISPATCHES -> `BackupPlugin:execute` + - π CALLS -> `task_manager:create_task` - Ζ **_matches_dashboard_filters** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) - Ζ **_sort_key** (`Function`) `[TRIVIAL]` @@ -4201,33 +4188,33 @@ - π¦ **backend.src.api.routes.__tests__.test_dashboards** (`Module`) - π Unit tests for Dashboards API endpoints - ποΈ Layer: API - - Ζ **test_get_dashboards_success** (`Function`) - - Ζ **test_get_dashboards_with_search** (`Function`) - - Ζ **test_get_dashboards_empty** (`Function`) - - Ζ **test_get_dashboards_superset_failure** (`Function`) - - Ζ **test_get_dashboards_env_not_found** (`Function`) - - Ζ **test_get_dashboards_invalid_pagination** (`Function`) - - Ζ **test_get_dashboard_detail_success** (`Function`) - - Ζ **test_get_dashboard_detail_env_not_found** (`Function`) - - Ζ **test_migrate_dashboards_success** (`Function`) - - Ζ **test_migrate_dashboards_no_ids** (`Function`) - - Ζ **test_migrate_dashboards_env_not_found** (`Function`) - - Ζ **test_backup_dashboards_success** (`Function`) - - Ζ **test_backup_dashboards_env_not_found** (`Function`) - - Ζ **test_get_database_mappings_success** (`Function`) - - Ζ **test_get_database_mappings_env_not_found** (`Function`) - - Ζ **test_get_dashboard_tasks_history_filters_success** (`Function`) - - Ζ **test_get_dashboard_thumbnail_success** (`Function`) - - Ζ **_build_profile_preference_stub** (`Function`) + - Ζ **test_get_dashboards_success** (`Function`) `[TRIVIAL]` + - Ζ **test_get_dashboards_with_search** (`Function`) `[TRIVIAL]` + - Ζ **test_get_dashboards_empty** (`Function`) `[TRIVIAL]` + - Ζ **test_get_dashboards_superset_failure** (`Function`) `[TRIVIAL]` + - Ζ **test_get_dashboards_env_not_found** (`Function`) `[TRIVIAL]` + - Ζ **test_get_dashboards_invalid_pagination** (`Function`) `[TRIVIAL]` + - Ζ **test_get_dashboard_detail_success** (`Function`) `[TRIVIAL]` + - Ζ **test_get_dashboard_detail_env_not_found** (`Function`) `[TRIVIAL]` + - Ζ **test_migrate_dashboards_success** (`Function`) `[TRIVIAL]` + - Ζ **test_migrate_dashboards_no_ids** (`Function`) `[TRIVIAL]` + - Ζ **test_migrate_dashboards_env_not_found** (`Function`) `[TRIVIAL]` + - Ζ **test_backup_dashboards_success** (`Function`) `[TRIVIAL]` + - Ζ **test_backup_dashboards_env_not_found** (`Function`) `[TRIVIAL]` + - Ζ **test_get_database_mappings_success** (`Function`) `[TRIVIAL]` + - Ζ **test_get_database_mappings_env_not_found** (`Function`) `[TRIVIAL]` + - Ζ **test_get_dashboard_tasks_history_filters_success** (`Function`) `[TRIVIAL]` + - Ζ **test_get_dashboard_thumbnail_success** (`Function`) `[TRIVIAL]` + - Ζ **_build_profile_preference_stub** (`Function`) `[TRIVIAL]` - π Creates profile preference payload stub for dashboards filter contract tests. - - Ζ **_matches_actor_case_insensitive** (`Function`) + - Ζ **_matches_actor_case_insensitive** (`Function`) `[TRIVIAL]` - π Applies trim + case-insensitive owners OR modified_by matching used by route contract tests. - - Ζ **test_get_dashboards_profile_filter_contract_owners_or_modified_by** (`Function`) - - Ζ **test_get_dashboards_override_show_all_contract** (`Function`) - - Ζ **test_get_dashboards_profile_filter_no_match_results_contract** (`Function`) - - Ζ **test_get_dashboards_page_context_other_disables_profile_default** (`Function`) - - Ζ **test_get_dashboards_profile_filter_matches_display_alias_without_detail_fanout** (`Function`) - - Ζ **test_get_dashboards_profile_filter_matches_owner_object_payload_contract** (`Function`) + - Ζ **test_get_dashboards_profile_filter_contract_owners_or_modified_by** (`Function`) `[TRIVIAL]` + - Ζ **test_get_dashboards_override_show_all_contract** (`Function`) `[TRIVIAL]` + - Ζ **test_get_dashboards_profile_filter_no_match_results_contract** (`Function`) `[TRIVIAL]` + - Ζ **test_get_dashboards_page_context_other_disables_profile_default** (`Function`) `[TRIVIAL]` + - Ζ **test_get_dashboards_profile_filter_matches_display_alias_without_detail_fanout** (`Function`) `[TRIVIAL]` + - Ζ **test_get_dashboards_profile_filter_matches_owner_object_payload_contract** (`Function`) `[TRIVIAL]` - Ζ **mock_deps** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) - Ζ **mock_get_dashboards** (`Function`) `[TRIVIAL]` @@ -4238,33 +4225,33 @@ - π Validate status endpoint behavior for missing and error repository states. - ποΈ Layer: Domain (Tests) - π CALLS -> `src.api.routes.git.get_repository_status` - - Ζ **test_get_repository_status_returns_no_repo_payload_for_missing_repo** (`Function`) + - Ζ **test_get_repository_status_returns_no_repo_payload_for_missing_repo** (`Function`) `[TRIVIAL]` - π Ensure missing local repository is represented as NO_REPO payload instead of an API error. - - Ζ **test_get_repository_status_propagates_non_404_http_exception** (`Function`) + - Ζ **test_get_repository_status_propagates_non_404_http_exception** (`Function`) `[TRIVIAL]` - π Ensure HTTP exceptions other than 404 are not masked. - - Ζ **test_get_repository_diff_propagates_http_exception** (`Function`) + - Ζ **test_get_repository_diff_propagates_http_exception** (`Function`) `[TRIVIAL]` - π Ensure diff endpoint preserves domain HTTP errors from GitService. - - Ζ **test_get_history_wraps_unexpected_error_as_500** (`Function`) + - Ζ **test_get_history_wraps_unexpected_error_as_500** (`Function`) `[TRIVIAL]` - π Ensure non-HTTP exceptions in history endpoint become deterministic 500 errors. - - Ζ **test_commit_changes_wraps_unexpected_error_as_500** (`Function`) + - Ζ **test_commit_changes_wraps_unexpected_error_as_500** (`Function`) `[TRIVIAL]` - π Ensure commit endpoint does not leak unexpected errors as 400. - - Ζ **test_get_repository_status_batch_returns_mixed_statuses** (`Function`) + - Ζ **test_get_repository_status_batch_returns_mixed_statuses** (`Function`) `[TRIVIAL]` - π Ensure batch endpoint returns per-dashboard statuses in one response. - - Ζ **test_get_repository_status_batch_marks_item_as_error_on_service_failure** (`Function`) + - Ζ **test_get_repository_status_batch_marks_item_as_error_on_service_failure** (`Function`) `[TRIVIAL]` - π Ensure batch endpoint marks failed items as ERROR without failing entire request. - - Ζ **test_get_repository_status_batch_deduplicates_and_truncates_ids** (`Function`) + - Ζ **test_get_repository_status_batch_deduplicates_and_truncates_ids** (`Function`) `[TRIVIAL]` - π Ensure batch endpoint protects server from oversized payloads. - - Ζ **test_commit_changes_applies_profile_identity_before_commit** (`Function`) + - Ζ **test_commit_changes_applies_profile_identity_before_commit** (`Function`) `[TRIVIAL]` - π Ensure commit route configures repository identity from profile preferences before commit call. - - Ζ **test_pull_changes_applies_profile_identity_before_pull** (`Function`) + - Ζ **test_pull_changes_applies_profile_identity_before_pull** (`Function`) `[TRIVIAL]` - π Ensure pull route configures repository identity from profile preferences before pull call. - - Ζ **test_get_merge_status_returns_service_payload** (`Function`) + - Ζ **test_get_merge_status_returns_service_payload** (`Function`) `[TRIVIAL]` - π Ensure merge status route returns service payload as-is. - - Ζ **test_resolve_merge_conflicts_passes_resolution_items_to_service** (`Function`) + - Ζ **test_resolve_merge_conflicts_passes_resolution_items_to_service** (`Function`) `[TRIVIAL]` - π Ensure merge resolve route forwards parsed resolutions to service. - - Ζ **test_abort_merge_calls_service_and_returns_result** (`Function`) + - Ζ **test_abort_merge_calls_service_and_returns_result** (`Function`) `[TRIVIAL]` - π Ensure abort route delegates to service. - - Ζ **test_continue_merge_passes_message_and_returns_commit** (`Function`) + - Ζ **test_continue_merge_passes_message_and_returns_commit** (`Function`) `[TRIVIAL]` - π Ensure continue route passes commit message to service. - Ζ **_get_repo_path** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -4401,39 +4388,39 @@ - π Unit tests for Datasets API endpoints - ποΈ Layer: API - π Invariant: Endpoint contracts remain stable for success and validation failure paths. - - Ζ **test_get_datasets_success** (`Function`) + - Ζ **test_get_datasets_success** (`Function`) `[TRIVIAL]` - π Validate successful datasets listing contract for an existing environment. - - Ζ **test_get_datasets_env_not_found** (`Function`) - - Ζ **test_get_datasets_invalid_pagination** (`Function`) - - Ζ **test_map_columns_success** (`Function`) - - Ζ **test_map_columns_invalid_source_type** (`Function`) - - Ζ **test_generate_docs_success** (`Function`) - - Ζ **test_map_columns_empty_ids** (`Function`) - - Ζ **test_generate_docs_empty_ids** (`Function`) - - Ζ **test_generate_docs_env_not_found** (`Function`) - - Ζ **test_get_datasets_superset_failure** (`Function`) + - Ζ **test_get_datasets_env_not_found** (`Function`) `[TRIVIAL]` + - Ζ **test_get_datasets_invalid_pagination** (`Function`) `[TRIVIAL]` + - Ζ **test_map_columns_success** (`Function`) `[TRIVIAL]` + - Ζ **test_map_columns_invalid_source_type** (`Function`) `[TRIVIAL]` + - Ζ **test_generate_docs_success** (`Function`) `[TRIVIAL]` + - Ζ **test_map_columns_empty_ids** (`Function`) `[TRIVIAL]` + - Ζ **test_generate_docs_empty_ids** (`Function`) `[TRIVIAL]` + - Ζ **test_generate_docs_env_not_found** (`Function`) `[TRIVIAL]` + - Ζ **test_get_datasets_superset_failure** (`Function`) `[TRIVIAL]` - Ζ **mock_deps** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) - π¦ **backend.src.api.routes.__tests__.test_profile_api** (`Module`) - π Verifies profile API route contracts for preference read/update and Superset account lookup. - ποΈ Layer: API - - Ζ **mock_profile_route_dependencies** (`Function`) + - Ζ **mock_profile_route_dependencies** (`Function`) `[TRIVIAL]` - π Provides deterministic dependency overrides for profile route tests. - - Ζ **profile_route_deps_fixture** (`Function`) + - Ζ **profile_route_deps_fixture** (`Function`) `[TRIVIAL]` - π Pytest fixture wrapper for profile route dependency overrides. - - Ζ **_build_preference_response** (`Function`) + - Ζ **_build_preference_response** (`Function`) `[TRIVIAL]` - π Builds stable profile preference response payload for route tests. - - Ζ **test_get_profile_preferences_returns_self_payload** (`Function`) + - Ζ **test_get_profile_preferences_returns_self_payload** (`Function`) `[TRIVIAL]` - π Verifies GET /api/profile/preferences returns stable self-scoped payload. - - Ζ **test_patch_profile_preferences_success** (`Function`) + - Ζ **test_patch_profile_preferences_success** (`Function`) `[TRIVIAL]` - π Verifies PATCH /api/profile/preferences persists valid payload through route mapping. - - Ζ **test_patch_profile_preferences_validation_error** (`Function`) + - Ζ **test_patch_profile_preferences_validation_error** (`Function`) `[TRIVIAL]` - π Verifies route maps domain validation failure to HTTP 422 with actionable details. - - Ζ **test_patch_profile_preferences_cross_user_denied** (`Function`) + - Ζ **test_patch_profile_preferences_cross_user_denied** (`Function`) `[TRIVIAL]` - π Verifies route maps domain authorization guard failure to HTTP 403. - - Ζ **test_lookup_superset_accounts_success** (`Function`) + - Ζ **test_lookup_superset_accounts_success** (`Function`) `[TRIVIAL]` - π Verifies lookup route returns success payload with normalized candidates. - - Ζ **test_lookup_superset_accounts_env_not_found** (`Function`) + - Ζ **test_lookup_superset_accounts_env_not_found** (`Function`) `[TRIVIAL]` - π Verifies lookup route maps missing environment to HTTP 404. - π¦ **backend.tests.test_reports_detail_api** (`Module`) - π Contract tests for GET /api/reports/{report_id} detail endpoint behavior. @@ -4454,7 +4441,7 @@ - π¦ **backend.src.api.routes.__tests__.test_clean_release_legacy_compat** (`Module`) - π Compatibility tests for legacy clean-release API paths retained during v2 migration. - ποΈ Layer: Tests - - Ζ **_seed_legacy_repo** (`Function`) + - Ζ **_seed_legacy_repo** (`Function`) `[TRIVIAL]` - π Seed in-memory repository with minimum trusted data for legacy endpoint contracts. - Ζ **test_legacy_prepare_endpoint_still_available** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -4494,11 +4481,11 @@ - π In-memory session substitute for assistant route persistence calls. - Ζ **_clear_assistant_state** (`Function`) `[TRIVIAL]` - π Reset assistant process-local state between test cases. - - Ζ **test_confirmation_owner_mismatch_returns_403** (`Function`) + - Ζ **test_confirmation_owner_mismatch_returns_403** (`Function`) `[TRIVIAL]` - π Confirm endpoint should reject requests from user that does not own the confirmation token. - - Ζ **test_expired_confirmation_cannot_be_confirmed** (`Function`) + - Ζ **test_expired_confirmation_cannot_be_confirmed** (`Function`) `[TRIVIAL]` - π Expired confirmation token should be rejected and not create task. - - Ζ **test_limited_user_cannot_launch_restricted_operation** (`Function`) + - Ζ **test_limited_user_cannot_launch_restricted_operation** (`Function`) `[TRIVIAL]` - π Limited user should receive denied state for privileged operation. - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -4559,7 +4546,7 @@ - π Auto-detected function (orphan) - Ζ **test_create_connection_bootstraps_missing_table** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- π¦ **backend.src.api.routes.__tests__.test_git_api** (`Module`) +- π¦ **backend.src.api.routes.__tests__.test_git_api** (`Module`) `[TRIVIAL]` - π API tests for Git configurations and repository operations. - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -4656,33 +4643,33 @@ - π In-memory fake database implementing subset of Session interface used by assistant routes. - Ζ **_clear_assistant_state** (`Function`) `[TRIVIAL]` - π Reset in-memory assistant registries for isolation between tests. - - Ζ **test_unknown_command_returns_needs_clarification** (`Function`) + - Ζ **test_unknown_command_returns_needs_clarification** (`Function`) `[TRIVIAL]` - π Unknown command should return clarification state and unknown intent. - - Ζ **test_capabilities_question_returns_successful_help** (`Function`) + - Ζ **test_capabilities_question_returns_successful_help** (`Function`) `[TRIVIAL]` - π Capability query should return deterministic help response, not clarification. - - Ζ **test_non_admin_command_returns_denied** (`Function`) + - Ζ **test_non_admin_command_returns_denied** (`Function`) `[TRIVIAL]` - π Non-admin user must receive denied state for privileged command. - - Ζ **test_migration_to_prod_requires_confirmation_and_can_be_confirmed** (`Function`) + - Ζ **test_migration_to_prod_requires_confirmation_and_can_be_confirmed** (`Function`) `[TRIVIAL]` - π Migration to prod must require confirmation and then start task after explicit confirm. - - Ζ **test_status_query_returns_task_status** (`Function`) + - Ζ **test_status_query_returns_task_status** (`Function`) `[TRIVIAL]` - π Task status command must surface current status text for existing task id. - - Ζ **test_status_query_without_task_id_returns_latest_user_task** (`Function`) + - Ζ **test_status_query_without_task_id_returns_latest_user_task** (`Function`) `[TRIVIAL]` - π Status command without explicit task_id should resolve to latest task for current user. - - Ζ **test_llm_validation_with_dashboard_ref_requires_confirmation** (`Function`) + - Ζ **test_llm_validation_with_dashboard_ref_requires_confirmation** (`Function`) `[TRIVIAL]` - π LLM validation with dashboard_ref should now require confirmation before dispatch. - - Ζ **test_list_conversations_groups_by_conversation_and_marks_archived** (`Function`) + - Ζ **test_list_conversations_groups_by_conversation_and_marks_archived** (`Function`) `[TRIVIAL]` - π Conversations endpoint must group messages and compute archived marker by inactivity threshold. - - Ζ **test_history_from_latest_returns_recent_page_first** (`Function`) + - Ζ **test_history_from_latest_returns_recent_page_first** (`Function`) `[TRIVIAL]` - π History endpoint from_latest mode must return newest page while preserving chronological order in chunk. - - Ζ **test_list_conversations_archived_only_filters_active** (`Function`) + - Ζ **test_list_conversations_archived_only_filters_active** (`Function`) `[TRIVIAL]` - π archived_only mode must return only archived conversations. - - Ζ **test_guarded_operation_always_requires_confirmation** (`Function`) + - Ζ **test_guarded_operation_always_requires_confirmation** (`Function`) `[TRIVIAL]` - π Non-dangerous (guarded) commands must still require confirmation before execution. - - Ζ **test_guarded_operation_confirm_roundtrip** (`Function`) + - Ζ **test_guarded_operation_confirm_roundtrip** (`Function`) `[TRIVIAL]` - π Guarded operation must execute successfully after explicit confirmation. - - Ζ **test_confirm_nonexistent_id_returns_404** (`Function`) + - Ζ **test_confirm_nonexistent_id_returns_404** (`Function`) `[TRIVIAL]` - π Confirming a non-existent ID should raise 404. - - Ζ **test_migration_with_dry_run_includes_summary** (`Function`) + - Ζ **test_migration_with_dry_run_includes_summary** (`Function`) `[TRIVIAL]` - π Migration command with dry run flag must return the dry run summary in confirmation text. - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -4790,11 +4777,11 @@ - π¦ **backend.src.models.llm** (`Module`) - π SQLAlchemy models for LLM provider configuration and validation results. - ποΈ Layer: Domain - - β **ValidationPolicy** (`Class`) + - β **ValidationPolicy** (`Class`) `[TRIVIAL]` - π Defines a scheduled rule for validating a group of dashboards within an execution window. - - β **LLMProvider** (`Class`) + - β **LLMProvider** (`Class`) `[TRIVIAL]` - π SQLAlchemy model for LLM provider configuration. - - β **ValidationRecord** (`Class`) + - β **ValidationRecord** (`Class`) `[TRIVIAL]` - π SQLAlchemy model for dashboard validation history. - Ζ **generate_uuid** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -4907,55 +4894,55 @@ - π Define canonical clean release domain entities and lifecycle guards. - ποΈ Layer: Domain - π Invariant: Immutable snapshots are never mutated; forbidden lifecycle transitions are rejected. - - β **CheckFinalStatus** (`Class`) + - β **CheckFinalStatus** (`Class`) `[TRIVIAL]` - π Backward-compatible final status enum for legacy TUI/orchestrator tests. - - β **CheckStageName** (`Class`) + - β **CheckStageName** (`Class`) `[TRIVIAL]` - π Backward-compatible stage name enum for legacy TUI/orchestrator tests. - - β **CheckStageStatus** (`Class`) + - β **CheckStageStatus** (`Class`) `[TRIVIAL]` - π Backward-compatible stage status enum for legacy TUI/orchestrator tests. - - β **CheckStageResult** (`Class`) + - β **CheckStageResult** (`Class`) `[TRIVIAL]` - π Backward-compatible stage result container for legacy TUI/orchestrator tests. - - β **ProfileType** (`Class`) + - β **ProfileType** (`Class`) `[TRIVIAL]` - π Backward-compatible profile enum for legacy TUI bootstrap logic. - - β **RegistryStatus** (`Class`) + - β **RegistryStatus** (`Class`) `[TRIVIAL]` - π Backward-compatible registry status enum for legacy TUI bootstrap logic. - - β **ReleaseCandidateStatus** (`Class`) + - β **ReleaseCandidateStatus** (`Class`) `[TRIVIAL]` - π Backward-compatible release candidate status enum for legacy TUI. - - β **ResourceSourceEntry** (`Class`) + - β **ResourceSourceEntry** (`Class`) `[TRIVIAL]` - π Backward-compatible source entry model for legacy TUI bootstrap logic. - - β **ResourceSourceRegistry** (`Class`) + - β **ResourceSourceRegistry** (`Class`) `[TRIVIAL]` - π Backward-compatible source registry model for legacy TUI bootstrap logic. - - β **CleanProfilePolicy** (`Class`) + - β **CleanProfilePolicy** (`Class`) `[TRIVIAL]` - π Backward-compatible policy model for legacy TUI bootstrap logic. - - β **ComplianceCheckRun** (`Class`) + - β **ComplianceCheckRun** (`Class`) `[TRIVIAL]` - π Backward-compatible run model for legacy TUI typing/import compatibility. - - β **ReleaseCandidate** (`Class`) + - β **ReleaseCandidate** (`Class`) `[TRIVIAL]` - π Represents the release unit being prepared and governed. - - β **CandidateArtifact** (`Class`) + - β **CandidateArtifact** (`Class`) `[TRIVIAL]` - π Represents one artifact associated with a release candidate. - - β **ManifestItem** (`Class`) - - β **ManifestSummary** (`Class`) - - β **DistributionManifest** (`Class`) + - β **ManifestItem** (`Class`) `[TRIVIAL]` + - β **ManifestSummary** (`Class`) `[TRIVIAL]` + - β **DistributionManifest** (`Class`) `[TRIVIAL]` - π Immutable snapshot of the candidate payload. - π Invariant: Immutable after creation. - - β **SourceRegistrySnapshot** (`Class`) + - β **SourceRegistrySnapshot** (`Class`) `[TRIVIAL]` - π Immutable registry snapshot for allowed sources. - - β **CleanPolicySnapshot** (`Class`) + - β **CleanPolicySnapshot** (`Class`) `[TRIVIAL]` - π Immutable policy snapshot used to evaluate a run. - - β **ComplianceRun** (`Class`) + - β **ComplianceRun** (`Class`) `[TRIVIAL]` - π Operational record for one compliance execution. - - β **ComplianceStageRun** (`Class`) + - β **ComplianceStageRun** (`Class`) `[TRIVIAL]` - π Stage-level execution record inside a run. - - β **ComplianceViolation** (`Class`) + - β **ComplianceViolation** (`Class`) `[TRIVIAL]` - π Violation produced by a stage. - - β **ComplianceReport** (`Class`) + - β **ComplianceReport** (`Class`) `[TRIVIAL]` - π Immutable result derived from a completed run. - π Invariant: Immutable after creation. - - β **ApprovalDecision** (`Class`) + - β **ApprovalDecision** (`Class`) `[TRIVIAL]` - π Approval or rejection bound to a candidate and report. - - β **PublicationRecord** (`Class`) + - β **PublicationRecord** (`Class`) `[TRIVIAL]` - π Publication or revocation record. - - β **CleanReleaseAuditLog** (`Class`) + - β **CleanReleaseAuditLog** (`Class`) `[TRIVIAL]` - π Represents a persistent audit log entry for clean release actions. - Ζ **id** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -4971,15 +4958,15 @@ - π Auto-detected function (orphan) - Ζ **check_run_id** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- π¦ **backend.src.models.auth** (`Module`) `[CRITICAL]` +- π¦ **backend.src.models.auth** (`Module`) - π SQLAlchemy models for multi-user authentication and authorization. - ποΈ Layer: Domain - π Invariant: Usernames and emails must be unique. - - Ζ **generate_uuid** (`Function`) + - Ζ **generate_uuid** (`Function`) `[TRIVIAL]` - π Generates a unique UUID string. - - π¦ **user_roles** (`Table`) + - π¦ **user_roles** (`Table`) `[TRIVIAL]` - π Association table for many-to-many relationship between Users and Roles. - - π¦ **role_permissions** (`Table`) + - π¦ **role_permissions** (`Table`) `[TRIVIAL]` - π Association table for many-to-many relationship between Roles and Permissions. - β **User** (`Class`) `[CRITICAL]` - π Represents an identity that can authenticate to the system. @@ -4997,12 +4984,12 @@ - π DEPENDS_ON -> `backend.src.models.auth` - β **UserDashboardPreference** (`Class`) - π Stores Superset username binding and default "my dashboards" toggle for one authenticated user. -- π¦ **src.models** (`Package`) +- π¦ **src.models** (`Package`) `[TRIVIAL]` - π Domain model package root. - π¦ **test_models** (`Module`) `[TRIVIAL]` - π Unit tests for data models - ποΈ Layer: Domain - - Ζ **test_environment_model** (`Function`) + - Ζ **test_environment_model** (`Function`) `[TRIVIAL]` - π Tests that Environment model correctly stores values. - π¦ **test_report_models** (`Module`) - π Unit tests for report Pydantic models and their validators @@ -5100,51 +5087,51 @@ - π Raised when caller attempts cross-user preference mutation. - β **ProfileService** (`Class`) `[CRITICAL]` - π Implements profile preference read/update flow and Superset account lookup degradation strategy. - - Ζ **__init__** (`Function`) + - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Initialize service with DB session and config manager. - - Ζ **get_my_preference** (`Function`) + - Ζ **get_my_preference** (`Function`) `[TRIVIAL]` - π Return current user's persisted preference or default non-configured view. - - Ζ **get_dashboard_filter_binding** (`Function`) + - Ζ **get_dashboard_filter_binding** (`Function`) `[TRIVIAL]` - π Return only dashboard-filter fields required by dashboards listing hot path. - - Ζ **update_my_preference** (`Function`) + - Ζ **update_my_preference** (`Function`) `[TRIVIAL]` - π Validate and persist current user's profile preference in self-scoped mode. - - Ζ **lookup_superset_accounts** (`Function`) + - Ζ **lookup_superset_accounts** (`Function`) `[TRIVIAL]` - π Query Superset users in selected environment and project canonical account candidates. - - Ζ **matches_dashboard_actor** (`Function`) + - Ζ **matches_dashboard_actor** (`Function`) `[TRIVIAL]` - π Apply trim+case-insensitive actor match across owners OR modified_by. - - Ζ **_build_security_summary** (`Function`) + - Ζ **_build_security_summary** (`Function`) `[TRIVIAL]` - π Build read-only security snapshot with role and permission badges. - - Ζ **_collect_user_permission_pairs** (`Function`) + - Ζ **_collect_user_permission_pairs** (`Function`) `[TRIVIAL]` - π Collect effective permission tuples from current user's roles. - - Ζ **_format_permission_key** (`Function`) + - Ζ **_format_permission_key** (`Function`) `[TRIVIAL]` - π Convert normalized permission pair to compact UI key. - - Ζ **_to_preference_payload** (`Function`) + - Ζ **_to_preference_payload** (`Function`) `[TRIVIAL]` - π Map ORM preference row to API DTO with token metadata. - - Ζ **_mask_secret_value** (`Function`) + - Ζ **_mask_secret_value** (`Function`) `[TRIVIAL]` - π Build a safe display value for sensitive secrets. - - Ζ **_sanitize_text** (`Function`) + - Ζ **_sanitize_text** (`Function`) `[TRIVIAL]` - π Normalize optional text into trimmed form or None. - - Ζ **_sanitize_secret** (`Function`) + - Ζ **_sanitize_secret** (`Function`) `[TRIVIAL]` - π Normalize secret input into trimmed form or None. - - Ζ **_normalize_start_page** (`Function`) + - Ζ **_normalize_start_page** (`Function`) `[TRIVIAL]` - π Normalize supported start page aliases to canonical values. - - Ζ **_normalize_density** (`Function`) + - Ζ **_normalize_density** (`Function`) `[TRIVIAL]` - π Normalize supported density aliases to canonical values. - - Ζ **_resolve_environment** (`Function`) + - Ζ **_resolve_environment** (`Function`) `[TRIVIAL]` - π Resolve environment model from configured environments by id. - - Ζ **_get_preference_row** (`Function`) + - Ζ **_get_preference_row** (`Function`) `[TRIVIAL]` - π Return persisted preference row for user or None. - - Ζ **_get_or_create_preference_row** (`Function`) + - Ζ **_get_or_create_preference_row** (`Function`) `[TRIVIAL]` - π Return existing preference row or create new unsaved row. - - Ζ **_build_default_preference** (`Function`) + - Ζ **_build_default_preference** (`Function`) `[TRIVIAL]` - π Build non-persisted default preference DTO for unconfigured users. - - Ζ **_validate_update_payload** (`Function`) + - Ζ **_validate_update_payload** (`Function`) `[TRIVIAL]` - π Validate username/toggle constraints for preference mutation. - - Ζ **_sanitize_username** (`Function`) + - Ζ **_sanitize_username** (`Function`) `[TRIVIAL]` - π Normalize raw username into trimmed form or None for empty input. - - Ζ **_normalize_username** (`Function`) + - Ζ **_normalize_username** (`Function`) `[TRIVIAL]` - π Apply deterministic trim+lower normalization for actor matching. - - Ζ **_normalize_owner_tokens** (`Function`) + - Ζ **_normalize_owner_tokens** (`Function`) `[TRIVIAL]` - π Normalize owners payload into deduplicated lower-cased tokens. - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -5152,43 +5139,48 @@ - π Shared service for fetching resource data with Git status and task status - ποΈ Layer: Service - π Invariant: All resources include metadata about their current state - - π DEPENDS_ON -> `backend.src.core.superset_client` - - π DEPENDS_ON -> `backend.src.core.task_manager` - - π DEPENDS_ON -> `backend.src.services.git_service` - - β **ResourceService** (`Class`) + - π DEPENDS_ON -> `backend.src.core.superset_client.SupersetClient` + - π DEPENDS_ON -> `TaskManagerPackage` + - π DEPENDS_ON -> `TaskManagerModels` + - π DEPENDS_ON -> `backend.src.services.git_service.GitService` + - β **backend.src.services.resource_service.ResourceService** (`Class`) - π Provides centralized access to resource data with enhanced metadata - - Ζ **__init__** (`Function`) + - Ζ **backend.src.services.resource_service.ResourceService.__init__** (`Function`) `[TRIVIAL]` - π Initialize the resource service with dependencies - - Ζ **get_dashboards_with_status** (`Function`) + - Ζ **backend.src.services.resource_service.ResourceService.get_dashboards_with_status** (`Function`) - π Fetch dashboards from environment with Git status and last task status - - π CALLS -> `SupersetClient.get_dashboards_summary` - - π CALLS -> `self._get_git_status_for_dashboard` - - π CALLS -> `self._get_last_llm_task_for_dashboard` - - Ζ **get_dashboards_page_with_status** (`Function`) - - π Fetch one dashboard page from environment and enrich only that page with status metadata. - - Ζ **_get_last_llm_task_for_dashboard** (`Function`) - - π Get most recent LLM validation task for a dashboard in an environment - - Ζ **_normalize_task_status** (`Function`) - - π Normalize task status to stable uppercase values for UI/API projections - - Ζ **_normalize_validation_status** (`Function`) - - π Normalize LLM validation status to PASS/FAIL/WARN/UNKNOWN - - Ζ **_normalize_datetime_for_compare** (`Function`) - - π Normalize datetime values to UTC-aware values for safe comparisons. - - Ζ **get_datasets_with_status** (`Function`) - - π Fetch datasets from environment with mapping progress and last task status - - π CALLS -> `SupersetClient.get_datasets_summary` - - π CALLS -> `self._get_last_task_for_resource` - - Ζ **get_activity_summary** (`Function`) - - π Get summary of active and recent tasks for the activity indicator - - Ζ **_get_git_status_for_dashboard** (`Function`) - - π Get Git sync status for a dashboard - - π CALLS -> `GitService.get_repo` - - Ζ **_get_last_task_for_resource** (`Function`) - - π Get the most recent task for a specific resource - - Ζ **_extract_resource_name_from_task** (`Function`) - - π Extract resource name from task params - - Ζ **_extract_resource_type_from_task** (`Function`) - - π Extract resource type from task params + - π CALLS -> `backend.src.core.superset_client.SupersetClient.get_dashboards_summary` + - π CALLS -> `backend.src.services.resource_service.ResourceService._get_git_status_for_dashboard` + - π CALLS -> `backend.src.services.resource_service.ResourceService._get_last_llm_task_for_dashboard` + - Ζ **get_dashboards_page_with_status** (`Function`) + - π Fetch one dashboard page from environment and enrich only that page with status metadata. + - Ζ **_get_last_llm_task_for_dashboard** (`Function`) + - π Get most recent LLM validation task for a dashboard in an environment + - Ζ **_normalize_task_status** (`Function`) + - π Normalize task status to stable uppercase values for UI/API projections + - Ζ **_normalize_validation_status** (`Function`) + - π Normalize LLM validation status to PASS/FAIL/WARN/UNKNOWN + - Ζ **_normalize_datetime_for_compare** (`Function`) + - π Normalize datetime values to UTC-aware values for safe comparisons. + - Ζ **get_datasets_with_status** (`Function`) + - π Fetch datasets from environment with mapping progress and last task status + - π CALLS -> `SupersetClient:get_datasets_summary` + - π CALLS -> `self:_get_last_task_for_resource` + - Ζ **get_activity_summary** (`Function`) + - π Get summary of active and recent tasks for the activity indicator + - Ζ **_get_git_status_for_dashboard** (`Function`) + - π Get Git sync status for a dashboard + - π CALLS -> `GitService:get_repo` + - Ζ **_get_last_task_for_resource** (`Function`) + - π Get the most recent task for a specific resource + - Ζ **_extract_resource_name_from_task** (`Function`) + - π Extract resource name from task params + - Ζ **_extract_resource_type_from_task** (`Function`) + - π Extract resource type from task params + - Ζ **__init__** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **get_dashboards_with_status** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - Ζ **_task_time** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) - π¦ **backend.src.services.llm_prompt_templates** (`Module`) @@ -5213,23 +5205,30 @@ - π¦ **health_service** (`Module`) - π Business logic for aggregating dashboard health status from validation records. - ποΈ Layer: Domain/Service - - π DEPENDS_ON -> `ValidationRecord` + - π DEPENDS_ON -> `backend.src.models.llm.ValidationRecord` - π DEPENDS_ON -> `backend.src.core.superset_client.SupersetClient` - π DEPENDS_ON -> `backend.src.core.task_manager.cleanup.TaskCleanupService` - β **HealthService** (`Class`) - π Aggregate latest dashboard validation state and manage persisted health report lifecycle. + - π DEPENDS_ON -> `backend.src.models.llm.ValidationRecord` + - π DEPENDS_ON -> `backend.src.schemas.health.DashboardHealthItem` + - π DEPENDS_ON -> `backend.src.schemas.health.HealthSummaryResponse` - π CALLS -> `backend.src.core.superset_client.SupersetClient` - π CALLS -> `backend.src.core.task_manager.cleanup.TaskCleanupService` - Ζ **HealthService.__init__** (`Function`) - π Initialize health service with DB session and optional config access for dashboard metadata resolution. - Ζ **HealthService._prime_dashboard_meta_cache** (`Function`) - π Warm dashboard slug/title cache with one Superset list fetch per environment. - - Ζ **HealthService._resolve_dashboard_meta** (`Function`) + - π CALLS -> `backend.src.core.superset_client.SupersetClient.get_dashboards_summary` + - Ζ **HealthService._resolve_dashboard_meta** (`Function`) `[TRIVIAL]` - π Resolve slug/title for a dashboard referenced by persisted validation record. - Ζ **HealthService.get_health_summary** (`Function`) - π Aggregate latest validation status per dashboard and enrich rows with dashboard slug/title. + - π CALLS -> `self._prime_dashboard_meta_cache` + - π CALLS -> `self._resolve_dashboard_meta` - Ζ **HealthService.delete_validation_report** (`Function`) - π Delete one persisted health report and optionally clean linked task/log artifacts. + - π CALLS -> `backend.src.core.task_manager.cleanup.TaskCleanupService.delete_task_with_logs` - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) - Ζ **_prime_dashboard_meta_cache** (`Function`) `[TRIVIAL]` @@ -5250,15 +5249,15 @@ - β **EncryptionManager** (`Class`) `[CRITICAL]` - π Handles encryption and decryption of sensitive data like API keys. - π Invariant: Uses only a validated secret key from environment. - - Ζ **EncryptionManager.__init__** (`Function`) + - Ζ **EncryptionManager.__init__** (`Function`) `[TRIVIAL]` - π Initialize the encryption manager with a Fernet key. - - Ζ **EncryptionManager.encrypt** (`Function`) + - Ζ **EncryptionManager.encrypt** (`Function`) `[TRIVIAL]` - π Encrypt a plaintext string. - - Ζ **EncryptionManager.decrypt** (`Function`) + - Ζ **EncryptionManager.decrypt** (`Function`) `[TRIVIAL]` - π Decrypt an encrypted string. - β **LLMProviderService** (`Class`) - π Service to manage LLM provider lifecycle. - - Ζ **LLMProviderService.__init__** (`Function`) + - Ζ **LLMProviderService.__init__** (`Function`) `[TRIVIAL]` - π Initialize the service with database session. - Ζ **get_all_providers** (`Function`) - π Returns all configured LLM providers. @@ -5286,23 +5285,23 @@ - π Invariant: Synchronization is idempotent for existing (resource, action) permission pairs. - π CALLS -> `backend.src.core.plugin_loader.PluginLoader.get_all_plugin_configs` - π DEPENDS_ON -> `backend.src.models.auth.Permission` - - π¦ **HAS_PERMISSION_PATTERN** (`Constant`) + - π¦ **HAS_PERMISSION_PATTERN** (`Constant`) `[TRIVIAL]` - π Regex pattern for extracting has_permission("resource", "ACTION") declarations. - - π¦ **ROUTES_DIR** (`Constant`) + - π¦ **ROUTES_DIR** (`Constant`) `[TRIVIAL]` - π Absolute directory path where API route RBAC declarations are defined. - - Ζ **_iter_route_files** (`Function`) + - Ζ **_iter_route_files** (`Function`) `[TRIVIAL]` - π Iterates API route files that may contain RBAC declarations. - - Ζ **_discover_route_permissions** (`Function`) + - Ζ **_discover_route_permissions** (`Function`) `[TRIVIAL]` - π Extracts explicit has_permission declarations from API route source code. - - Ζ **_discover_route_permissions_cached** (`Function`) + - Ζ **_discover_route_permissions_cached** (`Function`) `[TRIVIAL]` - π Cache route permission discovery because route source files are static during normal runtime. - - Ζ **_discover_plugin_execute_permissions** (`Function`) + - Ζ **_discover_plugin_execute_permissions** (`Function`) `[TRIVIAL]` - π Derives dynamic task permissions of form plugin:{plugin_id}:EXECUTE from plugin registry. - - Ζ **_discover_plugin_execute_permissions_cached** (`Function`) + - Ζ **_discover_plugin_execute_permissions_cached** (`Function`) `[TRIVIAL]` - π Cache dynamic plugin EXECUTE permission pairs by normalized plugin id tuple. - - Ζ **discover_declared_permissions** (`Function`) + - Ζ **discover_declared_permissions** (`Function`) `[TRIVIAL]` - π Builds canonical RBAC permission catalog from routes and plugin registry. - - Ζ **sync_permission_catalog** (`Function`) + - Ζ **sync_permission_catalog** (`Function`) `[TRIVIAL]` - π Persists missing RBAC permission pairs into auth database. - π¦ **backend.src.services** (`Module`) - π Package initialization for services module @@ -5318,9 +5317,9 @@ - π DEPENDS_ON -> `backend.src.core.auth.jwt.create_access_token` - π DEPENDS_ON -> `backend.src.models.auth.User` - π DEPENDS_ON -> `backend.src.models.auth.Role` - - β **AuthService** (`Class`) `[CRITICAL]` + - β **AuthService** (`Class`) - π Provides high-level authentication services. - - Ζ **__init__** (`Function`) + - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Initializes the authentication service with repository access over an active DB session. - Ζ **authenticate_user** (`Function`) - π Validates credentials and account state for local username/password authentication. @@ -5332,97 +5331,25 @@ - π Core Git logic using GitPython to manage dashboard repositories. - ποΈ Layer: Service - π Invariant: All Git operations must be performed on a valid local directory. - - π DEPENDS_ON -> `src.core.database.SessionLocal` - - π DEPENDS_ON -> `src.models.config.AppConfigRecord` - - π DEPENDS_ON -> `src.models.git.GitRepository` - - β **GitService** (`Class`) + - π DEPENDS_ON -> `backend.src.core.database.SessionLocal` + - π DEPENDS_ON -> `backend.src.models.config.AppConfigRecord` + - π DEPENDS_ON -> `backend.src.models.git.GitRepository` + - β **backend.src.services.git_service.GitService** (`Class`) - π Wrapper for GitPython operations with semantic logging and error handling. - - Ζ **__init__** (`Function`) + - Ζ **backend.src.services.git_service.GitService.__init__** (`Function`) `[TRIVIAL]` - π Initializes the GitService with a base path for repositories. - - Ζ **_ensure_base_path_exists** (`Function`) - - π Ensure the repositories root directory exists and is a directory. - - Ζ **_resolve_base_path** (`Function`) - - π Resolve base repository directory from explicit argument or global storage settings. - - Ζ **_normalize_repo_key** (`Function`) - - π Convert user/dashboard-provided key to safe filesystem directory name. - - Ζ **_update_repo_local_path** (`Function`) - - π Persist repository local_path in GitRepository table when record exists. - - Ζ **_migrate_repo_directory** (`Function`) - - π Move legacy repository directory to target path and sync DB metadata. - - Ζ **_ensure_gitflow_branches** (`Function`) - - π Ensure standard GitFlow branches (main/dev/preprod) exist locally and on origin. - - Ζ **_get_repo_path** (`Function`) - - π Resolves the local filesystem path for a dashboard's repository. - - Ζ **init_repo** (`Function`) - - π Initialize or clone a repository for a dashboard. - - Ζ **delete_repo** (`Function`) - - π Remove local repository and DB binding for a dashboard. - - Ζ **get_repo** (`Function`) - - π Get Repo object for a dashboard. - - Ζ **configure_identity** (`Function`) - - π Configure repository-local Git committer identity for user-scoped operations. - - Ζ **list_branches** (`Function`) - - π List all branches for a dashboard's repository. - - Ζ **create_branch** (`Function`) - - π Create a new branch from an existing one. - - Ζ **checkout_branch** (`Function`) - - π Switch to a specific branch. - - Ζ **commit_changes** (`Function`) - - π Stage and commit changes. - - Ζ **_extract_http_host** (`Function`) - - π Extract normalized host[:port] from HTTP(S) URL. - - Ζ **_strip_url_credentials** (`Function`) - - π Remove credentials from URL while preserving scheme/host/path. - - Ζ **_replace_host_in_url** (`Function`) - - π Replace source URL host with host from configured server URL. - - Ζ **_align_origin_host_with_config** (`Function`) - - π Auto-align local origin host to configured Git server host when they drift. - - Ζ **push_changes** (`Function`) - - π Push local commits to remote. - - Ζ **pull_changes** (`Function`) - - π Pull changes from remote. - - Ζ **get_status** (`Function`) - - π Get current repository status (dirty files, untracked, etc.) - - Ζ **get_diff** (`Function`) - - π Generate diff for a file or the whole repository. - - Ζ **get_commit_history** (`Function`) - - π Retrieve commit history for a repository. - - Ζ **test_connection** (`Function`) - - π Test connection to Git provider using PAT. - - Ζ **_normalize_git_server_url** (`Function`) - - π Normalize Git server URL for provider API calls. - - Ζ **_gitea_headers** (`Function`) - - π Build Gitea API authorization headers. - - Ζ **_gitea_request** (`Function`) - - π Execute HTTP request against Gitea API with stable error mapping. - - Ζ **get_gitea_current_user** (`Function`) - - π Resolve current Gitea user for PAT. - - Ζ **list_gitea_repositories** (`Function`) - - π List repositories visible to authenticated Gitea user. - - Ζ **create_gitea_repository** (`Function`) - - π Create repository in Gitea for authenticated user. - - Ζ **delete_gitea_repository** (`Function`) - - π Delete repository in Gitea. - - Ζ **_gitea_branch_exists** (`Function`) - - π Check whether a branch exists in Gitea repository. - - Ζ **_build_gitea_pr_404_detail** (`Function`) - - π Build actionable error detail for Gitea PR 404 responses. - - Ζ **create_github_repository** (`Function`) - - π Create repository in GitHub or GitHub Enterprise. - - Ζ **create_gitlab_repository** (`Function`) - - π Create repository(project) in GitLab. - - Ζ **_parse_remote_repo_identity** (`Function`) - - π Parse owner/repo from remote URL for Git server API operations. - - Ζ **_derive_server_url_from_remote** (`Function`) - - π Build API base URL from remote repository URL without credentials. - - Ζ **promote_direct_merge** (`Function`) - - π Perform direct merge between branches in local repo and push target branch. - - Ζ **create_gitea_pull_request** (`Function`) - - π Create pull request in Gitea. - - Ζ **create_github_pull_request** (`Function`) - - π Create pull request in GitHub or GitHub Enterprise. - - Ζ **create_gitlab_merge_request** (`Function`) - - π Create merge request in GitLab. + - Ζ **_ensure_base_path_exists** (`Function`) `[TRIVIAL]` + - π Ensure the repositories root directory exists and is a directory. + - Ζ **backend.src.services.git_service.GitService._resolve_base_path** (`Function`) `[TRIVIAL]` + - π Resolve base repository directory from explicit argument or global storage settings. + - Ζ **__init__** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_resolve_base_path** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_get_repo_path** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **get_repo** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - Ζ **_read_blob_text** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) - Ζ **_get_unmerged_file_paths** (`Function`) `[TRIVIAL]` @@ -5439,39 +5366,49 @@ - π Auto-detected function (orphan) - Ζ **continue_merge** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- π¦ **backend.src.services.mapping_service** (`Module`) + - Ζ **get_status** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_derive_server_url_from_remote** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **create_gitea_pull_request** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **create_github_pull_request** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **create_gitlab_merge_request** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) +- π¦ **backend.src.services.mapping_service** (`Module`) `[TRIVIAL]` - π Orchestrates database fetching and fuzzy matching suggestions. - ποΈ Layer: Service - π Invariant: Suggestions are based on database names. - π DEPENDS_ON -> `backend.src.core.superset_client` - π DEPENDS_ON -> `backend.src.core.utils.matching` - - β **MappingService** (`Class`) + - β **MappingService** (`Class`) `[TRIVIAL]` - π Service for handling database mapping logic. - - Ζ **__init__** (`Function`) + - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Initializes the mapping service with a config manager. - - Ζ **_get_client** (`Function`) + - Ζ **_get_client** (`Function`) `[TRIVIAL]` - π Helper to get an initialized SupersetClient for an environment. - - Ζ **get_suggestions** (`Function`) + - Ζ **get_suggestions** (`Function`) `[TRIVIAL]` - π Fetches databases from both environments and returns fuzzy matching suggestions. - π¦ **test_encryption_manager** (`Module`) - π Unit tests for EncryptionManager encrypt/decrypt functionality. - ποΈ Layer: Domain - π Invariant: Encrypt+decrypt roundtrip always returns original plaintext. - - β **TestEncryptionManager** (`Class`) + - β **TestEncryptionManager** (`Class`) `[TRIVIAL]` - π Validate EncryptionManager encrypt/decrypt roundtrip, uniqueness, and error handling. - - Ζ **test_encrypt_decrypt_roundtrip** (`Function`) + - Ζ **test_encrypt_decrypt_roundtrip** (`Function`) `[TRIVIAL]` - π Encrypt then decrypt returns original plaintext. - - Ζ **test_encrypt_produces_different_output** (`Function`) + - Ζ **test_encrypt_produces_different_output** (`Function`) `[TRIVIAL]` - π Same plaintext produces different ciphertext (Fernet uses random IV). - - Ζ **test_different_inputs_yield_different_ciphertext** (`Function`) + - Ζ **test_different_inputs_yield_different_ciphertext** (`Function`) `[TRIVIAL]` - π Different inputs produce different ciphertexts. - - Ζ **test_decrypt_invalid_data_raises** (`Function`) + - Ζ **test_decrypt_invalid_data_raises** (`Function`) `[TRIVIAL]` - π Decrypting invalid data raises InvalidToken. - - Ζ **test_encrypt_empty_string** (`Function`) + - Ζ **test_encrypt_empty_string** (`Function`) `[TRIVIAL]` - π Encrypting and decrypting an empty string works. - - Ζ **test_missing_key_fails_fast** (`Function`) + - Ζ **test_missing_key_fails_fast** (`Function`) `[TRIVIAL]` - π Missing ENCRYPTION_KEY must abort initialization instead of using a fallback secret. - - Ζ **test_custom_key_roundtrip** (`Function`) + - Ζ **test_custom_key_roundtrip** (`Function`) `[TRIVIAL]` - π Custom Fernet key produces valid roundtrip. - Ζ **_make_manager** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -5505,11 +5442,11 @@ - π Auto-detected function (orphan) - π¦ **backend.src.services.__tests__.test_llm_plugin_persistence** (`Module`) - π Regression test for ValidationRecord persistence fields populated from task context. - - β **_DummyLogger** (`Class`) + - β **_DummyLogger** (`Class`) `[TRIVIAL]` - π Minimal logger shim for TaskContext-like objects used in tests. - - β **_FakeDBSession** (`Class`) + - β **_FakeDBSession** (`Class`) `[TRIVIAL]` - π Captures persisted records for assertion and mimics SQLAlchemy session methods used by plugin. - - Ζ **test_dashboard_validation_plugin_persists_task_and_environment_ids** (`Function`) + - Ζ **test_dashboard_validation_plugin_persists_task_and_environment_ids** (`Function`) `[TRIVIAL]` - π Ensure db ValidationRecord includes context.task_id and params.environment_id. - Ζ **with_source** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -5570,7 +5507,7 @@ - π Verify provider binding resolution priority. - Ζ **test_normalize_llm_settings_keeps_assistant_planner_settings** (`Function`) - π Ensure assistant planner provider/model fields are preserved and normalized. -- π¦ **_test_encryption_key_fixture** (`Global`) +- π¦ **_test_encryption_key_fixture** (`Global`) `[TRIVIAL]` - π Ensure encryption-dependent provider tests run with a valid Fernet key. - π¦ **test_llm_provider** (`Module`) `[TRIVIAL]` - π Auto-generated module for backend/src/services/__tests__/test_llm_provider.py @@ -5599,42 +5536,42 @@ - π Unit tests for ResourceService - ποΈ Layer: Service - π Invariant: Resource summaries preserve task linkage and status projection behavior. - - Ζ **test_get_dashboards_with_status** (`Function`) + - Ζ **test_get_dashboards_with_status** (`Function`) `[TRIVIAL]` - π Validate dashboard enrichment includes git/task status projections. - - Ζ **test_get_datasets_with_status** (`Function`) - - Ζ **test_get_activity_summary** (`Function`) - - Ζ **test_get_git_status_for_dashboard_no_repo** (`Function`) - - Ζ **test_get_last_task_for_resource** (`Function`) - - Ζ **test_extract_resource_name_from_task** (`Function`) - - Ζ **test_get_last_task_for_resource_empty_tasks** (`Function`) - - Ζ **test_get_last_task_for_resource_no_match** (`Function`) - - Ζ **test_get_dashboards_with_status_handles_mixed_naive_and_aware_task_datetimes** (`Function`) - - Ζ **test_get_dashboards_with_status_prefers_latest_decisive_validation_status_over_newer_unknown** (`Function`) - - Ζ **test_get_dashboards_with_status_falls_back_to_latest_unknown_without_decisive_history** (`Function`) - - Ζ **test_get_last_task_for_resource_handles_mixed_naive_and_aware_created_at** (`Function`) + - Ζ **test_get_datasets_with_status** (`Function`) `[TRIVIAL]` + - Ζ **test_get_activity_summary** (`Function`) `[TRIVIAL]` + - Ζ **test_get_git_status_for_dashboard_no_repo** (`Function`) `[TRIVIAL]` + - Ζ **test_get_last_task_for_resource** (`Function`) `[TRIVIAL]` + - Ζ **test_extract_resource_name_from_task** (`Function`) `[TRIVIAL]` + - Ζ **test_get_last_task_for_resource_empty_tasks** (`Function`) `[TRIVIAL]` + - Ζ **test_get_last_task_for_resource_no_match** (`Function`) `[TRIVIAL]` + - Ζ **test_get_dashboards_with_status_handles_mixed_naive_and_aware_task_datetimes** (`Function`) `[TRIVIAL]` + - Ζ **test_get_dashboards_with_status_prefers_latest_decisive_validation_status_over_newer_unknown** (`Function`) `[TRIVIAL]` + - Ζ **test_get_dashboards_with_status_falls_back_to_latest_unknown_without_decisive_history** (`Function`) `[TRIVIAL]` + - Ζ **test_get_last_task_for_resource_handles_mixed_naive_and_aware_created_at** (`Function`) `[TRIVIAL]` - π¦ **backend.src.services.__tests__.test_rbac_permission_catalog** (`Module`) - π Verifies RBAC permission catalog discovery and idempotent synchronization behavior. - ποΈ Layer: Service Tests - π Invariant: Synchronization adds only missing normalized permission pairs. - - Ζ **test_discover_route_permissions_extracts_declared_pairs_and_ignores_tests** (`Function`) + - Ζ **test_discover_route_permissions_extracts_declared_pairs_and_ignores_tests** (`Function`) `[TRIVIAL]` - π Ensures route-scanner extracts has_permission pairs from route files and skips __tests__. - - Ζ **test_discover_declared_permissions_unions_route_and_plugin_permissions** (`Function`) + - Ζ **test_discover_declared_permissions_unions_route_and_plugin_permissions** (`Function`) `[TRIVIAL]` - π Ensures full catalog includes route-level permissions plus dynamic plugin EXECUTE rights. - - Ζ **test_sync_permission_catalog_inserts_only_missing_normalized_pairs** (`Function`) + - Ζ **test_sync_permission_catalog_inserts_only_missing_normalized_pairs** (`Function`) `[TRIVIAL]` - π Ensures synchronization inserts only missing pairs and normalizes action/resource tokens. - - Ζ **test_sync_permission_catalog_is_noop_when_all_permissions_exist** (`Function`) + - Ζ **test_sync_permission_catalog_is_noop_when_all_permissions_exist** (`Function`) `[TRIVIAL]` - π Ensures synchronization is idempotent when all declared pairs already exist. - π¦ **backend.src.services.notifications.providers** (`Module`) `[CRITICAL]` - π Defines abstract base and concrete implementations for external notification delivery. - ποΈ Layer: Infra - π Invariant: Sensitive credentials must be handled via encrypted config. - - β **NotificationProvider** (`Class`) + - β **NotificationProvider** (`Class`) `[TRIVIAL]` - π Abstract base class for all notification providers. - - β **SMTPProvider** (`Class`) + - β **SMTPProvider** (`Class`) `[TRIVIAL]` - π Delivers notifications via SMTP. - - β **TelegramProvider** (`Class`) + - β **TelegramProvider** (`Class`) `[TRIVIAL]` - π Delivers notifications via Telegram Bot API. - - β **SlackProvider** (`Class`) + - β **SlackProvider** (`Class`) `[TRIVIAL]` - π Delivers notifications via Slack Webhooks or API. - Ζ **send** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -5657,7 +5594,7 @@ - π DEPENDS_ON -> `backend.src.services.notifications.providers` - π DEPENDS_ON -> `backend.src.services.profile_service` - π DEPENDS_ON -> `backend.src.models.llm` - - β **NotificationService** (`Class`) + - β **NotificationService** (`Class`) `[TRIVIAL]` - π Routes validation reports to appropriate users and channels. - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -5673,7 +5610,7 @@ - π Auto-detected function (orphan) - Ζ **_build_body** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- π¦ **src.services.notifications** (`Package`) +- π¦ **src.services.notifications** (`Package`) `[TRIVIAL]` - π Notification service package root. - π¦ **backend.src.services.notifications.__tests__.test_notification_service** (`Module`) - π Unit tests for NotificationService routing and dispatch logic. @@ -5702,17 +5639,17 @@ - π DEPENDS_ON -> `backend.src.services.clean_release.stages` - π DEPENDS_ON -> `backend.src.services.clean_release.report_builder` - π DEPENDS_ON -> `backend.src.services.clean_release.repository` - - β **CleanComplianceOrchestrator** (`Class`) + - β **CleanComplianceOrchestrator** (`Class`) `[TRIVIAL]` - π Coordinate clean-release compliance verification stages. - - Ζ **CleanComplianceOrchestrator.__init__** (`Function`) + - Ζ **CleanComplianceOrchestrator.__init__** (`Function`) `[TRIVIAL]` - π Bind repository dependency used for orchestrator persistence and lookups. - - Ζ **start_check_run** (`Function`) + - Ζ **start_check_run** (`Function`) `[TRIVIAL]` - π Initiate a new compliance run session. - - Ζ **execute_stages** (`Function`) + - Ζ **execute_stages** (`Function`) `[TRIVIAL]` - π Execute or accept compliance stage outcomes and set intermediate/final check-run status fields. - - Ζ **finalize_run** (`Function`) + - Ζ **finalize_run** (`Function`) `[TRIVIAL]` - π Finalize run status based on cumulative stage results. - - Ζ **run_check_legacy** (`Function`) + - Ζ **run_check_legacy** (`Function`) `[TRIVIAL]` - π Legacy wrapper for compatibility with previous orchestrator call style. - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -5724,17 +5661,17 @@ - π DEPENDS_ON -> `backend.src.services.clean_release.policy_resolution_service` - π DEPENDS_ON -> `backend.src.services.clean_release.stages` - π DEPENDS_ON -> `backend.src.services.clean_release.report_builder` - - β **ComplianceExecutionResult** (`Class`) + - β **ComplianceExecutionResult** (`Class`) `[TRIVIAL]` - π Return envelope for compliance execution with run/report and persisted stage artifacts. - - β **ComplianceExecutionService** (`Class`) + - β **ComplianceExecutionService** (`Class`) `[TRIVIAL]` - π Execute clean-release compliance lifecycle over trusted snapshots and immutable evidence. - - Ζ **_resolve_manifest** (`Function`) + - Ζ **_resolve_manifest** (`Function`) `[TRIVIAL]` - π Resolve explicit manifest or fallback to latest candidate manifest. - - Ζ **_persist_stage_run** (`Function`) + - Ζ **_persist_stage_run** (`Function`) `[TRIVIAL]` - π Persist stage run if repository supports stage records. - - Ζ **_persist_violations** (`Function`) + - Ζ **_persist_violations** (`Function`) `[TRIVIAL]` - π Persist stage violations via repository adapters. - - Ζ **execute_run** (`Function`) + - Ζ **execute_run** (`Function`) `[TRIVIAL]` - π Execute compliance run stages and finalize immutable report on terminal success. - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -5743,9 +5680,9 @@ - ποΈ Layer: Domain - π Invariant: Equal semantic artifact sets produce identical deterministic hash values. - π DEPENDS_ON -> `backend.src.models.clean_release` - - Ζ **build_distribution_manifest** (`Function`) + - Ζ **build_distribution_manifest** (`Function`) `[TRIVIAL]` - π Build DistributionManifest with deterministic hash and validated counters. - - Ζ **build_manifest** (`Function`) + - Ζ **build_manifest** (`Function`) `[TRIVIAL]` - π Legacy compatibility wrapper for old manifest builder import paths. - Ζ **_stable_hash_payload** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -5755,7 +5692,7 @@ - π Invariant: Enterprise-clean policy always treats non-registry sources as violations. - π DEPENDS_ON -> `backend.src.models.clean_release.CleanProfilePolicy` - π DEPENDS_ON -> `backend.src.models.clean_release.ResourceSourceRegistry` - - β **CleanPolicyEngine** (`Class`) + - β **CleanPolicyEngine** (`Class`) `[TRIVIAL]` - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) - Ζ **validate_policy** (`Function`) `[TRIVIAL]` @@ -5775,9 +5712,9 @@ - π Invariant: Candidate lifecycle transitions are delegated to domain guard logic. - π DEPENDS_ON -> `backend.src.services.clean_release.repository` - π DEPENDS_ON -> `backend.src.models.clean_release` - - Ζ **_validate_artifacts** (`Function`) + - Ζ **_validate_artifacts** (`Function`) `[TRIVIAL]` - π Validate raw artifact payload list for required fields and shape. - - Ζ **register_candidate** (`Function`) + - Ζ **register_candidate** (`Function`) `[TRIVIAL]` - π Register a candidate and persist its artifacts with legal lifecycle transition. - π¦ **clean_release_enums** (`Module`) - π Canonical enums for clean release lifecycle and compliance. @@ -5790,22 +5727,22 @@ - π DEPENDS_ON -> `backend.src.services.clean_release.approval_service` - π DEPENDS_ON -> `backend.src.models.clean_release` - π DEPENDS_ON -> `backend.src.services.clean_release.audit_service` - - Ζ **_get_or_init_publications_store** (`Function`) + - Ζ **_get_or_init_publications_store** (`Function`) `[TRIVIAL]` - π Provide in-memory append-only publication storage. - - Ζ **_latest_publication_for_candidate** (`Function`) + - Ζ **_latest_publication_for_candidate** (`Function`) `[TRIVIAL]` - π Resolve latest publication record for candidate. - - Ζ **_latest_approval_for_candidate** (`Function`) + - Ζ **_latest_approval_for_candidate** (`Function`) `[TRIVIAL]` - π Resolve latest approval decision from repository decision store. - - Ζ **publish_candidate** (`Function`) + - Ζ **publish_candidate** (`Function`) `[TRIVIAL]` - π Create immutable publication record for approved candidate. - - Ζ **revoke_publication** (`Function`) + - Ζ **revoke_publication** (`Function`) `[TRIVIAL]` - π Revoke existing publication record without deleting history. - π¦ **backend.src.services.clean_release.artifact_catalog_loader** (`Module`) - π Load bootstrap artifact catalogs for clean release real-mode flows. - ποΈ Layer: Domain - π Invariant: Artifact catalog must produce deterministic CandidateArtifact entries with required identity and checksum fields. - π DEPENDS_ON -> `backend.src.models.clean_release.CandidateArtifact` - - Ζ **load_bootstrap_artifacts** (`Function`) + - Ζ **load_bootstrap_artifacts** (`Function`) `[TRIVIAL]` - π Parse artifact catalog JSON into CandidateArtifact models for TUI/bootstrap flows. - π¦ **backend.src.services.clean_release.audit_service** (`Module`) - π Provide lightweight audit hooks for clean release preparation/check/report lifecycle. @@ -5846,7 +5783,7 @@ - ποΈ Layer: Infra - π Invariant: Repository operations are side-effect free outside explicit save/update calls. - π DEPENDS_ON -> `backend.src.models.clean_release` - - β **CleanReleaseRepository** (`Class`) + - β **CleanReleaseRepository** (`Class`) `[TRIVIAL]` - π Data access object for clean release lifecycle. - Ζ **save_candidate** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -5901,7 +5838,7 @@ - π DEPENDS_ON -> `backend.src.services.clean_release.policy_engine` - π DEPENDS_ON -> `backend.src.services.clean_release.manifest_builder` - π DEPENDS_ON -> `backend.src.services.clean_release.repository` - - Ζ **prepare_candidate_legacy** (`Function`) + - Ζ **prepare_candidate_legacy** (`Function`) `[TRIVIAL]` - π Legacy compatibility wrapper kept for migration period. - Ζ **prepare_candidate** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -5925,18 +5862,18 @@ - π DEPENDS_ON -> `backend.src.core.config_manager` - π DEPENDS_ON -> `backend.src.services.clean_release.repository` - π DEPENDS_ON -> `backend.src.services.clean_release.exceptions` - - Ζ **resolve_trusted_policy_snapshots** (`Function`) + - Ζ **resolve_trusted_policy_snapshots** (`Function`) `[TRIVIAL]` - π Resolve immutable trusted policy and registry snapshots using active config IDs only. - π¦ **backend.src.services.clean_release.demo_data_service** (`Module`) - π Provide deterministic namespace helpers and isolated in-memory repository creation for demo and real modes. - ποΈ Layer: Domain - π Invariant: Demo and real namespaces must never collide for generated physical identifiers. - π DEPENDS_ON -> `backend.src.services.clean_release.repository` - - Ζ **resolve_namespace** (`Function`) + - Ζ **resolve_namespace** (`Function`) `[TRIVIAL]` - π Resolve canonical clean-release namespace for requested mode. - - Ζ **build_namespaced_id** (`Function`) + - Ζ **build_namespaced_id** (`Function`) `[TRIVIAL]` - π Build storage-safe physical identifier under mode namespace. - - Ζ **create_isolated_repository** (`Function`) + - Ζ **create_isolated_repository** (`Function`) `[TRIVIAL]` - π Create isolated in-memory repository instance for selected mode namespace. - π¦ **clean_release_dto** (`Module`) - π Data Transfer Objects for clean release compliance subsystem. @@ -5962,7 +5899,7 @@ - π DEPENDS_ON -> `backend.src.services.clean_release.repository` - π DEPENDS_ON -> `backend.src.services.clean_release.manifest_builder` - π DEPENDS_ON -> `backend.src.models.clean_release` - - Ζ **build_manifest_snapshot** (`Function`) + - Ζ **build_manifest_snapshot** (`Function`) `[TRIVIAL]` - π Create a new immutable manifest version for a candidate. - π¦ **backend.src.services.clean_release.approval_service** (`Module`) `[CRITICAL]` - π Enforce approval/rejection gates over immutable compliance reports. @@ -5971,15 +5908,15 @@ - π DEPENDS_ON -> `backend.src.services.clean_release.repository` - π DEPENDS_ON -> `backend.src.models.clean_release` - π DEPENDS_ON -> `backend.src.services.clean_release.audit_service` - - Ζ **_get_or_init_decisions_store** (`Function`) + - Ζ **_get_or_init_decisions_store** (`Function`) `[TRIVIAL]` - π Provide append-only in-memory storage for approval decisions. - - Ζ **_latest_decision_for_candidate** (`Function`) + - Ζ **_latest_decision_for_candidate** (`Function`) `[TRIVIAL]` - π Resolve latest approval decision for candidate from append-only store. - - Ζ **_resolve_candidate_and_report** (`Function`) + - Ζ **_resolve_candidate_and_report** (`Function`) `[TRIVIAL]` - π Validate candidate/report existence and ownership prior to decision persistence. - - Ζ **approve_candidate** (`Function`) + - Ζ **approve_candidate** (`Function`) `[TRIVIAL]` - π Persist immutable APPROVED decision and advance candidate lifecycle to APPROVED. - - Ζ **reject_candidate** (`Function`) + - Ζ **reject_candidate** (`Function`) `[TRIVIAL]` - π Persist immutable REJECTED decision without promoting candidate lifecycle. - π¦ **backend.tests.services.clean_release.test_audit_service** (`Module`) - π Validate audit hooks emit expected log patterns for clean release lifecycle. @@ -6011,35 +5948,35 @@ - π Validate compliance orchestrator stage transitions and final status derivation. - ποΈ Layer: Domain - π Invariant: Failed mandatory stage forces BLOCKED terminal status. - - Ζ **test_orchestrator_stage_failure_blocks_release** (`Function`) + - Ζ **test_orchestrator_stage_failure_blocks_release** (`Function`) `[TRIVIAL]` - π Verify mandatory stage failure forces BLOCKED final status. - - Ζ **test_orchestrator_compliant_candidate** (`Function`) + - Ζ **test_orchestrator_compliant_candidate** (`Function`) `[TRIVIAL]` - π Verify happy path where all mandatory stages pass yields COMPLIANT. - - Ζ **test_orchestrator_missing_stage_result** (`Function`) + - Ζ **test_orchestrator_missing_stage_result** (`Function`) `[TRIVIAL]` - π Verify incomplete mandatory stage set cannot end as COMPLIANT and results in FAILED. - - Ζ **test_orchestrator_report_generation_error** (`Function`) + - Ζ **test_orchestrator_report_generation_error** (`Function`) `[TRIVIAL]` - π Verify downstream report errors do not mutate orchestrator final status. - π¦ **backend.tests.services.clean_release.test_report_builder** (`Module`) - π Validate compliance report builder counter integrity and blocked-run constraints. - ποΈ Layer: Domain - π Invariant: blocked run requires at least one blocking violation. - - Ζ **_terminal_run** (`Function`) + - Ζ **_terminal_run** (`Function`) `[TRIVIAL]` - π Build terminal/non-terminal run fixtures for report builder tests. - - Ζ **_blocking_violation** (`Function`) + - Ζ **_blocking_violation** (`Function`) `[TRIVIAL]` - π Build a blocking violation fixture for blocked report scenarios. - - Ζ **test_report_builder_blocked_requires_blocking_violations** (`Function`) + - Ζ **test_report_builder_blocked_requires_blocking_violations** (`Function`) `[TRIVIAL]` - π Verify BLOCKED run requires at least one blocking violation. - - Ζ **test_report_builder_blocked_with_two_violations** (`Function`) + - Ζ **test_report_builder_blocked_with_two_violations** (`Function`) `[TRIVIAL]` - π Verify report builder generates conformant payload for a BLOCKED run with violations. - - Ζ **test_report_builder_counter_consistency** (`Function`) + - Ζ **test_report_builder_counter_consistency** (`Function`) `[TRIVIAL]` - π Verify violations counters remain consistent for blocking payload. - - Ζ **test_missing_operator_summary** (`Function`) + - Ζ **test_missing_operator_summary** (`Function`) `[TRIVIAL]` - π Validate non-terminal run prevents operator summary/report generation. - π¦ **backend.tests.services.clean_release.test_manifest_builder** (`Module`) - π Validate deterministic manifest generation behavior for US1. - ποΈ Layer: Domain - π Invariant: Same input artifacts produce identical deterministic hash. - - Ζ **test_manifest_deterministic_hash_for_same_input** (`Function`) + - Ζ **test_manifest_deterministic_hash_for_same_input** (`Function`) `[TRIVIAL]` - π Ensure hash is stable for same candidate/policy/artifact input. - π¦ **backend.tests.services.clean_release.test_stages** (`Module`) - π Validate final status derivation logic from stage results. @@ -6067,19 +6004,19 @@ - ποΈ Layer: Domain - π Invariant: Candidate preparation always persists manifest and candidate status deterministically. - π DEPENDS_ON -> `backend.src.services.clean_release.preparation_service:Module` - - Ζ **backend.tests.services.clean_release.test_preparation_service._mock_policy** (`Function`) + - Ζ **backend.tests.services.clean_release.test_preparation_service._mock_policy** (`Function`) `[TRIVIAL]` - π Build a valid clean profile policy fixture for preparation tests. - - Ζ **backend.tests.services.clean_release.test_preparation_service._mock_registry** (`Function`) + - Ζ **backend.tests.services.clean_release.test_preparation_service._mock_registry** (`Function`) `[TRIVIAL]` - π Build an internal-only source registry fixture for preparation tests. - - Ζ **backend.tests.services.clean_release.test_preparation_service._mock_candidate** (`Function`) + - Ζ **backend.tests.services.clean_release.test_preparation_service._mock_candidate** (`Function`) `[TRIVIAL]` - π Build a draft release candidate fixture with provided identifier. - - Ζ **backend.tests.services.clean_release.test_preparation_service.test_prepare_candidate_success** (`Function`) + - Ζ **backend.tests.services.clean_release.test_preparation_service.test_prepare_candidate_success** (`Function`) `[TRIVIAL]` - π Verify candidate transitions to PREPARED when evaluation returns no violations. - - Ζ **backend.tests.services.clean_release.test_preparation_service.test_prepare_candidate_with_violations** (`Function`) + - Ζ **backend.tests.services.clean_release.test_preparation_service.test_prepare_candidate_with_violations** (`Function`) `[TRIVIAL]` - π Verify candidate transitions to BLOCKED when evaluation returns blocking violations. - - Ζ **backend.tests.services.clean_release.test_preparation_service.test_prepare_candidate_not_found** (`Function`) + - Ζ **backend.tests.services.clean_release.test_preparation_service.test_prepare_candidate_not_found** (`Function`) `[TRIVIAL]` - π Verify preparation raises ValueError when candidate does not exist. - - Ζ **backend.tests.services.clean_release.test_preparation_service.test_prepare_candidate_no_active_policy** (`Function`) + - Ζ **backend.tests.services.clean_release.test_preparation_service.test_prepare_candidate_no_active_policy** (`Function`) `[TRIVIAL]` - π Verify preparation raises ValueError when no active policy is available. - Ζ **_mock_policy** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -6101,7 +6038,7 @@ - π Invariant: Endpoint outside allowed scheme/host always yields BLOCKED stage decision. - π IMPLEMENTS -> `backend.src.services.clean_release.stages.base.ComplianceStage` - π DEPENDS_ON -> `backend.src.services.clean_release.stages.base` - - β **NoExternalEndpointsStage** (`Class`) + - β **NoExternalEndpointsStage** (`Class`) `[TRIVIAL]` - π Validate endpoint references from manifest against trusted registry. - Ζ **execute** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -6111,7 +6048,7 @@ - π Invariant: Any source host outside allowed_hosts yields BLOCKED decision with at least one violation. - π IMPLEMENTS -> `backend.src.services.clean_release.stages.base.ComplianceStage` - π DEPENDS_ON -> `backend.src.services.clean_release.stages.base` - - β **InternalSourcesOnlyStage** (`Class`) + - β **InternalSourcesOnlyStage** (`Class`) `[TRIVIAL]` - π Enforce internal-source-only policy from trusted registry snapshot. - Ζ **execute** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -6121,7 +6058,7 @@ - π Invariant: prohibited_detected_count > 0 always yields BLOCKED stage decision. - π IMPLEMENTS -> `backend.src.services.clean_release.stages.base.ComplianceStage` - π DEPENDS_ON -> `backend.src.services.clean_release.stages.base` - - β **DataPurityStage** (`Class`) + - β **DataPurityStage** (`Class`) `[TRIVIAL]` - π Validate manifest summary for prohibited artifacts. - Ζ **execute** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -6130,15 +6067,15 @@ - ποΈ Layer: Domain - π Invariant: Stage execution is deterministic for equal input context. - π DEPENDS_ON -> `backend.src.models.clean_release` - - β **ComplianceStageContext** (`Class`) + - β **ComplianceStageContext** (`Class`) `[TRIVIAL]` - π Immutable input envelope passed to each compliance stage. - - β **StageExecutionResult** (`Class`) + - β **StageExecutionResult** (`Class`) `[TRIVIAL]` - π Structured stage output containing decision, details and violations. - - β **ComplianceStage** (`Class`) + - β **ComplianceStage** (`Class`) `[TRIVIAL]` - π Protocol for pluggable stage implementations. - - Ζ **build_stage_run_record** (`Function`) + - Ζ **build_stage_run_record** (`Function`) `[TRIVIAL]` - π Build persisted stage run record from stage result. - - Ζ **build_violation** (`Function`) + - Ζ **build_violation** (`Function`) `[TRIVIAL]` - π Construct a compliance violation with normalized defaults. - Ζ **execute** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -6148,7 +6085,7 @@ - π Invariant: Digest mismatch between run and manifest yields ERROR with blocking violation evidence. - π IMPLEMENTS -> `backend.src.services.clean_release.stages.base.ComplianceStage` - π DEPENDS_ON -> `backend.src.services.clean_release.stages.base` - - β **ManifestConsistencyStage** (`Class`) + - β **ManifestConsistencyStage** (`Class`) `[TRIVIAL]` - π Validate run/manifest linkage consistency. - Ζ **execute** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -6157,13 +6094,13 @@ - ποΈ Layer: Domain - π Invariant: Stage order remains deterministic for all compliance runs. - π DEPENDS_ON -> `backend.src.models.clean_release` - - Ζ **build_default_stages** (`Function`) + - Ζ **build_default_stages** (`Function`) `[TRIVIAL]` - π Build default deterministic stage pipeline implementation order. - - Ζ **stage_result_map** (`Function`) + - Ζ **stage_result_map** (`Function`) `[TRIVIAL]` - π Convert stage result list to dictionary by stage name. - - Ζ **missing_mandatory_stages** (`Function`) + - Ζ **missing_mandatory_stages** (`Function`) `[TRIVIAL]` - π Identify mandatory stages that are absent from run results. - - Ζ **derive_final_status** (`Function`) + - Ζ **derive_final_status** (`Function`) `[TRIVIAL]` - π Derive final run status from stage results with deterministic blocking behavior. - π¦ **candidate_repository** (`Module`) - π Persist and query release candidates. @@ -6293,26 +6230,26 @@ - π DEPENDS_ON -> `backend.src.core.task_manager.models.Task` - π DEPENDS_ON -> `backend.src.models.report` - π DEPENDS_ON -> `backend.src.services.reports.type_profiles` - - Ζ **status_to_report_status** (`Function`) + - Ζ **status_to_report_status** (`Function`) `[TRIVIAL]` - π Normalize internal task status to canonical report status. - - Ζ **build_summary** (`Function`) + - Ζ **build_summary** (`Function`) `[TRIVIAL]` - π Build deterministic user-facing summary from task payload and status. - - Ζ **extract_error_context** (`Function`) + - Ζ **extract_error_context** (`Function`) `[TRIVIAL]` - π Extract normalized error context and next actions for failed/partial reports. - - Ζ **normalize_task_report** (`Function`) + - Ζ **normalize_task_report** (`Function`) `[TRIVIAL]` - π Convert one Task to canonical TaskReport envelope. - π¦ **backend.src.services.reports.type_profiles** (`Module`) `[CRITICAL]` - π Deterministic mapping of plugin/task identifiers to canonical report task types and fallback profile metadata. - ποΈ Layer: Domain - π Invariant: Unknown input always resolves to TaskType.UNKNOWN with a single fallback profile. - π DEPENDS_ON -> `backend.src.models.report.TaskType` - - π¦ **PLUGIN_TO_TASK_TYPE** (`Data`) + - π¦ **PLUGIN_TO_TASK_TYPE** (`Data`) `[TRIVIAL]` - π Maps plugin identifiers to normalized report task types. - - π¦ **TASK_TYPE_PROFILES** (`Data`) + - π¦ **TASK_TYPE_PROFILES** (`Data`) `[TRIVIAL]` - π Profile metadata registry for each normalized task type. - - Ζ **resolve_task_type** (`Function`) + - Ζ **resolve_task_type** (`Function`) `[TRIVIAL]` - π Resolve canonical task type from plugin/task identifier with guaranteed fallback. - - Ζ **get_type_profile** (`Function`) + - Ζ **get_type_profile** (`Function`) `[TRIVIAL]` - π Return deterministic profile metadata for a task type. - π¦ **backend.src.services.reports.report_service** (`Module`) `[CRITICAL]` - π Aggregate, normalize, filter, and paginate task reports for unified list/detail API use cases. @@ -6327,26 +6264,26 @@ - Ζ **__init__** (`Function`) `[CRITICAL]` - π Initialize service with TaskManager dependency. - π Invariant: Constructor performs no task mutations. - - Ζ **_load_normalized_reports** (`Function`) + - Ζ **_load_normalized_reports** (`Function`) `[TRIVIAL]` - π Build normalized reports from all available tasks. - π Invariant: Every returned item is a TaskReport. - - Ζ **_to_utc_datetime** (`Function`) + - Ζ **_to_utc_datetime** (`Function`) `[TRIVIAL]` - π Normalize naive/aware datetime values to UTC-aware datetime for safe comparisons. - π Invariant: Naive datetimes are interpreted as UTC to preserve deterministic ordering/filtering. - - Ζ **_datetime_sort_key** (`Function`) + - Ζ **_datetime_sort_key** (`Function`) `[TRIVIAL]` - π Produce stable numeric sort key for report timestamps. - π Invariant: Mixed naive/aware datetimes never raise TypeError. - - Ζ **_matches_query** (`Function`) + - Ζ **_matches_query** (`Function`) `[TRIVIAL]` - π Apply query filtering to a report. - π Invariant: Filter evaluation is side-effect free. - - Ζ **_sort_reports** (`Function`) + - Ζ **_sort_reports** (`Function`) `[TRIVIAL]` - π Sort reports deterministically according to query settings. - π Invariant: Sorting criteria are deterministic for equal input. - - Ζ **list_reports** (`Function`) + - Ζ **list_reports** (`Function`) `[TRIVIAL]` - π Return filtered, sorted, paginated report collection. - - Ζ **get_report_detail** (`Function`) + - Ζ **get_report_detail** (`Function`) `[TRIVIAL]` - π Return one normalized report with timeline/diagnostics/next actions. -- π¦ **src.services.reports** (`Package`) +- π¦ **src.services.reports** (`Package`) `[TRIVIAL]` - π Report service package root. - π¦ **test_type_profiles** (`Module`) `[TRIVIAL]` - π Auto-generated module for backend/src/services/reports/__tests__/test_type_profiles.py @@ -6406,125 +6343,125 @@ - π Auto-detected function (orphan) - Ζ **test_clean_release_plugin_maps_to_clean_release_task_type** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- π¦ **BackupPlugin** (`Module`) +- π¦ **BackupPlugin** (`Module`) `[TRIVIAL]` - π A plugin that provides functionality to back up Superset dashboards. - ποΈ Layer: App - π IMPLEMENTS -> `PluginBase` - π DEPENDS_ON -> `superset_tool.client` - π DEPENDS_ON -> `superset_tool.utils` - - β **BackupPlugin** (`Class`) + - β **BackupPlugin** (`Class`) `[TRIVIAL]` - π Implementation of the backup plugin logic. - - Ζ **id** (`Function`) + - Ζ **id** (`Function`) `[TRIVIAL]` - π Returns the unique identifier for the backup plugin. - - Ζ **name** (`Function`) + - Ζ **name** (`Function`) `[TRIVIAL]` - π Returns the human-readable name of the backup plugin. - - Ζ **description** (`Function`) + - Ζ **description** (`Function`) `[TRIVIAL]` - π Returns a description of the backup plugin. - - Ζ **version** (`Function`) + - Ζ **version** (`Function`) `[TRIVIAL]` - π Returns the version of the backup plugin. - - Ζ **ui_route** (`Function`) + - Ζ **ui_route** (`Function`) `[TRIVIAL]` - π Returns the frontend route for the backup plugin. - - Ζ **get_schema** (`Function`) + - Ζ **get_schema** (`Function`) `[TRIVIAL]` - π Returns the JSON schema for backup plugin parameters. - - Ζ **execute** (`Function`) + - Ζ **execute** (`Function`) `[TRIVIAL]` - π Executes the dashboard backup logic with TaskContext support. -- π¦ **DebugPluginModule** (`Module`) +- π¦ **DebugPluginModule** (`Module`) `[TRIVIAL]` - π Implements a plugin for system diagnostics and debugging Superset API responses. - ποΈ Layer: Plugins - - β **DebugPlugin** (`Class`) + - β **DebugPlugin** (`Class`) `[TRIVIAL]` - π Plugin for system diagnostics and debugging. - - Ζ **id** (`Function`) + - Ζ **id** (`Function`) `[TRIVIAL]` - π Returns the unique identifier for the debug plugin. - - Ζ **name** (`Function`) + - Ζ **name** (`Function`) `[TRIVIAL]` - π Returns the human-readable name of the debug plugin. - - Ζ **description** (`Function`) + - Ζ **description** (`Function`) `[TRIVIAL]` - π Returns a description of the debug plugin. - - Ζ **version** (`Function`) + - Ζ **version** (`Function`) `[TRIVIAL]` - π Returns the version of the debug plugin. - - Ζ **ui_route** (`Function`) + - Ζ **ui_route** (`Function`) `[TRIVIAL]` - π Returns the frontend route for the debug plugin. - - Ζ **get_schema** (`Function`) + - Ζ **get_schema** (`Function`) `[TRIVIAL]` - π Returns the JSON schema for the debug plugin parameters. - - Ζ **execute** (`Function`) + - Ζ **execute** (`Function`) `[TRIVIAL]` - π Executes the debug logic with TaskContext support. - - Ζ **_test_db_api** (`Function`) + - Ζ **_test_db_api** (`Function`) `[TRIVIAL]` - π Tests database API connectivity for source and target environments. - - Ζ **_get_dataset_structure** (`Function`) + - Ζ **_get_dataset_structure** (`Function`) `[TRIVIAL]` - π Retrieves the structure of a dataset. -- π¦ **SearchPluginModule** (`Module`) +- π¦ **SearchPluginModule** (`Module`) `[TRIVIAL]` - π Implements a plugin for searching text patterns across all datasets in a specific Superset environment. - ποΈ Layer: Plugins - - β **SearchPlugin** (`Class`) + - β **SearchPlugin** (`Class`) `[TRIVIAL]` - π Plugin for searching text patterns in Superset datasets. - - Ζ **id** (`Function`) + - Ζ **id** (`Function`) `[TRIVIAL]` - π Returns the unique identifier for the search plugin. - - Ζ **name** (`Function`) + - Ζ **name** (`Function`) `[TRIVIAL]` - π Returns the human-readable name of the search plugin. - - Ζ **description** (`Function`) + - Ζ **description** (`Function`) `[TRIVIAL]` - π Returns a description of the search plugin. - - Ζ **version** (`Function`) + - Ζ **version** (`Function`) `[TRIVIAL]` - π Returns the version of the search plugin. - - Ζ **ui_route** (`Function`) + - Ζ **ui_route** (`Function`) `[TRIVIAL]` - π Returns the frontend route for the search plugin. - - Ζ **get_schema** (`Function`) + - Ζ **get_schema** (`Function`) `[TRIVIAL]` - π Returns the JSON schema for the search plugin parameters. - - Ζ **execute** (`Function`) + - Ζ **execute** (`Function`) `[TRIVIAL]` - π Executes the dataset search logic with TaskContext support. - - Ζ **_get_context** (`Function`) + - Ζ **_get_context** (`Function`) `[TRIVIAL]` - π Extracts a small context around the match for display. -- π¦ **MapperPluginModule** (`Module`) +- π¦ **MapperPluginModule** (`Module`) `[TRIVIAL]` - π Implements a plugin for mapping dataset columns using external database connections or Excel files. - ποΈ Layer: Plugins - - β **MapperPlugin** (`Class`) + - β **MapperPlugin** (`Class`) `[TRIVIAL]` - π Plugin for mapping dataset columns verbose names. - - Ζ **id** (`Function`) + - Ζ **id** (`Function`) `[TRIVIAL]` - π Returns the unique identifier for the mapper plugin. - - Ζ **name** (`Function`) + - Ζ **name** (`Function`) `[TRIVIAL]` - π Returns the human-readable name of the mapper plugin. - - Ζ **description** (`Function`) + - Ζ **description** (`Function`) `[TRIVIAL]` - π Returns a description of the mapper plugin. - - Ζ **version** (`Function`) + - Ζ **version** (`Function`) `[TRIVIAL]` - π Returns the version of the mapper plugin. - - Ζ **ui_route** (`Function`) + - Ζ **ui_route** (`Function`) `[TRIVIAL]` - π Returns the frontend route for the mapper plugin. - - Ζ **get_schema** (`Function`) + - Ζ **get_schema** (`Function`) `[TRIVIAL]` - π Returns the JSON schema for the mapper plugin parameters. - - Ζ **execute** (`Function`) + - Ζ **execute** (`Function`) `[TRIVIAL]` - π Executes the dataset mapping logic with TaskContext support. -- π¦ **backend.src.plugins.git_plugin** (`Module`) +- π¦ **backend.src.plugins.git_plugin** (`Module`) `[TRIVIAL]` - π ΠΡΠ΅Π΄ΠΎΡΡΠ°Π²Π»ΡΠ΅Ρ ΠΏΠ»Π°Π³ΠΈΠ½ Π΄Π»Ρ Π²Π΅ΡΡΠΈΠΎΠ½ΠΈΡΠΎΠ²Π°Π½ΠΈΡ ΠΈ ΡΠ°Π·Π²Π΅ΡΡΡΠ²Π°Π½ΠΈΡ Π΄Π°ΡΠ±ΠΎΡΠ΄ΠΎΠ² Superset. - ποΈ Layer: Plugin - π Invariant: ΠΡΠ΅ ΠΎΠΏΠ΅ΡΠ°ΡΠΈΠΈ Ρ Git Π΄ΠΎΠ»ΠΆΠ½Ρ Π²ΡΠΏΠΎΠ»Π½ΡΡΡΡΡ ΡΠ΅ΡΠ΅Π· GitService. - - β **GitPlugin** (`Class`) + - β **GitPlugin** (`Class`) `[TRIVIAL]` - π Π Π΅Π°Π»ΠΈΠ·Π°ΡΠΈΡ ΠΏΠ»Π°Π³ΠΈΠ½Π° Git Integration Π΄Π»Ρ ΡΠΏΡΠ°Π²Π»Π΅Π½ΠΈΡ Π²Π΅ΡΡΠΈΡΠΌΠΈ Π΄Π°ΡΠ±ΠΎΡΠ΄ΠΎΠ². - - Ζ **__init__** (`Function`) + - Ζ **__init__** (`Function`) `[TRIVIAL]` - π ΠΠ½ΠΈΡΠΈΠ°Π»ΠΈΠ·ΠΈΡΡΠ΅Ρ ΠΏΠ»Π°Π³ΠΈΠ½ ΠΈ Π΅Π³ΠΎ Π·Π°Π²ΠΈΡΠΈΠΌΠΎΡΡΠΈ. - - Ζ **id** (`Function`) + - Ζ **id** (`Function`) `[TRIVIAL]` - π Returns the plugin identifier. - - Ζ **name** (`Function`) + - Ζ **name** (`Function`) `[TRIVIAL]` - π Returns the plugin name. - - Ζ **description** (`Function`) + - Ζ **description** (`Function`) `[TRIVIAL]` - π Returns the plugin description. - - Ζ **version** (`Function`) + - Ζ **version** (`Function`) `[TRIVIAL]` - π Returns the plugin version. - - Ζ **ui_route** (`Function`) + - Ζ **ui_route** (`Function`) `[TRIVIAL]` - π Returns the frontend route for the git plugin. - - Ζ **get_schema** (`Function`) + - Ζ **get_schema** (`Function`) `[TRIVIAL]` - π ΠΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ JSON-ΡΡ Π΅ΠΌΡ ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡΠΎΠ² Π΄Π»Ρ Π²ΡΠΏΠΎΠ»Π½Π΅Π½ΠΈΡ Π·Π°Π΄Π°Ρ ΠΏΠ»Π°Π³ΠΈΠ½Π°. - - Ζ **initialize** (`Function`) + - Ζ **initialize** (`Function`) `[TRIVIAL]` - π ΠΡΠΏΠΎΠ»Π½ΡΠ΅Ρ Π½Π°ΡΠ°Π»ΡΠ½ΡΡ Π½Π°ΡΡΡΠΎΠΉΠΊΡ ΠΏΠ»Π°Π³ΠΈΠ½Π°. - - Ζ **execute** (`Function`) + - Ζ **execute** (`Function`) `[TRIVIAL]` - π ΠΡΠ½ΠΎΠ²Π½ΠΎΠΉ ΠΌΠ΅ΡΠΎΠ΄ Π²ΡΠΏΠΎΠ»Π½Π΅Π½ΠΈΡ Π·Π°Π΄Π°Ρ ΠΏΠ»Π°Π³ΠΈΠ½Π° Ρ ΠΏΠΎΠ΄Π΄Π΅ΡΠΆΠΊΠΎΠΉ TaskContext. - π CALLS -> `self._handle_sync` - π CALLS -> `self._handle_deploy` - - Ζ **_handle_sync** (`Function`) + - Ζ **_handle_sync** (`Function`) `[TRIVIAL]` - π ΠΠΊΡΠΏΠΎΡΡΠΈΡΡΠ΅Ρ Π΄Π°ΡΠ±ΠΎΡΠ΄ ΠΈΠ· Superset ΠΈ ΡΠ°ΡΠΏΠ°ΠΊΠΎΠ²ΡΠ²Π°Π΅Ρ Π² Git-ΡΠ΅ΠΏΠΎΠ·ΠΈΡΠΎΡΠΈΠΉ. - π CALLS -> `src.services.git_service.GitService.get_repo` - π CALLS -> `src.core.superset_client.SupersetClient.export_dashboard` - - Ζ **_handle_deploy** (`Function`) + - Ζ **_handle_deploy** (`Function`) `[TRIVIAL]` - π Π£ΠΏΠ°ΠΊΠΎΠ²ΡΠ²Π°Π΅Ρ ΡΠ΅ΠΏΠΎΠ·ΠΈΡΠΎΡΠΈΠΉ Π² ZIP ΠΈ ΠΈΠΌΠΏΠΎΡΡΠΈΡΡΠ΅Ρ Π² ΡΠ΅Π»Π΅Π²ΠΎΠ΅ ΠΎΠΊΡΡΠΆΠ΅Π½ΠΈΠ΅ Superset. - π CALLS -> `src.core.superset_client.SupersetClient.import_dashboard` - - Ζ **_get_env** (`Function`) + - Ζ **_get_env** (`Function`) `[TRIVIAL]` - π ΠΡΠΏΠΎΠΌΠΎΠ³Π°ΡΠ΅Π»ΡΠ½ΡΠΉ ΠΌΠ΅ΡΠΎΠ΄ Π΄Π»Ρ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ ΠΊΠΎΠ½ΡΠΈΠ³ΡΡΠ°ΡΠΈΠΈ ΠΎΠΊΡΡΠΆΠ΅Π½ΠΈΡ. - π¦ **MigrationPlugin** (`Module`) `[CRITICAL]` - π Orchestrates export, DB-mapping transformation, and import of Superset dashboards across environments. @@ -6536,54 +6473,54 @@ - π DEPENDS_ON -> `IdMappingService` - β **MigrationPlugin** (`Class`) `[CRITICAL]` - π Implementation of the migration plugin workflow and transformation orchestration. - - Ζ **id** (`Function`) + - Ζ **id** (`Function`) `[TRIVIAL]` - π Returns the unique identifier for the migration plugin. - - Ζ **name** (`Function`) + - Ζ **name** (`Function`) `[TRIVIAL]` - π Returns the human-readable name of the plugin. - - Ζ **description** (`Function`) + - Ζ **description** (`Function`) `[TRIVIAL]` - π Returns the semantic description of the plugin. - - Ζ **version** (`Function`) + - Ζ **version** (`Function`) `[TRIVIAL]` - π Returns the semantic version of the migration plugin. - - Ζ **ui_route** (`Function`) + - Ζ **ui_route** (`Function`) `[TRIVIAL]` - π Returns the frontend routing anchor for the plugin. - - Ζ **get_schema** (`Function`) + - Ζ **get_schema** (`Function`) `[TRIVIAL]` - π Generates the JSON Schema for the plugin execution form dynamically. - - Ζ **execute** (`Function`) + - Ζ **execute** (`Function`) `[TRIVIAL]` - π Orchestrates the dashboard migration pipeline including extraction, AST mutation, and ingestion. -- π¦ **src.plugins** (`Package`) +- π¦ **src.plugins** (`Package`) `[TRIVIAL]` - π Plugin package root for dynamic discovery and runtime imports. -- Ζ **schedule_dashboard_validation** (`Function`) +- Ζ **schedule_dashboard_validation** (`Function`) `[TRIVIAL]` - π Schedules a recurring dashboard validation task. -- Ζ **_parse_cron** (`Function`) +- Ζ **_parse_cron** (`Function`) `[TRIVIAL]` - π Basic cron parser placeholder. - π¦ **scheduler** (`Module`) `[TRIVIAL]` - π Auto-generated module for backend/src/plugins/llm_analysis/scheduler.py - ποΈ Layer: Unknown - Ζ **job_func** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- β **LLMProviderType** (`Class`) +- β **LLMProviderType** (`Class`) `[TRIVIAL]` - π Enum for supported LLM providers. -- β **LLMProviderConfig** (`Class`) +- β **LLMProviderConfig** (`Class`) `[TRIVIAL]` - π Configuration for an LLM provider. -- β **ValidationStatus** (`Class`) +- β **ValidationStatus** (`Class`) `[TRIVIAL]` - π Enum for dashboard validation status. -- β **DetectedIssue** (`Class`) +- β **DetectedIssue** (`Class`) `[TRIVIAL]` - π Model for a single issue detected during validation. -- β **ValidationResult** (`Class`) +- β **ValidationResult** (`Class`) `[TRIVIAL]` - π Model for dashboard validation result. -- Ζ **_is_masked_or_invalid_api_key** (`Function`) +- Ζ **_is_masked_or_invalid_api_key** (`Function`) `[TRIVIAL]` - π Guards against placeholder or malformed API keys in runtime. -- Ζ **_json_safe_value** (`Function`) +- Ζ **_json_safe_value** (`Function`) `[TRIVIAL]` - π Recursively normalize payload values for JSON serialization. -- β **DashboardValidationPlugin** (`Class`) +- β **DashboardValidationPlugin** (`Class`) `[TRIVIAL]` - π Plugin for automated dashboard health analysis using LLMs. - π IMPLEMENTS -> `backend.src.core.plugin_base.PluginBase` - - Ζ **DashboardValidationPlugin.execute** (`Function`) + - Ζ **DashboardValidationPlugin.execute** (`Function`) `[TRIVIAL]` - π Executes the dashboard validation task with TaskContext support. -- β **DocumentationPlugin** (`Class`) +- β **DocumentationPlugin** (`Class`) `[TRIVIAL]` - π Plugin for automated dataset documentation using LLMs. - π IMPLEMENTS -> `backend.src.core.plugin_base.PluginBase` - - Ζ **DocumentationPlugin.execute** (`Function`) + - Ζ **DocumentationPlugin.execute** (`Function`) `[TRIVIAL]` - π Executes the dataset documentation task with TaskContext support. - π¦ **plugin** (`Module`) `[TRIVIAL]` - π Auto-generated module for backend/src/plugins/llm_analysis/plugin.py @@ -6612,43 +6549,43 @@ - π Auto-detected function (orphan) - Ζ **execute** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- β **ScreenshotService** (`Class`) +- β **ScreenshotService** (`Class`) `[TRIVIAL]` - π Handles capturing screenshots of Superset dashboards. - - Ζ **ScreenshotService.__init__** (`Function`) + - Ζ **ScreenshotService.__init__** (`Function`) `[TRIVIAL]` - π Initializes the ScreenshotService with environment configuration. - - Ζ **ScreenshotService._find_first_visible_locator** (`Function`) + - Ζ **ScreenshotService._find_first_visible_locator** (`Function`) `[TRIVIAL]` - π Resolve the first visible locator from multiple Playwright locator strategies. - - Ζ **ScreenshotService._iter_login_roots** (`Function`) + - Ζ **ScreenshotService._iter_login_roots** (`Function`) `[TRIVIAL]` - π Enumerate page and child frames where login controls may be rendered. - - Ζ **ScreenshotService._extract_hidden_login_fields** (`Function`) + - Ζ **ScreenshotService._extract_hidden_login_fields** (`Function`) `[TRIVIAL]` - π Collect hidden form fields required for direct login POST fallback. - - Ζ **ScreenshotService._extract_csrf_token** (`Function`) + - Ζ **ScreenshotService._extract_csrf_token** (`Function`) `[TRIVIAL]` - π Resolve CSRF token value from main page or embedded login frame. - - Ζ **ScreenshotService._response_looks_like_login_page** (`Function`) + - Ζ **ScreenshotService._response_looks_like_login_page** (`Function`) `[TRIVIAL]` - π Detect when fallback login POST returned the login form again instead of an authenticated page. - - Ζ **ScreenshotService._redirect_looks_authenticated** (`Function`) + - Ζ **ScreenshotService._redirect_looks_authenticated** (`Function`) `[TRIVIAL]` - π Treat non-login redirects after form POST as successful authentication without waiting for redirect target. - - Ζ **ScreenshotService._submit_login_via_form_post** (`Function`) + - Ζ **ScreenshotService._submit_login_via_form_post** (`Function`) `[TRIVIAL]` - π Fallback login path that submits credentials directly with csrf token. - - Ζ **ScreenshotService._find_login_field_locator** (`Function`) + - Ζ **ScreenshotService._find_login_field_locator** (`Function`) `[TRIVIAL]` - π Resolve login form input using semantic label text plus generic visible-input fallbacks. - - Ζ **ScreenshotService._find_submit_locator** (`Function`) + - Ζ **ScreenshotService._find_submit_locator** (`Function`) `[TRIVIAL]` - π Resolve login submit button from main page or embedded auth frame. - - Ζ **ScreenshotService._goto_resilient** (`Function`) + - Ζ **ScreenshotService._goto_resilient** (`Function`) `[TRIVIAL]` - π Navigate without relying on networkidle for pages with long-polling or persistent requests. - - Ζ **ScreenshotService.capture_dashboard** (`Function`) + - Ζ **ScreenshotService.capture_dashboard** (`Function`) `[TRIVIAL]` - π Captures a full-page screenshot of a dashboard using Playwright and CDP. -- β **LLMClient** (`Class`) +- β **LLMClient** (`Class`) `[TRIVIAL]` - π Wrapper for LLM provider APIs. - - Ζ **LLMClient.__init__** (`Function`) + - Ζ **LLMClient.__init__** (`Function`) `[TRIVIAL]` - π Initializes the LLMClient with provider settings. - - Ζ **LLMClient._supports_json_response_format** (`Function`) + - Ζ **LLMClient._supports_json_response_format** (`Function`) `[TRIVIAL]` - π Detect whether provider/model is likely compatible with response_format=json_object. - - Ζ **LLMClient.get_json_completion** (`Function`) + - Ζ **LLMClient.get_json_completion** (`Function`) `[TRIVIAL]` - π Helper to handle LLM calls with JSON mode and fallback parsing. - - Ζ **LLMClient.test_runtime_connection** (`Function`) + - Ζ **LLMClient.test_runtime_connection** (`Function`) `[TRIVIAL]` - π Validate provider credentials using the same chat completions transport as runtime analysis. - - Ζ **LLMClient.analyze_dashboard** (`Function`) + - Ζ **LLMClient.analyze_dashboard** (`Function`) `[TRIVIAL]` - π Sends dashboard data (screenshot + logs) to LLM for health analysis. - π¦ **service** (`Module`) `[TRIVIAL]` - π Auto-generated module for backend/src/plugins/llm_analysis/service.py @@ -6693,9 +6630,9 @@ - π Auto-detected function (orphan) - π¦ **backend.src.plugins.llm_analysis.__tests__.test_service** (`Module`) - π Verify LLM analysis transport/provider failures do not masquerade as dashboard FAIL results. - - Ζ **test_test_runtime_connection_uses_json_completion_transport** (`Function`) + - Ζ **test_test_runtime_connection_uses_json_completion_transport** (`Function`) `[TRIVIAL]` - π Provider self-test must exercise the same chat completion transport as runtime analysis. - - Ζ **test_analyze_dashboard_provider_error_maps_to_unknown** (`Function`) + - Ζ **test_analyze_dashboard_provider_error_maps_to_unknown** (`Function`) `[TRIVIAL]` - π Infrastructure/provider failures must produce UNKNOWN analysis status rather than FAIL. - Ζ **_fake_get_json_completion** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -6703,23 +6640,23 @@ - π Auto-detected function (orphan) - π¦ **backend.src.plugins.llm_analysis.__tests__.test_client_headers** (`Module`) - π Verify OpenRouter client initialization includes provider-specific headers. - - Ζ **test_openrouter_client_includes_referer_and_title_headers** (`Function`) + - Ζ **test_openrouter_client_includes_referer_and_title_headers** (`Function`) `[TRIVIAL]` - π OpenRouter requests should carry site/app attribution headers for compatibility. - π¦ **backend.src.plugins.llm_analysis.__tests__.test_screenshot_service** (`Module`) - π Protect dashboard screenshot navigation from brittle networkidle waits. - - Ζ **test_iter_login_roots_includes_child_frames** (`Function`) + - Ζ **test_iter_login_roots_includes_child_frames** (`Function`) `[TRIVIAL]` - π Login discovery must search embedded auth frames, not only the main page. - - Ζ **test_response_looks_like_login_page_detects_login_markup** (`Function`) + - Ζ **test_response_looks_like_login_page_detects_login_markup** (`Function`) `[TRIVIAL]` - π Direct login fallback must reject responses that render the login screen again. - - Ζ **test_find_first_visible_locator_skips_hidden_first_match** (`Function`) + - Ζ **test_find_first_visible_locator_skips_hidden_first_match** (`Function`) `[TRIVIAL]` - π Locator helper must not reject a selector collection just because its first element is hidden. - - Ζ **test_submit_login_via_form_post_uses_browser_context_request** (`Function`) + - Ζ **test_submit_login_via_form_post_uses_browser_context_request** (`Function`) `[TRIVIAL]` - π Fallback login must submit hidden fields and credentials through the context request cookie jar. - - Ζ **test_submit_login_via_form_post_accepts_authenticated_redirect** (`Function`) + - Ζ **test_submit_login_via_form_post_accepts_authenticated_redirect** (`Function`) `[TRIVIAL]` - π Fallback login must treat non-login 302 redirect as success without waiting for redirect target. - - Ζ **test_submit_login_via_form_post_rejects_login_markup_response** (`Function`) + - Ζ **test_submit_login_via_form_post_rejects_login_markup_response** (`Function`) `[TRIVIAL]` - π Fallback login must fail when POST response still contains login form content. - - Ζ **test_goto_resilient_falls_back_from_domcontentloaded_to_load** (`Function`) + - Ζ **test_goto_resilient_falls_back_from_domcontentloaded_to_load** (`Function`) `[TRIVIAL]` - π Pages with unstable primary wait must retry with fallback wait strategy. - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -6803,123 +6740,123 @@ - π Auto-detected function (orphan) - Ζ **goto** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- π¦ **StoragePlugin** (`Module`) +- π¦ **StoragePlugin** (`Module`) `[TRIVIAL]` - π Provides core filesystem operations for managing backups and repositories. - ποΈ Layer: App - π Invariant: All file operations must be restricted to the configured storage root. - π IMPLEMENTS -> `PluginBase` - π DEPENDS_ON -> `backend.src.models.storage` - - β **StoragePlugin** (`Class`) + - β **StoragePlugin** (`Class`) `[TRIVIAL]` - π Implementation of the storage management plugin. - - Ζ **__init__** (`Function`) + - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Initializes the StoragePlugin and ensures required directories exist. - - Ζ **id** (`Function`) + - Ζ **id** (`Function`) `[TRIVIAL]` - π Returns the unique identifier for the storage plugin. - - Ζ **name** (`Function`) + - Ζ **name** (`Function`) `[TRIVIAL]` - π Returns the human-readable name of the storage plugin. - - Ζ **description** (`Function`) + - Ζ **description** (`Function`) `[TRIVIAL]` - π Returns a description of the storage plugin. - - Ζ **version** (`Function`) + - Ζ **version** (`Function`) `[TRIVIAL]` - π Returns the version of the storage plugin. - - Ζ **ui_route** (`Function`) + - Ζ **ui_route** (`Function`) `[TRIVIAL]` - π Returns the frontend route for the storage plugin. - - Ζ **get_schema** (`Function`) + - Ζ **get_schema** (`Function`) `[TRIVIAL]` - π Returns the JSON schema for storage plugin parameters. - - Ζ **execute** (`Function`) + - Ζ **execute** (`Function`) `[TRIVIAL]` - π Executes storage-related tasks with TaskContext support. - - Ζ **get_storage_root** (`Function`) + - Ζ **get_storage_root** (`Function`) `[TRIVIAL]` - π Resolves the absolute path to the storage root. - - Ζ **resolve_path** (`Function`) + - Ζ **resolve_path** (`Function`) `[TRIVIAL]` - π Resolves a dynamic path pattern using provided variables. - - Ζ **ensure_directories** (`Function`) + - Ζ **ensure_directories** (`Function`) `[TRIVIAL]` - π Creates the storage root and category subdirectories if they don't exist. - - Ζ **validate_path** (`Function`) + - Ζ **validate_path** (`Function`) `[TRIVIAL]` - π Prevents path traversal attacks by ensuring the path is within the storage root. - - Ζ **list_files** (`Function`) + - Ζ **list_files** (`Function`) `[TRIVIAL]` - π Lists all files and directories in a specific category and subpath. - - Ζ **save_file** (`Function`) + - Ζ **save_file** (`Function`) `[TRIVIAL]` - π Saves an uploaded file to the specified category and optional subpath. - - Ζ **delete_file** (`Function`) + - Ζ **delete_file** (`Function`) `[TRIVIAL]` - π Deletes a file or directory from the specified category and path. - - Ζ **get_file_path** (`Function`) + - Ζ **get_file_path** (`Function`) `[TRIVIAL]` - π Returns the absolute path of a file for download. -- β **GitLLMExtension** (`Class`) +- β **GitLLMExtension** (`Class`) `[TRIVIAL]` - π Provides LLM capabilities to the Git plugin. - - Ζ **suggest_commit_message** (`Function`) + - Ζ **suggest_commit_message** (`Function`) `[TRIVIAL]` - π Generates a suggested commit message based on a diff and history. - π¦ **llm_extension** (`Module`) `[TRIVIAL]` - π Auto-generated module for backend/src/plugins/git/llm_extension.py - ποΈ Layer: Unknown - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- π¦ **src.plugins.git** (`Package`) +- π¦ **src.plugins.git** (`Package`) `[TRIVIAL]` - π Git plugin extension package root. - π¦ **test_task_persistence** (`Module`) - π Unit tests for TaskPersistenceService. - ποΈ Layer: Test - β **TestTaskPersistenceHelpers** (`Class`) - π Test suite for TaskPersistenceService static helper methods. - - Ζ **test_json_load_if_needed_none** (`Function`) + - Ζ **test_json_load_if_needed_none** (`Function`) `[TRIVIAL]` - π Test _json_load_if_needed with None input. - - Ζ **test_json_load_if_needed_dict** (`Function`) + - Ζ **test_json_load_if_needed_dict** (`Function`) `[TRIVIAL]` - π Test _json_load_if_needed with dict input. - - Ζ **test_json_load_if_needed_list** (`Function`) + - Ζ **test_json_load_if_needed_list** (`Function`) `[TRIVIAL]` - π Test _json_load_if_needed with list input. - - Ζ **test_json_load_if_needed_json_string** (`Function`) + - Ζ **test_json_load_if_needed_json_string** (`Function`) `[TRIVIAL]` - π Test _json_load_if_needed with JSON string. - - Ζ **test_json_load_if_needed_empty_string** (`Function`) + - Ζ **test_json_load_if_needed_empty_string** (`Function`) `[TRIVIAL]` - π Test _json_load_if_needed with empty/null strings. - - Ζ **test_json_load_if_needed_plain_string** (`Function`) + - Ζ **test_json_load_if_needed_plain_string** (`Function`) `[TRIVIAL]` - π Test _json_load_if_needed with non-JSON string. - - Ζ **test_json_load_if_needed_integer** (`Function`) + - Ζ **test_json_load_if_needed_integer** (`Function`) `[TRIVIAL]` - π Test _json_load_if_needed with integer. - - Ζ **test_parse_datetime_none** (`Function`) + - Ζ **test_parse_datetime_none** (`Function`) `[TRIVIAL]` - π Test _parse_datetime with None. - - Ζ **test_parse_datetime_datetime_object** (`Function`) + - Ζ **test_parse_datetime_datetime_object** (`Function`) `[TRIVIAL]` - π Test _parse_datetime with datetime object. - - Ζ **test_parse_datetime_iso_string** (`Function`) + - Ζ **test_parse_datetime_iso_string** (`Function`) `[TRIVIAL]` - π Test _parse_datetime with ISO string. - - Ζ **test_parse_datetime_invalid_string** (`Function`) + - Ζ **test_parse_datetime_invalid_string** (`Function`) `[TRIVIAL]` - π Test _parse_datetime with invalid string. - - Ζ **test_parse_datetime_integer** (`Function`) + - Ζ **test_parse_datetime_integer** (`Function`) `[TRIVIAL]` - π Test _parse_datetime with non-string, non-datetime. - β **TestTaskPersistenceService** (`Class`) - π Test suite for TaskPersistenceService CRUD operations. - - Ζ **setup_class** (`Function`) + - Ζ **setup_class** (`Function`) `[TRIVIAL]` - π Setup in-memory test database. - - Ζ **teardown_class** (`Function`) + - Ζ **teardown_class** (`Function`) `[TRIVIAL]` - π Dispose of test database. - - Ζ **setup_method** (`Function`) + - Ζ **setup_method** (`Function`) `[TRIVIAL]` - π Clean task_records table before each test. - - Ζ **test_persist_task_new** (`Function`) + - Ζ **test_persist_task_new** (`Function`) `[TRIVIAL]` - π Test persisting a new task creates a record. - - Ζ **test_persist_task_update** (`Function`) + - Ζ **test_persist_task_update** (`Function`) `[TRIVIAL]` - π Test updating an existing task. - - Ζ **test_persist_task_with_logs** (`Function`) + - Ζ **test_persist_task_with_logs** (`Function`) `[TRIVIAL]` - π Test persisting a task with log entries. - - Ζ **test_persist_task_failed_extracts_error** (`Function`) + - Ζ **test_persist_task_failed_extracts_error** (`Function`) `[TRIVIAL]` - π Test that FAILED task extracts last error message. - - Ζ **test_persist_tasks_batch** (`Function`) + - Ζ **test_persist_tasks_batch** (`Function`) `[TRIVIAL]` - π Test persisting multiple tasks. - - Ζ **test_load_tasks** (`Function`) + - Ζ **test_load_tasks** (`Function`) `[TRIVIAL]` - π Test loading tasks from database. - - Ζ **test_load_tasks_with_status_filter** (`Function`) + - Ζ **test_load_tasks_with_status_filter** (`Function`) `[TRIVIAL]` - π Test loading tasks filtered by status. - - Ζ **test_load_tasks_with_limit** (`Function`) + - Ζ **test_load_tasks_with_limit** (`Function`) `[TRIVIAL]` - π Test loading tasks with limit. - - Ζ **test_delete_tasks** (`Function`) + - Ζ **test_delete_tasks** (`Function`) `[TRIVIAL]` - π Test deleting tasks by ID list. - - Ζ **test_delete_tasks_empty_list** (`Function`) + - Ζ **test_delete_tasks_empty_list** (`Function`) `[TRIVIAL]` - π Test deleting with empty list (no-op). - - Ζ **test_persist_task_with_datetime_in_params** (`Function`) + - Ζ **test_persist_task_with_datetime_in_params** (`Function`) `[TRIVIAL]` - π Test json_serializable handles datetime in params. - - Ζ **test_persist_task_resolves_environment_slug_to_existing_id** (`Function`) + - Ζ **test_persist_task_resolves_environment_slug_to_existing_id** (`Function`) `[TRIVIAL]` - π Ensure slug-like environment token resolves to environments.id before persisting task. - Ζ **_patched** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) - Ζ **_make_task** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- Ζ **test_environment_model** (`Function`) +- Ζ **test_environment_model** (`Function`) `[TRIVIAL]` - π Tests that Environment model correctly stores values. - π¦ **test_task_manager** (`Module`) - π Unit tests for TaskManager lifecycle, CRUD, log buffering, and filtering. @@ -7040,11 +6977,11 @@ - π Auto-detected function (orphan) - Ζ **test_task_matches_dashboard_logic** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- π¦ **test_dashboards_api** (`Test`) +- π¦ **test_dashboards_api** (`Test`) `[TRIVIAL]` - π Verify GET /api/dashboards contract compliance -- π¦ **test_datasets_api** (`Test`) +- π¦ **test_datasets_api** (`Test`) `[TRIVIAL]` - π Verify GET /api/datasets contract compliance -- π¦ **test_pagination_boundaries** (`Test`) +- π¦ **test_pagination_boundaries** (`Test`) `[TRIVIAL]` - π Verify pagination validation for GET endpoints - π¦ **test_resource_hubs** (`Module`) `[TRIVIAL]` - π Auto-generated module for backend/tests/test_resource_hubs.py @@ -7078,51 +7015,51 @@ - ποΈ Layer: Test - β **TestTaskLogger** (`Class`) - π Test suite for TaskLogger. - - Ζ **setup_method** (`Function`) + - Ζ **setup_method** (`Function`) `[TRIVIAL]` - π Setup for each test method. - - Ζ **test_init** (`Function`) + - Ζ **test_init** (`Function`) `[TRIVIAL]` - π Test TaskLogger initialization. - - Ζ **test_with_source** (`Function`) + - Ζ **test_with_source** (`Function`) `[TRIVIAL]` - π Test creating a sub-logger with different source. - - Ζ **test_debug** (`Function`) + - Ζ **test_debug** (`Function`) `[TRIVIAL]` - π Test debug log level. - - Ζ **test_info** (`Function`) + - Ζ **test_info** (`Function`) `[TRIVIAL]` - π Test info log level. - - Ζ **test_warning** (`Function`) + - Ζ **test_warning** (`Function`) `[TRIVIAL]` - π Test warning log level. - - Ζ **test_error** (`Function`) + - Ζ **test_error** (`Function`) `[TRIVIAL]` - π Test error log level. - - Ζ **test_error_with_metadata** (`Function`) + - Ζ **test_error_with_metadata** (`Function`) `[TRIVIAL]` - π Test error logging with metadata. - - Ζ **test_progress** (`Function`) + - Ζ **test_progress** (`Function`) `[TRIVIAL]` - π Test progress logging. - - Ζ **test_progress_clamping** (`Function`) + - Ζ **test_progress_clamping** (`Function`) `[TRIVIAL]` - π Test progress value clamping (0-100). - - Ζ **test_source_override** (`Function`) + - Ζ **test_source_override** (`Function`) `[TRIVIAL]` - π Test overriding the default source. - - Ζ **test_sub_logger_source_independence** (`Function`) + - Ζ **test_sub_logger_source_independence** (`Function`) `[TRIVIAL]` - π Test sub-logger independence from parent. - β **TestTaskContext** (`Class`) - π Test suite for TaskContext. - - Ζ **setup_method** (`Function`) + - Ζ **setup_method** (`Function`) `[TRIVIAL]` - π Setup for each test method. - - Ζ **test_init** (`Function`) + - Ζ **test_init** (`Function`) `[TRIVIAL]` - π Test TaskContext initialization. - - Ζ **test_task_id_property** (`Function`) + - Ζ **test_task_id_property** (`Function`) `[TRIVIAL]` - π Test task_id property. - - Ζ **test_logger_property** (`Function`) + - Ζ **test_logger_property** (`Function`) `[TRIVIAL]` - π Test logger property. - - Ζ **test_params_property** (`Function`) + - Ζ **test_params_property** (`Function`) `[TRIVIAL]` - π Test params property. - - Ζ **test_get_param** (`Function`) + - Ζ **test_get_param** (`Function`) `[TRIVIAL]` - π Test getting a specific parameter. - - Ζ **test_create_sub_context** (`Function`) + - Ζ **test_create_sub_context** (`Function`) `[TRIVIAL]` - π Test creating a sub-context with different source. - - Ζ **test_context_logger_delegates_to_task_logger** (`Function`) + - Ζ **test_context_logger_delegates_to_task_logger** (`Function`) `[TRIVIAL]` - π Test context logger delegates to TaskLogger. - - Ζ **test_sub_context_with_source** (`Function`) + - Ζ **test_sub_context_with_source** (`Function`) `[TRIVIAL]` - π Test sub-context logger uses new source. - - Ζ **test_multiple_sub_contexts** (`Function`) + - Ζ **test_multiple_sub_contexts** (`Function`) `[TRIVIAL]` - π Test creating multiple sub-contexts. - π¦ **test_smoke_plugins** (`Module`) `[TRIVIAL]` - π Auto-generated module for backend/tests/test_smoke_plugins.py @@ -7135,21 +7072,21 @@ - π Unit tests for the custom logger formatters and configuration context manager. - ποΈ Layer: Logging (Tests) - π Invariant: All required log statements must correctly check the threshold. - - Ζ **test_belief_scope_logs_entry_action_exit_at_debug** (`Function`) + - Ζ **test_belief_scope_logs_entry_action_exit_at_debug** (`Function`) `[TRIVIAL]` - π Test that belief_scope generates [ID][Entry], [ID][Action], and [ID][Exit] logs at DEBUG level. - - Ζ **test_belief_scope_error_handling** (`Function`) + - Ζ **test_belief_scope_error_handling** (`Function`) `[TRIVIAL]` - π Test that belief_scope logs Coherence:Failed on exception. - - Ζ **test_belief_scope_success_coherence** (`Function`) + - Ζ **test_belief_scope_success_coherence** (`Function`) `[TRIVIAL]` - π Test that belief_scope logs Coherence:OK on success. - - Ζ **test_belief_scope_not_visible_at_info** (`Function`) + - Ζ **test_belief_scope_not_visible_at_info** (`Function`) `[TRIVIAL]` - π Test that belief_scope Entry/Exit/Coherence logs are NOT visible at INFO level. - - Ζ **test_task_log_level_default** (`Function`) + - Ζ **test_task_log_level_default** (`Function`) `[TRIVIAL]` - π Test that default task log level is INFO. - - Ζ **test_should_log_task_level** (`Function`) + - Ζ **test_should_log_task_level** (`Function`) `[TRIVIAL]` - π Test that should_log_task_level correctly filters log levels. - - Ζ **test_configure_logger_task_log_level** (`Function`) + - Ζ **test_configure_logger_task_log_level** (`Function`) `[TRIVIAL]` - π Test that configure_logger updates task_log_level. - - Ζ **test_enable_belief_state_flag** (`Function`) + - Ζ **test_enable_belief_state_flag** (`Function`) `[TRIVIAL]` - π Test that enable_belief_state flag controls belief_scope logging. - π¦ **test_auth** (`Module`) `[TRIVIAL]` - π Auto-generated module for backend/tests/test_auth.py @@ -7189,35 +7126,35 @@ - ποΈ Layer: Test - β **TestLogPersistence** (`Class`) - π Test suite for TaskLogPersistenceService. - - Ζ **setup_class** (`Function`) + - Ζ **setup_class** (`Function`) `[TRIVIAL]` - π Setup test database and service instance. - - Ζ **teardown_class** (`Function`) + - Ζ **teardown_class** (`Function`) `[TRIVIAL]` - π Clean up test database. - - Ζ **setup_method** (`Function`) + - Ζ **setup_method** (`Function`) `[TRIVIAL]` - π Setup for each test method β clean task_logs table. - - Ζ **test_add_logs_single** (`Function`) + - Ζ **test_add_logs_single** (`Function`) `[TRIVIAL]` - π Test adding a single log entry. - - Ζ **test_add_logs_batch** (`Function`) + - Ζ **test_add_logs_batch** (`Function`) `[TRIVIAL]` - π Test adding multiple log entries in batch. - - Ζ **test_add_logs_empty** (`Function`) + - Ζ **test_add_logs_empty** (`Function`) `[TRIVIAL]` - π Test adding empty log list (should be no-op). - - Ζ **test_get_logs_by_task_id** (`Function`) + - Ζ **test_get_logs_by_task_id** (`Function`) `[TRIVIAL]` - π Test retrieving logs by task ID. - - Ζ **test_get_logs_with_filters** (`Function`) + - Ζ **test_get_logs_with_filters** (`Function`) `[TRIVIAL]` - π Test retrieving logs with level and source filters. - - Ζ **test_get_logs_with_pagination** (`Function`) + - Ζ **test_get_logs_with_pagination** (`Function`) `[TRIVIAL]` - π Test retrieving logs with pagination. - - Ζ **test_get_logs_with_search** (`Function`) + - Ζ **test_get_logs_with_search** (`Function`) `[TRIVIAL]` - π Test retrieving logs with search query. - - Ζ **test_get_log_stats** (`Function`) + - Ζ **test_get_log_stats** (`Function`) `[TRIVIAL]` - π Test retrieving log statistics. - - Ζ **test_get_sources** (`Function`) + - Ζ **test_get_sources** (`Function`) `[TRIVIAL]` - π Test retrieving unique log sources. - - Ζ **test_delete_logs_for_task** (`Function`) + - Ζ **test_delete_logs_for_task** (`Function`) `[TRIVIAL]` - π Test deleting logs by task ID. - - Ζ **test_delete_logs_for_tasks** (`Function`) + - Ζ **test_delete_logs_for_tasks** (`Function`) `[TRIVIAL]` - π Test deleting logs for multiple tasks. - - Ζ **test_delete_logs_for_tasks_empty** (`Function`) + - Ζ **test_delete_logs_for_tasks_empty** (`Function`) `[TRIVIAL]` - π Test deleting with empty list (no-op). - Ζ **_patched** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -7271,11 +7208,11 @@ - π Validate Gitea PR creation fallback behavior when configured server URL is stale. - ποΈ Layer: Domain - π Invariant: A 404 from primary Gitea URL retries once against remote-url host when different. - - Ζ **test_derive_server_url_from_remote_strips_credentials** (`Function`) + - Ζ **test_derive_server_url_from_remote_strips_credentials** (`Function`) `[TRIVIAL]` - π Ensure helper returns host base URL and removes embedded credentials. - - Ζ **test_create_gitea_pull_request_retries_with_remote_host_on_404** (`Function`) + - Ζ **test_create_gitea_pull_request_retries_with_remote_host_on_404** (`Function`) `[TRIVIAL]` - π Verify create_gitea_pull_request retries with remote URL host after primary 404. - - Ζ **test_create_gitea_pull_request_returns_branch_error_when_target_missing** (`Function`) + - Ζ **test_create_gitea_pull_request_returns_branch_error_when_target_missing** (`Function`) `[TRIVIAL]` - π Ensure Gitea 404 on PR creation is mapped to actionable target-branch validation error. - Ζ **fake_gitea_request** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -7394,31 +7331,31 @@ - π Define publication gate contracts over approved candidates and immutable publication records. - ποΈ Layer: Tests - π Invariant: Publish requires approval; revoke requires existing publication; republish after revoke is allowed as a new record. - - Ζ **_seed_candidate_with_passed_report** (`Function`) + - Ζ **_seed_candidate_with_passed_report** (`Function`) `[TRIVIAL]` - π Seed candidate/report fixtures for publication gate scenarios. - - Ζ **test_publish_without_approval_rejected** (`Function`) + - Ζ **test_publish_without_approval_rejected** (`Function`) `[TRIVIAL]` - π Ensure publish action is blocked until candidate is approved. - - Ζ **test_revoke_unknown_publication_rejected** (`Function`) + - Ζ **test_revoke_unknown_publication_rejected** (`Function`) `[TRIVIAL]` - π Ensure revocation is rejected for unknown publication id. - - Ζ **test_republish_after_revoke_creates_new_active_record** (`Function`) + - Ζ **test_republish_after_revoke_creates_new_active_record** (`Function`) `[TRIVIAL]` - π Ensure republish after revoke is allowed and creates a new ACTIVE record. - π¦ **backend.tests.services.clean_release.test_compliance_task_integration** (`Module`) - π Verify clean release compliance runs execute through TaskManager lifecycle with observable success/failure outcomes. - ποΈ Layer: Tests - π Invariant: Compliance execution triggered as task produces terminal task status and persists run evidence. - - Ζ **_seed_repository** (`Function`) + - Ζ **_seed_repository** (`Function`) `[TRIVIAL]` - π Prepare deterministic candidate/policy/registry/manifest fixtures for task integration tests. - - β **CleanReleaseCompliancePlugin** (`Class`) + - β **CleanReleaseCompliancePlugin** (`Class`) `[TRIVIAL]` - π TaskManager plugin shim that executes clean release compliance orchestration. - - β **_PluginLoaderStub** (`Class`) + - β **_PluginLoaderStub** (`Class`) `[TRIVIAL]` - π Provide minimal plugin loader contract used by TaskManager in integration tests. - - Ζ **_make_task_manager** (`Function`) + - Ζ **_make_task_manager** (`Function`) `[TRIVIAL]` - π Build TaskManager with mocked persistence services for isolated integration tests. - - Ζ **_wait_for_terminal_task** (`Function`) + - Ζ **_wait_for_terminal_task** (`Function`) `[TRIVIAL]` - π Poll task registry until target task reaches terminal status. - - Ζ **test_compliance_run_executes_as_task_manager_task** (`Function`) + - Ζ **test_compliance_run_executes_as_task_manager_task** (`Function`) `[TRIVIAL]` - π Verify successful compliance execution is observable as TaskManager SUCCESS task. - - Ζ **test_compliance_run_missing_manifest_marks_task_failed** (`Function`) + - Ζ **test_compliance_run_missing_manifest_marks_task_failed** (`Function`) `[TRIVIAL]` - π Verify missing manifest startup failure is surfaced as TaskManager FAILED task. - Ζ **id** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -7436,23 +7373,23 @@ - π Verify demo and real mode namespace isolation contracts before TUI integration. - ποΈ Layer: Tests - π DEPENDS_ON -> `backend.src.services.clean_release.demo_data_service` - - Ζ **test_resolve_namespace_separates_demo_and_real** (`Function`) + - Ζ **test_resolve_namespace_separates_demo_and_real** (`Function`) `[TRIVIAL]` - π Ensure namespace resolver returns deterministic and distinct namespaces. - - Ζ **test_build_namespaced_id_prevents_cross_mode_collisions** (`Function`) + - Ζ **test_build_namespaced_id_prevents_cross_mode_collisions** (`Function`) `[TRIVIAL]` - π Ensure ID generation prevents demo/real collisions for identical logical IDs. - - Ζ **test_create_isolated_repository_keeps_mode_data_separate** (`Function`) + - Ζ **test_create_isolated_repository_keeps_mode_data_separate** (`Function`) `[TRIVIAL]` - π Verify demo and real repositories do not leak state across mode boundaries. - π¦ **backend.tests.services.clean_release.test_report_audit_immutability** (`Module`) - π Validate report snapshot immutability expectations and append-only audit hook behavior for US2. - ποΈ Layer: Tests - π Invariant: Built reports are immutable snapshots; audit hooks produce append-only event traces. - - Ζ **_terminal_run** (`Function`) + - Ζ **_terminal_run** (`Function`) `[TRIVIAL]` - π Build deterministic terminal run fixture for report snapshot tests. - - Ζ **test_report_builder_sets_immutable_snapshot_flag** (`Function`) + - Ζ **test_report_builder_sets_immutable_snapshot_flag** (`Function`) `[TRIVIAL]` - π Ensure generated report payload is marked immutable and persisted as snapshot. - - Ζ **test_repository_rejects_report_overwrite_for_same_report_id** (`Function`) + - Ζ **test_repository_rejects_report_overwrite_for_same_report_id** (`Function`) `[TRIVIAL]` - π Define immutability contract that report snapshots cannot be overwritten by same identifier. - - Ζ **test_audit_hooks_emit_append_only_event_stream** (`Function`) + - Ζ **test_audit_hooks_emit_append_only_event_stream** (`Function`) `[TRIVIAL]` - π Verify audit hooks emit one event per action call and preserve call order. - π¦ **test_candidate_manifest_services** (`Module`) - π Test lifecycle and manifest versioning for release candidates. @@ -7484,39 +7421,39 @@ - π DEPENDS_ON -> `backend.src.services.clean_release.policy_resolution_service` - π DEPENDS_ON -> `backend.src.services.clean_release.repository` - π DEPENDS_ON -> `backend.src.services.clean_release.exceptions` - - Ζ **_config_manager** (`Function`) + - Ζ **_config_manager** (`Function`) `[TRIVIAL]` - π Build deterministic ConfigManager-like stub for tests. - - Ζ **test_resolve_trusted_policy_snapshots_missing_profile** (`Function`) + - Ζ **test_resolve_trusted_policy_snapshots_missing_profile** (`Function`) `[TRIVIAL]` - π Ensure resolution fails when trusted profile is not configured. - - Ζ **test_resolve_trusted_policy_snapshots_missing_registry** (`Function`) + - Ζ **test_resolve_trusted_policy_snapshots_missing_registry** (`Function`) `[TRIVIAL]` - π Ensure resolution fails when trusted registry is not configured. - - Ζ **test_resolve_trusted_policy_snapshots_rejects_override_attempt** (`Function`) + - Ζ **test_resolve_trusted_policy_snapshots_rejects_override_attempt** (`Function`) `[TRIVIAL]` - π Ensure runtime override attempt is rejected even if snapshots exist. - π¦ **backend.tests.services.clean_release.test_approval_service** (`Module`) - π Define approval gate contracts for approve/reject operations over immutable compliance evidence. - ποΈ Layer: Tests - π Invariant: Approval is allowed only for PASSED report bound to candidate; duplicate approve and foreign report must be rejected. - - Ζ **_seed_candidate_with_report** (`Function`) + - Ζ **_seed_candidate_with_report** (`Function`) `[TRIVIAL]` - π Seed candidate and report fixtures for approval gate tests. - - Ζ **test_approve_rejects_blocked_report** (`Function`) + - Ζ **test_approve_rejects_blocked_report** (`Function`) `[TRIVIAL]` - π Ensure approve is rejected when latest report final status is not PASSED. - - Ζ **test_approve_rejects_foreign_report** (`Function`) + - Ζ **test_approve_rejects_foreign_report** (`Function`) `[TRIVIAL]` - π Ensure approve is rejected when report belongs to another candidate. - - Ζ **test_approve_rejects_duplicate_approve** (`Function`) + - Ζ **test_approve_rejects_duplicate_approve** (`Function`) `[TRIVIAL]` - π Ensure repeated approve decision for same candidate is blocked. - - Ζ **test_reject_persists_decision_without_promoting_candidate_state** (`Function`) + - Ζ **test_reject_persists_decision_without_promoting_candidate_state** (`Function`) `[TRIVIAL]` - π Ensure reject decision is immutable and does not promote candidate to APPROVED. - - Ζ **test_reject_then_publish_is_blocked** (`Function`) + - Ζ **test_reject_then_publish_is_blocked** (`Function`) `[TRIVIAL]` - π Ensure latest REJECTED decision blocks publication gate. - π¦ **backend.tests.services.clean_release.test_compliance_execution_service** (`Module`) - π Validate stage pipeline and run finalization contracts for compliance execution. - ποΈ Layer: Tests - π Invariant: Missing manifest prevents run startup; failed execution cannot finalize as PASSED. - - Ζ **_seed_with_candidate_policy_registry** (`Function`) + - Ζ **_seed_with_candidate_policy_registry** (`Function`) `[TRIVIAL]` - π Build deterministic repository state for run startup tests. - - Ζ **test_run_without_manifest_rejected** (`Function`) + - Ζ **test_run_without_manifest_rejected** (`Function`) `[TRIVIAL]` - π Ensure compliance run cannot start when manifest is unresolved. - - Ζ **test_task_crash_mid_run_marks_failed** (`Function`) + - Ζ **test_task_crash_mid_run_marks_failed** (`Function`) `[TRIVIAL]` - π Ensure execution crash conditions force FAILED run status. - - Ζ **test_blocked_run_finalization_blocks_report_builder** (`Function`) + - Ζ **test_blocked_run_finalization_blocks_report_builder** (`Function`) `[TRIVIAL]` - π Ensure blocked runs require blocking violations before report creation. diff --git a/.ai/standards/semantics.md b/.ai/standards/semantics.md index af6cb066..d6c4929d 100644 --- a/.ai/standards/semantics.md +++ b/.ai/standards/semantics.md @@ -93,9 +93,9 @@ - ΠΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½ΠΈΠ΅ `belief_scope` ΡΡΡΠΎΠ³ΠΎ ΠΎΠ±ΡΠ·Π°ΡΠ΅Π»ΡΠ½ΠΎ. **Legacy mapping (ΠΎΠ±ΡΠ°ΡΠ½Π°Ρ ΡΠΎΠ²ΠΌΠ΅ΡΡΠΈΠΌΠΎΡΡΡ):** -- `@TIER: TRIVIAL` -> Complexity 1 -- `@TIER: STANDARD` -> Complexity 3 -- `@TIER: CRITICAL` -> Complexity 5 +- `@COMPLEXITY: 1` -> Complexity 1 +- `@COMPLEXITY: 3` -> Complexity 3 +- `@COMPLEXITY: 5` -> Complexity 5 ## VI. ΠΠ ΠΠ’ΠΠΠΠ ΠΠΠΠΠ ΠΠΠΠΠΠ― (THREAD-LOCAL BELIEF STATE) ΠΠΎΠ³ΠΈΡΠΎΠ²Π°Π½ΠΈΠ΅ β ΡΡΠΎ ΠΌΠ΅Ρ Π°Π½ΠΈΠ·ΠΌ ΡΡΠ°ΡΡΠΈΡΠΎΠ²ΠΊΠΈ ΡΠ°ΡΡΡΠΆΠ΄Π΅Π½ΠΈΠΉ ΠΠ (CoT) ΠΈ ΡΠΏΡΠ°Π²Π»Π΅Π½ΠΈΡ Attention Energy. ΠΡΡ ΠΈΡΠ΅ΠΊΡΡΡΠ° ΠΈΡΠΏΠΎΠ»ΡΠ·ΡΠ΅Ρ Thread-local storage (`_belief_state`), ΠΏΠΎΡΡΠΎΠΌΡ `ID` ΠΏΡΠΎΠΊΠΈΠ΄ΡΠ²Π°Π΅ΡΡΡ Π°Π²ΡΠΎΠΌΠ°ΡΠΈΡΠ΅ΡΠΊΠΈ. diff --git a/.kilocode/mcp.json b/.kilocode/mcp.json index 0356e0e3..e8302168 100644 --- a/.kilocode/mcp.json +++ b/.kilocode/mcp.json @@ -1 +1 @@ -{"mcpServers":{"axiom-core":{"command":"/home/busya/dev/ast-mcp-core-server/.venv/bin/python","args":["-c","from src.server import main; main()"],"env":{"PYTHONPATH":"/home/busya/dev/ast-mcp-core-server"},"alwaysAllow":["reindex_workspace_tool","read_grace_outline_tool","ast_search_tool","get_semantic_context_tool","build_task_context_tool","workspace_semantic_health_tool","audit_contracts_tool","diff_contract_semantics_tool","impact_analysis_tool","simulate_patch_tool","patch_contract_tool","guarded_patch_contract_tool","rename_contract_id_tool","move_contract_tool","extract_contract_tool","infer_missing_relations_tool","map_runtime_trace_to_contracts_tool","trace_tests_for_contract_tool","scaffold_contract_tests_tool"]}}} \ No newline at end of file +{"mcpServers":{"axiom-core":{"command":"/home/busya/dev/ast-mcp-core-server/.venv/bin/python","args":["-c","from src.server import main; main()"],"env":{"PYTHONPATH":"/home/busya/dev/ast-mcp-core-server"},"alwaysAllow":["reindex_workspace_tool","read_grace_outline_tool","ast_search_tool","get_semantic_context_tool","build_task_context_tool","workspace_semantic_health_tool","audit_contracts_tool","diff_contract_semantics_tool","impact_analysis_tool","simulate_patch_tool","patch_contract_tool","guarded_patch_contract_tool","rename_contract_id_tool","move_contract_tool","extract_contract_tool","infer_missing_relations_tool","map_runtime_trace_to_contracts_tool","trace_tests_for_contract_tool","scaffold_contract_tests_tool","search_contracts_tool"]}}} \ No newline at end of file diff --git a/.kilocode/workflows/speckit.semantics.md b/.kilocode/workflows/speckit.semantics.md index 5d3d6bf0..d4774e3c 100644 --- a/.kilocode/workflows/speckit.semantics.md +++ b/.kilocode/workflows/speckit.semantics.md @@ -22,6 +22,8 @@ Ensure the codebase adheres to the semantic standards defined in `.ai/standards/ 4. **NON-DESTRUCTIVE**: Do not remove existing code logic; only add or update semantic annotations. 5. **TIER AWARENESS**: Prioritize CRITICAL and STANDARD modules for compliance fixes. 6. **NO PSEUDO-CONTRACTS (CRITICAL)**: You are STRICTLY FORBIDDEN from using automated scripts (e.g., Python/Bash/sed) to mechanically inject boilerplate, placeholders, or "pseudo-contracts" merely to artificially inflate the compliance score. Every semantic tag, anchor, and contract you add MUST reflect a genuine, deep understanding of the code's actual logic and business requirements. +7. **ID NAMING (CRITICAL)**: NEVER use fully-qualified Python import paths in `[DEF:id:Type]`. Use short, domain-driven semantic IDs (e.g., `[DEF:AuthService:Class]`). Follow the exact style shown in `.ai/standards/semantics.md`. +8. **ORPHAN PREVENTION**: To reduce the orphan count, you MUST physically wrap actual class and function definitions with `[DEF:id:Type] ... [/DEF]` blocks in the code. Modifying `@RELATION` tags does NOT fix orphans. The AST parser flags any unwrapped function as an orphan. ## Execution Steps diff --git a/.kilocodemodes b/.kilocodemodes index fcb8afa3..92c1b727 100644 --- a/.kilocodemodes +++ b/.kilocodemodes @@ -186,6 +186,9 @@ customModes: 6. RELATION RECOVERY: Use inferred-relation and impact-analysis tools to reduce orphan and unresolved relation counts, not just to silence audits. 7. TEST TRACEABILITY: For CRITICAL or behavior-heavy contracts, use MCP test tracing/scaffolding tools to connect semantics with verification assets. 8. VERIFY AFTER EACH CHANGE: Re-run health and audit MCP checks after every semantic repair batch and report deltas in contract count, orphan count, and unresolved relations. + 9. ID NAMING (CRITICAL): NEVER use fully-qualified Python import paths in `[DEF:id:Type]`. Use short, domain-driven semantic IDs that match the style documented in [`.ai/standards/semantics.md`](.ai/standards/semantics.md). + 10. ORPHAN REDUCTION (CRITICAL): To reduce orphan count, prefer wrapping real unanchored classes and functions in matching `[DEF:id:Type] ... [/DEF]` blocks. Do NOT treat `@RELATION` rewrites alone as an orphan fix. + 11. PROTOCOL OVER TOOLING: If MCP or parser behavior appears to tolerate an undocumented ID convention, follow [`.ai/standards/semantics.md`](.ai/standards/semantics.md) instead of inventing a new canonical form. groups: - read - edit diff --git a/backend/src/api/auth.py b/backend/src/api/auth.py index 4aa8be14..86b671c4 100755 --- a/backend/src/api/auth.py +++ b/backend/src/api/auth.py @@ -1,6 +1,6 @@ # [DEF:backend.src.api.auth:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: api, auth, routes, login, logout # @PURPOSE: Authentication API endpoints. # @LAYER: API @@ -24,13 +24,13 @@ import starlette.requests # [/SECTION] # [DEF:router:Variable] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: APIRouter instance for authentication routes. router = APIRouter(prefix="/api/auth", tags=["auth"]) # [/DEF:router:Variable] # [DEF:login_for_access_token:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Authenticates a user and returns a JWT access token. # @PRE: form_data contains username and password. # @POST: Returns a Token object on success. @@ -58,7 +58,7 @@ async def login_for_access_token( # [/DEF:login_for_access_token:Function] # [DEF:read_users_me:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Retrieves the profile of the currently authenticated user. # @PRE: Valid JWT token provided. # @POST: Returns the current user's data. @@ -71,7 +71,7 @@ async def read_users_me(current_user: UserSchema = Depends(get_current_user)): # [/DEF:read_users_me:Function] # [DEF:logout:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Logs out the current user (placeholder for session revocation). # @PRE: Valid JWT token provided. # @POST: Returns success message. @@ -85,7 +85,7 @@ async def logout(current_user: UserSchema = Depends(get_current_user)): # [/DEF:logout:Function] # [DEF:login_adfs:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Initiates the ADFS OIDC login flow. # @POST: Redirects the user to ADFS. @router.get("/login/adfs") @@ -101,7 +101,7 @@ async def login_adfs(request: starlette.requests.Request): # [/DEF:login_adfs:Function] # [DEF:auth_callback_adfs:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Handles the callback from ADFS after successful authentication. # @POST: Provisions user JIT and returns session token. @router.get("/callback/adfs", name="auth_callback_adfs") diff --git a/backend/src/api/routes/__init__.py b/backend/src/api/routes/__init__.py index 71c4abe6..e845a972 100755 --- a/backend/src/api/routes/__init__.py +++ b/backend/src/api/routes/__init__.py @@ -1,5 +1,5 @@ # [DEF:backend.src.api.routes.__init__:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: routes, lazy-import, module-registry # @PURPOSE: Provide lazy route module loading to avoid heavyweight imports during tests. # @LAYER: API @@ -10,7 +10,7 @@ __all__ = ['plugins', 'tasks', 'settings', 'connections', 'environments', 'mappi # [DEF:__getattr__:Function] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Lazily import route module by attribute name. # @PRE: name is module candidate exposed in __all__. # @POST: Returns imported submodule or raises AttributeError. diff --git a/backend/src/api/routes/__tests__/test_assistant_api.py b/backend/src/api/routes/__tests__/test_assistant_api.py index c6c3bf3c..e49522cf 100644 --- a/backend/src/api/routes/__tests__/test_assistant_api.py +++ b/backend/src/api/routes/__tests__/test_assistant_api.py @@ -1,5 +1,5 @@ # [DEF:backend.src.api.routes.__tests__.test_assistant_api:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: tests, assistant, api, confirmation, status # @PURPOSE: Validate assistant API endpoint logic via direct async handler invocation. # @LAYER: UI (API Tests) @@ -26,7 +26,7 @@ from src.models.assistant import ( # [DEF:_run_async:Function] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Execute async endpoint handler in synchronous test context. # @PRE: coroutine is awaitable endpoint invocation. # @POST: Returns coroutine result or raises propagated exception. @@ -36,7 +36,7 @@ def _run_async(coroutine): # [/DEF:_run_async:Function] # [DEF:_FakeTask:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Lightweight task stub used by assistant API tests. class _FakeTask: def __init__(self, task_id: str, status: str = "RUNNING", user_id: str = "u-admin"): @@ -47,7 +47,7 @@ class _FakeTask: # [/DEF:_FakeTask:Class] # [DEF:_FakeTaskManager:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Minimal async-compatible TaskManager fixture for deterministic test flows. class _FakeTaskManager: def __init__(self): @@ -71,7 +71,7 @@ class _FakeTaskManager: # [/DEF:_FakeTaskManager:Class] # [DEF:_FakeConfigManager:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Environment config fixture with dev/prod aliases for parser tests. class _FakeConfigManager: def get_environments(self): @@ -87,7 +87,7 @@ class _FakeConfigManager: ) # [/DEF:_FakeConfigManager:Class] # [DEF:_admin_user:Function] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Build admin principal fixture. # @PRE: Test harness requires authenticated admin-like principal object. # @POST: Returns user stub with Admin role. @@ -98,7 +98,7 @@ def _admin_user(): # [/DEF:_admin_user:Function] # [DEF:_limited_user:Function] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Build non-admin principal fixture. # @PRE: Test harness requires restricted principal for deny scenarios. # @POST: Returns user stub without admin privileges. @@ -109,7 +109,7 @@ def _limited_user(): # [/DEF:_limited_user:Function] # [DEF:_FakeQuery:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Minimal chainable query object for fake SQLAlchemy-like DB behavior in tests. class _FakeQuery: def __init__(self, rows): @@ -141,7 +141,7 @@ class _FakeQuery: # [/DEF:_FakeQuery:Class] # [DEF:_FakeDb:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: In-memory fake database implementing subset of Session interface used by assistant routes. class _FakeDb: def __init__(self): @@ -191,7 +191,7 @@ class _FakeDb: # [/DEF:_FakeDb:Class] # [DEF:_clear_assistant_state:Function] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Reset in-memory assistant registries for isolation between tests. # @PRE: Assistant module globals may contain residues from previous test runs. # @POST: In-memory conversation/confirmation/audit dictionaries are empty. diff --git a/backend/src/api/routes/__tests__/test_assistant_authz.py b/backend/src/api/routes/__tests__/test_assistant_authz.py index 19e64a77..bbb299fb 100644 --- a/backend/src/api/routes/__tests__/test_assistant_authz.py +++ b/backend/src/api/routes/__tests__/test_assistant_authz.py @@ -1,5 +1,5 @@ # [DEF:backend.src.api.routes.__tests__.test_assistant_authz:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: tests, assistant, authz, confirmation, rbac # @PURPOSE: Verify assistant confirmation ownership, expiration, and deny behavior for restricted users. # @LAYER: UI (API Tests) @@ -28,7 +28,7 @@ from src.models.assistant import ( # [DEF:_run_async:Function] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Execute async endpoint handler in synchronous test context. # @PRE: coroutine is awaitable endpoint invocation. # @POST: Returns coroutine result or raises propagated exception. @@ -38,7 +38,7 @@ def _run_async(coroutine): # [/DEF:_run_async:Function] # [DEF:_FakeTask:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Lightweight task model used for assistant authz tests. class _FakeTask: def __init__(self, task_id: str, status: str = "RUNNING", user_id: str = "u-admin"): @@ -49,7 +49,7 @@ class _FakeTask: # [/DEF:_FakeTask:Class] # [DEF:_FakeTaskManager:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Minimal task manager for deterministic operation creation and lookup. class _FakeTaskManager: def __init__(self): @@ -73,7 +73,7 @@ class _FakeTaskManager: # [/DEF:_FakeTaskManager:Class] # [DEF:_FakeConfigManager:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Provide deterministic environment aliases required by intent parsing. class _FakeConfigManager: def get_environments(self): @@ -85,7 +85,7 @@ class _FakeConfigManager: # [/DEF:_FakeConfigManager:Class] # [DEF:_admin_user:Function] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Build admin principal fixture. # @PRE: Test requires privileged principal for risky operations. # @POST: Returns admin-like user stub with Admin role. @@ -96,7 +96,7 @@ def _admin_user(): # [/DEF:_admin_user:Function] # [DEF:_other_admin_user:Function] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Build second admin principal fixture for ownership tests. # @PRE: Ownership mismatch scenario needs distinct authenticated actor. # @POST: Returns alternate admin-like user stub. @@ -107,7 +107,7 @@ def _other_admin_user(): # [/DEF:_other_admin_user:Function] # [DEF:_limited_user:Function] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Build limited principal without required assistant execution privileges. # @PRE: Permission denial scenario needs non-admin actor. # @POST: Returns restricted user stub. @@ -118,7 +118,7 @@ def _limited_user(): # [/DEF:_limited_user:Function] # [DEF:_FakeQuery:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Minimal chainable query object for fake DB interactions. class _FakeQuery: def __init__(self, rows): @@ -150,7 +150,7 @@ class _FakeQuery: # [/DEF:_FakeQuery:Class] # [DEF:_FakeDb:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: In-memory session substitute for assistant route persistence calls. class _FakeDb: def __init__(self): @@ -197,7 +197,7 @@ class _FakeDb: # [/DEF:_FakeDb:Class] # [DEF:_clear_assistant_state:Function] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Reset assistant process-local state between test cases. # @PRE: Assistant globals may contain state from prior tests. # @POST: Assistant in-memory state dictionaries are cleared. diff --git a/backend/src/api/routes/__tests__/test_clean_release_api.py b/backend/src/api/routes/__tests__/test_clean_release_api.py index 9c1f4048..25a6bade 100644 --- a/backend/src/api/routes/__tests__/test_clean_release_api.py +++ b/backend/src/api/routes/__tests__/test_clean_release_api.py @@ -1,5 +1,5 @@ # [DEF:backend.tests.api.routes.test_clean_release_api:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: tests, api, clean-release, checks, reports # @PURPOSE: Contract tests for clean release checks and reports endpoints. # @LAYER: Domain diff --git a/backend/src/api/routes/__tests__/test_clean_release_legacy_compat.py b/backend/src/api/routes/__tests__/test_clean_release_legacy_compat.py index 5d811254..42dc09ea 100644 --- a/backend/src/api/routes/__tests__/test_clean_release_legacy_compat.py +++ b/backend/src/api/routes/__tests__/test_clean_release_legacy_compat.py @@ -1,5 +1,5 @@ # [DEF:backend.src.api.routes.__tests__.test_clean_release_legacy_compat:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Compatibility tests for legacy clean-release API paths retained during v2 migration. # @LAYER: Tests # @RELATION: TESTS -> backend.src.api.routes.clean_release diff --git a/backend/src/api/routes/__tests__/test_clean_release_source_policy.py b/backend/src/api/routes/__tests__/test_clean_release_source_policy.py index 452ec5a0..c6c7818e 100644 --- a/backend/src/api/routes/__tests__/test_clean_release_source_policy.py +++ b/backend/src/api/routes/__tests__/test_clean_release_source_policy.py @@ -1,5 +1,5 @@ # [DEF:backend.tests.api.routes.test_clean_release_source_policy:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: tests, api, clean-release, source-policy # @PURPOSE: Validate API behavior for source isolation violations in clean release preparation. # @LAYER: Domain diff --git a/backend/src/api/routes/__tests__/test_clean_release_v2_api.py b/backend/src/api/routes/__tests__/test_clean_release_v2_api.py index 2e0ae9e1..ddfd452a 100644 --- a/backend/src/api/routes/__tests__/test_clean_release_v2_api.py +++ b/backend/src/api/routes/__tests__/test_clean_release_v2_api.py @@ -1,5 +1,5 @@ # [DEF:test_clean_release_v2_api:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: API contract tests for redesigned clean release endpoints. # @LAYER: Domain diff --git a/backend/src/api/routes/__tests__/test_clean_release_v2_release_api.py b/backend/src/api/routes/__tests__/test_clean_release_v2_release_api.py index 4068176b..18e6535c 100644 --- a/backend/src/api/routes/__tests__/test_clean_release_v2_release_api.py +++ b/backend/src/api/routes/__tests__/test_clean_release_v2_release_api.py @@ -1,5 +1,5 @@ # [DEF:test_clean_release_v2_release_api:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: API contract test scaffolding for clean release approval and publication endpoints. # @LAYER: Domain # @RELATION: IMPLEMENTS -> clean_release_v2_release_api_contracts diff --git a/backend/src/api/routes/__tests__/test_connections_routes.py b/backend/src/api/routes/__tests__/test_connections_routes.py index ee022fdc..e35ba31d 100644 --- a/backend/src/api/routes/__tests__/test_connections_routes.py +++ b/backend/src/api/routes/__tests__/test_connections_routes.py @@ -1,5 +1,5 @@ # [DEF:backend.src.api.routes.__tests__.test_connections_routes:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Verifies connection routes bootstrap their table before CRUD access. # @LAYER: API # @RELATION: VERIFIES -> backend.src.api.routes.connections diff --git a/backend/src/api/routes/__tests__/test_dashboards.py b/backend/src/api/routes/__tests__/test_dashboards.py index 05586550..845c1082 100644 --- a/backend/src/api/routes/__tests__/test_dashboards.py +++ b/backend/src/api/routes/__tests__/test_dashboards.py @@ -1,5 +1,5 @@ # [DEF:backend.src.api.routes.__tests__.test_dashboards:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Unit tests for Dashboards API endpoints # @LAYER: API # @RELATION: TESTS -> backend.src.api.routes.dashboards diff --git a/backend/src/api/routes/__tests__/test_datasets.py b/backend/src/api/routes/__tests__/test_datasets.py index 0718f523..d9a12763 100644 --- a/backend/src/api/routes/__tests__/test_datasets.py +++ b/backend/src/api/routes/__tests__/test_datasets.py @@ -1,5 +1,5 @@ # [DEF:backend.src.api.routes.__tests__.test_datasets:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: datasets, api, tests, pagination, mapping, docs # @PURPOSE: Unit tests for Datasets API endpoints # @LAYER: API diff --git a/backend/src/api/routes/__tests__/test_git_status_route.py b/backend/src/api/routes/__tests__/test_git_status_route.py index 3dfbd59f..2bd8a8ef 100644 --- a/backend/src/api/routes/__tests__/test_git_status_route.py +++ b/backend/src/api/routes/__tests__/test_git_status_route.py @@ -1,5 +1,5 @@ # [DEF:backend.src.api.routes.__tests__.test_git_status_route:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: tests, git, api, status, no_repo # @PURPOSE: Validate status endpoint behavior for missing and error repository states. # @LAYER: Domain (Tests) diff --git a/backend/src/api/routes/__tests__/test_migration_routes.py b/backend/src/api/routes/__tests__/test_migration_routes.py index 66e5b57c..6cb619d8 100644 --- a/backend/src/api/routes/__tests__/test_migration_routes.py +++ b/backend/src/api/routes/__tests__/test_migration_routes.py @@ -1,6 +1,6 @@ # [DEF:backend.src.api.routes.__tests__.test_migration_routes:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Unit tests for migration API route handlers. # @LAYER: API # @RELATION: VERIFIES -> backend.src.api.routes.migration diff --git a/backend/src/api/routes/__tests__/test_profile_api.py b/backend/src/api/routes/__tests__/test_profile_api.py index 8cbd9365..63d72561 100644 --- a/backend/src/api/routes/__tests__/test_profile_api.py +++ b/backend/src/api/routes/__tests__/test_profile_api.py @@ -1,5 +1,5 @@ # [DEF:backend.src.api.routes.__tests__.test_profile_api:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: tests, profile, api, preferences, lookup, contract # @PURPOSE: Verifies profile API route contracts for preference read/update and Superset account lookup. # @LAYER: API diff --git a/backend/src/api/routes/__tests__/test_reports_api.py b/backend/src/api/routes/__tests__/test_reports_api.py index d40c9053..3c6e3b82 100644 --- a/backend/src/api/routes/__tests__/test_reports_api.py +++ b/backend/src/api/routes/__tests__/test_reports_api.py @@ -1,5 +1,5 @@ # [DEF:backend.tests.test_reports_api:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: tests, reports, api, contract, pagination, filtering # @PURPOSE: Contract tests for GET /api/reports defaults, pagination, and filtering behavior. # @LAYER: Domain (Tests) diff --git a/backend/src/api/routes/__tests__/test_reports_detail_api.py b/backend/src/api/routes/__tests__/test_reports_detail_api.py index 6ae95769..bb78d7b3 100644 --- a/backend/src/api/routes/__tests__/test_reports_detail_api.py +++ b/backend/src/api/routes/__tests__/test_reports_detail_api.py @@ -1,5 +1,5 @@ # [DEF:backend.tests.test_reports_detail_api:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: tests, reports, api, detail, diagnostics # @PURPOSE: Contract tests for GET /api/reports/{report_id} detail endpoint behavior. # @LAYER: Domain (Tests) diff --git a/backend/src/api/routes/__tests__/test_reports_openapi_conformance.py b/backend/src/api/routes/__tests__/test_reports_openapi_conformance.py index 07755bde..14d30982 100644 --- a/backend/src/api/routes/__tests__/test_reports_openapi_conformance.py +++ b/backend/src/api/routes/__tests__/test_reports_openapi_conformance.py @@ -1,5 +1,5 @@ # [DEF:backend.tests.test_reports_openapi_conformance:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: tests, reports, openapi, conformance # @PURPOSE: Validate implemented reports payload shape against OpenAPI-required top-level contract fields. # @LAYER: Domain (Tests) diff --git a/backend/src/api/routes/admin.py b/backend/src/api/routes/admin.py index bb0359cc..2ce813e9 100644 --- a/backend/src/api/routes/admin.py +++ b/backend/src/api/routes/admin.py @@ -1,6 +1,6 @@ # [DEF:backend.src.api.routes.admin:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: api, admin, users, roles, permissions # @PURPOSE: Admin API endpoints for user and role management. # @LAYER: API @@ -36,7 +36,7 @@ router = APIRouter(prefix="/api/admin", tags=["admin"]) # [/DEF:router:Variable] # [DEF:list_users:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Lists all registered users. # @PRE: Current user has 'Admin' role. # @POST: Returns a list of UserSchema objects. @@ -53,7 +53,7 @@ async def list_users( # [/DEF:list_users:Function] # [DEF:create_user:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Creates a new local user. # @PRE: Current user has 'Admin' role. # @POST: New user is created in the database. @@ -91,7 +91,7 @@ async def create_user( # [/DEF:create_user:Function] # [DEF:update_user:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Updates an existing user. @router.put("/users/{user_id}", response_model=UserSchema) async def update_user( @@ -126,7 +126,7 @@ async def update_user( # [/DEF:update_user:Function] # [DEF:delete_user:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Deletes a user. @router.delete("/users/{user_id}", status_code=status.HTTP_204_NO_CONTENT) async def delete_user( @@ -150,7 +150,7 @@ async def delete_user( # [/DEF:delete_user:Function] # [DEF:list_roles:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Lists all available roles. # @RETURN: List[RoleSchema] - List of roles. # @RELATION: CALLS -> backend.src.models.auth.Role @@ -164,7 +164,7 @@ async def list_roles( # [/DEF:list_roles:Function] # [DEF:create_role:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Creates a new system role with associated permissions. # @PRE: Role name must be unique. # @POST: New Role record is created in auth.db. @@ -202,7 +202,7 @@ async def create_role( # [/DEF:create_role:Function] # [DEF:update_role:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Updates an existing role's metadata and permissions. # @PRE: role_id must be a valid existing role UUID. # @POST: Role record is updated in auth.db. @@ -247,7 +247,7 @@ async def update_role( # [/DEF:update_role:Function] # [DEF:delete_role:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Removes a role from the system. # @PRE: role_id must be a valid existing role UUID. # @POST: Role record is removed from auth.db. @@ -274,7 +274,7 @@ async def delete_role( # [/DEF:delete_role:Function] # [DEF:list_permissions:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Lists all available system permissions for assignment. # @POST: Returns a list of all PermissionSchema objects. # @PARAM: db (Session) - Auth database session. @@ -300,7 +300,7 @@ async def list_permissions( # [/DEF:list_permissions:Function] # [DEF:list_ad_mappings:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Lists all AD Group to Role mappings. @router.get("/ad-mappings", response_model=List[ADGroupMappingSchema]) async def list_ad_mappings( @@ -312,7 +312,7 @@ async def list_ad_mappings( # [/DEF:list_ad_mappings:Function] # [DEF:create_ad_mapping:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Creates a new AD Group mapping. @router.post("/ad-mappings", response_model=ADGroupMappingSchema) async def create_ad_mapping( diff --git a/backend/src/api/routes/assistant.py b/backend/src/api/routes/assistant.py index 4f525f63..26006579 100644 --- a/backend/src/api/routes/assistant.py +++ b/backend/src/api/routes/assistant.py @@ -1,5 +1,5 @@ # [DEF:backend.src.api.routes.assistant:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: api, assistant, chat, command, confirmation # @PURPOSE: API routes for LLM assistant command parsing and safe execution orchestration. # @LAYER: API @@ -47,7 +47,7 @@ git_service = GitService() # [DEF:AssistantMessageRequest:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Input payload for assistant message endpoint. # @PRE: message length is within accepted bounds. # @POST: Request object provides message text and optional conversation binding. @@ -58,7 +58,7 @@ class AssistantMessageRequest(BaseModel): # [DEF:AssistantAction:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: UI action descriptor returned with assistant responses. # @PRE: type and label are provided by orchestration logic. # @POST: Action can be rendered as button on frontend. @@ -70,7 +70,7 @@ class AssistantAction(BaseModel): # [DEF:AssistantMessageResponse:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Output payload contract for assistant interaction endpoints. # @PRE: Response includes deterministic state and text. # @POST: Payload may include task_id/confirmation_id/actions for UI follow-up. @@ -88,7 +88,7 @@ class AssistantMessageResponse(BaseModel): # [DEF:ConfirmationRecord:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: In-memory confirmation token model for risky operation dispatch. # @PRE: intent/dispatch/user_id are populated at confirmation request time. # @POST: Record tracks lifecycle state and expiry timestamp. @@ -125,7 +125,7 @@ INTENT_PERMISSION_CHECKS: Dict[str, List[Tuple[str, str]]] = { # [DEF:_append_history:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Append conversation message to in-memory history buffer. # @PRE: user_id and conversation_id identify target conversation bucket. # @POST: Message entry is appended to CONVERSATIONS key list. @@ -157,7 +157,7 @@ def _append_history( # [DEF:_persist_message:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Persist assistant/user message record to database. # @PRE: db session is writable and message payload is serializable. # @POST: Message row is committed or persistence failure is logged. @@ -193,7 +193,7 @@ def _persist_message( # [DEF:_audit:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Append in-memory audit record for assistant decision trace. # @PRE: payload describes decision/outcome fields. # @POST: ASSISTANT_AUDIT list for user contains new timestamped entry. @@ -206,7 +206,7 @@ def _audit(user_id: str, payload: Dict[str, Any]): # [DEF:_persist_audit:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Persist structured assistant audit payload in database. # @PRE: db session is writable and payload is JSON-serializable. # @POST: Audit row is committed or failure is logged with rollback. @@ -230,7 +230,7 @@ def _persist_audit(db: Session, user_id: str, payload: Dict[str, Any], conversat # [DEF:_persist_confirmation:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Persist confirmation token record to database. # @PRE: record contains id/user/intent/dispatch/expiry fields. # @POST: Confirmation row exists in persistent storage. @@ -256,7 +256,7 @@ def _persist_confirmation(db: Session, record: ConfirmationRecord): # [DEF:_update_confirmation_state:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Update persistent confirmation token lifecycle state. # @PRE: confirmation_id references existing row. # @POST: State and consumed_at fields are updated when applicable. @@ -276,7 +276,7 @@ def _update_confirmation_state(db: Session, confirmation_id: str, state: str): # [DEF:_load_confirmation_from_db:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Load confirmation token from database into in-memory model. # @PRE: confirmation_id may or may not exist in storage. # @POST: Returns ConfirmationRecord when found, otherwise None. @@ -302,7 +302,7 @@ def _load_confirmation_from_db(db: Session, confirmation_id: str) -> Optional[Co # [DEF:_ensure_conversation:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Resolve active conversation id in memory or create a new one. # @PRE: user_id identifies current actor. # @POST: Returns stable conversation id and updates USER_ACTIVE_CONVERSATION. @@ -322,7 +322,7 @@ def _ensure_conversation(user_id: str, conversation_id: Optional[str]) -> str: # [DEF:_resolve_or_create_conversation:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Resolve active conversation using explicit id, memory cache, or persisted history. # @PRE: user_id and db session are available. # @POST: Returns conversation id and updates USER_ACTIVE_CONVERSATION cache. @@ -352,7 +352,7 @@ def _resolve_or_create_conversation(user_id: str, conversation_id: Optional[str] # [DEF:_cleanup_history_ttl:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Enforce assistant message retention window by deleting expired rows and in-memory records. # @PRE: db session is available and user_id references current actor scope. # @POST: Messages older than ASSISTANT_MESSAGE_TTL_DAYS are removed from persistence and memory mirrors. @@ -390,7 +390,7 @@ def _cleanup_history_ttl(db: Session, user_id: str): # [DEF:_is_conversation_archived:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Determine archived state for a conversation based on last update timestamp. # @PRE: updated_at can be null for empty conversations. # @POST: Returns True when conversation inactivity exceeds archive threshold. @@ -403,7 +403,7 @@ def _is_conversation_archived(updated_at: Optional[datetime]) -> bool: # [DEF:_coerce_query_bool:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Normalize bool-like query values for compatibility in direct handler invocations/tests. # @PRE: value may be bool, string, or FastAPI Query metadata object. # @POST: Returns deterministic boolean flag. @@ -417,7 +417,7 @@ def _coerce_query_bool(value: Any) -> bool: # [DEF:_extract_id:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Extract first regex match group from text by ordered pattern list. # @PRE: patterns contain at least one capture group. # @POST: Returns first matched token or None. @@ -431,7 +431,7 @@ def _extract_id(text: str, patterns: List[str]) -> Optional[str]: # [DEF:_resolve_env_id:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Resolve environment identifier/name token to canonical environment id. # @PRE: config_manager provides environment list. # @POST: Returns matched environment id or None. @@ -449,7 +449,7 @@ def _resolve_env_id(token: Optional[str], config_manager: ConfigManager) -> Opti # [DEF:_is_production_env:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Determine whether environment token resolves to production-like target. # @PRE: config_manager provides environments or token text is provided. # @POST: Returns True for production/prod synonyms, else False. @@ -467,7 +467,7 @@ def _is_production_env(token: Optional[str], config_manager: ConfigManager) -> b # [DEF:_resolve_provider_id:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Resolve provider token to provider id with active/default fallback. # @PRE: db session can load provider list through LLMProviderService. # @POST: Returns provider id or None when no providers configured. @@ -503,7 +503,7 @@ def _resolve_provider_id( # [DEF:_get_default_environment_id:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Resolve default environment id from settings or first configured environment. # @PRE: config_manager returns environments list. # @POST: Returns default environment id or None when environment list is empty. @@ -525,7 +525,7 @@ def _get_default_environment_id(config_manager: ConfigManager) -> Optional[str]: # [DEF:_resolve_dashboard_id_by_ref:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Resolve dashboard id by title or slug reference in selected environment. # @PRE: dashboard_ref is a non-empty string-like token. # @POST: Returns dashboard id when uniquely matched, otherwise None. @@ -568,7 +568,7 @@ def _resolve_dashboard_id_by_ref( # [DEF:_resolve_dashboard_id_entity:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Resolve dashboard id from intent entities using numeric id or dashboard_ref fallback. # @PRE: entities may contain dashboard_id as int/str and optional dashboard_ref. # @POST: Returns resolved dashboard id or None when ambiguous/unresolvable. @@ -600,7 +600,7 @@ def _resolve_dashboard_id_entity( # [DEF:_get_environment_name_by_id:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Resolve human-readable environment name by id. # @PRE: environment id may be None. # @POST: Returns matching environment name or fallback id. @@ -613,7 +613,7 @@ def _get_environment_name_by_id(env_id: Optional[str], config_manager: ConfigMan # [DEF:_extract_result_deep_links:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Build deep-link actions to verify task result from assistant chat. # @PRE: task object is available. # @POST: Returns zero or more assistant actions for dashboard open/diff. @@ -670,7 +670,7 @@ def _extract_result_deep_links(task: Any, config_manager: ConfigManager) -> List # [DEF:_build_task_observability_summary:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Build compact textual summary for completed tasks to reduce "black box" effect. # @PRE: task may contain plugin-specific result payload. # @POST: Returns non-empty summary line for known task types or empty string fallback. @@ -734,7 +734,7 @@ def _build_task_observability_summary(task: Any, config_manager: ConfigManager) # [DEF:_parse_command:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Deterministically parse RU/EN command text into intent payload. # @PRE: message contains raw user text and config manager resolves environments. # @POST: Returns intent dict with domain/operation/entities/confidence/risk fields. @@ -928,7 +928,7 @@ def _parse_command(message: str, config_manager: ConfigManager) -> Dict[str, Any # [DEF:_check_any_permission:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Validate user against alternative permission checks (logical OR). # @PRE: checks list contains resource-action tuples. # @POST: Returns on first successful permission; raises 403-like HTTPException otherwise. @@ -946,7 +946,7 @@ def _check_any_permission(current_user: User, checks: List[Tuple[str, str]]): # [DEF:_has_any_permission:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Check whether user has at least one permission tuple from the provided list. # @PRE: current_user and checks list are valid. # @POST: Returns True when at least one permission check passes. @@ -960,7 +960,7 @@ def _has_any_permission(current_user: User, checks: List[Tuple[str, str]]) -> bo # [DEF:_build_tool_catalog:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Build current-user tool catalog for LLM planner with operation contracts and defaults. # @PRE: current_user is authenticated; config/db are available. # @POST: Returns list of executable tools filtered by permission and runtime availability. @@ -1084,7 +1084,7 @@ def _build_tool_catalog(current_user: User, config_manager: ConfigManager, db: S # [DEF:_coerce_intent_entities:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Normalize intent entity value types from LLM output to route-compatible values. # @PRE: intent contains entities dict or missing entities. # @POST: Returned intent has numeric ids coerced where possible and string values stripped. @@ -1109,7 +1109,7 @@ _SAFE_OPS = {"show_capabilities", "get_task_status", "get_health_summary"} # [DEF:_confirmation_summary:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Build human-readable confirmation prompt for an intent before execution. # @PRE: intent contains operation and entities fields. # @POST: Returns descriptive Russian-language text ending with confirmation prompt. @@ -1205,7 +1205,7 @@ async def _async_confirmation_summary(intent: Dict[str, Any], config_manager: Co # [DEF:_clarification_text_for_intent:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Convert technical missing-parameter errors into user-facing clarification prompts. # @PRE: state was classified as needs_clarification for current intent/error combination. # @POST: Returned text is human-readable and actionable for target operation. @@ -1229,7 +1229,7 @@ def _clarification_text_for_intent(intent: Optional[Dict[str, Any]], detail_text # [DEF:_plan_intent_with_llm:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Use active LLM provider to select best tool/operation from dynamic catalog. # @PRE: tools list contains allowed operations for current user. # @POST: Returns normalized intent dict when planning succeeds; otherwise None. @@ -1340,7 +1340,7 @@ async def _plan_intent_with_llm( # [DEF:_authorize_intent:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Validate user permissions for parsed intent before confirmation/dispatch. # @PRE: intent.operation is present for known assistant command domains. # @POST: Returns if authorized; raises HTTPException(403) when denied. @@ -1352,7 +1352,7 @@ def _authorize_intent(intent: Dict[str, Any], current_user: User): # [DEF:_dispatch_intent:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Execute parsed assistant intent via existing task/plugin/git services. # @PRE: intent operation is known and actor permissions are validated per operation. # @POST: Returns response text, optional task id, and UI actions for follow-up. @@ -1674,7 +1674,7 @@ async def _dispatch_intent( @router.post("/messages", response_model=AssistantMessageResponse) # [DEF:send_message:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Parse assistant command, enforce safety gates, and dispatch executable intent. # @PRE: Authenticated user is available and message text is non-empty. # @POST: Response state is one of clarification/confirmation/started/success/denied/failed. @@ -1844,7 +1844,7 @@ async def send_message( @router.post("/confirmations/{confirmation_id}/confirm", response_model=AssistantMessageResponse) # [DEF:confirm_operation:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Execute previously requested risky operation after explicit user confirmation. # @PRE: confirmation_id exists, belongs to current user, is pending, and not expired. # @POST: Confirmation state becomes consumed and operation result is persisted in history. @@ -1911,7 +1911,7 @@ async def confirm_operation( @router.post("/confirmations/{confirmation_id}/cancel", response_model=AssistantMessageResponse) # [DEF:cancel_operation:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Cancel pending risky operation and mark confirmation token as cancelled. # @PRE: confirmation_id exists, belongs to current user, and is still pending. # @POST: Confirmation becomes cancelled and cannot be executed anymore. @@ -1968,7 +1968,7 @@ async def cancel_operation( # [DEF:list_conversations:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Return paginated conversation list for current user with archived flag and last message preview. # @PRE: Authenticated user context and valid pagination params. # @POST: Conversations are grouped by conversation_id sorted by latest activity descending. @@ -2056,7 +2056,7 @@ async def list_conversations( # [DEF:delete_conversation:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Soft-delete or hard-delete a conversation and clear its in-memory trace. # @PRE: conversation_id belongs to current_user. # @POST: Conversation records are removed from DB and CONVERSATIONS cache. diff --git a/backend/src/api/routes/clean_release.py b/backend/src/api/routes/clean_release.py index a76cdf4a..a5d643ae 100644 --- a/backend/src/api/routes/clean_release.py +++ b/backend/src/api/routes/clean_release.py @@ -1,5 +1,5 @@ # [DEF:backend.src.api.routes.clean_release:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: api, clean-release, candidate-preparation, compliance # @PURPOSE: Expose clean release endpoints for candidate preparation and subsequent compliance flow. # @LAYER: API diff --git a/backend/src/api/routes/clean_release_v2.py b/backend/src/api/routes/clean_release_v2.py index 1929d5b0..82943f44 100644 --- a/backend/src/api/routes/clean_release_v2.py +++ b/backend/src/api/routes/clean_release_v2.py @@ -1,5 +1,5 @@ # [DEF:backend.src.api.routes.clean_release_v2:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: api, clean-release, v2, headless # @PURPOSE: Redesigned clean release API for headless candidate lifecycle. # @LAYER: API diff --git a/backend/src/api/routes/dashboards.py b/backend/src/api/routes/dashboards.py index aa85fdde..f1e0108e 100644 --- a/backend/src/api/routes/dashboards.py +++ b/backend/src/api/routes/dashboards.py @@ -1,6 +1,6 @@ # [DEF:backend.src.api.routes.dashboards:Module] # -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: api, dashboards, resources, hub # @PURPOSE: API endpoints for the Dashboard Hub - listing dashboards with Git and task status # @LAYER: API @@ -66,7 +66,7 @@ from ...services.resource_service import ResourceService router = APIRouter(prefix="/api/dashboards", tags=["Dashboards"]) # [DEF:GitStatus:DataClass] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: DTO for dashboard Git synchronization status. class GitStatus(BaseModel): branch: Optional[str] = None @@ -76,7 +76,7 @@ class GitStatus(BaseModel): # [/DEF:GitStatus:DataClass] # [DEF:LastTask:DataClass] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: DTO for the most recent background task associated with a dashboard. class LastTask(BaseModel): task_id: Optional[str] = None @@ -88,7 +88,7 @@ class LastTask(BaseModel): # [/DEF:LastTask:DataClass] # [DEF:DashboardItem:DataClass] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: DTO representing a single dashboard with projected metadata. class DashboardItem(BaseModel): id: int @@ -104,7 +104,7 @@ class DashboardItem(BaseModel): # [/DEF:DashboardItem:DataClass] # [DEF:EffectiveProfileFilter:DataClass] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Metadata about applied profile filters for UI context. class EffectiveProfileFilter(BaseModel): applied: bool @@ -117,7 +117,7 @@ class EffectiveProfileFilter(BaseModel): # [/DEF:EffectiveProfileFilter:DataClass] # [DEF:DashboardsResponse:DataClass] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Envelope DTO for paginated dashboards list. class DashboardsResponse(BaseModel): dashboards: List[DashboardItem] @@ -129,7 +129,7 @@ class DashboardsResponse(BaseModel): # [/DEF:DashboardsResponse:DataClass] # [DEF:DashboardChartItem:DataClass] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: DTO for a chart linked to a dashboard. class DashboardChartItem(BaseModel): id: int @@ -141,7 +141,7 @@ class DashboardChartItem(BaseModel): # [/DEF:DashboardChartItem:DataClass] # [DEF:DashboardDatasetItem:DataClass] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: DTO for a dataset associated with a dashboard. class DashboardDatasetItem(BaseModel): id: int @@ -153,7 +153,7 @@ class DashboardDatasetItem(BaseModel): # [/DEF:DashboardDatasetItem:DataClass] # [DEF:DashboardDetailResponse:DataClass] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Detailed dashboard metadata including children. class DashboardDetailResponse(BaseModel): id: int @@ -170,7 +170,7 @@ class DashboardDetailResponse(BaseModel): # [/DEF:DashboardDetailResponse:DataClass] # [DEF:DashboardTaskHistoryItem:DataClass] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Individual history record entry. class DashboardTaskHistoryItem(BaseModel): id: str @@ -184,7 +184,7 @@ class DashboardTaskHistoryItem(BaseModel): # [/DEF:DashboardTaskHistoryItem:DataClass] # [DEF:DashboardTaskHistoryResponse:DataClass] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Collection DTO for task history. class DashboardTaskHistoryResponse(BaseModel): dashboard_id: int @@ -192,7 +192,7 @@ class DashboardTaskHistoryResponse(BaseModel): # [/DEF:DashboardTaskHistoryResponse:DataClass] # [DEF:DatabaseMapping:DataClass] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: DTO for cross-environment database ID mapping. class DatabaseMapping(BaseModel): source_db: str @@ -203,7 +203,7 @@ class DatabaseMapping(BaseModel): # [/DEF:DatabaseMapping:DataClass] # [DEF:DatabaseMappingsResponse:DataClass] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Wrapper for database mappings. class DatabaseMappingsResponse(BaseModel): mappings: List[DatabaseMapping] @@ -211,7 +211,7 @@ class DatabaseMappingsResponse(BaseModel): # [DEF:_find_dashboard_id_by_slug:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Resolve dashboard numeric ID by slug using Superset list endpoint. # @PRE: `dashboard_slug` is non-empty. # @POST: Returns dashboard ID when found, otherwise None. @@ -239,7 +239,7 @@ def _find_dashboard_id_by_slug( # [DEF:_resolve_dashboard_id_from_ref:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Resolve dashboard ID from slug-first reference with numeric fallback. # @PRE: `dashboard_ref` is provided in route path. # @POST: Returns a valid dashboard ID or raises HTTPException(404). @@ -264,7 +264,7 @@ def _resolve_dashboard_id_from_ref( # [DEF:_find_dashboard_id_by_slug_async:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Resolve dashboard numeric ID by slug using async Superset list endpoint. # @PRE: dashboard_slug is non-empty. # @POST: Returns dashboard ID when found, otherwise None. @@ -292,7 +292,7 @@ async def _find_dashboard_id_by_slug_async( # [DEF:_resolve_dashboard_id_from_ref_async:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Resolve dashboard ID from slug-first reference using async Superset client. # @PRE: dashboard_ref is provided in route path. # @POST: Returns valid dashboard ID or raises HTTPException(404). @@ -316,7 +316,7 @@ async def _resolve_dashboard_id_from_ref_async( # [DEF:_normalize_filter_values:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Normalize query filter values to lower-cased non-empty tokens. # @PRE: values may be None or list of strings. # @POST: Returns trimmed normalized list preserving input order. @@ -333,7 +333,7 @@ def _normalize_filter_values(values: Optional[List[str]]) -> List[str]: # [DEF:_dashboard_git_filter_value:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Build comparable git status token for dashboards filtering. # @PRE: dashboard payload may contain git_status or None. # @POST: Returns one of ok|diff|no_repo|error|pending. @@ -353,7 +353,7 @@ def _dashboard_git_filter_value(dashboard: Dict[str, Any]) -> str: # [/DEF:_dashboard_git_filter_value:Function] # [DEF:_normalize_actor_alias_token:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Normalize actor alias token to comparable trim+lower text. # @PRE: value can be scalar/None. # @POST: Returns normalized token or None. @@ -364,7 +364,7 @@ def _normalize_actor_alias_token(value: Any) -> Optional[str]: # [DEF:_normalize_owner_display_token:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Project owner payload value into stable display string for API response contracts. # @PRE: owner can be scalar, dict or None. # @POST: Returns trimmed non-empty owner display token or None. @@ -391,7 +391,7 @@ def _normalize_owner_display_token(owner: Any) -> Optional[str]: # [DEF:_normalize_dashboard_owner_values:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Normalize dashboard owners payload to optional list of display strings. # @PRE: owners payload can be None, scalar, or list with mixed values. # @POST: Returns deduplicated owner labels preserving order, or None when absent. @@ -416,7 +416,7 @@ def _normalize_dashboard_owner_values(owners: Any) -> Optional[List[str]]: # [DEF:_project_dashboard_response_items:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Project dashboard payloads to response-contract-safe shape. # @PRE: dashboards is a list of dict-like dashboard payloads. # @POST: Returned items satisfy DashboardItem owners=list[str]|None contract. @@ -433,7 +433,7 @@ def _project_dashboard_response_items(dashboards: List[Dict[str, Any]]) -> List[ # [DEF:_resolve_profile_actor_aliases:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Resolve stable actor aliases for profile filtering without per-dashboard detail fan-out. # @PRE: bound username is available and env is valid. # @POST: Returns at least normalized username; may include Superset display-name alias. @@ -498,7 +498,7 @@ def _resolve_profile_actor_aliases(env: Any, bound_username: str) -> List[str]: # [DEF:_matches_dashboard_actor_aliases:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Apply profile actor matching against multiple aliases (username + optional display name). # @PRE: actor_aliases contains normalized non-empty tokens. # @POST: Returns True when any alias matches owners OR modified_by. @@ -520,7 +520,7 @@ def _matches_dashboard_actor_aliases( # [DEF:get_dashboards:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Fetch list of dashboards from a specific environment with Git status and last task status # @PRE: env_id must be a valid environment ID # @PRE: page must be >= 1 if provided @@ -823,7 +823,7 @@ async def get_dashboards( # [/DEF:get_dashboards:Function] # [DEF:get_database_mappings:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Get database mapping suggestions between source and target environments # @PRE: User has permission plugin:migration:read # @PRE: source_env_id and target_env_id are valid environment IDs @@ -879,7 +879,7 @@ async def get_database_mappings( # [/DEF:get_database_mappings:Function] # [DEF:get_dashboard_detail:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Fetch detailed dashboard info with related charts and datasets # @PRE: env_id must be valid and dashboard ref (slug or id) must exist # @POST: Returns dashboard detail payload for overview page @@ -917,7 +917,7 @@ async def get_dashboard_detail( # [DEF:_task_matches_dashboard:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Checks whether task params are tied to a specific dashboard and environment. # @PRE: task-like object exposes plugin_id and params fields. # @POST: Returns True only for supported task plugins tied to dashboard_id (+optional env_id). @@ -951,7 +951,7 @@ def _task_matches_dashboard(task: Any, dashboard_id: int, env_id: Optional[str]) # [DEF:get_dashboard_tasks_history:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Returns history of backup and LLM validation tasks for a dashboard. # @PRE: dashboard ref (slug or id) is valid. # @POST: Response contains sorted task history (newest first). @@ -1038,7 +1038,7 @@ async def get_dashboard_tasks_history( # [DEF:get_dashboard_thumbnail:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Proxies Superset dashboard thumbnail with cache support. # @PRE: env_id must exist. # @POST: Returns image bytes or 202 when thumbnail is being prepared by Superset. @@ -1132,7 +1132,7 @@ async def get_dashboard_thumbnail( # [/DEF:get_dashboard_thumbnail:Function] # [DEF:MigrateRequest:DataClass] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: DTO for dashboard migration requests. class MigrateRequest(BaseModel): source_env_id: str = Field(..., description="Source environment ID") @@ -1143,14 +1143,14 @@ class MigrateRequest(BaseModel): # [/DEF:MigrateRequest:DataClass] # [DEF:TaskResponse:DataClass] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: DTO for async task ID return. class TaskResponse(BaseModel): task_id: str # [/DEF:TaskResponse:DataClass] # [DEF:migrate_dashboards:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Trigger bulk migration of dashboards from source to target environment # @PRE: User has permission plugin:migration:execute # @PRE: source_env_id and target_env_id are valid environment IDs @@ -1211,7 +1211,7 @@ async def migrate_dashboards( # [/DEF:migrate_dashboards:Function] # [DEF:BackupRequest:DataClass] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: DTO for dashboard backup requests. class BackupRequest(BaseModel): env_id: str = Field(..., description="Environment ID") @@ -1220,7 +1220,7 @@ class BackupRequest(BaseModel): # [/DEF:BackupRequest:DataClass] # [DEF:backup_dashboards:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Trigger bulk backup of dashboards with optional cron schedule # @PRE: User has permission plugin:backup:execute # @PRE: env_id is a valid environment ID diff --git a/backend/src/api/routes/datasets.py b/backend/src/api/routes/datasets.py index 31c82804..99b42e60 100644 --- a/backend/src/api/routes/datasets.py +++ b/backend/src/api/routes/datasets.py @@ -1,6 +1,6 @@ # [DEF:backend.src.api.routes.datasets:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: api, datasets, resources, hub # @PURPOSE: API endpoints for the Dataset Hub - listing datasets with mapping progress # @LAYER: API @@ -22,7 +22,7 @@ from ...core.superset_client import SupersetClient router = APIRouter(prefix="/api/datasets", tags=["Datasets"]) # [DEF:MappedFields:DataClass] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: DTO for dataset mapping progress statistics class MappedFields(BaseModel): total: int @@ -30,7 +30,7 @@ class MappedFields(BaseModel): # [/DEF:MappedFields:DataClass] # [DEF:LastTask:DataClass] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: DTO for the most recent task associated with a dataset class LastTask(BaseModel): task_id: Optional[str] = None @@ -38,7 +38,7 @@ class LastTask(BaseModel): # [/DEF:LastTask:DataClass] # [DEF:DatasetItem:DataClass] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Summary DTO for a dataset in the hub listing class DatasetItem(BaseModel): id: int @@ -53,7 +53,7 @@ class DatasetItem(BaseModel): # [/DEF:DatasetItem:DataClass] # [DEF:LinkedDashboard:DataClass] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: DTO for a dashboard linked to a dataset class LinkedDashboard(BaseModel): id: int @@ -62,7 +62,7 @@ class LinkedDashboard(BaseModel): # [/DEF:LinkedDashboard:DataClass] # [DEF:DatasetColumn:DataClass] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: DTO for a single dataset column's metadata class DatasetColumn(BaseModel): id: int @@ -74,7 +74,7 @@ class DatasetColumn(BaseModel): # [/DEF:DatasetColumn:DataClass] # [DEF:DatasetDetailResponse:DataClass] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Detailed DTO for a dataset including columns and links class DatasetDetailResponse(BaseModel): id: int @@ -96,7 +96,7 @@ class DatasetDetailResponse(BaseModel): # [/DEF:DatasetDetailResponse:DataClass] # [DEF:DatasetsResponse:DataClass] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Paginated response DTO for dataset listings class DatasetsResponse(BaseModel): datasets: List[DatasetItem] @@ -107,14 +107,14 @@ class DatasetsResponse(BaseModel): # [/DEF:DatasetsResponse:DataClass] # [DEF:TaskResponse:DataClass] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Response DTO containing a task ID for tracking class TaskResponse(BaseModel): task_id: str # [/DEF:TaskResponse:DataClass] # [DEF:get_dataset_ids:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Fetch list of all dataset IDs from a specific environment (without pagination) # @PRE: env_id must be a valid environment ID # @POST: Returns a list of all dataset IDs @@ -166,7 +166,7 @@ async def get_dataset_ids( # [/DEF:get_dataset_ids:Function] # [DEF:get_datasets:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Fetch list of datasets from a specific environment with mapping progress # @PRE: env_id must be a valid environment ID # @PRE: page must be >= 1 if provided @@ -246,7 +246,7 @@ async def get_datasets( # [/DEF:get_datasets:Function] # [DEF:MapColumnsRequest:DataClass] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Request DTO for initiating column mapping class MapColumnsRequest(BaseModel): env_id: str = Field(..., description="Environment ID") @@ -257,7 +257,7 @@ class MapColumnsRequest(BaseModel): # [/DEF:MapColumnsRequest:DataClass] # [DEF:map_columns:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Trigger bulk column mapping for datasets # @PRE: User has permission plugin:mapper:execute # @PRE: env_id is a valid environment ID @@ -319,7 +319,7 @@ async def map_columns( # [/DEF:map_columns:Function] # [DEF:GenerateDocsRequest:DataClass] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Request DTO for initiating documentation generation class GenerateDocsRequest(BaseModel): env_id: str = Field(..., description="Environment ID") @@ -329,7 +329,7 @@ class GenerateDocsRequest(BaseModel): # [/DEF:GenerateDocsRequest:DataClass] # [DEF:generate_docs:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Trigger bulk documentation generation for datasets # @PRE: User has permission plugin:llm_analysis:execute # @PRE: env_id is a valid environment ID @@ -385,7 +385,7 @@ async def generate_docs( # [/DEF:generate_docs:Function] # [DEF:get_dataset_detail:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Get detailed dataset information including columns and linked dashboards # @PRE: env_id is a valid environment ID # @PRE: dataset_id is a valid dataset ID diff --git a/backend/src/api/routes/environments.py b/backend/src/api/routes/environments.py index 349a779a..fa45eec7 100644 --- a/backend/src/api/routes/environments.py +++ b/backend/src/api/routes/environments.py @@ -1,6 +1,6 @@ # [DEF:backend.src.api.routes.environments:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: api, environments, superset, databases # @PURPOSE: API endpoints for listing environments and their databases. # @LAYER: API diff --git a/backend/src/api/routes/git.py b/backend/src/api/routes/git.py index 3962bd5e..81fa673c 100644 --- a/backend/src/api/routes/git.py +++ b/backend/src/api/routes/git.py @@ -1,6 +1,6 @@ # [DEF:backend.src.api.routes.git:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: git, routes, api, fastapi, repository, deployment # @PURPOSE: Provides FastAPI endpoints for Git integration operations. # @LAYER: API @@ -48,7 +48,7 @@ MAX_REPOSITORY_STATUS_BATCH = 50 # [DEF:_build_no_repo_status_payload:Function] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Build a consistent status payload for dashboards without initialized repositories. # @PRE: None. # @POST: Returns a stable payload compatible with frontend repository status parsing. @@ -73,7 +73,7 @@ def _build_no_repo_status_payload() -> dict: # [DEF:_handle_unexpected_git_route_error:Function] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: 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. @@ -86,7 +86,7 @@ def _handle_unexpected_git_route_error(route_name: str, error: Exception) -> Non # [DEF:_resolve_repository_status:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: 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. @@ -113,7 +113,7 @@ def _resolve_repository_status(dashboard_id: int) -> dict: # [DEF:_get_git_config_or_404:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Resolve GitServerConfig by id or raise 404. # @PRE: db session is available. # @POST: Returns GitServerConfig model. @@ -126,7 +126,7 @@ def _get_git_config_or_404(db: Session, config_id: str) -> GitServerConfig: # [DEF:_find_dashboard_id_by_slug:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Resolve dashboard numeric ID by slug in a specific environment. # @PRE: dashboard_slug is non-empty. # @POST: Returns dashboard ID or None when not found. @@ -153,7 +153,7 @@ def _find_dashboard_id_by_slug( # [DEF:_resolve_dashboard_id_from_ref:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Resolve dashboard ID from slug-or-id reference for Git routes. # @PRE: dashboard_ref is provided; env_id is required for slug values. # @POST: Returns numeric dashboard ID or raises HTTPException. @@ -188,7 +188,7 @@ def _resolve_dashboard_id_from_ref( # [DEF:_find_dashboard_id_by_slug_async:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Resolve dashboard numeric ID by slug asynchronously for hot-path Git routes. # @PRE: dashboard_slug is non-empty. # @POST: Returns dashboard ID or None when not found. @@ -215,7 +215,7 @@ async def _find_dashboard_id_by_slug_async( # [DEF:_resolve_dashboard_id_from_ref_async:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Resolve dashboard ID asynchronously from slug-or-id reference for hot Git routes. # @PRE: dashboard_ref is provided; env_id is required for slug values. # @POST: Returns numeric dashboard ID or raises HTTPException. @@ -254,7 +254,7 @@ async def _resolve_dashboard_id_from_ref_async( # [DEF:_resolve_repo_key_from_ref:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Resolve repository folder key with slug-first strategy and deterministic fallback. # @PRE: dashboard_id is resolved and valid. # @POST: Returns safe key to be used in local repository path. @@ -287,7 +287,7 @@ def _resolve_repo_key_from_ref( # [DEF:_sanitize_optional_identity_value:Function] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Normalize optional identity value into trimmed string or None. # @PRE: value may be None or blank. # @POST: Returns sanitized value suitable for git identity configuration. @@ -301,7 +301,7 @@ def _sanitize_optional_identity_value(value: Optional[str]) -> Optional[str]: # [DEF:_resolve_current_user_git_identity:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Resolve configured Git username/email from current user's profile preferences. # @PRE: `db` may be stubbed in tests; `current_user` may be absent for direct handler invocations. # @POST: Returns tuple(username, email) only when both values are configured. @@ -343,7 +343,7 @@ def _resolve_current_user_git_identity( # [DEF:_apply_git_identity_from_profile:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Apply user-scoped Git identity to repository-local config before write/pull operations. # @PRE: dashboard_id is resolved; db/current_user may be missing in direct test invocation context. # @POST: git_service.configure_identity is called only when identity and method are available. @@ -367,7 +367,7 @@ def _apply_git_identity_from_profile( # [DEF:get_git_configs:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: List all configured Git servers. # @PRE: Database session `db` is available. # @POST: Returns a list of all GitServerConfig objects from the database. @@ -388,7 +388,7 @@ async def get_git_configs( # [/DEF:get_git_configs:Function] # [DEF:create_git_config:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Register a new Git server configuration. # @PRE: `config` contains valid GitServerConfigCreate data. # @POST: A new GitServerConfig record is created in the database. @@ -410,7 +410,7 @@ async def create_git_config( # [/DEF:create_git_config:Function] # [DEF:update_git_config:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Update an existing Git server configuration. # @PRE: `config_id` corresponds to an existing configuration. # @POST: The configuration record is updated in the database. @@ -445,7 +445,7 @@ async def update_git_config( # [/DEF:update_git_config:Function] # [DEF:delete_git_config:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Remove a Git server configuration. # @PRE: `config_id` corresponds to an existing configuration. # @POST: The configuration record is removed from the database. @@ -467,7 +467,7 @@ async def delete_git_config( # [/DEF:delete_git_config:Function] # [DEF:test_git_config:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Validate connection to a Git server using provided credentials. # @PRE: `config` contains provider, url, and pat. # @POST: Returns success if the connection is validated via GitService. @@ -499,7 +499,7 @@ async def test_git_config( # [DEF:list_gitea_repositories:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: List repositories in Gitea for a saved Gitea config. # @PRE: config_id exists and provider is GITEA. # @POST: Returns repositories visible to PAT user. @@ -530,7 +530,7 @@ async def list_gitea_repositories( # [DEF:create_gitea_repository:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Create a repository in Gitea for a saved Gitea config. # @PRE: config_id exists and provider is GITEA. # @POST: Returns created repository payload. @@ -567,7 +567,7 @@ async def create_gitea_repository( # [DEF:create_remote_repository:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Create repository on remote Git server using selected provider config. # @PRE: config_id exists and PAT has creation permissions. # @POST: Returns normalized remote repository payload. @@ -628,7 +628,7 @@ async def create_remote_repository( # [DEF:delete_gitea_repository:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Delete repository in Gitea for a saved Gitea config. # @PRE: config_id exists and provider is GITEA. # @POST: Target repository is deleted on Gitea. @@ -654,7 +654,7 @@ async def delete_gitea_repository( # [/DEF:delete_gitea_repository:Function] # [DEF:init_repository:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Link a dashboard to a Git repository and perform initial clone/init. # @PRE: `dashboard_ref` exists and `init_data` contains valid config_id and remote_url. # @POST: Repository is initialized on disk and a GitRepository record is saved in DB. @@ -712,7 +712,7 @@ async def init_repository( # [/DEF:init_repository:Function] # [DEF:get_repository_binding:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Return repository binding with provider metadata for selected dashboard. # @PRE: `dashboard_ref` resolves to a valid dashboard and repository is initialized. # @POST: Returns dashboard repository binding and linked provider. @@ -747,7 +747,7 @@ async def get_repository_binding( # [/DEF:get_repository_binding:Function] # [DEF:delete_repository:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Delete local repository workspace and DB binding for selected dashboard. # @PRE: `dashboard_ref` resolves to a valid dashboard. # @POST: Repository files and binding record are removed when present. @@ -772,7 +772,7 @@ async def delete_repository( # [/DEF:delete_repository:Function] # [DEF:get_branches:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: List all branches for a dashboard's repository. # @PRE: Repository for `dashboard_ref` is initialized. # @POST: Returns a list of branches from the local repository. @@ -796,7 +796,7 @@ async def get_branches( # [/DEF:get_branches:Function] # [DEF:create_branch:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Create a new branch in the dashboard's repository. # @PRE: `dashboard_ref` repository exists and `branch_data` has name and from_branch. # @POST: A new branch is created in the local repository. @@ -825,7 +825,7 @@ async def create_branch( # [/DEF:create_branch:Function] # [DEF:checkout_branch:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Switch the dashboard's repository to a specific branch. # @PRE: `dashboard_ref` repository exists and branch `checkout_data.name` exists. # @POST: The local repository HEAD is moved to the specified branch. @@ -851,7 +851,7 @@ async def checkout_branch( # [/DEF:checkout_branch:Function] # [DEF:commit_changes:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Stage and commit changes in the dashboard's repository. # @PRE: `dashboard_ref` repository exists and `commit_data` has message and files. # @POST: Specified files are staged and a new commit is created. @@ -880,7 +880,7 @@ async def commit_changes( # [/DEF:commit_changes:Function] # [DEF:push_changes:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Push local commits to the remote repository. # @PRE: `dashboard_ref` repository exists and has a remote configured. # @POST: Local commits are pushed to the remote repository. @@ -904,7 +904,7 @@ async def push_changes( # [/DEF:push_changes:Function] # [DEF:pull_changes:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Pull changes from the remote repository. # @PRE: `dashboard_ref` repository exists and has a remote configured. # @POST: Remote changes are fetched and merged into the local branch. @@ -952,7 +952,7 @@ async def pull_changes( # [/DEF:pull_changes:Function] # [DEF:get_merge_status:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Return unfinished-merge status for repository (web-only recovery support). # @PRE: `dashboard_ref` resolves to a valid dashboard repository. # @POST: Returns merge status payload. @@ -975,7 +975,7 @@ async def get_merge_status( # [DEF:get_merge_conflicts:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Return conflicted files with mine/theirs previews for web conflict resolver. # @PRE: `dashboard_ref` resolves to a valid dashboard repository. # @POST: Returns conflict file list. @@ -998,7 +998,7 @@ async def get_merge_conflicts( # [DEF:resolve_merge_conflicts:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Apply mine/theirs/manual conflict resolutions from WebUI and stage files. # @PRE: `dashboard_ref` resolves; request contains at least one resolution item. # @POST: Resolved files are staged in index. @@ -1026,7 +1026,7 @@ async def resolve_merge_conflicts( # [DEF:abort_merge:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Abort unfinished merge from WebUI flow. # @PRE: `dashboard_ref` resolves to repository. # @POST: Merge operation is aborted or reports no active merge. @@ -1049,7 +1049,7 @@ async def abort_merge( # [DEF:continue_merge:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Finalize unfinished merge from WebUI flow. # @PRE: All conflicts are resolved and staged. # @POST: Merge commit is created. @@ -1073,7 +1073,7 @@ async def continue_merge( # [DEF:sync_dashboard:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Sync dashboard state from Superset to Git using the GitPlugin. # @PRE: `dashboard_ref` is valid; GitPlugin is available. # @POST: Dashboard YAMLs are exported from Superset and committed to Git. @@ -1105,7 +1105,7 @@ async def sync_dashboard( # [DEF:promote_dashboard:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Promote changes between branches via MR or direct merge. # @PRE: dashboard repository is initialized and Git config is valid. # @POST: Returns promotion result metadata. @@ -1208,7 +1208,7 @@ async def promote_dashboard( # [/DEF:promote_dashboard:Function] # [DEF:get_environments:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: List all deployment environments. # @PRE: Config manager is accessible. # @POST: Returns a list of DeploymentEnvironmentSchema objects. @@ -1231,7 +1231,7 @@ async def get_environments( # [/DEF:get_environments:Function] # [DEF:deploy_dashboard:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Deploy dashboard from Git to a target environment. # @PRE: `dashboard_ref` and `deploy_data.environment_id` are valid. # @POST: Dashboard YAMLs are read from Git and imported into the target Superset. @@ -1262,7 +1262,7 @@ async def deploy_dashboard( # [/DEF:deploy_dashboard:Function] # [DEF:get_history:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: View commit history for a dashboard's repository. # @PRE: `dashboard_ref` repository exists. # @POST: Returns a list of recent commits from the repository. @@ -1288,7 +1288,7 @@ async def get_history( # [/DEF:get_history:Function] # [DEF:get_repository_status:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Get current Git status for a dashboard repository. # @PRE: `dashboard_ref` resolves to a valid dashboard. # @POST: Returns repository status; if repo is not initialized, returns `NO_REPO` payload. @@ -1313,7 +1313,7 @@ async def get_repository_status( # [DEF:get_repository_status_batch:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Get Git statuses for multiple dashboard repositories in one request. # @PRE: `request.dashboard_ids` is provided. # @POST: Returns `statuses` map where each key is dashboard ID and value is repository status payload. @@ -1357,7 +1357,7 @@ async def get_repository_status_batch( # [/DEF:get_repository_status_batch:Function] # [DEF:get_repository_diff:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Get Git diff for a dashboard repository. # @PRE: `dashboard_ref` repository exists. # @POST: Returns the diff text for the specified file or all changes. @@ -1386,7 +1386,7 @@ async def get_repository_diff( # [/DEF:get_repository_diff:Function] # [DEF:generate_commit_message:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Generate a suggested commit message using LLM. # @PRE: Repository for `dashboard_ref` is initialized. # @POST: Returns a suggested commit message string. diff --git a/backend/src/api/routes/git_schemas.py b/backend/src/api/routes/git_schemas.py index 042f0197..3026d8f0 100644 --- a/backend/src/api/routes/git_schemas.py +++ b/backend/src/api/routes/git_schemas.py @@ -1,6 +1,6 @@ # [DEF:backend.src.api.routes.git_schemas:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: git, schemas, pydantic, api, contracts # @PURPOSE: Defines Pydantic models for the Git integration API layer. # @LAYER: API @@ -14,7 +14,7 @@ from datetime import datetime from src.models.git import GitProvider, GitStatus, SyncStatus # [DEF:GitServerConfigBase:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Base schema for Git server configuration attributes. class GitServerConfigBase(BaseModel): name: str = Field(..., description="Display name for the Git server") diff --git a/backend/src/api/routes/health.py b/backend/src/api/routes/health.py index 086e0bcb..2890f367 100644 --- a/backend/src/api/routes/health.py +++ b/backend/src/api/routes/health.py @@ -1,5 +1,5 @@ # [DEF:health_router:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: health, monitoring, dashboards # @PURPOSE: API endpoints for dashboard health monitoring and status aggregation. # @LAYER: UI/API diff --git a/backend/src/api/routes/llm.py b/backend/src/api/routes/llm.py index cb70a8cc..8a92a978 100644 --- a/backend/src/api/routes/llm.py +++ b/backend/src/api/routes/llm.py @@ -1,5 +1,5 @@ # [DEF:backend/src/api/routes/llm.py:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: api, routes, llm # @PURPOSE: API routes for LLM provider configuration and management. # @LAYER: UI (API) diff --git a/backend/src/api/routes/mappings.py b/backend/src/api/routes/mappings.py index 5c1b985c..81f9851d 100644 --- a/backend/src/api/routes/mappings.py +++ b/backend/src/api/routes/mappings.py @@ -1,6 +1,6 @@ # [DEF:backend.src.api.routes.mappings:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: api, mappings, database, fuzzy-matching # @PURPOSE: API endpoints for managing database mappings and getting suggestions. # @LAYER: API diff --git a/backend/src/api/routes/migration.py b/backend/src/api/routes/migration.py index 124082bc..d9febca6 100644 --- a/backend/src/api/routes/migration.py +++ b/backend/src/api/routes/migration.py @@ -1,5 +1,5 @@ # [DEF:backend.src.api.routes.migration:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: api, migration, dashboards, sync, dry-run # @PURPOSE: HTTP contract layer for migration orchestration, settings, dry-run, and mapping sync endpoints. # @LAYER: Infra @@ -38,7 +38,7 @@ from ...models.mapping import ResourceMapping router = APIRouter(prefix="/api", tags=["migration"]) # [DEF:get_dashboards:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Fetch dashboard metadata from a requested environment for migration selection UI. # @PRE: env_id is provided and exists in configured environments. # @POST: Returns List[DashboardMetadata] for the resolved environment; emits HTTP_404 when environment is absent. @@ -66,7 +66,7 @@ async def get_dashboards( # [/DEF:get_dashboards:Function] # [DEF:execute_migration:Function] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @PURPOSE: Validate migration selection and enqueue asynchronous migration task execution. # @PRE: DashboardSelection payload is valid and both source/target environments exist. # @POST: Returns {"task_id": str, "message": str} when task creation succeeds; emits HTTP_400/HTTP_500 on failure. @@ -108,7 +108,7 @@ async def execute_migration( # [DEF:dry_run_migration:Function] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @PURPOSE: Build pre-flight migration diff and risk summary without mutating target systems. # @PRE: DashboardSelection is valid, source and target environments exist, differ, and selected_ids is non-empty. # @POST: Returns deterministic dry-run payload; emits HTTP_400 for guard violations and HTTP_500 for orchestrator value errors. @@ -160,7 +160,7 @@ async def dry_run_migration( # [/DEF:dry_run_migration:Function] # [DEF:get_migration_settings:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Read and return configured migration synchronization cron expression. # @PRE: Configuration store is available and requester has READ permission. # @POST: Returns {"cron": str} reflecting current persisted settings value. @@ -178,7 +178,7 @@ async def get_migration_settings( # [/DEF:get_migration_settings:Function] # [DEF:update_migration_settings:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Validate and persist migration synchronization cron expression update. # @PRE: Payload includes "cron" key and requester has WRITE permission. # @POST: Returns {"cron": str, "status": "updated"} and persists updated cron value. @@ -204,7 +204,7 @@ async def update_migration_settings( # [/DEF:update_migration_settings:Function] # [DEF:get_resource_mappings:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Fetch synchronized resource mappings with optional filters and pagination for migration mappings view. # @PRE: skip>=0, 1<=limit<=500, DB session is active, requester has READ permission. # @POST: Returns {"items": [...], "total": int} where items reflect applied filters and pagination. @@ -255,7 +255,7 @@ async def get_resource_mappings( # [/DEF:get_resource_mappings:Function] # [DEF:trigger_sync_now:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Trigger immediate ID synchronization for every configured environment. # @PRE: At least one environment is configured and requester has EXECUTE permission. # @POST: Returns sync summary with synced/failed counts after attempting all environments. diff --git a/backend/src/api/routes/plugins.py b/backend/src/api/routes/plugins.py index a78197fb..45639c45 100755 --- a/backend/src/api/routes/plugins.py +++ b/backend/src/api/routes/plugins.py @@ -1,32 +1,32 @@ -# [DEF:PluginsRouter:Module] -# @TIER: STANDARD -# @SEMANTICS: api, router, plugins, list -# @PURPOSE: Defines the FastAPI router for plugin-related endpoints, allowing clients to list available plugins. -# @LAYER: UI (API) -# @RELATION: Depends on the PluginLoader and PluginConfig. It is included by the main app. -from typing import List -from fastapi import APIRouter, Depends - -from ...core.plugin_base import PluginConfig -from ...dependencies import get_plugin_loader, has_permission -from ...core.logger import belief_scope - -router = APIRouter() - -# [DEF:list_plugins:Function] -# @PURPOSE: Retrieve a list of all available plugins. -# @PRE: plugin_loader is injected via Depends. -# @POST: Returns a list of PluginConfig objects. -# @RETURN: List[PluginConfig] - List of registered plugins. -@router.get("", response_model=List[PluginConfig]) -async def list_plugins( - plugin_loader = Depends(get_plugin_loader), - _ = Depends(has_permission("plugins", "READ")) -): - with belief_scope("list_plugins"): - """ - Retrieve a list of all available plugins. - """ - return plugin_loader.get_all_plugin_configs() -# [/DEF:list_plugins:Function] +# [DEF:PluginsRouter:Module] +# @COMPLEXITY: 3 +# @SEMANTICS: api, router, plugins, list +# @PURPOSE: Defines the FastAPI router for plugin-related endpoints, allowing clients to list available plugins. +# @LAYER: UI (API) +# @RELATION: Depends on the PluginLoader and PluginConfig. It is included by the main app. +from typing import List +from fastapi import APIRouter, Depends + +from ...core.plugin_base import PluginConfig +from ...dependencies import get_plugin_loader, has_permission +from ...core.logger import belief_scope + +router = APIRouter() + +# [DEF:list_plugins:Function] +# @PURPOSE: Retrieve a list of all available plugins. +# @PRE: plugin_loader is injected via Depends. +# @POST: Returns a list of PluginConfig objects. +# @RETURN: List[PluginConfig] - List of registered plugins. +@router.get("", response_model=List[PluginConfig]) +async def list_plugins( + plugin_loader = Depends(get_plugin_loader), + _ = Depends(has_permission("plugins", "READ")) +): + with belief_scope("list_plugins"): + """ + Retrieve a list of all available plugins. + """ + return plugin_loader.get_all_plugin_configs() +# [/DEF:list_plugins:Function] # [/DEF:PluginsRouter:Module] \ No newline at end of file diff --git a/backend/src/api/routes/profile.py b/backend/src/api/routes/profile.py index 825c45a9..bb0f9339 100644 --- a/backend/src/api/routes/profile.py +++ b/backend/src/api/routes/profile.py @@ -1,6 +1,6 @@ # [DEF:backend.src.api.routes.profile:Module] # -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: api, profile, preferences, self-service, account-lookup # @PURPOSE: Exposes self-scoped profile preference endpoints and environment-based Superset account lookup. # @LAYER: API diff --git a/backend/src/api/routes/reports.py b/backend/src/api/routes/reports.py index d3c174b8..87a0cdea 100644 --- a/backend/src/api/routes/reports.py +++ b/backend/src/api/routes/reports.py @@ -1,5 +1,5 @@ # [DEF:ReportsRouter:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: api, reports, list, detail, pagination, filters # @PURPOSE: FastAPI router for unified task report list and detail retrieval endpoints. # @LAYER: UI (API) @@ -29,7 +29,7 @@ router = APIRouter(prefix="/api/reports", tags=["Reports"]) # [DEF:_parse_csv_enum_list:Function] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Parse comma-separated query value into enum list. # @PRE: raw may be None/empty or comma-separated values. # @POST: Returns enum list or raises HTTP 400 with deterministic machine-readable payload. @@ -64,7 +64,7 @@ def _parse_csv_enum_list(raw: Optional[str], enum_cls, field_name: str) -> List: # [DEF:list_reports:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Return paginated unified reports list. # @PRE: authenticated/authorized request and validated query params. # @POST: returns {items,total,page,page_size,has_next,applied_filters}. @@ -131,7 +131,7 @@ async def list_reports( # [DEF:get_report_detail:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Return one normalized report detail with diagnostics and next actions. # @PRE: authenticated/authorized request and existing report_id. # @POST: returns normalized detail envelope or 404 when report is not found. diff --git a/backend/src/api/routes/settings.py b/backend/src/api/routes/settings.py index 6572f583..2ea668f8 100755 --- a/backend/src/api/routes/settings.py +++ b/backend/src/api/routes/settings.py @@ -1,6 +1,6 @@ # [DEF:SettingsRouter:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: settings, api, router, fastapi # @PURPOSE: Provides API endpoints for managing application settings and Superset environments. # @LAYER: UI (API) @@ -29,7 +29,7 @@ from sqlalchemy.orm import Session # [/SECTION] # [DEF:LoggingConfigResponse:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Response model for logging configuration with current task log level. # @SEMANTICS: logging, config, response class LoggingConfigResponse(BaseModel): @@ -42,7 +42,7 @@ router = APIRouter() # [DEF:_normalize_superset_env_url:Function] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Canonicalize Superset environment URL to base host/path without trailing /api/v1. # @PRE: raw_url can be empty. # @POST: Returns normalized base URL. @@ -55,7 +55,7 @@ def _normalize_superset_env_url(raw_url: str) -> str: # [DEF:_validate_superset_connection_fast:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Run lightweight Superset connectivity validation without full pagination scan. # @PRE: env contains valid URL and credentials. # @POST: Raises on auth/API failures; returns None on success. @@ -74,7 +74,7 @@ def _validate_superset_connection_fast(env: Environment) -> None: # [/DEF:_validate_superset_connection_fast:Function] # [DEF:get_settings:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Retrieves all application settings. # @PRE: Config manager is available. # @POST: Returns masked AppConfig. @@ -96,7 +96,7 @@ async def get_settings( # [/DEF:get_settings:Function] # [DEF:update_global_settings:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Updates global application settings. # @PRE: New settings are provided. # @POST: Global settings are updated. @@ -116,7 +116,7 @@ async def update_global_settings( # [/DEF:update_global_settings:Function] # [DEF:get_storage_settings:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Retrieves storage-specific settings. # @RETURN: StorageConfig - The storage configuration. @router.get("/storage", response_model=StorageConfig) @@ -129,7 +129,7 @@ async def get_storage_settings( # [/DEF:get_storage_settings:Function] # [DEF:update_storage_settings:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Updates storage-specific settings. # @PARAM: storage (StorageConfig) - The new storage settings. # @POST: Storage settings are updated and saved. @@ -152,7 +152,7 @@ async def update_storage_settings( # [/DEF:update_storage_settings:Function] # [DEF:get_environments:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Lists all configured Superset environments. # @PRE: Config manager is available. # @POST: Returns list of environments. @@ -172,7 +172,7 @@ async def get_environments( # [/DEF:get_environments:Function] # [DEF:add_environment:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Adds a new Superset environment. # @PRE: Environment data is valid and reachable. # @POST: Environment is added to config. @@ -200,7 +200,7 @@ async def add_environment( # [/DEF:add_environment:Function] # [DEF:update_environment:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Updates an existing Superset environment. # @PRE: ID and valid environment data are provided. # @POST: Environment is updated in config. @@ -238,7 +238,7 @@ async def update_environment( # [/DEF:update_environment:Function] # [DEF:delete_environment:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Deletes a Superset environment. # @PRE: ID is provided. # @POST: Environment is removed from config. @@ -255,7 +255,7 @@ async def delete_environment( # [/DEF:delete_environment:Function] # [DEF:test_environment_connection:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Tests the connection to a Superset environment. # @PRE: ID is provided. # @POST: Returns success or error status. @@ -285,7 +285,7 @@ async def test_environment_connection( # [/DEF:test_environment_connection:Function] # [DEF:get_logging_config:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Retrieves current logging configuration. # @PRE: Config manager is available. # @POST: Returns logging configuration. @@ -305,7 +305,7 @@ async def get_logging_config( # [/DEF:get_logging_config:Function] # [DEF:update_logging_config:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Updates logging configuration. # @PRE: New logging config is provided. # @POST: Logging configuration is updated and saved. @@ -333,7 +333,7 @@ async def update_logging_config( # [/DEF:update_logging_config:Function] # [DEF:ConsolidatedSettingsResponse:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Response model for consolidated application settings. class ConsolidatedSettingsResponse(BaseModel): environments: List[dict] @@ -346,7 +346,7 @@ class ConsolidatedSettingsResponse(BaseModel): # [/DEF:ConsolidatedSettingsResponse:Class] # [DEF:get_consolidated_settings:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Retrieves all settings categories in a single call # @PRE: Config manager is available. # @POST: Returns all consolidated settings. @@ -400,7 +400,7 @@ async def get_consolidated_settings( # [/DEF:get_consolidated_settings:Function] # [DEF:update_consolidated_settings:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Bulk update application settings from the consolidated view. # @PRE: User has admin permissions, config is valid. # @POST: Settings are updated and saved via ConfigManager. @@ -446,7 +446,7 @@ async def update_consolidated_settings( # [/DEF:update_consolidated_settings:Function] # [DEF:get_validation_policies:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Lists all validation policies. # @RETURN: List[ValidationPolicyResponse] - List of policies. @router.get("/automation/policies", response_model=List[ValidationPolicyResponse]) @@ -459,7 +459,7 @@ async def get_validation_policies( # [/DEF:get_validation_policies:Function] # [DEF:create_validation_policy:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Creates a new validation policy. # @PARAM: policy (ValidationPolicyCreate) - The policy data. # @RETURN: ValidationPolicyResponse - The created policy. @@ -478,7 +478,7 @@ async def create_validation_policy( # [/DEF:create_validation_policy:Function] # [DEF:update_validation_policy:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Updates an existing validation policy. # @PARAM: id (str) - The ID of the policy to update. # @PARAM: policy (ValidationPolicyUpdate) - The updated policy data. @@ -505,7 +505,7 @@ async def update_validation_policy( # [/DEF:update_validation_policy:Function] # [DEF:delete_validation_policy:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Deletes a validation policy. # @PARAM: id (str) - The ID of the policy to delete. @router.delete("/automation/policies/{id}") diff --git a/backend/src/api/routes/storage.py b/backend/src/api/routes/storage.py index 54bbde28..7bab1d82 100644 --- a/backend/src/api/routes/storage.py +++ b/backend/src/api/routes/storage.py @@ -1,6 +1,6 @@ # [DEF:storage_routes:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: storage, files, upload, download, backup, repository # @PURPOSE: API endpoints for file storage management (backups and repositories). # @LAYER: API @@ -22,7 +22,7 @@ from ...core.logger import belief_scope router = APIRouter(tags=["storage"]) # [DEF:list_files:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: List all files and directories in the storage system. # # @PRE: None. @@ -49,7 +49,7 @@ async def list_files( # [/DEF:list_files:Function] # [DEF:upload_file:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Upload a file to the storage system. # # @PRE: category must be a valid FileCategory. @@ -83,7 +83,7 @@ async def upload_file( # [/DEF:upload_file:Function] # [DEF:delete_file:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Delete a specific file or directory. # # @PRE: category must be a valid FileCategory. @@ -116,7 +116,7 @@ async def delete_file( # [/DEF:delete_file:Function] # [DEF:download_file:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Retrieve a file for download. # # @PRE: category must be a valid FileCategory. @@ -149,7 +149,7 @@ async def download_file( # [/DEF:download_file:Function] # [DEF:get_file_by_path:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Retrieve a file by validated absolute/relative path under storage root. # # @PRE: path must resolve under configured storage root. diff --git a/backend/src/api/routes/tasks.py b/backend/src/api/routes/tasks.py index deaf4933..57892ed9 100755 --- a/backend/src/api/routes/tasks.py +++ b/backend/src/api/routes/tasks.py @@ -1,5 +1,5 @@ # [DEF:TasksRouter:Module] -# @TIER: STANDARD +# @COMPLEXITY: 4 # @SEMANTICS: api, router, tasks, create, list, get, logs # @PURPOSE: Defines the FastAPI router for task-related endpoints, allowing clients to create, list, and get the status of tasks. # @LAYER: UI (API) @@ -43,7 +43,7 @@ class ResumeTaskRequest(BaseModel): passwords: Dict[str, str] # [DEF:create_task:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Create and start a new task for a given plugin. # @PARAM: request (CreateTaskRequest) - The request body containing plugin_id and params. # @PARAM: task_manager (TaskManager) - The task manager instance. @@ -107,7 +107,7 @@ async def create_task( # [/DEF:create_task:Function] # [DEF:list_tasks:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Retrieve a list of tasks with pagination and optional status filter. # @PARAM: limit (int) - Maximum number of tasks to return. # @PARAM: offset (int) - Number of tasks to skip. @@ -147,7 +147,7 @@ async def list_tasks( # [/DEF:list_tasks:Function] # [DEF:get_task:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Retrieve the details of a specific task. # @PARAM: task_id (str) - The unique identifier of the task. # @PARAM: task_manager (TaskManager) - The task manager instance. @@ -168,7 +168,7 @@ async def get_task( # [/DEF:get_task:Function] # [DEF:get_task_logs:Function] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @PURPOSE: Retrieve logs for a specific task with optional filtering. # @PARAM: task_id (str) - The unique identifier of the task. # @PARAM: level (Optional[str]) - Filter by log level (DEBUG, INFO, WARNING, ERROR). @@ -214,7 +214,7 @@ async def get_task_logs( # [/DEF:get_task_logs:Function] # [DEF:get_task_log_stats:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Get statistics about logs for a task (counts by level and source). # @PARAM: task_id (str) - The unique identifier of the task. # @PARAM: task_manager (TaskManager) - The task manager instance. @@ -235,7 +235,7 @@ async def get_task_log_stats( # [/DEF:get_task_log_stats:Function] # [DEF:get_task_log_sources:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Get unique sources for a task's logs. # @PARAM: task_id (str) - The unique identifier of the task. # @PARAM: task_manager (TaskManager) - The task manager instance. @@ -256,7 +256,7 @@ async def get_task_log_sources( # [/DEF:get_task_log_sources:Function] # [DEF:resolve_task:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Resolve a task that is awaiting mapping. # @PARAM: task_id (str) - The unique identifier of the task. # @PARAM: request (ResolveTaskRequest) - The resolution parameters. @@ -280,7 +280,7 @@ async def resolve_task( # [/DEF:resolve_task:Function] # [DEF:resume_task:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Resume a task that is awaiting input (e.g., passwords). # @PARAM: task_id (str) - The unique identifier of the task. # @PARAM: request (ResumeTaskRequest) - The input (passwords). @@ -304,7 +304,7 @@ async def resume_task( # [/DEF:resume_task:Function] # [DEF:clear_tasks:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Clear tasks matching the status filter. # @PARAM: status (Optional[TaskStatus]) - Filter by task status. # @PARAM: task_manager (TaskManager) - The task manager instance. diff --git a/backend/src/app.py b/backend/src/app.py index b4587448..91dbc2d1 100755 --- a/backend/src/app.py +++ b/backend/src/app.py @@ -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. diff --git a/backend/src/core/__tests__/test_config_manager_compat.py b/backend/src/core/__tests__/test_config_manager_compat.py index 7d461c30..1dfa8779 100644 --- a/backend/src/core/__tests__/test_config_manager_compat.py +++ b/backend/src/core/__tests__/test_config_manager_compat.py @@ -1,5 +1,5 @@ # [DEF:backend.src.core.__tests__.test_config_manager_compat:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: config-manager, compatibility, payload, tests # @PURPOSE: Verifies ConfigManager compatibility wrappers preserve legacy payload sections. # @LAYER: Domain diff --git a/backend/src/core/__tests__/test_superset_profile_lookup.py b/backend/src/core/__tests__/test_superset_profile_lookup.py index 660af712..fb8f4d6e 100644 --- a/backend/src/core/__tests__/test_superset_profile_lookup.py +++ b/backend/src/core/__tests__/test_superset_profile_lookup.py @@ -1,5 +1,5 @@ # [DEF:backend.src.core.__tests__.test_superset_profile_lookup:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: tests, superset, profile, lookup, fallback, sorting # @PURPOSE: Verifies Superset profile lookup adapter payload normalization and fallback error precedence. # @LAYER: Domain diff --git a/backend/src/core/__tests__/test_throttled_scheduler.py b/backend/src/core/__tests__/test_throttled_scheduler.py index 64c984b8..ff0cf697 100644 --- a/backend/src/core/__tests__/test_throttled_scheduler.py +++ b/backend/src/core/__tests__/test_throttled_scheduler.py @@ -3,7 +3,7 @@ from datetime import time, date, datetime, timedelta from src.core.scheduler import ThrottledSchedulerConfigurator # [DEF:test_throttled_scheduler:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Unit tests for ThrottledSchedulerConfigurator distribution logic. def test_calculate_schedule_even_distribution(): diff --git a/backend/src/core/async_superset_client.py b/backend/src/core/async_superset_client.py index 1c00e08b..e97014fa 100644 --- a/backend/src/core/async_superset_client.py +++ b/backend/src/core/async_superset_client.py @@ -1,6 +1,6 @@ # [DEF:backend.src.core.async_superset_client:Module] # -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: superset, async, client, httpx, dashboards, datasets # @PURPOSE: Async Superset client for dashboard hot-path requests without blocking FastAPI event loop. # @LAYER: Core @@ -26,14 +26,14 @@ from .utils.async_network import AsyncAPIClient # [DEF:backend.src.core.async_superset_client.AsyncSupersetClient:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Async sibling of SupersetClient for dashboard read paths. # @RELATION: [INHERITS] ->[backend.src.core.superset_client.SupersetClient] # @RELATION: [DEPENDS_ON] ->[backend.src.core.utils.async_network.AsyncAPIClient] # @RELATION: [CALLS] ->[backend.src.core.utils.async_network.AsyncAPIClient.request] class AsyncSupersetClient(SupersetClient): # [DEF:backend.src.core.async_superset_client.AsyncSupersetClient.__init__:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Initialize async Superset client with AsyncAPIClient transport. # @PRE: env is valid Environment instance. # @POST: Client uses async network transport and inherited projection helpers. @@ -55,7 +55,7 @@ class AsyncSupersetClient(SupersetClient): # [/DEF:backend.src.core.async_superset_client.AsyncSupersetClient.__init__:Function] # [DEF:backend.src.core.async_superset_client.AsyncSupersetClient.aclose:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Close async transport resources. # @POST: Underlying AsyncAPIClient is closed. # @SIDE_EFFECT: Closes network sockets. @@ -64,7 +64,7 @@ class AsyncSupersetClient(SupersetClient): # [/DEF:backend.src.core.async_superset_client.AsyncSupersetClient.aclose:Function] # [DEF:backend.src.core.async_superset_client.AsyncSupersetClient.get_dashboards_page_async:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Fetch one dashboards page asynchronously. # @POST: Returns total count and page result list. # @DATA_CONTRACT: Input[query: Optional[Dict]] -> Output[Tuple[int, List[Dict]]] @@ -99,7 +99,7 @@ class AsyncSupersetClient(SupersetClient): # [/DEF:get_dashboards_page_async:Function] # [DEF:get_dashboard_async:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Fetch one dashboard payload asynchronously. # @POST: Returns raw dashboard payload from Superset API. # @DATA_CONTRACT: Input[dashboard_id: int] -> Output[Dict] @@ -110,7 +110,7 @@ class AsyncSupersetClient(SupersetClient): # [/DEF:get_dashboard_async:Function] # [DEF:get_chart_async:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Fetch one chart payload asynchronously. # @POST: Returns raw chart payload from Superset API. # @DATA_CONTRACT: Input[chart_id: int] -> Output[Dict] @@ -121,7 +121,7 @@ class AsyncSupersetClient(SupersetClient): # [/DEF:get_chart_async:Function] # [DEF:get_dashboard_detail_async:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Fetch dashboard detail asynchronously with concurrent charts/datasets requests. # @POST: Returns dashboard detail payload for overview page. # @DATA_CONTRACT: Input[dashboard_id: int] -> Output[Dict] diff --git a/backend/src/core/auth/__tests__/test_auth.py b/backend/src/core/auth/__tests__/test_auth.py index f6c51dd7..e9b83b88 100644 --- a/backend/src/core/auth/__tests__/test_auth.py +++ b/backend/src/core/auth/__tests__/test_auth.py @@ -1,5 +1,5 @@ # [DEF:test_auth:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Unit tests for authentication module # @LAYER: Domain # @RELATION: VERIFIES -> src.core.auth diff --git a/backend/src/core/auth/jwt.py b/backend/src/core/auth/jwt.py index dcf13260..e80bb611 100644 --- a/backend/src/core/auth/jwt.py +++ b/backend/src/core/auth/jwt.py @@ -1,6 +1,6 @@ # [DEF:backend.src.core.auth.jwt:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: jwt, token, session, auth # @PURPOSE: JWT token generation and validation logic. # @LAYER: Core diff --git a/backend/src/core/auth/logger.py b/backend/src/core/auth/logger.py index e09ac839..d25cd50e 100644 --- a/backend/src/core/auth/logger.py +++ b/backend/src/core/auth/logger.py @@ -1,6 +1,6 @@ # [DEF:backend.src.core.auth.logger:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: auth, logger, audit, security # @PURPOSE: Audit logging for security-related events. # @LAYER: Core diff --git a/backend/src/core/auth/repository.py b/backend/src/core/auth/repository.py index bda4a07d..1f70336d 100644 --- a/backend/src/core/auth/repository.py +++ b/backend/src/core/auth/repository.py @@ -1,6 +1,6 @@ # [DEF:backend.src.core.auth.repository:Module] # -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: auth, repository, database, user, role, permission # @PURPOSE: Data access layer for authentication and user preference entities. # @LAYER: Domain @@ -25,12 +25,12 @@ from ..logger import belief_scope, logger # [/SECTION] # [DEF:AuthRepository:Class] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @PURPOSE: Encapsulates database operations for authentication-related entities. # @RELATION: [DEPENDS_ON] ->[sqlalchemy.orm.Session] class AuthRepository: # [DEF:__init__:Function] - # @TIER: CRITICAL + # @COMPLEXITY: 5 # @PURPOSE: Bind repository instance to an existing SQLAlchemy session. # @PRE: db is an initialized sqlalchemy.orm.Session instance. # @POST: self.db points to the provided session and is used by all repository methods. @@ -48,7 +48,7 @@ class AuthRepository: # [/DEF:__init__:Function] # [DEF:get_user_by_username:Function] - # @TIER: CRITICAL + # @COMPLEXITY: 5 # @PURPOSE: Retrieve a user entity by unique username. # @PRE: username is a non-empty str and self.db is a valid open Session. # @POST: Returns matching User entity when present, otherwise None. @@ -75,7 +75,7 @@ class AuthRepository: # [/DEF:get_user_by_username:Function] # [DEF:get_user_by_id:Function] - # @TIER: CRITICAL + # @COMPLEXITY: 5 # @PURPOSE: Retrieve a user entity by identifier. # @PRE: user_id is a non-empty str and self.db is a valid open Session. # @POST: Returns matching User entity when present, otherwise None. @@ -97,7 +97,7 @@ class AuthRepository: # [/DEF:get_user_by_id:Function] # [DEF:get_role_by_name:Function] - # @TIER: CRITICAL + # @COMPLEXITY: 5 # @PURPOSE: Retrieve a role entity by role name. # @PRE: name is a non-empty str and self.db is a valid open Session. # @POST: Returns matching Role entity when present, otherwise None. @@ -109,7 +109,7 @@ class AuthRepository: # [/DEF:get_role_by_name:Function] # [DEF:update_last_login:Function] - # @TIER: CRITICAL + # @COMPLEXITY: 5 # @PURPOSE: Update last_login timestamp for the provided user entity. # @PRE: user is a managed User instance and self.db is a valid open Session. # @POST: user.last_login is set to current UTC timestamp and transaction is committed. @@ -129,7 +129,7 @@ class AuthRepository: # [/DEF:update_last_login:Function] # [DEF:get_role_by_id:Function] - # @TIER: CRITICAL + # @COMPLEXITY: 5 # @PURPOSE: Retrieve a role entity by identifier. # @PRE: role_id is a non-empty str and self.db is a valid open Session. # @POST: Returns matching Role entity when present, otherwise None. @@ -141,7 +141,7 @@ class AuthRepository: # [/DEF:get_role_by_id:Function] # [DEF:get_permission_by_id:Function] - # @TIER: CRITICAL + # @COMPLEXITY: 5 # @PURPOSE: Retrieve a permission entity by identifier. # @PRE: perm_id is a non-empty str and self.db is a valid open Session. # @POST: Returns matching Permission entity when present, otherwise None. @@ -153,7 +153,7 @@ class AuthRepository: # [/DEF:get_permission_by_id:Function] # [DEF:get_permission_by_resource_action:Function] - # @TIER: CRITICAL + # @COMPLEXITY: 5 # @PURPOSE: Retrieve a permission entity by resource and action pair. # @PRE: resource and action are non-empty str values; self.db is a valid open Session. # @POST: Returns matching Permission entity when present, otherwise None. @@ -168,7 +168,7 @@ class AuthRepository: # [/DEF:get_permission_by_resource_action:Function] # [DEF:get_user_dashboard_preference:Function] - # @TIER: CRITICAL + # @COMPLEXITY: 5 # @PURPOSE: Retrieve dashboard preference entity owned by specified user. # @PRE: user_id is a non-empty str and self.db is a valid open Session. # @POST: Returns matching UserDashboardPreference entity when present, otherwise None. @@ -184,7 +184,7 @@ class AuthRepository: # [/DEF:get_user_dashboard_preference:Function] # [DEF:save_user_dashboard_preference:Function] - # @TIER: CRITICAL + # @COMPLEXITY: 5 # @PURPOSE: Persist dashboard preference entity and return refreshed persistent row. # @PRE: preference is a valid UserDashboardPreference entity and self.db is a valid open Session. # @POST: preference is committed to DB, refreshed from DB state, and returned. @@ -207,7 +207,7 @@ class AuthRepository: # [/DEF:save_user_dashboard_preference:Function] # [DEF:list_permissions:Function] - # @TIER: CRITICAL + # @COMPLEXITY: 5 # @PURPOSE: List all permission entities available in storage. # @PRE: self.db is a valid open Session. # @POST: Returns list containing all Permission entities visible to the session. diff --git a/backend/src/core/config_manager.py b/backend/src/core/config_manager.py index ee214dd1..3a0b60c9 100644 --- a/backend/src/core/config_manager.py +++ b/backend/src/core/config_manager.py @@ -1,6 +1,6 @@ # [DEF:ConfigManagerModule:Module] # -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: config, manager, persistence, migration, postgresql # @PURPOSE: Manages application configuration persistence in DB with one-time migration from legacy JSON. # @LAYER: Domain @@ -29,7 +29,7 @@ from .logger import logger, configure_logger, belief_scope # [DEF:ConfigManager:Class] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @PURPOSE: Handles application configuration load, validation, mutation, and persistence lifecycle. class ConfigManager: # [DEF:__init__:Function] @@ -60,7 +60,7 @@ class ConfigManager: # [/DEF:__init__:Function] # [DEF:_default_config:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Build default application configuration fallback. # @PRE: None. # @POST: Returns valid AppConfig with empty environments and default storage settings. @@ -75,7 +75,7 @@ class ConfigManager: # [/DEF:_default_config:Function] # [DEF:_sync_raw_payload_from_config:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Merge typed AppConfig state into raw payload while preserving unsupported legacy sections. # @PRE: self.config is initialized as AppConfig. # @POST: self.raw_payload contains AppConfig fields refreshed from self.config. @@ -90,7 +90,7 @@ class ConfigManager: # [/DEF:_sync_raw_payload_from_config:Function] # [DEF:_load_from_legacy_file:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Load legacy JSON configuration for migration fallback path. # @PRE: self.config_path is initialized. # @POST: Returns AppConfig from file payload or safe default. @@ -116,7 +116,7 @@ class ConfigManager: # [/DEF:_load_from_legacy_file:Function] # [DEF:_get_record:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Resolve global configuration record from DB. # @PRE: session is an active SQLAlchemy Session. # @POST: Returns record when present, otherwise None. @@ -128,7 +128,7 @@ class ConfigManager: # [/DEF:_get_record:Function] # [DEF:_load_config:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Load configuration from DB or perform one-time migration from legacy JSON. # @PRE: SessionLocal factory is available and AppConfigRecord schema is accessible. # @POST: Returns valid AppConfig and closes opened DB session. @@ -160,7 +160,7 @@ class ConfigManager: # [/DEF:_load_config:Function] # [DEF:_save_config_to_db:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Persist provided AppConfig into the global DB configuration record. # @PRE: config is AppConfig; session is either None or an active Session. # @POST: Global DB record payload equals config.model_dump() when commit succeeds. @@ -195,7 +195,7 @@ class ConfigManager: # [/DEF:_save_config_to_db:Function] # [DEF:save:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Persist current in-memory configuration state. # @PRE: self.config is initialized. # @POST: Current self.config is written to DB global record. @@ -207,7 +207,7 @@ class ConfigManager: # [/DEF:save:Function] # [DEF:get_config:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Return current in-memory configuration snapshot. # @PRE: self.config is initialized. # @POST: Returns AppConfig reference stored in manager. @@ -219,7 +219,7 @@ class ConfigManager: # [/DEF:get_config:Function] # [DEF:get_payload:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Return full persisted payload including sections outside typed AppConfig schema. # @PRE: Manager state is initialized. # @POST: Returns dict payload with current AppConfig fields synchronized. @@ -231,7 +231,7 @@ class ConfigManager: # [/DEF:get_payload:Function] # [DEF:save_config:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Persist configuration provided either as typed AppConfig or raw payload dict. # @PRE: config is AppConfig or dict compatible with AppConfig core schema. # @POST: self.config and self.raw_payload are synchronized and persisted to DB. @@ -253,7 +253,7 @@ class ConfigManager: # [/DEF:save_config:Function] # [DEF:update_global_settings:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Replace global settings and persist the resulting configuration. # @PRE: settings is GlobalSettings. # @POST: self.config.settings equals provided settings and DB state is updated. @@ -272,7 +272,7 @@ class ConfigManager: # [/DEF:update_global_settings:Function] # [DEF:validate_path:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Validate that path exists and is writable, creating it when absent. # @PRE: path is a string path candidate. # @POST: Returns (True, msg) for writable path, else (False, reason). @@ -294,7 +294,7 @@ class ConfigManager: # [/DEF:validate_path:Function] # [DEF:get_environments:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Return all configured environments. # @PRE: self.config is initialized. # @POST: Returns list of Environment models from current configuration. @@ -306,7 +306,7 @@ class ConfigManager: # [/DEF:get_environments:Function] # [DEF:has_environments:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Check whether at least one environment exists in configuration. # @PRE: self.config is initialized. # @POST: Returns True iff environment list length is greater than zero. @@ -318,7 +318,7 @@ class ConfigManager: # [/DEF:has_environments:Function] # [DEF:get_environment:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Resolve a configured environment by identifier. # @PRE: env_id is string identifier. # @POST: Returns matching Environment when found; otherwise None. @@ -333,7 +333,7 @@ class ConfigManager: # [/DEF:get_environment:Function] # [DEF:add_environment:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Upsert environment by id into configuration and persist. # @PRE: env is Environment. # @POST: Configuration contains provided env id with new payload persisted. @@ -352,7 +352,7 @@ class ConfigManager: # [/DEF:add_environment:Function] # [DEF:update_environment:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Update existing environment by id and preserve masked password placeholder behavior. # @PRE: env_id is non-empty string and updated_env is Environment. # @POST: Returns True and persists update when target exists; else returns False. @@ -382,7 +382,7 @@ class ConfigManager: # [/DEF:update_environment:Function] # [DEF:delete_environment:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Delete environment by id and persist when deletion occurs. # @PRE: env_id is non-empty string. # @POST: Environment is removed when present; otherwise configuration is unchanged. diff --git a/backend/src/core/config_models.py b/backend/src/core/config_models.py index 80dfc21a..ca5e7d39 100755 --- a/backend/src/core/config_models.py +++ b/backend/src/core/config_models.py @@ -1,93 +1,93 @@ -# [DEF:ConfigModels:Module] -# @TIER: STANDARD -# @SEMANTICS: config, models, pydantic -# @PURPOSE: Defines the data models for application configuration using Pydantic. -# @LAYER: Core -# @RELATION: READS_FROM -> app_configurations (database) -# @RELATION: USED_BY -> ConfigManager - -from pydantic import BaseModel, Field -from typing import List, Optional -from ..models.storage import StorageConfig -from ..services.llm_prompt_templates import ( - DEFAULT_LLM_ASSISTANT_SETTINGS, - DEFAULT_LLM_PROMPTS, - DEFAULT_LLM_PROVIDER_BINDINGS, -) - -# [DEF:Schedule:DataClass] -# @PURPOSE: Represents a backup schedule configuration. -class Schedule(BaseModel): - enabled: bool = False - cron_expression: str = "0 0 * * *" # Default: daily at midnight -# [/DEF:Schedule:DataClass] - -# [DEF:Environment:DataClass] -# @PURPOSE: Represents a Superset environment configuration. -class Environment(BaseModel): - id: str - name: str - url: str - username: str - password: str # Will be masked in UI - stage: str = Field(default="DEV", pattern="^(DEV|PREPROD|PROD)$") - verify_ssl: bool = True - timeout: int = 30 - is_default: bool = False - is_production: bool = False - backup_schedule: Schedule = Field(default_factory=Schedule) -# [/DEF:Environment:DataClass] - -# [DEF:LoggingConfig:DataClass] -# @PURPOSE: Defines the configuration for the application's logging system. -class LoggingConfig(BaseModel): - level: str = "INFO" - task_log_level: str = "INFO" # Minimum level for task-specific logs (DEBUG, INFO, WARNING, ERROR) - file_path: Optional[str] = None - max_bytes: int = 10 * 1024 * 1024 - backup_count: int = 5 - enable_belief_state: bool = True -# [/DEF:LoggingConfig:DataClass] - -# [DEF:CleanReleaseConfig:DataClass] -# @PURPOSE: Configuration for clean release compliance subsystem. -class CleanReleaseConfig(BaseModel): - active_policy_id: Optional[str] = None - active_registry_id: Optional[str] = None -# [/DEF:CleanReleaseConfig:DataClass] - -# [DEF:GlobalSettings:DataClass] -# @PURPOSE: Represents global application settings. -class GlobalSettings(BaseModel): - storage: StorageConfig = Field(default_factory=StorageConfig) - clean_release: CleanReleaseConfig = Field(default_factory=CleanReleaseConfig) - default_environment_id: Optional[str] = None - logging: LoggingConfig = Field(default_factory=LoggingConfig) - connections: List[dict] = [] - llm: dict = Field( - default_factory=lambda: { - "providers": [], - "default_provider": "", - "prompts": dict(DEFAULT_LLM_PROMPTS), - "provider_bindings": dict(DEFAULT_LLM_PROVIDER_BINDINGS), - **dict(DEFAULT_LLM_ASSISTANT_SETTINGS), - } - ) - - # Task retention settings - task_retention_days: int = 30 - task_retention_limit: int = 100 - pagination_limit: int = 10 - - # Migration sync settings - migration_sync_cron: str = "0 2 * * *" -# [/DEF:GlobalSettings:DataClass] - -# [DEF:AppConfig:DataClass] -# @PURPOSE: The root configuration model containing all application settings. -class AppConfig(BaseModel): - environments: List[Environment] = [] - settings: GlobalSettings -# [/DEF:AppConfig:DataClass] - -# [/DEF:ConfigModels:Module] +# [DEF:backend.src.core.config_models:Module] +# @COMPLEXITY: 3 +# @SEMANTICS: config, models, pydantic +# @PURPOSE: Defines the data models for application configuration using Pydantic. +# @LAYER: Core +# @RELATION: READS_FROM -> app_configurations (database) +# @RELATION: USED_BY -> ConfigManager + +from pydantic import BaseModel, Field +from typing import List, Optional +from ..models.storage import StorageConfig +from ..services.llm_prompt_templates import ( + DEFAULT_LLM_ASSISTANT_SETTINGS, + DEFAULT_LLM_PROMPTS, + DEFAULT_LLM_PROVIDER_BINDINGS, +) + +# [DEF:Schedule:DataClass] +# @PURPOSE: Represents a backup schedule configuration. +class Schedule(BaseModel): + enabled: bool = False + cron_expression: str = "0 0 * * *" # Default: daily at midnight +# [/DEF:Schedule:DataClass] + +# [DEF:backend.src.core.config_models.Environment:DataClass] +# @PURPOSE: Represents a Superset environment configuration. +class Environment(BaseModel): + id: str + name: str + url: str + username: str + password: str # Will be masked in UI + stage: str = Field(default="DEV", pattern="^(DEV|PREPROD|PROD)$") + verify_ssl: bool = True + timeout: int = 30 + is_default: bool = False + is_production: bool = False + backup_schedule: Schedule = Field(default_factory=Schedule) +# [/DEF:backend.src.core.config_models.Environment:DataClass] + +# [DEF:LoggingConfig:DataClass] +# @PURPOSE: Defines the configuration for the application's logging system. +class LoggingConfig(BaseModel): + level: str = "INFO" + task_log_level: str = "INFO" # Minimum level for task-specific logs (DEBUG, INFO, WARNING, ERROR) + file_path: Optional[str] = None + max_bytes: int = 10 * 1024 * 1024 + backup_count: int = 5 + enable_belief_state: bool = True +# [/DEF:LoggingConfig:DataClass] + +# [DEF:CleanReleaseConfig:DataClass] +# @PURPOSE: Configuration for clean release compliance subsystem. +class CleanReleaseConfig(BaseModel): + active_policy_id: Optional[str] = None + active_registry_id: Optional[str] = None +# [/DEF:CleanReleaseConfig:DataClass] + +# [DEF:GlobalSettings:DataClass] +# @PURPOSE: Represents global application settings. +class GlobalSettings(BaseModel): + storage: StorageConfig = Field(default_factory=StorageConfig) + clean_release: CleanReleaseConfig = Field(default_factory=CleanReleaseConfig) + default_environment_id: Optional[str] = None + logging: LoggingConfig = Field(default_factory=LoggingConfig) + connections: List[dict] = [] + llm: dict = Field( + default_factory=lambda: { + "providers": [], + "default_provider": "", + "prompts": dict(DEFAULT_LLM_PROMPTS), + "provider_bindings": dict(DEFAULT_LLM_PROVIDER_BINDINGS), + **dict(DEFAULT_LLM_ASSISTANT_SETTINGS), + } + ) + + # Task retention settings + task_retention_days: int = 30 + task_retention_limit: int = 100 + pagination_limit: int = 10 + + # Migration sync settings + migration_sync_cron: str = "0 2 * * *" +# [/DEF:GlobalSettings:DataClass] + +# [DEF:AppConfig:DataClass] +# @PURPOSE: The root configuration model containing all application settings. +class AppConfig(BaseModel): + environments: List[Environment] = [] + settings: GlobalSettings +# [/DEF:AppConfig:DataClass] + +# [/DEF:ConfigModels:Module] diff --git a/backend/src/core/database.py b/backend/src/core/database.py index c9534cdf..64523ad8 100644 --- a/backend/src/core/database.py +++ b/backend/src/core/database.py @@ -1,6 +1,6 @@ # [DEF:backend.src.core.database:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: database, postgresql, sqlalchemy, session, persistence # @PURPOSE: Configures database connection and session management (PostgreSQL-first). # @LAYER: Core @@ -31,13 +31,13 @@ from pathlib import Path # [/SECTION] # [DEF:BASE_DIR:Variable] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Base directory for the backend. BASE_DIR = Path(__file__).resolve().parent.parent.parent # [/DEF:BASE_DIR:Variable] # [DEF:DATABASE_URL:Constant] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: URL for the main application database. DEFAULT_POSTGRES_URL = os.getenv( "POSTGRES_URL", @@ -47,20 +47,20 @@ DATABASE_URL = os.getenv("DATABASE_URL", DEFAULT_POSTGRES_URL) # [/DEF:DATABASE_URL:Constant] # [DEF:TASKS_DATABASE_URL:Constant] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: URL for the tasks execution database. # Defaults to DATABASE_URL to keep task logs in the same PostgreSQL instance. TASKS_DATABASE_URL = os.getenv("TASKS_DATABASE_URL", DATABASE_URL) # [/DEF:TASKS_DATABASE_URL:Constant] # [DEF:AUTH_DATABASE_URL:Constant] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: URL for the authentication database. AUTH_DATABASE_URL = os.getenv("AUTH_DATABASE_URL", auth_config.AUTH_DATABASE_URL) # [/DEF:AUTH_DATABASE_URL:Constant] # [DEF:engine:Variable] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: SQLAlchemy engine for mappings database. # @SIDE_EFFECT: Creates database engine and manages connection pool. def _build_engine(db_url: str): @@ -73,40 +73,40 @@ engine = _build_engine(DATABASE_URL) # [/DEF:engine:Variable] # [DEF:tasks_engine:Variable] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: SQLAlchemy engine for tasks database. tasks_engine = _build_engine(TASKS_DATABASE_URL) # [/DEF:tasks_engine:Variable] # [DEF:auth_engine:Variable] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: SQLAlchemy engine for authentication database. auth_engine = _build_engine(AUTH_DATABASE_URL) # [/DEF:auth_engine:Variable] # [DEF:SessionLocal:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: A session factory for the main mappings database. # @PRE: engine is initialized. SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) # [/DEF:SessionLocal:Class] # [DEF:TasksSessionLocal:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: A session factory for the tasks execution database. # @PRE: tasks_engine is initialized. TasksSessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=tasks_engine) # [/DEF:TasksSessionLocal:Class] # [DEF:AuthSessionLocal:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: A session factory for the authentication database. # @PRE: auth_engine is initialized. AuthSessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=auth_engine) # [/DEF:AuthSessionLocal:Class] # [DEF:_ensure_user_dashboard_preferences_columns:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Applies additive schema upgrades for user_dashboard_preferences table. # @PRE: bind_engine points to application database where profile table is stored. # @POST: Missing columns are added without data loss. @@ -173,7 +173,7 @@ def _ensure_user_dashboard_preferences_columns(bind_engine): # [DEF:_ensure_user_dashboard_preferences_health_columns:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Applies additive schema upgrades for user_dashboard_preferences table (health fields). def _ensure_user_dashboard_preferences_health_columns(bind_engine): with belief_scope("_ensure_user_dashboard_preferences_health_columns"): @@ -217,7 +217,7 @@ def _ensure_user_dashboard_preferences_health_columns(bind_engine): # [DEF:_ensure_llm_validation_results_columns:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Applies additive schema upgrades for llm_validation_results table. def _ensure_llm_validation_results_columns(bind_engine): with belief_scope("_ensure_llm_validation_results_columns"): @@ -257,7 +257,7 @@ def _ensure_llm_validation_results_columns(bind_engine): # [DEF:_ensure_git_server_configs_columns:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Applies additive schema upgrades for git_server_configs table. # @PRE: bind_engine points to application database. # @POST: Missing columns are added without data loss. @@ -295,7 +295,7 @@ def _ensure_git_server_configs_columns(bind_engine): # [DEF:ensure_connection_configs_table:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Ensures the external connection registry table exists in the main database. # @PRE: bind_engine points to the application database. # @POST: connection_configs table exists without dropping existing data. @@ -313,7 +313,7 @@ def ensure_connection_configs_table(bind_engine): # [DEF:init_db:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Initializes the database by creating all tables. # @PRE: engine, tasks_engine and auth_engine are initialized. # @POST: Database tables created in all databases. @@ -331,7 +331,7 @@ def init_db(): # [/DEF:init_db:Function] # [DEF:get_db:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Dependency for getting a database session. # @PRE: SessionLocal is initialized. # @POST: Session is closed after use. @@ -346,7 +346,7 @@ def get_db(): # [/DEF:get_db:Function] # [DEF:get_tasks_db:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Dependency for getting a tasks database session. # @PRE: TasksSessionLocal is initialized. # @POST: Session is closed after use. @@ -361,7 +361,7 @@ def get_tasks_db(): # [/DEF:get_tasks_db:Function] # [DEF:get_auth_db:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Dependency for getting an authentication database session. # @PRE: AuthSessionLocal is initialized. # @POST: Session is closed after use. diff --git a/backend/src/core/encryption_key.py b/backend/src/core/encryption_key.py index 558c5693..c8f0c4af 100644 --- a/backend/src/core/encryption_key.py +++ b/backend/src/core/encryption_key.py @@ -1,5 +1,5 @@ # [DEF:backend.src.core.encryption_key:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: encryption, key, bootstrap, environment, startup # @PURPOSE: Resolve and persist the Fernet encryption key required by runtime services. # @LAYER: Infra diff --git a/backend/src/core/logger/__tests__/test_logger.py b/backend/src/core/logger/__tests__/test_logger.py index 7877da4d..4d08b1b8 100644 --- a/backend/src/core/logger/__tests__/test_logger.py +++ b/backend/src/core/logger/__tests__/test_logger.py @@ -1,5 +1,5 @@ # [DEF:test_logger:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Unit tests for logger module # @LAYER: Infra # @RELATION: VERIFIES -> src.core.logger diff --git a/backend/src/core/mapping_service.py b/backend/src/core/mapping_service.py index 127e6b13..0e6f7741 100644 --- a/backend/src/core/mapping_service.py +++ b/backend/src/core/mapping_service.py @@ -1,6 +1,6 @@ # [DEF:backend.src.core.mapping_service:Module] # -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: mapping, ids, synchronization, environments, cross-filters # @PURPOSE: Service for tracking and synchronizing Superset Resource IDs (UUID <-> Integer ID) # @LAYER: Core @@ -21,7 +21,7 @@ from src.core.logger import logger, belief_scope # [/SECTION] # [DEF:IdMappingService:Class] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @PURPOSE: Service handling the cataloging and retrieval of remote Superset Integer IDs. # # @TEST_CONTRACT: IdMappingServiceModel -> diff --git a/backend/src/core/migration/__init__.py b/backend/src/core/migration/__init__.py index 360f6171..4e601c8f 100644 --- a/backend/src/core/migration/__init__.py +++ b/backend/src/core/migration/__init__.py @@ -1,5 +1,5 @@ # [DEF:backend.src.core.migration.__init__:Module] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @SEMANTICS: migration, package, exports # @PURPOSE: Namespace package for migration pre-flight orchestration components. # @LAYER: Core diff --git a/backend/src/core/migration/archive_parser.py b/backend/src/core/migration/archive_parser.py index a8be8ff3..da125941 100644 --- a/backend/src/core/migration/archive_parser.py +++ b/backend/src/core/migration/archive_parser.py @@ -1,5 +1,5 @@ # [DEF:backend.src.core.migration.archive_parser:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: migration, zip, parser, yaml, metadata # @PURPOSE: Parse Superset export ZIP archives into normalized object catalogs for diffing. # @LAYER: Core diff --git a/backend/src/core/migration/dry_run_orchestrator.py b/backend/src/core/migration/dry_run_orchestrator.py index 29a6a1f2..50bf3c1c 100644 --- a/backend/src/core/migration/dry_run_orchestrator.py +++ b/backend/src/core/migration/dry_run_orchestrator.py @@ -1,12 +1,12 @@ # [DEF:backend.src.core.migration.dry_run_orchestrator:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: migration, dry_run, diff, risk, superset # @PURPOSE: Compute pre-flight migration diff and risk scoring without apply. # @LAYER: Core -# @RELATION: DEPENDS_ON -> backend.src.core.superset_client -# @RELATION: DEPENDS_ON -> backend.src.core.migration_engine -# @RELATION: DEPENDS_ON -> backend.src.core.migration.archive_parser -# @RELATION: DEPENDS_ON -> backend.src.core.migration.risk_assessor +# @RELATION: DEPENDS_ON ->[backend.src.core.superset_client.SupersetClient] +# @RELATION: DEPENDS_ON ->[backend.src.core.migration_engine.MigrationEngine] +# @RELATION: DEPENDS_ON ->[backend.src.core.migration.archive_parser.MigrationArchiveParser] +# @RELATION: DEPENDS_ON ->[backend.src.core.migration.risk_assessor] # @INVARIANT: Dry run is informative only and must not mutate target environment. from datetime import datetime, timezone diff --git a/backend/src/core/migration/risk_assessor.py b/backend/src/core/migration/risk_assessor.py index 43bb8114..75590617 100644 --- a/backend/src/core/migration/risk_assessor.py +++ b/backend/src/core/migration/risk_assessor.py @@ -1,5 +1,5 @@ # [DEF:backend.src.core.migration.risk_assessor:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: migration, dry_run, risk, scoring, preflight # @PURPOSE: Compute deterministic migration risk items and aggregate score for dry-run reporting. # @LAYER: Domain diff --git a/backend/src/core/migration_engine.py b/backend/src/core/migration_engine.py index fb479b10..04a53b1f 100644 --- a/backend/src/core/migration_engine.py +++ b/backend/src/core/migration_engine.py @@ -1,6 +1,6 @@ # [DEF:backend.src.core.migration_engine:Module] # -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: migration, engine, zip, yaml, transformation, cross-filter, id-mapping # @PURPOSE: Transforms Superset export ZIP archives while preserving archive integrity and patching mapped identifiers. # @LAYER: Domain diff --git a/backend/src/core/plugin_loader.py b/backend/src/core/plugin_loader.py index 505f4e3c..b614c7ab 100755 --- a/backend/src/core/plugin_loader.py +++ b/backend/src/core/plugin_loader.py @@ -1,192 +1,192 @@ -import importlib.util -import os -import sys # Added this line -from typing import Dict, List, Optional -from .plugin_base import PluginBase, PluginConfig -from .logger import belief_scope - -# [DEF:PluginLoader:Class] -# @TIER: STANDARD -# @SEMANTICS: plugin, loader, dynamic, import -# @PURPOSE: Scans a specified directory for Python modules, dynamically loads them, and registers any classes that are valid implementations of the PluginBase interface. -# @LAYER: Core -# @RELATION: Depends on PluginBase. It is used by the main application to discover and manage available plugins. -class PluginLoader: - """ - Scans a directory for Python modules, loads them, and identifies classes - that inherit from PluginBase. - """ - - # [DEF:__init__:Function] - # @PURPOSE: Initializes the PluginLoader with a directory to scan. - # @PRE: plugin_dir is a valid directory path. - # @POST: Plugins are loaded and registered. - # @PARAM: plugin_dir (str) - The directory containing plugin modules. - def __init__(self, plugin_dir: str): - with belief_scope("__init__"): - self.plugin_dir = plugin_dir - self._plugins: Dict[str, PluginBase] = {} - self._plugin_configs: Dict[str, PluginConfig] = {} - self._load_plugins() - # [/DEF:__init__:Function] - - # [DEF:_load_plugins:Function] - # @PURPOSE: Scans the plugin directory and loads all valid plugins. - # @PRE: plugin_dir exists or can be created. - # @POST: _load_module is called for each .py file. - def _load_plugins(self): - with belief_scope("_load_plugins"): - """ - Scans the plugin directory, imports modules, and registers valid plugins. - """ - if not os.path.exists(self.plugin_dir): - os.makedirs(self.plugin_dir) - - # Add the plugin directory's parent to sys.path to enable relative imports within plugins - # This assumes plugin_dir is something like 'backend/src/plugins' - # and we want 'backend/src' to be on the path for 'from ..core...' imports - plugin_parent_dir = os.path.abspath(os.path.join(self.plugin_dir, os.pardir)) - if plugin_parent_dir not in sys.path: - sys.path.insert(0, plugin_parent_dir) - - for filename in os.listdir(self.plugin_dir): - file_path = os.path.join(self.plugin_dir, filename) - - # Handle directory-based plugins (packages) - if os.path.isdir(file_path): - init_file = os.path.join(file_path, "__init__.py") - if os.path.exists(init_file): - self._load_module(filename, init_file) - continue - - # Handle single-file plugins - if filename.endswith(".py") and filename != "__init__.py": - module_name = filename[:-3] - self._load_module(module_name, file_path) - # [/DEF:_load_plugins:Function] - - # [DEF:_load_module:Function] - # @PURPOSE: Loads a single Python module and discovers PluginBase implementations. - # @PRE: module_name and file_path are valid. - # @POST: Plugin classes are instantiated and registered. - # @PARAM: module_name (str) - The name of the module. - # @PARAM: file_path (str) - The path to the module file. - def _load_module(self, module_name: str, file_path: str): - with belief_scope("_load_module"): - """ - Loads a single Python module and extracts PluginBase subclasses. - """ +import importlib.util +import os +import sys # Added this line +from typing import Dict, List, Optional +from .plugin_base import PluginBase, PluginConfig +from .logger import belief_scope + +# [DEF:PluginLoader:Class] +# @COMPLEXITY: 3 +# @SEMANTICS: plugin, loader, dynamic, import +# @PURPOSE: Scans a specified directory for Python modules, dynamically loads them, and registers any classes that are valid implementations of the PluginBase interface. +# @LAYER: Core +# @RELATION: Depends on PluginBase. It is used by the main application to discover and manage available plugins. +class PluginLoader: + """ + Scans a directory for Python modules, loads them, and identifies classes + that inherit from PluginBase. + """ + + # [DEF:__init__:Function] + # @PURPOSE: Initializes the PluginLoader with a directory to scan. + # @PRE: plugin_dir is a valid directory path. + # @POST: Plugins are loaded and registered. + # @PARAM: plugin_dir (str) - The directory containing plugin modules. + def __init__(self, plugin_dir: str): + with belief_scope("__init__"): + self.plugin_dir = plugin_dir + self._plugins: Dict[str, PluginBase] = {} + self._plugin_configs: Dict[str, PluginConfig] = {} + self._load_plugins() + # [/DEF:__init__:Function] + + # [DEF:_load_plugins:Function] + # @PURPOSE: Scans the plugin directory and loads all valid plugins. + # @PRE: plugin_dir exists or can be created. + # @POST: _load_module is called for each .py file. + def _load_plugins(self): + with belief_scope("_load_plugins"): + """ + Scans the plugin directory, imports modules, and registers valid plugins. + """ + if not os.path.exists(self.plugin_dir): + os.makedirs(self.plugin_dir) + + # Add the plugin directory's parent to sys.path to enable relative imports within plugins + # This assumes plugin_dir is something like 'backend/src/plugins' + # and we want 'backend/src' to be on the path for 'from ..core...' imports + plugin_parent_dir = os.path.abspath(os.path.join(self.plugin_dir, os.pardir)) + if plugin_parent_dir not in sys.path: + sys.path.insert(0, plugin_parent_dir) + + for filename in os.listdir(self.plugin_dir): + file_path = os.path.join(self.plugin_dir, filename) + + # Handle directory-based plugins (packages) + if os.path.isdir(file_path): + init_file = os.path.join(file_path, "__init__.py") + if os.path.exists(init_file): + self._load_module(filename, init_file) + continue + + # Handle single-file plugins + if filename.endswith(".py") and filename != "__init__.py": + module_name = filename[:-3] + self._load_module(module_name, file_path) + # [/DEF:_load_plugins:Function] + + # [DEF:_load_module:Function] + # @PURPOSE: Loads a single Python module and discovers PluginBase implementations. + # @PRE: module_name and file_path are valid. + # @POST: Plugin classes are instantiated and registered. + # @PARAM: module_name (str) - The name of the module. + # @PARAM: file_path (str) - The path to the module file. + def _load_module(self, module_name: str, file_path: str): + with belief_scope("_load_module"): + """ + Loads a single Python module and extracts PluginBase subclasses. + """ # All runtime code is imported through the canonical `src` package root. package_name = f"src.plugins.{module_name}" - - # print(f"DEBUG: Loading plugin {module_name} as {package_name}") - spec = importlib.util.spec_from_file_location(package_name, file_path) - if spec is None or spec.loader is None: - print(f"Could not load module spec for {package_name}") # Replace with proper logging - return - - module = importlib.util.module_from_spec(spec) - try: - spec.loader.exec_module(module) - except Exception as e: - print(f"Error loading plugin module {module_name}: {e}") # Replace with proper logging - return - - for attribute_name in dir(module): - attribute = getattr(module, attribute_name) - if ( - isinstance(attribute, type) - and issubclass(attribute, PluginBase) - and attribute is not PluginBase - ): - try: - plugin_instance = attribute() - self._register_plugin(plugin_instance) - except Exception as e: - print(f"Error instantiating plugin {attribute_name} in {module_name}: {e}") # Replace with proper logging - # [/DEF:_load_module:Function] - - # [DEF:_register_plugin:Function] - # @PURPOSE: Registers a PluginBase instance and its configuration. - # @PRE: plugin_instance is a valid implementation of PluginBase. - # @POST: Plugin is added to _plugins and _plugin_configs. - # @PARAM: plugin_instance (PluginBase) - The plugin instance to register. - def _register_plugin(self, plugin_instance: PluginBase): - with belief_scope("_register_plugin"): - """ - Registers a valid plugin instance. - """ - plugin_id = plugin_instance.id - if plugin_id in self._plugins: - print(f"Warning: Duplicate plugin ID '{plugin_id}' found. Skipping.") # Replace with proper logging - return - - try: - schema = plugin_instance.get_schema() - # Basic validation to ensure it's a dictionary - if not isinstance(schema, dict): - raise TypeError("get_schema() must return a dictionary.") - - plugin_config = PluginConfig( - id=plugin_instance.id, - name=plugin_instance.name, - description=plugin_instance.description, - version=plugin_instance.version, - ui_route=plugin_instance.ui_route, - schema=schema, - ) - # The following line is commented out because it requires a schema to be passed to validate against. - # The schema provided by the plugin is the one being validated, not the data. - # validate(instance={}, schema=schema) - self._plugins[plugin_id] = plugin_instance - self._plugin_configs[plugin_id] = plugin_config - from ..core.logger import logger - logger.info(f"Plugin '{plugin_instance.name}' (ID: {plugin_id}) loaded successfully.") - except Exception as e: - from ..core.logger import logger - logger.error(f"Error validating plugin '{plugin_instance.name}' (ID: {plugin_id}): {e}") - # [/DEF:_register_plugin:Function] - - - # [DEF:get_plugin:Function] - # @PURPOSE: Retrieves a loaded plugin instance by its ID. - # @PRE: plugin_id is a string. - # @POST: Returns plugin instance or None. - # @PARAM: plugin_id (str) - The unique identifier of the plugin. - # @RETURN: Optional[PluginBase] - The plugin instance if found, otherwise None. - def get_plugin(self, plugin_id: str) -> Optional[PluginBase]: - with belief_scope("get_plugin"): - """ - Returns a loaded plugin instance by its ID. - """ - return self._plugins.get(plugin_id) - # [/DEF:get_plugin:Function] - - # [DEF:get_all_plugin_configs:Function] - # @PURPOSE: Returns a list of all registered plugin configurations. - # @PRE: None. - # @POST: Returns list of all PluginConfig objects. - # @RETURN: List[PluginConfig] - A list of plugin configurations. - def get_all_plugin_configs(self) -> List[PluginConfig]: - with belief_scope("get_all_plugin_configs"): - """ - Returns a list of all loaded plugin configurations. - """ - return list(self._plugin_configs.values()) - # [/DEF:get_all_plugin_configs:Function] - - # [DEF:has_plugin:Function] - # @PURPOSE: Checks if a plugin with the given ID is registered. - # @PRE: plugin_id is a string. - # @POST: Returns True if plugin exists. - # @PARAM: plugin_id (str) - The unique identifier of the plugin. - # @RETURN: bool - True if the plugin is registered, False otherwise. - def has_plugin(self, plugin_id: str) -> bool: - with belief_scope("has_plugin"): - """ - Checks if a plugin with the given ID is loaded. - """ - return plugin_id in self._plugins - # [/DEF:has_plugin:Function] - + + # print(f"DEBUG: Loading plugin {module_name} as {package_name}") + spec = importlib.util.spec_from_file_location(package_name, file_path) + if spec is None or spec.loader is None: + print(f"Could not load module spec for {package_name}") # Replace with proper logging + return + + module = importlib.util.module_from_spec(spec) + try: + spec.loader.exec_module(module) + except Exception as e: + print(f"Error loading plugin module {module_name}: {e}") # Replace with proper logging + return + + for attribute_name in dir(module): + attribute = getattr(module, attribute_name) + if ( + isinstance(attribute, type) + and issubclass(attribute, PluginBase) + and attribute is not PluginBase + ): + try: + plugin_instance = attribute() + self._register_plugin(plugin_instance) + except Exception as e: + print(f"Error instantiating plugin {attribute_name} in {module_name}: {e}") # Replace with proper logging + # [/DEF:_load_module:Function] + + # [DEF:_register_plugin:Function] + # @PURPOSE: Registers a PluginBase instance and its configuration. + # @PRE: plugin_instance is a valid implementation of PluginBase. + # @POST: Plugin is added to _plugins and _plugin_configs. + # @PARAM: plugin_instance (PluginBase) - The plugin instance to register. + def _register_plugin(self, plugin_instance: PluginBase): + with belief_scope("_register_plugin"): + """ + Registers a valid plugin instance. + """ + plugin_id = plugin_instance.id + if plugin_id in self._plugins: + print(f"Warning: Duplicate plugin ID '{plugin_id}' found. Skipping.") # Replace with proper logging + return + + try: + schema = plugin_instance.get_schema() + # Basic validation to ensure it's a dictionary + if not isinstance(schema, dict): + raise TypeError("get_schema() must return a dictionary.") + + plugin_config = PluginConfig( + id=plugin_instance.id, + name=plugin_instance.name, + description=plugin_instance.description, + version=plugin_instance.version, + ui_route=plugin_instance.ui_route, + schema=schema, + ) + # The following line is commented out because it requires a schema to be passed to validate against. + # The schema provided by the plugin is the one being validated, not the data. + # validate(instance={}, schema=schema) + self._plugins[plugin_id] = plugin_instance + self._plugin_configs[plugin_id] = plugin_config + from ..core.logger import logger + logger.info(f"Plugin '{plugin_instance.name}' (ID: {plugin_id}) loaded successfully.") + except Exception as e: + from ..core.logger import logger + logger.error(f"Error validating plugin '{plugin_instance.name}' (ID: {plugin_id}): {e}") + # [/DEF:_register_plugin:Function] + + + # [DEF:get_plugin:Function] + # @PURPOSE: Retrieves a loaded plugin instance by its ID. + # @PRE: plugin_id is a string. + # @POST: Returns plugin instance or None. + # @PARAM: plugin_id (str) - The unique identifier of the plugin. + # @RETURN: Optional[PluginBase] - The plugin instance if found, otherwise None. + def get_plugin(self, plugin_id: str) -> Optional[PluginBase]: + with belief_scope("get_plugin"): + """ + Returns a loaded plugin instance by its ID. + """ + return self._plugins.get(plugin_id) + # [/DEF:get_plugin:Function] + + # [DEF:get_all_plugin_configs:Function] + # @PURPOSE: Returns a list of all registered plugin configurations. + # @PRE: None. + # @POST: Returns list of all PluginConfig objects. + # @RETURN: List[PluginConfig] - A list of plugin configurations. + def get_all_plugin_configs(self) -> List[PluginConfig]: + with belief_scope("get_all_plugin_configs"): + """ + Returns a list of all loaded plugin configurations. + """ + return list(self._plugin_configs.values()) + # [/DEF:get_all_plugin_configs:Function] + + # [DEF:has_plugin:Function] + # @PURPOSE: Checks if a plugin with the given ID is registered. + # @PRE: plugin_id is a string. + # @POST: Returns True if plugin exists. + # @PARAM: plugin_id (str) - The unique identifier of the plugin. + # @RETURN: bool - True if the plugin is registered, False otherwise. + def has_plugin(self, plugin_id: str) -> bool: + with belief_scope("has_plugin"): + """ + Checks if a plugin with the given ID is loaded. + """ + return plugin_id in self._plugins + # [/DEF:has_plugin:Function] + # [/DEF:PluginLoader:Class] diff --git a/backend/src/core/scheduler.py b/backend/src/core/scheduler.py index 9ae55c30..29c8803b 100644 --- a/backend/src/core/scheduler.py +++ b/backend/src/core/scheduler.py @@ -1,5 +1,5 @@ # [DEF:SchedulerModule:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: scheduler, apscheduler, cron, backup # @PURPOSE: Manages scheduled tasks using APScheduler. # @LAYER: Core @@ -18,7 +18,7 @@ from datetime import datetime, time, timedelta, date # [/SECTION] # [DEF:SchedulerService:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: scheduler, service, apscheduler # @PURPOSE: Provides a service to manage scheduled backup tasks. class SchedulerService: @@ -123,7 +123,7 @@ class SchedulerService: # [/DEF:SchedulerService:Class] # [DEF:ThrottledSchedulerConfigurator:Class] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: scheduler, throttling, distribution # @PURPOSE: Distributes validation tasks evenly within an execution window. class ThrottledSchedulerConfigurator: diff --git a/backend/src/core/superset_client.py b/backend/src/core/superset_client.py index 80955893..824b2e54 100644 --- a/backend/src/core/superset_client.py +++ b/backend/src/core/superset_client.py @@ -1,6 +1,6 @@ # [DEF:backend.src.core.superset_client:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: superset, api, client, rest, http, dashboard, dataset, import, export # @PURPOSE: ΠΡΠ΅Π΄ΠΎΡΡΠ°Π²Π»ΡΠ΅Ρ Π²ΡΡΠΎΠΊΠΎΡΡΠΎΠ²Π½Π΅Π²ΡΠΉ ΠΊΠ»ΠΈΠ΅Π½Ρ Π΄Π»Ρ Π²Π·Π°ΠΈΠΌΠΎΠ΄Π΅ΠΉΡΡΠ²ΠΈΡ Ρ Superset REST API, ΠΈΠ½ΠΊΠ°ΠΏΡΡΠ»ΠΈΡΡΡ Π»ΠΎΠ³ΠΈΠΊΡ Π·Π°ΠΏΡΠΎΡΠΎΠ², ΠΎΠ±ΡΠ°Π±ΠΎΡΠΊΡ ΠΎΡΠΈΠ±ΠΎΠΊ ΠΈ ΠΏΠ°Π³ΠΈΠ½Π°ΡΠΈΡ. # @LAYER: Core @@ -25,13 +25,13 @@ from .config_models import Environment # [/SECTION] # [DEF:backend.src.core.superset_client.SupersetClient:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: ΠΠ»Π°ΡΡ-ΠΎΠ±ΡΡΡΠΊΠ° Π½Π°Π΄ Superset REST API, ΠΏΡΠ΅Π΄ΠΎΡΡΠ°Π²Π»ΡΡΡΠΈΠΉ ΠΌΠ΅ΡΠΎΠ΄Ρ Π΄Π»Ρ ΡΠ°Π±ΠΎΡΡ Ρ Π΄Π°ΡΠ±ΠΎΡΠ΄Π°ΠΌΠΈ ΠΈ Π΄Π°ΡΠ°ΡΠ΅ΡΠ°ΠΌΠΈ. # @RELATION: [DEPENDS_ON] ->[backend.src.core.utils.network.APIClient] # @RELATION: [DEPENDS_ON] ->[backend.src.core.config_models.Environment] class SupersetClient: # [DEF:backend.src.core.superset_client.SupersetClient.__init__:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: ΠΠ½ΠΈΡΠΈΠ°Π»ΠΈΠ·ΠΈΡΡΠ΅Ρ ΠΊΠ»ΠΈΠ΅Π½Ρ, ΠΏΡΠΎΠ²Π΅ΡΡΠ΅Ρ ΠΊΠΎΠ½ΡΠΈΠ³ΡΡΠ°ΡΠΈΡ ΠΈ ΡΠΎΠ·Π΄Π°Π΅Ρ ΡΠ΅ΡΠ΅Π²ΠΎΠΉ ΠΊΠ»ΠΈΠ΅Π½Ρ. # @PRE: `env` Π΄ΠΎΠ»ΠΆΠ΅Π½ Π±ΡΡΡ Π²Π°Π»ΠΈΠ΄Π½ΡΠΌ ΠΎΠ±ΡΠ΅ΠΊΡΠΎΠΌ Environment. # @POST: ΠΡΡΠΈΠ±ΡΡΡ `env` ΠΈ `network` ΡΠΎΠ·Π΄Π°Π½Ρ ΠΈ Π³ΠΎΡΠΎΠ²Ρ ΠΊ ΡΠ°Π±ΠΎΡΠ΅. @@ -60,7 +60,7 @@ class SupersetClient: # [/DEF:__init__:Function] # [DEF:backend.src.core.superset_client.SupersetClient.authenticate:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Authenticates the client using the configured credentials. # @PRE: self.network must be initialized with valid auth configuration. # @POST: Client is authenticated and tokens are stored. @@ -73,7 +73,7 @@ class SupersetClient: @property # [DEF:backend.src.core.superset_client.SupersetClient.headers:Function] - # @TIER: TRIVIAL + # @COMPLEXITY: 1 # @PURPOSE: ΠΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ Π±Π°Π·ΠΎΠ²ΡΠ΅ HTTP-Π·Π°Π³ΠΎΠ»ΠΎΠ²ΠΊΠΈ, ΠΈΡΠΏΠΎΠ»ΡΠ·ΡΠ΅ΠΌΡΠ΅ ΡΠ΅ΡΠ΅Π²ΡΠΌ ΠΊΠ»ΠΈΠ΅Π½ΡΠΎΠΌ. # @PRE: APIClient is initialized and authenticated. # @POST: Returns a dictionary of HTTP headers. @@ -85,7 +85,7 @@ class SupersetClient: # [SECTION: DASHBOARD OPERATIONS] # [DEF:backend.src.core.superset_client.SupersetClient.get_dashboards:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: ΠΠΎΠ»ΡΡΠ°Π΅Ρ ΠΏΠΎΠ»Π½ΡΠΉ ΡΠΏΠΈΡΠΎΠΊ Π΄Π°ΡΠ±ΠΎΡΠ΄ΠΎΠ², Π°Π²ΡΠΎΠΌΠ°ΡΠΈΡΠ΅ΡΠΊΠΈ ΠΎΠ±ΡΠ°Π±Π°ΡΡΠ²Π°Ρ ΠΏΠ°Π³ΠΈΠ½Π°ΡΠΈΡ. # @PRE: Client is authenticated. # @POST: Returns a tuple with total count and list of dashboards. @@ -119,7 +119,7 @@ class SupersetClient: # [/DEF:get_dashboards:Function] # [DEF:backend.src.core.superset_client.SupersetClient.get_dashboards_page:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Fetches a single dashboards page from Superset without iterating all pages. # @PRE: Client is authenticated. # @POST: Returns total count and one page of dashboards. @@ -156,7 +156,7 @@ class SupersetClient: # [/DEF:get_dashboards_page:Function] # [DEF:backend.src.core.superset_client.SupersetClient.get_dashboards_summary:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Fetches dashboard metadata optimized for the grid. # @PRE: Client is authenticated. # @POST: Returns a list of dashboard metadata summaries. @@ -241,7 +241,7 @@ class SupersetClient: # [/DEF:get_dashboards_summary:Function] # [DEF:backend.src.core.superset_client.SupersetClient.get_dashboards_summary_page:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Fetches one page of dashboard metadata optimized for the grid. # @PRE: page >= 1 and page_size > 0. # @POST: Returns mapped summaries and total dashboard count. @@ -314,7 +314,7 @@ class SupersetClient: # [/DEF:get_dashboards_summary_page:Function] # [DEF:backend.src.core.superset_client.SupersetClient._extract_owner_labels:Function] - # @TIER: TRIVIAL + # @COMPLEXITY: 1 # @PURPOSE: Normalize dashboard owners payload to stable display labels. # @PRE: owners payload can be scalar, object or list. # @POST: Returns deduplicated non-empty owner labels preserving order. @@ -342,7 +342,7 @@ class SupersetClient: # [/DEF:_extract_owner_labels:Function] # [DEF:backend.src.core.superset_client.SupersetClient._extract_user_display:Function] - # @TIER: TRIVIAL + # @COMPLEXITY: 1 # @PURPOSE: Normalize user payload to a stable display name. # @PRE: user payload can be string, dict or None. # @POST: Returns compact non-empty display value or None. @@ -371,7 +371,7 @@ class SupersetClient: # [/DEF:_extract_user_display:Function] # [DEF:backend.src.core.superset_client.SupersetClient._sanitize_user_text:Function] - # @TIER: TRIVIAL + # @COMPLEXITY: 1 # @PURPOSE: Convert scalar value to non-empty user-facing text. # @PRE: value can be any scalar type. # @POST: Returns trimmed string or None. @@ -385,7 +385,7 @@ class SupersetClient: # [/DEF:_sanitize_user_text:Function] # [DEF:backend.src.core.superset_client.SupersetClient.get_dashboard:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Fetches a single dashboard by ID. # @PRE: Client is authenticated and dashboard_id exists. # @POST: Returns dashboard payload from Superset API. @@ -398,7 +398,7 @@ class SupersetClient: # [/DEF:get_dashboard:Function] # [DEF:backend.src.core.superset_client.SupersetClient.get_chart:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Fetches a single chart by ID. # @PRE: Client is authenticated and chart_id exists. # @POST: Returns chart payload from Superset API. @@ -411,7 +411,7 @@ class SupersetClient: # [/DEF:get_chart:Function] # [DEF:backend.src.core.superset_client.SupersetClient.get_dashboard_detail:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Fetches detailed dashboard information including related charts and datasets. # @PRE: Client is authenticated and dashboard_id exists. # @POST: Returns dashboard metadata with charts and datasets lists. @@ -606,7 +606,7 @@ class SupersetClient: # [/DEF:get_dashboard_detail:Function] # [DEF:backend.src.core.superset_client.SupersetClient.get_charts:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Fetches all charts with pagination support. # @PRE: Client is authenticated. # @POST: Returns total count and charts list. @@ -626,7 +626,7 @@ class SupersetClient: # [/DEF:get_charts:Function] # [DEF:backend.src.core.superset_client.SupersetClient._extract_chart_ids_from_layout:Function] - # @TIER: TRIVIAL + # @COMPLEXITY: 1 # @PURPOSE: Traverses dashboard layout metadata and extracts chart IDs from common keys. # @PRE: payload can be dict/list/scalar. # @POST: Returns a set of chart IDs found in nested structures. @@ -659,7 +659,7 @@ class SupersetClient: # [/DEF:_extract_chart_ids_from_layout:Function] # [DEF:backend.src.core.superset_client.SupersetClient.export_dashboard:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: ΠΠΊΡΠΏΠΎΡΡΠΈΡΡΠ΅Ρ Π΄Π°ΡΠ±ΠΎΡΠ΄ Π² Π²ΠΈΠ΄Π΅ ZIP-Π°ΡΡ ΠΈΠ²Π°. # @PRE: dashboard_id must exist in Superset. # @POST: Returns ZIP content and filename. @@ -684,7 +684,7 @@ class SupersetClient: # [/DEF:export_dashboard:Function] # [DEF:backend.src.core.superset_client.SupersetClient.import_dashboard:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: ΠΠΌΠΏΠΎΡΡΠΈΡΡΠ΅Ρ Π΄Π°ΡΠ±ΠΎΡΠ΄ ΠΈΠ· ZIP-ΡΠ°ΠΉΠ»Π°. # @PRE: file_name must be a valid ZIP dashboard export. # @POST: Dashboard is imported or re-imported after deletion. @@ -716,7 +716,7 @@ class SupersetClient: # [/DEF:import_dashboard:Function] # [DEF:backend.src.core.superset_client.SupersetClient.delete_dashboard:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Π£Π΄Π°Π»ΡΠ΅Ρ Π΄Π°ΡΠ±ΠΎΡΠ΄ ΠΏΠΎ Π΅Π³ΠΎ ID ΠΈΠ»ΠΈ slug. # @PRE: dashboard_id must exist. # @POST: Dashboard is removed from Superset. @@ -738,7 +738,7 @@ class SupersetClient: # [SECTION: DATASET OPERATIONS] # [DEF:backend.src.core.superset_client.SupersetClient.get_datasets:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: ΠΠΎΠ»ΡΡΠ°Π΅Ρ ΠΏΠΎΠ»Π½ΡΠΉ ΡΠΏΠΈΡΠΎΠΊ Π΄Π°ΡΠ°ΡΠ΅ΡΠΎΠ², Π°Π²ΡΠΎΠΌΠ°ΡΠΈΡΠ΅ΡΠΊΠΈ ΠΎΠ±ΡΠ°Π±Π°ΡΡΠ²Π°Ρ ΠΏΠ°Π³ΠΈΠ½Π°ΡΠΈΡ. # @PRE: Client is authenticated. # @POST: Returns total count and list of datasets. @@ -759,7 +759,7 @@ class SupersetClient: # [/DEF:get_datasets:Function] # [DEF:backend.src.core.superset_client.SupersetClient.get_datasets_summary:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Fetches dataset metadata optimized for the Dataset Hub grid. # @PRE: Client is authenticated. # @POST: Returns a list of dataset metadata summaries. @@ -784,7 +784,7 @@ class SupersetClient: # [/DEF:get_datasets_summary:Function] # [DEF:backend.src.core.superset_client.SupersetClient.get_dataset_detail:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Fetches detailed dataset information including columns and linked dashboards # @PRE: Client is authenticated and dataset_id exists. # @POST: Returns detailed dataset info with columns and linked dashboards. @@ -897,7 +897,7 @@ class SupersetClient: # [/DEF:get_dataset_detail:Function] # [DEF:backend.src.core.superset_client.SupersetClient.get_dataset:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: ΠΠΎΠ»ΡΡΠ°Π΅Ρ ΠΈΠ½ΡΠΎΡΠΌΠ°ΡΠΈΡ ΠΎ ΠΊΠΎΠ½ΠΊΡΠ΅ΡΠ½ΠΎΠΌ Π΄Π°ΡΠ°ΡΠ΅ΡΠ΅ ΠΏΠΎ Π΅Π³ΠΎ ID. # @PRE: dataset_id must exist. # @POST: Returns dataset details. @@ -913,7 +913,7 @@ class SupersetClient: # [/DEF:get_dataset:Function] # [DEF:backend.src.core.superset_client.SupersetClient.update_dataset:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: ΠΠ±Π½ΠΎΠ²Π»ΡΠ΅Ρ Π΄Π°Π½Π½ΡΠ΅ Π΄Π°ΡΠ°ΡΠ΅ΡΠ° ΠΏΠΎ Π΅Π³ΠΎ ID. # @PRE: dataset_id must exist. # @POST: Dataset is updated in Superset. @@ -939,7 +939,7 @@ class SupersetClient: # [SECTION: DATABASE OPERATIONS] # [DEF:backend.src.core.superset_client.SupersetClient.get_databases:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: ΠΠΎΠ»ΡΡΠ°Π΅Ρ ΠΏΠΎΠ»Π½ΡΠΉ ΡΠΏΠΈΡΠΎΠΊ Π±Π°Π· Π΄Π°Π½Π½ΡΡ . # @PRE: Client is authenticated. # @POST: Returns total count and list of databases. @@ -962,7 +962,7 @@ class SupersetClient: # [/DEF:get_databases:Function] # [DEF:backend.src.core.superset_client.SupersetClient.get_database:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: ΠΠΎΠ»ΡΡΠ°Π΅Ρ ΠΈΠ½ΡΠΎΡΠΌΠ°ΡΠΈΡ ΠΎ ΠΊΠΎΠ½ΠΊΡΠ΅ΡΠ½ΠΎΠΉ Π±Π°Π·Π΅ Π΄Π°Π½Π½ΡΡ ΠΏΠΎ Π΅Ρ ID. # @PRE: database_id must exist. # @POST: Returns database details. @@ -978,7 +978,7 @@ class SupersetClient: # [/DEF:get_database:Function] # [DEF:backend.src.core.superset_client.SupersetClient.get_databases_summary:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Fetch a summary of databases including uuid, name, and engine. # @PRE: Client is authenticated. # @POST: Returns list of database summaries. @@ -999,7 +999,7 @@ class SupersetClient: # [/DEF:get_databases_summary:Function] # [DEF:backend.src.core.superset_client.SupersetClient.get_database_by_uuid:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Find a database by its UUID. # @PRE: db_uuid must be a valid UUID string. # @POST: Returns database info or None. @@ -1019,7 +1019,7 @@ class SupersetClient: # [SECTION: HELPERS] # [DEF:backend.src.core.superset_client.SupersetClient._resolve_target_id_for_delete:Function] - # @TIER: TRIVIAL + # @COMPLEXITY: 1 # @PURPOSE: Resolves a dashboard ID from either an ID or a slug. # @PRE: Either dash_id or dash_slug should be provided. # @POST: Returns the resolved ID or None. @@ -1042,7 +1042,7 @@ class SupersetClient: # [/DEF:_resolve_target_id_for_delete:Function] # [DEF:backend.src.core.superset_client.SupersetClient._do_import:Function] - # @TIER: TRIVIAL + # @COMPLEXITY: 1 # @PURPOSE: Performs the actual multipart upload for import. # @PRE: file_name must be a path to an existing ZIP file. # @POST: Returns the API response from the upload. @@ -1064,7 +1064,7 @@ class SupersetClient: # [/DEF:_do_import:Function] # [DEF:backend.src.core.superset_client.SupersetClient._validate_export_response:Function] - # @TIER: TRIVIAL + # @COMPLEXITY: 1 # @PURPOSE: Validates that the export response is a non-empty ZIP archive. # @PRE: response must be a valid requests.Response object. # @POST: Raises SupersetAPIError if validation fails. @@ -1078,7 +1078,7 @@ class SupersetClient: # [/DEF:_validate_export_response:Function] # [DEF:backend.src.core.superset_client.SupersetClient._resolve_export_filename:Function] - # @TIER: TRIVIAL + # @COMPLEXITY: 1 # @PURPOSE: Determines the filename for an exported dashboard. # @PRE: response must contain Content-Disposition header or dashboard_id must be provided. # @POST: Returns a sanitized filename string. @@ -1094,7 +1094,7 @@ class SupersetClient: # [/DEF:_resolve_export_filename:Function] # [DEF:backend.src.core.superset_client.SupersetClient._validate_query_params:Function] - # @TIER: TRIVIAL + # @COMPLEXITY: 1 # @PURPOSE: Ensures query parameters have default page and page_size. # @PRE: query can be None or a dictionary. # @POST: Returns a dictionary with at least page and page_size. @@ -1107,7 +1107,7 @@ class SupersetClient: # [/DEF:_validate_query_params:Function] # [DEF:backend.src.core.superset_client.SupersetClient._fetch_total_object_count:Function] - # @TIER: TRIVIAL + # @COMPLEXITY: 1 # @PURPOSE: Fetches the total number of items for a given endpoint. # @PRE: endpoint must be a valid Superset API path. # @POST: Returns the total count as an integer. @@ -1122,7 +1122,7 @@ class SupersetClient: # [/DEF:_fetch_total_object_count:Function] # [DEF:backend.src.core.superset_client.SupersetClient._fetch_all_pages:Function] - # @TIER: TRIVIAL + # @COMPLEXITY: 1 # @PURPOSE: Iterates through all pages to collect all data items. # @PRE: pagination_options must contain base_query, total_count, and results_field. # @POST: Returns a combined list of all items. @@ -1132,7 +1132,7 @@ class SupersetClient: # [/DEF:_fetch_all_pages:Function] # [DEF:backend.src.core.superset_client.SupersetClient._validate_import_file:Function] - # @TIER: TRIVIAL + # @COMPLEXITY: 1 # @PURPOSE: Validates that the file to be imported is a valid ZIP with metadata.yaml. # @PRE: zip_path must be a path to a file. # @POST: Raises error if file is missing, not a ZIP, or missing metadata. @@ -1149,7 +1149,7 @@ class SupersetClient: # [/DEF:_validate_import_file:Function] # [DEF:backend.src.core.superset_client.SupersetClient.get_all_resources:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Fetches all resources of a given type with id, uuid, and name columns. # @PARAM: resource_type (str) - One of "chart", "dataset", "dashboard". # @PRE: Client is authenticated. resource_type is valid. diff --git a/backend/src/core/superset_profile_lookup.py b/backend/src/core/superset_profile_lookup.py index d8a5d36f..858a3842 100644 --- a/backend/src/core/superset_profile_lookup.py +++ b/backend/src/core/superset_profile_lookup.py @@ -1,6 +1,6 @@ # [DEF:backend.src.core.superset_profile_lookup:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: superset, users, lookup, profile, pagination, normalization # @PURPOSE: Provides environment-scoped Superset account lookup adapter with stable normalized output. # @LAYER: Core @@ -19,7 +19,7 @@ from .utils.network import APIClient, AuthenticationError, SupersetAPIError # [DEF:SupersetAccountLookupAdapter:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Lookup Superset users and normalize candidates for profile binding. class SupersetAccountLookupAdapter: # [DEF:__init__:Function] diff --git a/backend/src/core/task_manager/__init__.py b/backend/src/core/task_manager/__init__.py index b2cc5b81..da9dc452 100644 --- a/backend/src/core/task_manager/__init__.py +++ b/backend/src/core/task_manager/__init__.py @@ -1,9 +1,12 @@ # [DEF:TaskManagerPackage:Module] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @SEMANTICS: task, manager, package, exports # @PURPOSE: Exports the public API of the task manager package. # @LAYER: Core -# @RELATION: Aggregates models and manager. +# @RELATION: DEPENDS_ON ->[TaskManagerModels] +# @RELATION: DEPENDS_ON ->[TaskManagerModule] +# @RELATION: DEPENDS_ON ->[backend.src.core.task_manager.manager.TaskManager] +# @INVARIANT: Package exports stay aligned with manager and models contracts. from .models import Task, TaskStatus, LogEntry from .manager import TaskManager diff --git a/backend/src/core/task_manager/__tests__/test_context.py b/backend/src/core/task_manager/__tests__/test_context.py index 5388f06a..4cea1c81 100644 --- a/backend/src/core/task_manager/__tests__/test_context.py +++ b/backend/src/core/task_manager/__tests__/test_context.py @@ -1,5 +1,5 @@ # [DEF:backend.src.core.task_manager.__tests__.test_context:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: tests, task-context, background-tasks, sub-context # @PURPOSE: Verify TaskContext preserves optional background task scheduler across sub-context creation. diff --git a/backend/src/core/task_manager/cleanup.py b/backend/src/core/task_manager/cleanup.py index 5f0fb68d..00b1147c 100644 --- a/backend/src/core/task_manager/cleanup.py +++ b/backend/src/core/task_manager/cleanup.py @@ -1,5 +1,5 @@ # [DEF:TaskCleanupModule:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: task, cleanup, retention, logs # @PURPOSE: Implements task cleanup and retention policies, including associated logs. # @LAYER: Core @@ -12,7 +12,7 @@ from ..config_manager import ConfigManager # [DEF:TaskCleanupService:Class] # @PURPOSE: Provides methods to clean up old task records and their associated logs. -# @TIER: STANDARD +# @COMPLEXITY: 3 class TaskCleanupService: # [DEF:__init__:Function] # @PURPOSE: Initializes the cleanup service with dependencies. diff --git a/backend/src/core/task_manager/context.py b/backend/src/core/task_manager/context.py index 2764b55d..3e410946 100644 --- a/backend/src/core/task_manager/context.py +++ b/backend/src/core/task_manager/context.py @@ -3,7 +3,7 @@ # @PURPOSE: Provides execution context passed to plugins during task execution. # @LAYER: Core # @RELATION: DEPENDS_ON -> TaskLogger, USED_BY -> plugins -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @INVARIANT: Each TaskContext is bound to a single task execution. # [SECTION: IMPORTS] @@ -16,7 +16,7 @@ from ..logger import belief_scope # [DEF:TaskContext:Class] # @SEMANTICS: context, task, execution, plugin # @PURPOSE: A container passed to plugin.execute() providing the logger and other task-specific utilities. -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @INVARIANT: logger is always a valid TaskLogger instance. # @UX_STATE: Idle -> Active -> Complete # diff --git a/backend/src/core/task_manager/manager.py b/backend/src/core/task_manager/manager.py index b2b4e31f..5e75d7d4 100644 --- a/backend/src/core/task_manager/manager.py +++ b/backend/src/core/task_manager/manager.py @@ -1,5 +1,5 @@ # [DEF:TaskManagerModule:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: task, manager, lifecycle, execution, state # @PURPOSE: Manages the lifecycle of tasks, including their creation, execution, and state tracking. It uses a thread pool to run plugins asynchronously. # @LAYER: Core @@ -38,7 +38,7 @@ from ..logger import logger, belief_scope, should_log_task_level # [/SECTION] # [DEF:TaskManager:Class] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: task, manager, lifecycle, execution, state # @PURPOSE: Manages the lifecycle of tasks, including their creation, execution, and state tracking. # @INVARIANT: Task IDs are unique within the registry. @@ -67,7 +67,7 @@ class TaskManager: LOG_FLUSH_INTERVAL = 2.0 # [DEF:__init__:Function] - # @TIER: CRITICAL + # @COMPLEXITY: 5 # @PURPOSE: Initialize the TaskManager with dependencies. # @PRE: plugin_loader is initialized. # @POST: TaskManager is ready to accept tasks. @@ -101,7 +101,7 @@ class TaskManager: # [/DEF:__init__:Function] # [DEF:_flusher_loop:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Background thread that periodically flushes log buffer to database. # @PRE: TaskManager is initialized. # @POST: Logs are batch-written to database every LOG_FLUSH_INTERVAL seconds. @@ -113,7 +113,7 @@ class TaskManager: # [/DEF:_flusher_loop:Function] # [DEF:_flush_logs:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Flush all buffered logs to the database. # @PRE: None. # @POST: All buffered logs are written to task_logs table. @@ -140,7 +140,7 @@ class TaskManager: # [/DEF:_flush_logs:Function] # [DEF:_flush_task_logs:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Flush logs for a specific task immediately. # @PRE: task_id exists. # @POST: Task's buffered logs are written to database. @@ -159,7 +159,7 @@ class TaskManager: # [/DEF:_flush_task_logs:Function] # [DEF:create_task:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Creates and queues a new task for execution. # @PRE: Plugin with plugin_id exists. Params are valid. # @POST: Task is created, added to registry, and scheduled for execution. @@ -189,7 +189,7 @@ class TaskManager: # [/DEF:create_task:Function] # [DEF:_run_task:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Internal method to execute a task with TaskContext support. # @PRE: Task exists in registry. # @POST: Task is executed, status updated to SUCCESS or FAILED. @@ -257,7 +257,7 @@ class TaskManager: # [/DEF:_run_task:Function] # [DEF:resolve_task:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Resumes a task that is awaiting mapping. # @PRE: Task exists and is in AWAITING_MAPPING state. # @POST: Task status updated to RUNNING, params updated, execution resumed. @@ -282,7 +282,7 @@ class TaskManager: # [/DEF:resolve_task:Function] # [DEF:wait_for_resolution:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Pauses execution and waits for a resolution signal. # @PRE: Task exists. # @POST: Execution pauses until future is set. @@ -305,7 +305,7 @@ class TaskManager: # [/DEF:wait_for_resolution:Function] # [DEF:wait_for_input:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Pauses execution and waits for user input. # @PRE: Task exists. # @POST: Execution pauses until future is set via resume_task_with_password. @@ -327,7 +327,7 @@ class TaskManager: # [/DEF:wait_for_input:Function] # [DEF:get_task:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Retrieves a task by its ID. # @PRE: task_id is a string. # @POST: Returns Task object or None. @@ -339,7 +339,7 @@ class TaskManager: # [/DEF:get_task:Function] # [DEF:get_all_tasks:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Retrieves all registered tasks. # @PRE: None. # @POST: Returns list of all Task objects. @@ -350,7 +350,7 @@ class TaskManager: # [/DEF:get_all_tasks:Function] # [DEF:get_tasks:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Retrieves tasks with pagination and optional status filter. # @PRE: limit and offset are non-negative integers. # @POST: Returns a list of tasks sorted by start_time descending. @@ -391,7 +391,7 @@ class TaskManager: # [/DEF:get_tasks:Function] # [DEF:get_task_logs:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Retrieves logs for a specific task (from memory for running, persistence for completed). # @PRE: task_id is a string. # @POST: Returns list of LogEntry or TaskLog objects. @@ -424,7 +424,7 @@ class TaskManager: # [/DEF:get_task_logs:Function] # [DEF:get_task_log_stats:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Get statistics about logs for a task. # @PRE: task_id is a valid task ID. # @POST: Returns LogStats with counts by level and source. @@ -436,7 +436,7 @@ class TaskManager: # [/DEF:get_task_log_stats:Function] # [DEF:get_task_log_sources:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Get unique sources for a task's logs. # @PRE: task_id is a valid task ID. # @POST: Returns list of unique source strings. @@ -448,7 +448,7 @@ class TaskManager: # [/DEF:get_task_log_sources:Function] # [DEF:_add_log:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Adds a log entry to a task buffer and notifies subscribers. # @PRE: Task exists. # @POST: Log added to buffer and pushed to queues (if level meets task_log_level filter). @@ -501,7 +501,7 @@ class TaskManager: # [/DEF:_add_log:Function] # [DEF:subscribe_logs:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Subscribes to real-time logs for a task. # @PRE: task_id is a string. # @POST: Returns an asyncio.Queue for log entries. @@ -517,7 +517,7 @@ class TaskManager: # [/DEF:subscribe_logs:Function] # [DEF:unsubscribe_logs:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Unsubscribes from real-time logs for a task. # @PRE: task_id is a string, queue is asyncio.Queue. # @POST: Queue removed from subscribers. @@ -533,7 +533,7 @@ class TaskManager: # [/DEF:unsubscribe_logs:Function] # [DEF:load_persisted_tasks:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Load persisted tasks using persistence service. # @PRE: None. # @POST: Persisted tasks loaded into self.tasks. @@ -546,7 +546,7 @@ class TaskManager: # [/DEF:load_persisted_tasks:Function] # [DEF:await_input:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Transition a task to AWAITING_INPUT state with input request. # @PRE: Task exists and is in RUNNING state. # @POST: Task status changed to AWAITING_INPUT, input_request set, persisted. @@ -569,7 +569,7 @@ class TaskManager: # [/DEF:await_input:Function] # [DEF:resume_task_with_password:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Resume a task that is awaiting input with provided passwords. # @PRE: Task exists and is in AWAITING_INPUT state. # @POST: Task status changed to RUNNING, passwords injected, task resumed. @@ -599,7 +599,7 @@ class TaskManager: # [/DEF:resume_task_with_password:Function] # [DEF:clear_tasks:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Clears tasks based on status filter (also deletes associated logs). # @PRE: status is Optional[TaskStatus]. # @POST: Tasks matching filter (or all non-active) cleared from registry and database. diff --git a/backend/src/core/task_manager/models.py b/backend/src/core/task_manager/models.py index a5232e29..fe32efd8 100644 --- a/backend/src/core/task_manager/models.py +++ b/backend/src/core/task_manager/models.py @@ -1,5 +1,5 @@ # [DEF:TaskManagerModels:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: task, models, pydantic, enum, state # @PURPOSE: Defines the data models and enumerations used by the Task Manager. # @LAYER: Core @@ -17,7 +17,7 @@ from pydantic import BaseModel, Field # [/SECTION] # [DEF:TaskStatus:Enum] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @SEMANTICS: task, status, state, enum # @PURPOSE: Defines the possible states a task can be in during its lifecycle. class TaskStatus(str, Enum): @@ -32,7 +32,7 @@ class TaskStatus(str, Enum): # [DEF:LogLevel:Enum] # @SEMANTICS: log, level, severity, enum # @PURPOSE: Defines the possible log levels for task logging. -# @TIER: STANDARD +# @COMPLEXITY: 3 class LogLevel(str, Enum): DEBUG = "DEBUG" INFO = "INFO" @@ -43,7 +43,7 @@ class LogLevel(str, Enum): # [DEF:LogEntry:Class] # @SEMANTICS: log, entry, record, pydantic # @PURPOSE: A Pydantic model representing a single, structured log entry associated with a task. -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @INVARIANT: Each log entry has a unique timestamp and source. # # @TEST_CONTRACT: LogEntryModel -> @@ -65,7 +65,7 @@ class LogEntry(BaseModel): # [DEF:TaskLog:Class] # @SEMANTICS: task, log, persistent, pydantic # @PURPOSE: A Pydantic model representing a persisted log entry from the database. -# @TIER: STANDARD +# @COMPLEXITY: 3 # @RELATION: MAPS_TO -> TaskLogRecord class TaskLog(BaseModel): id: int @@ -83,7 +83,7 @@ class TaskLog(BaseModel): # [DEF:LogFilter:Class] # @SEMANTICS: log, filter, query, pydantic # @PURPOSE: Filter parameters for querying task logs. -# @TIER: STANDARD +# @COMPLEXITY: 3 class LogFilter(BaseModel): level: Optional[str] = None # Filter by log level source: Optional[str] = None # Filter by source component @@ -95,7 +95,7 @@ class LogFilter(BaseModel): # [DEF:LogStats:Class] # @SEMANTICS: log, stats, aggregation, pydantic # @PURPOSE: Statistics about log entries for a task. -# @TIER: STANDARD +# @COMPLEXITY: 3 class LogStats(BaseModel): total_count: int by_level: Dict[str, int] # {"INFO": 10, "ERROR": 2} @@ -103,7 +103,7 @@ class LogStats(BaseModel): # [/DEF:LogStats:Class] # [DEF:Task:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: task, job, execution, state, pydantic # @PURPOSE: A Pydantic model representing a single execution instance of a plugin, including its status, parameters, and logs. class Task(BaseModel): diff --git a/backend/src/core/task_manager/persistence.py b/backend/src/core/task_manager/persistence.py index 99707708..b899c956 100644 --- a/backend/src/core/task_manager/persistence.py +++ b/backend/src/core/task_manager/persistence.py @@ -1,5 +1,5 @@ # [DEF:TaskPersistenceModule:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: persistence, sqlite, sqlalchemy, task, storage # @PURPOSE: Handles the persistence of tasks using SQLAlchemy and the tasks.db database. # @LAYER: Core @@ -8,7 +8,7 @@ # @SIDE_EFFECT: Performs database I/O on tasks.db. # @DATA_CONTRACT: Input[Task, LogEntry] -> Model[TaskRecord, TaskLogRecord] # @RELATION: [USED_BY] ->[backend.src.core.task_manager.manager.TaskManager] -# @RELATION: [DEPENDS_ON] ->[backend.src.core.database.TasksSessionLocal] +# @RELATION: [DEPENDS_ON] ->[TasksSessionLocal] # @INVARIANT: Database schema must match the TaskRecord model structure. # [SECTION: IMPORTS] @@ -26,12 +26,16 @@ from ..logger import logger, belief_scope # [/SECTION] # [DEF:TaskPersistenceService:Class] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: persistence, service, database, sqlalchemy -# @PURPOSE: Provides methods to save and load tasks from the tasks.db database using SQLAlchemy. -# @RELATION: [DEPENDS_ON] ->[backend.src.core.database.TasksSessionLocal] -# @RELATION: [DEPENDS_ON] ->[backend.src.models.task.TaskRecord] -# @RELATION: [DEPENDS_ON] ->[backend.src.models.mapping.Environment] +# @PURPOSE: Provides methods to save, load, and delete task records in tasks.db using SQLAlchemy models. +# @PRE: TasksSessionLocal must provide an active SQLAlchemy session, Task inputs must expose id/plugin_id/status/params/result/logs fields, and TaskRecord plus Environment schemas must be available. +# @POST: Persist operations leave matching TaskRecord rows committed or rolled back without leaking sessions, load operations return reconstructed Task objects from stored TaskRecord rows, and delete operations remove only the addressed task rows. +# @SIDE_EFFECT: Opens SQLAlchemy sessions, reads and writes task_records rows, resolves environment foreign keys against environments, commits or rolls back transactions, and emits error logs on persistence failures. +# @DATA_CONTRACT: Input[Task | List[Task] | List[str] | Query(limit:int,status:Optional[TaskStatus])] -> Model[TaskRecord, Environment] -> Output[None | List[Task]] +# @RELATION: [DEPENDS_ON] ->[TasksSessionLocal] +# @RELATION: [DEPENDS_ON] ->[TaskRecord] +# @RELATION: [DEPENDS_ON] ->[Environment] # @RELATION: [USED_BY] ->[backend.src.core.task_manager.manager.TaskManager] # @INVARIANT: Persistence must handle potentially missing task fields natively. # @@ -50,7 +54,7 @@ from ..logger import logger, belief_scope # @TEST_INVARIANT: accurate_round_trip -> verifies: [valid_task_persistence, load_corrupt_json_params] class TaskPersistenceService: # [DEF:_json_load_if_needed:Function] - # @TIER: TRIVIAL + # @COMPLEXITY: 1 # @PURPOSE: Safely load JSON strings from DB if necessary # @PRE: value is an arbitrary database value # @POST: Returns parsed JSON object, list, string, or primitive @@ -73,7 +77,7 @@ class TaskPersistenceService: # [/DEF:_json_load_if_needed:Function] # [DEF:_parse_datetime:Function] - # @TIER: TRIVIAL + # @COMPLEXITY: 1 # @PURPOSE: Safely parse a datetime string from the database # @PRE: value is an ISO string or datetime object # @POST: Returns datetime object or None @@ -91,7 +95,7 @@ class TaskPersistenceService: # [/DEF:_parse_datetime:Function] # [DEF:_resolve_environment_id:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Resolve environment id into existing environments.id value to satisfy FK constraints. # @PRE: Session is active # @POST: Returns existing environments.id or None when unresolved. @@ -130,7 +134,7 @@ class TaskPersistenceService: # [/DEF:_resolve_environment_id:Function] # [DEF:__init__:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Initializes the persistence service. # @PRE: None. # @POST: Service is ready. @@ -141,14 +145,14 @@ class TaskPersistenceService: # [/DEF:__init__:Function] # [DEF:persist_task:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Persists or updates a single task in the database. # @PRE: isinstance(task, Task) # @POST: Task record created or updated in database. # @PARAM: task (Task) - The task object to persist. # @SIDE_EFFECT: Writes to task_records table in tasks.db # @DATA_CONTRACT: Input[Task] -> Model[TaskRecord] - # @RELATION: [CALLS] ->[self._resolve_environment_id] + # @RELATION: [CALLS] ->[_resolve_environment_id] def persist_task(self, task: Task) -> None: with belief_scope("TaskPersistenceService.persist_task", f"task_id={task.id}"): session: Session = TasksSessionLocal() @@ -206,12 +210,12 @@ class TaskPersistenceService: # [/DEF:persist_task:Function] # [DEF:persist_tasks:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Persists multiple tasks. # @PRE: isinstance(tasks, list) # @POST: All tasks in list are persisted. # @PARAM: tasks (List[Task]) - The list of tasks to persist. - # @RELATION: [CALLS] ->[self.persist_task] + # @RELATION: [CALLS] ->[persist_task] def persist_tasks(self, tasks: List[Task]) -> None: with belief_scope("TaskPersistenceService.persist_tasks"): for task in tasks: @@ -219,7 +223,7 @@ class TaskPersistenceService: # [/DEF:persist_tasks:Function] # [DEF:load_tasks:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Loads tasks from the database. # @PRE: limit is an integer. # @POST: Returns list of Task objects. @@ -227,8 +231,8 @@ class TaskPersistenceService: # @PARAM: status (Optional[TaskStatus]) - Filter by status. # @RETURN: List[Task] - The loaded tasks. # @DATA_CONTRACT: Model[TaskRecord] -> Output[List[Task]] - # @RELATION: [CALLS] ->[self._json_load_if_needed] - # @RELATION: [CALLS] ->[self._parse_datetime] + # @RELATION: [CALLS] ->[_json_load_if_needed] + # @RELATION: [CALLS] ->[_parse_datetime] def load_tasks(self, limit: int = 100, status: Optional[TaskStatus] = None) -> List[Task]: with belief_scope("TaskPersistenceService.load_tasks"): session: Session = TasksSessionLocal() @@ -277,7 +281,7 @@ class TaskPersistenceService: # [/DEF:load_tasks:Function] # [DEF:delete_tasks:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Deletes specific tasks from the database. # @PRE: task_ids is a list of strings. # @POST: Specified task records deleted from database. @@ -297,15 +301,18 @@ class TaskPersistenceService: finally: session.close() # [/DEF:delete_tasks:Function] - # [/DEF:TaskPersistenceService:Class] # [DEF:TaskLogPersistenceService:Class] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: persistence, service, database, log, sqlalchemy -# @PURPOSE: Provides methods to save and query task logs from the task_logs table. -# @RELATION: [DEPENDS_ON] ->[backend.src.models.task.TaskLogRecord] -# @RELATION: [DEPENDS_ON] ->[backend.src.core.database.TasksSessionLocal] +# @PURPOSE: Provides methods to store, query, summarize, and delete task log rows in the task_logs table. +# @PRE: TasksSessionLocal must provide an active SQLAlchemy session, task_id inputs must identify task log rows, LogEntry batches must expose timestamp/level/source/message/metadata fields, and LogFilter inputs must provide pagination and filter attributes used by queries. +# @POST: add_logs commits all provided log entries or rolls back on failure, query methods return TaskLog or LogStats views reconstructed from TaskLogRecord rows, and delete methods remove only log rows matching the supplied task identifiers. +# @SIDE_EFFECT: Opens SQLAlchemy sessions, inserts, reads, aggregates, and deletes task_logs rows, serializes log metadata to JSON, commits or rolls back transactions, and emits error logs on persistence failures. +# @DATA_CONTRACT: Input[task_id:str, logs:List[LogEntry], log_filter:LogFilter, task_ids:List[str]] -> Model[TaskLogRecord] -> Output[None | List[TaskLog] | LogStats | List[str]] +# @RELATION: [DEPENDS_ON] ->[TaskLogRecord] +# @RELATION: [DEPENDS_ON] ->[TasksSessionLocal] # @RELATION: [USED_BY] ->[backend.src.core.task_manager.manager.TaskManager] # @INVARIANT: Log entries are batch-inserted for performance. # @@ -328,7 +335,7 @@ class TaskLogPersistenceService: """ # [DEF:__init__:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Initializes the TaskLogPersistenceService # @PRE: config is provided or defaults are used # @POST: Service is ready for log persistence @@ -337,7 +344,7 @@ class TaskLogPersistenceService: # [/DEF:__init__:Function] # [DEF:add_logs:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Batch insert log entries for a task. # @PRE: logs is a list of LogEntry objects. # @POST: All logs inserted into task_logs table. @@ -370,7 +377,7 @@ class TaskLogPersistenceService: # [/DEF:add_logs:Function] # [DEF:get_logs:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Query logs for a task with filtering and pagination. # @PRE: task_id is a valid task ID. # @POST: Returns list of TaskLog objects matching filters. @@ -424,7 +431,7 @@ class TaskLogPersistenceService: # [/DEF:get_logs:Function] # [DEF:get_log_stats:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Get statistics about logs for a task. # @PRE: task_id is a valid task ID. # @POST: Returns LogStats with counts by level and source. @@ -471,7 +478,7 @@ class TaskLogPersistenceService: # [/DEF:get_log_stats:Function] # [DEF:get_sources:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Get unique sources for a task's logs. # @PRE: task_id is a valid task ID. # @POST: Returns list of unique source strings. @@ -492,7 +499,7 @@ class TaskLogPersistenceService: # [/DEF:get_sources:Function] # [DEF:delete_logs_for_task:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Delete all logs for a specific task. # @PRE: task_id is a valid task ID. # @POST: All logs for the task are deleted. @@ -514,7 +521,7 @@ class TaskLogPersistenceService: # [/DEF:delete_logs_for_task:Function] # [DEF:delete_logs_for_tasks:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Delete all logs for multiple tasks. # @PRE: task_ids is a list of task IDs. # @POST: All logs for the tasks are deleted. @@ -536,6 +543,5 @@ class TaskLogPersistenceService: finally: session.close() # [/DEF:delete_logs_for_tasks:Function] - # [/DEF:TaskLogPersistenceService:Class] # [/DEF:TaskPersistenceModule:Module] diff --git a/backend/src/core/task_manager/task_logger.py b/backend/src/core/task_manager/task_logger.py index a548ae14..4d242f6d 100644 --- a/backend/src/core/task_manager/task_logger.py +++ b/backend/src/core/task_manager/task_logger.py @@ -3,7 +3,7 @@ # @PURPOSE: Provides a dedicated logger for tasks with automatic source attribution. # @LAYER: Core # @RELATION: DEPENDS_ON -> TaskManager, CALLS -> TaskManager._add_log -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @INVARIANT: Each TaskLogger instance is bound to a specific task_id and default source. # [SECTION: IMPORTS] @@ -13,7 +13,7 @@ from typing import Dict, Any, Optional, Callable # [DEF:TaskLogger:Class] # @SEMANTICS: logger, task, source, attribution # @PURPOSE: A wrapper around TaskManager._add_log that carries task_id and source context. -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @INVARIANT: All log calls include the task_id and source. # @UX_STATE: Idle -> Logging -> (system records log) # diff --git a/backend/src/core/utils/async_network.py b/backend/src/core/utils/async_network.py index 742d96a4..446c1a8a 100644 --- a/backend/src/core/utils/async_network.py +++ b/backend/src/core/utils/async_network.py @@ -1,9 +1,13 @@ # [DEF:backend.src.core.utils.async_network:Module] # -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: network, httpx, async, superset, authentication, cache # @PURPOSE: Provides async Superset API client with shared auth-token cache to avoid per-request re-login. # @LAYER: Infra +# @PRE: Config payloads contain a Superset base URL and authentication fields needed for login. +# @POST: Async network clients reuse cached auth tokens and expose stable async request/error translation flow. +# @SIDE_EFFECT: Performs upstream HTTP I/O and mutates process-local auth cache entries. +# @DATA_CONTRACT: Input[config: Dict[str, Any]] -> Output[authenticated async Superset HTTP interactions] # @RELATION: DEPENDS_ON -> backend.src.core.utils.network.SupersetAuthCache # @INVARIANT: Async client reuses cached auth tokens per environment credentials and invalidates on 401. @@ -25,8 +29,8 @@ from .network import ( # [/SECTION] -# [DEF:AsyncAPIClient:Class] -# @TIER: STANDARD +# [DEF:backend.src.core.utils.async_network.AsyncAPIClient:Class] +# @COMPLEXITY: 3 # @PURPOSE: Async Superset API client backed by httpx.AsyncClient with shared auth cache. # @RELATION: [DEPENDS_ON] ->[backend.src.core.utils.network.SupersetAuthCache] # @RELATION: [CALLS] ->[backend.src.core.utils.network.SupersetAuthCache.get] @@ -35,8 +39,8 @@ class AsyncAPIClient: DEFAULT_TIMEOUT = 30 _auth_locks: Dict[tuple[str, str, bool], asyncio.Lock] = {} - # [DEF:__init__:Function] - # @TIER: STANDARD + # [DEF:backend.src.core.utils.async_network.AsyncAPIClient.__init__:Function] + # @COMPLEXITY: 3 # @PURPOSE: Initialize async API client for one environment. # @PRE: config contains base_url and auth payload. # @POST: Client is ready for async request/authentication flow. @@ -61,8 +65,8 @@ class AsyncAPIClient: # [/DEF:__init__:Function] - # [DEF:_normalize_base_url:Function] - # @TIER: TRIVIAL + # [DEF:backend.src.core.utils.async_network.AsyncAPIClient._normalize_base_url:Function] + # @COMPLEXITY: 1 # @PURPOSE: Normalize base URL for Superset API root construction. # @POST: Returns canonical base URL without trailing slash and duplicate /api/v1 suffix. def _normalize_base_url(self, raw_url: str) -> str: @@ -73,7 +77,7 @@ class AsyncAPIClient: # [/DEF:_normalize_base_url:Function] # [DEF:_build_api_url:Function] - # @TIER: TRIVIAL + # @COMPLEXITY: 1 # @PURPOSE: Build full API URL from relative Superset endpoint. # @POST: Returns absolute URL for upstream request. def _build_api_url(self, endpoint: str) -> str: @@ -88,7 +92,7 @@ class AsyncAPIClient: # [/DEF:_build_api_url:Function] # [DEF:_get_auth_lock:Function] - # @TIER: TRIVIAL + # @COMPLEXITY: 1 # @PURPOSE: Return per-cache-key async lock to serialize fresh login attempts. # @POST: Returns stable asyncio.Lock instance. @classmethod @@ -102,7 +106,7 @@ class AsyncAPIClient: # [/DEF:_get_auth_lock:Function] # [DEF:authenticate:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Authenticate against Superset and cache access/csrf tokens. # @POST: Client tokens are populated and reusable across requests. # @SIDE_EFFECT: Performs network requests to Superset authentication endpoints. @@ -162,7 +166,7 @@ class AsyncAPIClient: # [/DEF:authenticate:Function] # [DEF:get_headers:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Return authenticated Superset headers for async requests. # @POST: Headers include Authorization and CSRF tokens. # @RELATION: CALLS -> self.authenticate @@ -178,7 +182,7 @@ class AsyncAPIClient: # [/DEF:get_headers:Function] # [DEF:request:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Perform one authenticated async Superset API request. # @POST: Returns JSON payload or raw httpx.Response when raw_response=true. # @SIDE_EFFECT: Performs network I/O. @@ -215,7 +219,7 @@ class AsyncAPIClient: # [/DEF:request:Function] # [DEF:_handle_http_error:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Translate upstream HTTP errors into stable domain exceptions. # @POST: Raises domain-specific exception for caller flow control. # @DATA_CONTRACT: Input[httpx.HTTPStatusError] -> Exception @@ -234,7 +238,7 @@ class AsyncAPIClient: # [/DEF:_handle_http_error:Function] # [DEF:_handle_network_error:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Translate generic httpx errors into NetworkError. # @POST: Raises NetworkError with URL context. # @DATA_CONTRACT: Input[httpx.HTTPError] -> NetworkError @@ -250,7 +254,7 @@ class AsyncAPIClient: # [/DEF:_handle_network_error:Function] # [DEF:aclose:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Close underlying httpx client. # @POST: Client resources are released. # @SIDE_EFFECT: Closes network connections. diff --git a/backend/src/core/utils/network.py b/backend/src/core/utils/network.py index 7183b9e1..e8d44519 100644 --- a/backend/src/core/utils/network.py +++ b/backend/src/core/utils/network.py @@ -1,5 +1,6 @@ -# [DEF:backend.core.utils.network:Module] +# [DEF:network:Module] # +# @COMPLEXITY: 3 # @SEMANTICS: network, http, client, api, requests, session, authentication # @PURPOSE: ΠΠ½ΠΊΠ°ΠΏΡΡΠ»ΠΈΡΡΠ΅Ρ Π½ΠΈΠ·ΠΊΠΎΡΡΠΎΠ²Π½Π΅Π²ΡΡ HTTP-Π»ΠΎΠ³ΠΈΠΊΡ Π΄Π»Ρ Π²Π·Π°ΠΈΠΌΠΎΠ΄Π΅ΠΉΡΡΠ²ΠΈΡ Ρ Superset API, Π²ΠΊΠ»ΡΡΠ°Ρ Π°ΡΡΠ΅Π½ΡΠΈΡΠΈΠΊΠ°ΡΠΈΡ, ΡΠΏΡΠ°Π²Π»Π΅Π½ΠΈΠ΅ ΡΠ΅ΡΡΠΈΠ΅ΠΉ, retry-Π»ΠΎΠ³ΠΈΠΊΡ ΠΈ ΠΎΠ±ΡΠ°Π±ΠΎΡΠΊΡ ΠΎΡΠΈΠ±ΠΎΠΊ. # @LAYER: Infra @@ -22,9 +23,11 @@ from ..logger import logger as app_logger, belief_scope # [/SECTION] # [DEF:SupersetAPIError:Class] +# @COMPLEXITY: 1 # @PURPOSE: Base exception for all Superset API related errors. class SupersetAPIError(Exception): # [DEF:__init__:Function] + # @COMPLEXITY: 1 # @PURPOSE: Initializes the exception with a message and context. # @PRE: message is a string, context is a dict. # @POST: Exception is initialized with context. @@ -36,9 +39,11 @@ class SupersetAPIError(Exception): # [/DEF:SupersetAPIError:Class] # [DEF:AuthenticationError:Class] +# @COMPLEXITY: 1 # @PURPOSE: Exception raised when authentication fails. class AuthenticationError(SupersetAPIError): # [DEF:__init__:Function] + # @COMPLEXITY: 1 # @PURPOSE: Initializes the authentication error. # @PRE: message is a string, context is a dict. # @POST: AuthenticationError is initialized. @@ -77,7 +82,7 @@ class DashboardNotFoundError(SupersetAPIError): # [DEF:NetworkError:Class] # @PURPOSE: Exception raised when a network level error occurs. class NetworkError(Exception): - # [DEF:__init__:Function] + # [DEF:network.APIClient.__init__:Function] # @PURPOSE: Initializes the network error. # @PRE: message is a string. # @POST: NetworkError is initialized. @@ -89,7 +94,7 @@ class NetworkError(Exception): # [/DEF:NetworkError:Class] -# [DEF:SupersetAuthCache:Class] +# [DEF:network.SupersetAuthCache:Class] # @PURPOSE: Process-local cache for Superset access/csrf tokens keyed by environment credentials. # @PRE: base_url and username are stable strings. # @POST: Cached entries expire automatically by TTL and can be reused across requests. @@ -145,10 +150,10 @@ class SupersetAuthCache: # [/DEF:SupersetAuthCache:Class] # [DEF:APIClient:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Synchronous Superset API client with process-local auth token caching. -# @RELATION: DEPENDS_ON -> backend.src.core.utils.network.SupersetAuthCache -# @RELATION: DEPENDS_ON -> backend.src.core.logger.logger +# @RELATION: DEPENDS_ON -> network.SupersetAuthCache +# @RELATION: DEPENDS_ON -> logger class APIClient: DEFAULT_TIMEOUT = 30 diff --git a/backend/src/dependencies.py b/backend/src/dependencies.py index 20716bcc..3c57c730 100755 --- a/backend/src/dependencies.py +++ b/backend/src/dependencies.py @@ -1,5 +1,5 @@ -# [DEF:Dependencies:Module] -# @TIER: STANDARD +# [DEF:backend.src.dependencies:Module] +# @COMPLEXITY: 3 # @SEMANTICS: dependency, injection, singleton, factory, auth, jwt # @PURPOSE: Manages creation and provision of shared application dependencies, such as PluginLoader and TaskManager, to avoid circular imports. # @LAYER: Core @@ -40,7 +40,7 @@ init_db() config_manager = ConfigManager(config_path=str(config_path)) # [DEF:get_config_manager:Function] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Dependency injector for ConfigManager. # @PRE: Global config_manager must be initialized. # @POST: Returns shared ConfigManager instance. @@ -71,7 +71,7 @@ logger.info("ResourceService initialized") # initialize them inside the dependency functions. # [DEF:get_plugin_loader:Function] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Dependency injector for PluginLoader. # @PRE: Global plugin_loader must be initialized. # @POST: Returns shared PluginLoader instance. @@ -82,7 +82,7 @@ def get_plugin_loader() -> PluginLoader: # [/DEF:get_plugin_loader:Function] # [DEF:get_task_manager:Function] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Dependency injector for TaskManager. # @PRE: Global task_manager must be initialized. # @POST: Returns shared TaskManager instance. @@ -93,7 +93,7 @@ def get_task_manager() -> TaskManager: # [/DEF:get_task_manager:Function] # [DEF:get_scheduler_service:Function] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Dependency injector for SchedulerService. # @PRE: Global scheduler_service must be initialized. # @POST: Returns shared SchedulerService instance. @@ -104,7 +104,7 @@ def get_scheduler_service() -> SchedulerService: # [/DEF:get_scheduler_service:Function] # [DEF:get_resource_service:Function] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Dependency injector for ResourceService. # @PRE: Global resource_service must be initialized. # @POST: Returns shared ResourceService instance. @@ -115,7 +115,7 @@ def get_resource_service() -> ResourceService: # [/DEF:get_resource_service:Function] # [DEF:get_mapping_service:Function] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Dependency injector for MappingService. # @PRE: Global config_manager must be initialized. # @POST: Returns new MappingService instance. @@ -129,7 +129,7 @@ def get_mapping_service() -> MappingService: _clean_release_repository = CleanReleaseRepository() # [DEF:get_clean_release_repository:Function] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Legacy compatibility shim for CleanReleaseRepository. # @POST: Returns a shared CleanReleaseRepository instance. def get_clean_release_repository() -> CleanReleaseRepository: @@ -139,7 +139,7 @@ def get_clean_release_repository() -> CleanReleaseRepository: # [DEF:get_clean_release_facade:Function] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Dependency injector for CleanReleaseFacade. # @POST: Returns a facade instance with a fresh DB session. def get_clean_release_facade(db = Depends(get_db)) -> CleanReleaseFacade: @@ -168,13 +168,13 @@ def get_clean_release_facade(db = Depends(get_db)) -> CleanReleaseFacade: # [/DEF:get_clean_release_facade:Function] # [DEF:oauth2_scheme:Variable] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: OAuth2 password bearer scheme for token extraction. oauth2_scheme = OAuth2PasswordBearer(tokenUrl="/api/auth/login") # [/DEF:oauth2_scheme:Variable] # [DEF:get_current_user:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Dependency for retrieving currently authenticated user from a JWT. # @PRE: JWT token provided in Authorization header. # @POST: Returns User object if token is valid. @@ -204,7 +204,7 @@ def get_current_user(token: str = Depends(oauth2_scheme), db = Depends(get_auth_ # [/DEF:get_current_user:Function] # [DEF:has_permission:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Dependency for checking if the current user has a specific permission. # @PRE: User is authenticated. # @POST: Returns True if user has permission. @@ -234,4 +234,4 @@ def has_permission(resource: str, action: str): return permission_checker # [/DEF:has_permission:Function] -# [/DEF:Dependencies:Module] +# [/DEF:backend.src.dependencies:Module] diff --git a/backend/src/models/__tests__/test_models.py b/backend/src/models/__tests__/test_models.py index fdec3f78..c3abb811 100644 --- a/backend/src/models/__tests__/test_models.py +++ b/backend/src/models/__tests__/test_models.py @@ -1,5 +1,5 @@ # [DEF:test_models:Module] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Unit tests for data models # @LAYER: Domain # @RELATION: VERIFIES -> src.models diff --git a/backend/src/models/__tests__/test_report_models.py b/backend/src/models/__tests__/test_report_models.py index e3ce0e9f..05be2630 100644 --- a/backend/src/models/__tests__/test_report_models.py +++ b/backend/src/models/__tests__/test_report_models.py @@ -1,5 +1,5 @@ # [DEF:test_report_models:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Unit tests for report Pydantic models and their validators # @LAYER: Domain # @RELATION: TESTS -> backend.src.models.report diff --git a/backend/src/models/assistant.py b/backend/src/models/assistant.py index 90f74bc8..17e9d128 100644 --- a/backend/src/models/assistant.py +++ b/backend/src/models/assistant.py @@ -1,5 +1,5 @@ # [DEF:backend.src.models.assistant:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: assistant, audit, confirmation, chat # @PURPOSE: SQLAlchemy models for assistant audit trail and confirmation tokens. # @LAYER: Domain @@ -14,7 +14,7 @@ from .mapping import Base # [DEF:AssistantAuditRecord:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Store audit decisions and outcomes produced by assistant command handling. # @PRE: user_id must identify the actor for every record. # @POST: Audit payload remains available for compliance and debugging. @@ -33,7 +33,7 @@ class AssistantAuditRecord(Base): # [DEF:AssistantMessageRecord:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Persist chat history entries for assistant conversations. # @PRE: user_id, conversation_id, role and text must be present. # @POST: Message row can be queried in chronological order. @@ -54,7 +54,7 @@ class AssistantMessageRecord(Base): # [DEF:AssistantConfirmationRecord:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Persist risky operation confirmation tokens with lifecycle state. # @PRE: intent/dispatch and expiry timestamp must be provided. # @POST: State transitions can be tracked and audited. diff --git a/backend/src/models/auth.py b/backend/src/models/auth.py index b36db945..870be068 100644 --- a/backend/src/models/auth.py +++ b/backend/src/models/auth.py @@ -1,6 +1,6 @@ # [DEF:backend.src.models.auth:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: auth, models, user, role, permission, sqlalchemy # @PURPOSE: SQLAlchemy models for multi-user authentication and authorization. # @LAYER: Domain diff --git a/backend/src/models/clean_release.py b/backend/src/models/clean_release.py index 909f4038..628a09eb 100644 --- a/backend/src/models/clean_release.py +++ b/backend/src/models/clean_release.py @@ -1,5 +1,5 @@ # [DEF:backend.src.models.clean_release:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: clean-release, models, lifecycle, compliance, evidence, immutability # @PURPOSE: Define canonical clean release domain entities and lifecycle guards. # @LAYER: Domain diff --git a/backend/src/models/config.py b/backend/src/models/config.py index a73bf5f4..7a604fb5 100644 --- a/backend/src/models/config.py +++ b/backend/src/models/config.py @@ -1,6 +1,6 @@ # [DEF:backend.src.models.config:Module] # -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: database, config, settings, sqlalchemy, notification # @PURPOSE: Defines SQLAlchemy persistence models for application and notification configuration records. # @LAYER: Domain diff --git a/backend/src/models/connection.py b/backend/src/models/connection.py index 6c930eac..ef0daf09 100644 --- a/backend/src/models/connection.py +++ b/backend/src/models/connection.py @@ -1,6 +1,6 @@ # [DEF:backend.src.models.connection:Module] # -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @SEMANTICS: database, connection, configuration, sqlalchemy, sqlite # @PURPOSE: Defines the database schema for external database connection configurations. # @LAYER: Domain @@ -16,7 +16,7 @@ import uuid # [/SECTION] # [DEF:ConnectionConfig:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Stores credentials for external databases used for column mapping. class ConnectionConfig(Base): __tablename__ = "connection_configs" diff --git a/backend/src/models/dashboard.py b/backend/src/models/dashboard.py index a190c022..c47067ac 100644 --- a/backend/src/models/dashboard.py +++ b/backend/src/models/dashboard.py @@ -1,5 +1,5 @@ # [DEF:backend.src.models.dashboard:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: dashboard, model, metadata, migration # @PURPOSE: Defines data models for dashboard metadata and selection. # @LAYER: Model @@ -9,7 +9,7 @@ from pydantic import BaseModel from typing import List # [DEF:DashboardMetadata:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Represents a dashboard available for migration. class DashboardMetadata(BaseModel): id: int @@ -19,7 +19,7 @@ class DashboardMetadata(BaseModel): # [/DEF:DashboardMetadata:Class] # [DEF:DashboardSelection:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Represents the user's selection of dashboards to migrate. class DashboardSelection(BaseModel): selected_ids: List[int] diff --git a/backend/src/models/git.py b/backend/src/models/git.py index 938b282f..f7cbd474 100644 --- a/backend/src/models/git.py +++ b/backend/src/models/git.py @@ -1,5 +1,5 @@ # [DEF:GitModels:Module] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @SEMANTICS: git, models, sqlalchemy, database, schema # @PURPOSE: Git-specific SQLAlchemy models for configuration and repository tracking. # @LAYER: Model @@ -27,7 +27,7 @@ class SyncStatus(str, enum.Enum): CONFLICT = "CONFLICT" # [DEF:GitServerConfig:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Configuration for a Git server connection. class GitServerConfig(Base): __tablename__ = "git_server_configs" @@ -44,7 +44,7 @@ class GitServerConfig(Base): # [/DEF:GitServerConfig:Class] # [DEF:GitRepository:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Tracking for a local Git repository linked to a dashboard. class GitRepository(Base): __tablename__ = "git_repositories" @@ -59,7 +59,7 @@ class GitRepository(Base): # [/DEF:GitRepository:Class] # [DEF:DeploymentEnvironment:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Target Superset environments for dashboard deployment. class DeploymentEnvironment(Base): __tablename__ = "deployment_environments" diff --git a/backend/src/models/llm.py b/backend/src/models/llm.py index 6de5aa42..906dbdc6 100644 --- a/backend/src/models/llm.py +++ b/backend/src/models/llm.py @@ -1,5 +1,5 @@ # [DEF:backend.src.models.llm:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: llm, models, sqlalchemy, persistence # @PURPOSE: SQLAlchemy models for LLM provider configuration and validation results. # @LAYER: Domain diff --git a/backend/src/models/mapping.py b/backend/src/models/mapping.py index edb4de49..e0afb1e0 100644 --- a/backend/src/models/mapping.py +++ b/backend/src/models/mapping.py @@ -1,6 +1,6 @@ # [DEF:backend.src.models.mapping:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: database, mapping, environment, migration, sqlalchemy, sqlite # @PURPOSE: Defines the database schema for environment metadata and database mappings using SQLAlchemy. # @LAYER: Domain @@ -20,7 +20,7 @@ import enum Base = declarative_base() # [DEF:ResourceType:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Enumeration of possible Superset resource types for ID mapping. class ResourceType(str, enum.Enum): CHART = "chart" @@ -30,7 +30,7 @@ class ResourceType(str, enum.Enum): # [DEF:MigrationStatus:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Enumeration of possible migration job statuses. class MigrationStatus(enum.Enum): PENDING = "PENDING" @@ -41,7 +41,7 @@ class MigrationStatus(enum.Enum): # [/DEF:MigrationStatus:Class] # [DEF:Environment:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Represents a Superset instance environment. class Environment(Base): __tablename__ = "environments" @@ -53,7 +53,7 @@ class Environment(Base): # [/DEF:Environment:Class] # [DEF:DatabaseMapping:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Represents a mapping between source and target databases. class DatabaseMapping(Base): __tablename__ = "database_mappings" @@ -69,7 +69,7 @@ class DatabaseMapping(Base): # [/DEF:DatabaseMapping:Class] # [DEF:MigrationJob:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 2 # @PURPOSE: Represents a single migration execution job. class MigrationJob(Base): __tablename__ = "migration_jobs" @@ -83,7 +83,7 @@ class MigrationJob(Base): # [/DEF:MigrationJob:Class] # [DEF:ResourceMapping:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Maps a universal UUID for a resource to its actual ID on a specific environment. # @TEST_DATA: resource_mapping_record -> {'environment_id': 'prod-env-1', 'resource_type': 'chart', 'uuid': '123e4567-e89b-12d3-a456-426614174000', 'remote_integer_id': '42'} class ResourceMapping(Base): diff --git a/backend/src/models/profile.py b/backend/src/models/profile.py index 1a2f8278..3c73ba97 100644 --- a/backend/src/models/profile.py +++ b/backend/src/models/profile.py @@ -1,6 +1,6 @@ # [DEF:backend.src.models.profile:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: profile, preferences, persistence, user, dashboard-filter, git, ui-preferences, sqlalchemy # @PURPOSE: Defines persistent per-user profile settings for dashboard filter, Git identity/token, and UX preferences. # @LAYER: Domain @@ -20,7 +20,7 @@ from .mapping import Base # [DEF:UserDashboardPreference:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Stores Superset username binding and default "my dashboards" toggle for one authenticated user. class UserDashboardPreference(Base): __tablename__ = "user_dashboard_preferences" diff --git a/backend/src/models/report.py b/backend/src/models/report.py index 165f8925..f7d9b448 100644 --- a/backend/src/models/report.py +++ b/backend/src/models/report.py @@ -1,5 +1,5 @@ # [DEF:backend.src.models.report:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: reports, models, pydantic, normalization, pagination # @PURPOSE: Canonical report schemas for unified task reporting across heterogeneous task types. # @LAYER: Domain @@ -20,7 +20,7 @@ from pydantic import BaseModel, Field, field_validator, model_validator # [DEF:TaskType:Class] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @INVARIANT: Must contain valid generic task type mappings. # @SEMANTICS: enum, type, task # @PURPOSE: Supported normalized task report types. @@ -35,7 +35,7 @@ class TaskType(str, Enum): # [DEF:ReportStatus:Class] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @INVARIANT: TaskStatus enum mapping logic holds. # @SEMANTICS: enum, status, task # @PURPOSE: Supported normalized report status values. @@ -48,7 +48,7 @@ class ReportStatus(str, Enum): # [DEF:ErrorContext:Class] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @INVARIANT: The properties accurately describe error state. # @SEMANTICS: error, context, payload # @PURPOSE: Error and recovery context for failed/partial reports. @@ -73,7 +73,7 @@ class ErrorContext(BaseModel): # [DEF:TaskReport:Class] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @INVARIANT: Must represent canonical task record attributes. # @SEMANTICS: report, model, summary # @PURPOSE: Canonical normalized report envelope for one task execution. @@ -130,7 +130,7 @@ class TaskReport(BaseModel): # [DEF:ReportQuery:Class] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @INVARIANT: Time and pagination queries are mutually consistent. # @SEMANTICS: query, filter, search # @PURPOSE: Query object for server-side report filtering, sorting, and pagination. @@ -188,7 +188,7 @@ class ReportQuery(BaseModel): # [DEF:ReportCollection:Class] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @INVARIANT: Represents paginated data correctly. # @SEMANTICS: collection, pagination # @PURPOSE: Paginated collection of normalized task reports. @@ -213,7 +213,7 @@ class ReportCollection(BaseModel): # [DEF:ReportDetailView:Class] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @INVARIANT: Incorporates a report and logs correctly. # @SEMANTICS: view, detail, logs # @PURPOSE: Detailed report representation including diagnostics and recovery actions. diff --git a/backend/src/models/storage.py b/backend/src/models/storage.py index cdf039ed..3283db44 100644 --- a/backend/src/models/storage.py +++ b/backend/src/models/storage.py @@ -1,5 +1,5 @@ # [DEF:backend.src.models.storage:Module] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @SEMANTICS: storage, file, model, pydantic # @PURPOSE: Data models for the storage system. # @LAYER: Domain @@ -10,7 +10,7 @@ from typing import Optional from pydantic import BaseModel, Field # [DEF:FileCategory:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Enumeration of supported file categories in the storage system. class FileCategory(str, Enum): BACKUP = "backups" @@ -18,7 +18,7 @@ class FileCategory(str, Enum): # [/DEF:FileCategory:Class] # [DEF:StorageConfig:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Configuration model for the storage system, defining paths and naming patterns. class StorageConfig(BaseModel): root_path: str = Field(default="backups", description="Absolute path to the storage root directory.") @@ -30,7 +30,7 @@ class StorageConfig(BaseModel): # [/DEF:StorageConfig:Class] # [DEF:StoredFile:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Data model representing metadata for a file stored in the system. class StoredFile(BaseModel): name: str = Field(..., description="Name of the file (including extension).") diff --git a/backend/src/models/task.py b/backend/src/models/task.py index c3cd002f..c532dde0 100644 --- a/backend/src/models/task.py +++ b/backend/src/models/task.py @@ -1,6 +1,6 @@ # [DEF:backend.src.models.task:Module] # -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @SEMANTICS: database, task, record, sqlalchemy, sqlite # @PURPOSE: Defines the database schema for task execution records. # @LAYER: Domain @@ -16,7 +16,7 @@ import uuid # [/SECTION] # [DEF:TaskRecord:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Represents a persistent record of a task execution. class TaskRecord(Base): __tablename__ = "task_records" @@ -36,7 +36,7 @@ class TaskRecord(Base): # [DEF:TaskLogRecord:Class] # @PURPOSE: Represents a single persistent log entry for a task. -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @RELATION: DEPENDS_ON -> TaskRecord # @INVARIANT: Each log entry belongs to exactly one task. # diff --git a/backend/src/plugins/git/llm_extension.py b/backend/src/plugins/git/llm_extension.py index d621269c..58f9b0e7 100644 --- a/backend/src/plugins/git/llm_extension.py +++ b/backend/src/plugins/git/llm_extension.py @@ -1,5 +1,5 @@ # [DEF:backend/src/plugins/git/llm_extension:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: git, llm, commit # @PURPOSE: LLM-based extensions for the Git plugin, specifically for commit message generation. # @LAYER: Domain diff --git a/backend/src/plugins/llm_analysis/__init__.py b/backend/src/plugins/llm_analysis/__init__.py index 56483a78..fd678af2 100644 --- a/backend/src/plugins/llm_analysis/__init__.py +++ b/backend/src/plugins/llm_analysis/__init__.py @@ -1,5 +1,5 @@ # [DEF:backend/src/plugins/llm_analysis/__init__.py:Module] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Initialize the LLM Analysis plugin package. # @LAYER: Domain diff --git a/backend/src/plugins/llm_analysis/__tests__/test_client_headers.py b/backend/src/plugins/llm_analysis/__tests__/test_client_headers.py index 2e665c6e..9eb163b1 100644 --- a/backend/src/plugins/llm_analysis/__tests__/test_client_headers.py +++ b/backend/src/plugins/llm_analysis/__tests__/test_client_headers.py @@ -1,5 +1,5 @@ # [DEF:backend.src.plugins.llm_analysis.__tests__.test_client_headers:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: tests, llm-client, openrouter, headers # @PURPOSE: Verify OpenRouter client initialization includes provider-specific headers. diff --git a/backend/src/plugins/llm_analysis/__tests__/test_screenshot_service.py b/backend/src/plugins/llm_analysis/__tests__/test_screenshot_service.py index d4bf32e1..3425ad9f 100644 --- a/backend/src/plugins/llm_analysis/__tests__/test_screenshot_service.py +++ b/backend/src/plugins/llm_analysis/__tests__/test_screenshot_service.py @@ -1,5 +1,5 @@ # [DEF:backend.src.plugins.llm_analysis.__tests__.test_screenshot_service:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: tests, screenshot-service, navigation, timeout-regression # @PURPOSE: Protect dashboard screenshot navigation from brittle networkidle waits. diff --git a/backend/src/plugins/llm_analysis/__tests__/test_service.py b/backend/src/plugins/llm_analysis/__tests__/test_service.py index e6a3a72b..4c3d70f3 100644 --- a/backend/src/plugins/llm_analysis/__tests__/test_service.py +++ b/backend/src/plugins/llm_analysis/__tests__/test_service.py @@ -1,5 +1,5 @@ # [DEF:backend.src.plugins.llm_analysis.__tests__.test_service:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: tests, llm-analysis, fallback, provider-error, unknown-status # @PURPOSE: Verify LLM analysis transport/provider failures do not masquerade as dashboard FAIL results. diff --git a/backend/src/plugins/llm_analysis/models.py b/backend/src/plugins/llm_analysis/models.py index d4fac7d2..f7a8cd48 100644 --- a/backend/src/plugins/llm_analysis/models.py +++ b/backend/src/plugins/llm_analysis/models.py @@ -1,5 +1,5 @@ # [DEF:backend/src/plugins/llm_analysis/models.py:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: pydantic, models, llm # @PURPOSE: Define Pydantic models for LLM Analysis plugin. # @LAYER: Domain diff --git a/backend/src/plugins/llm_analysis/plugin.py b/backend/src/plugins/llm_analysis/plugin.py index b88cef30..ec8e06e4 100644 --- a/backend/src/plugins/llm_analysis/plugin.py +++ b/backend/src/plugins/llm_analysis/plugin.py @@ -1,5 +1,5 @@ # [DEF:backend/src/plugins/llm_analysis/plugin.py:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: plugin, llm, analysis, documentation # @PURPOSE: Implements DashboardValidationPlugin and DocumentationPlugin. # @LAYER: Domain diff --git a/backend/src/plugins/llm_analysis/scheduler.py b/backend/src/plugins/llm_analysis/scheduler.py index 5398db83..c8287efd 100644 --- a/backend/src/plugins/llm_analysis/scheduler.py +++ b/backend/src/plugins/llm_analysis/scheduler.py @@ -1,5 +1,5 @@ # [DEF:backend/src/plugins/llm_analysis/scheduler.py:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: scheduler, task, automation # @PURPOSE: Provides helper functions to schedule LLM-based validation tasks. # @LAYER: Domain diff --git a/backend/src/plugins/llm_analysis/service.py b/backend/src/plugins/llm_analysis/service.py index ef614731..0ecbe146 100644 --- a/backend/src/plugins/llm_analysis/service.py +++ b/backend/src/plugins/llm_analysis/service.py @@ -1,5 +1,5 @@ # [DEF:backend/src/plugins/llm_analysis/service.py:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: service, llm, screenshot, playwright, openai # @PURPOSE: Services for LLM interaction and dashboard screenshots. # @LAYER: Domain diff --git a/backend/src/plugins/migration.py b/backend/src/plugins/migration.py index 2ffc3c5f..5a37c98a 100755 --- a/backend/src/plugins/migration.py +++ b/backend/src/plugins/migration.py @@ -1,384 +1,384 @@ -# [DEF:MigrationPlugin:Module] -# @TIER: CRITICAL -# @SEMANTICS: migration, superset, automation, dashboard, plugin, transformation -# @PURPOSE: Orchestrates export, DB-mapping transformation, and import of Superset dashboards across environments. -# @LAYER: App -# @RELATION: IMPLEMENTS -> PluginBase -# @RELATION: DEPENDS_ON -> SupersetClient -# @RELATION: DEPENDS_ON -> MigrationEngine -# @RELATION: DEPENDS_ON -> IdMappingService -# @RELATION: USES -> TaskContext -# @INVARIANT: Dashboards must never be imported with unmapped/source DB connections to prevent data leaks or cross-environment pollution. - -from typing import Dict, Any, Optional -import re - -from ..core.plugin_base import PluginBase -from ..core.logger import belief_scope, logger as app_logger -from ..core.superset_client import SupersetClient -from ..core.utils.fileio import create_temp_file -from ..dependencies import get_config_manager -from ..core.migration_engine import MigrationEngine -from ..core.database import SessionLocal -from ..models.mapping import DatabaseMapping, Environment -from ..core.mapping_service import IdMappingService -from ..core.task_manager.context import TaskContext - -# [DEF:MigrationPlugin:Class] -# @PURPOSE: Implementation of the migration plugin workflow and transformation orchestration. -# @PRE: Plugin loader must register this instance. -# @POST: Provides migration UI schema and executes atomic dashboard transfers. -# @TEST_FIXTURE: superset_export_zip -> file:backend/tests/fixtures/migration/dashboard_export.zip -# @TEST_FIXTURE: db_mapping_payload -> INLINE_JSON: {"db_mappings": {"source_uuid_1": "target_uuid_2"}} -# @TEST_FIXTURE: password_inject_payload -> INLINE_JSON: {"passwords": {"PostgreSQL": "secret123"}} -# @TEST_INVARIANT: strict_db_isolation -> VERIFIED_BY: [successful_dashboard_transfer, missing_mapping_resolution] -class MigrationPlugin(PluginBase): - """ - A plugin to migrate Superset dashboards between environments. - """ - - @property - # [DEF:id:Function] - # @PURPOSE: Returns the unique identifier for the migration plugin. - # @PRE: None. - # @POST: Returns stable string "superset-migration". - # @RETURN: str - def id(self) -> str: - with belief_scope("MigrationPlugin.id"): - return "superset-migration" - # [/DEF:id:Function] - - @property - # [DEF:name:Function] - # @PURPOSE: Returns the human-readable name of the plugin. - # @PRE: None. - # @POST: Returns "Superset Dashboard Migration". - # @RETURN: str - def name(self) -> str: - with belief_scope("MigrationPlugin.name"): - return "Superset Dashboard Migration" - # [/DEF:name:Function] - - @property - # [DEF:description:Function] - # @PURPOSE: Returns the semantic description of the plugin. - # @PRE: None. - # @POST: Returns description string. - # @RETURN: str - def description(self) -> str: - with belief_scope("MigrationPlugin.description"): - return "Migrates dashboards between Superset environments." - # [/DEF:description:Function] - - @property - # [DEF:version:Function] - # @PURPOSE: Returns the semantic version of the migration plugin. - # @PRE: None. - # @POST: Returns "1.0.0". - # @RETURN: str - def version(self) -> str: - with belief_scope("MigrationPlugin.version"): - return "1.0.0" - # [/DEF:version:Function] - - @property - # [DEF:ui_route:Function] - # @PURPOSE: Returns the frontend routing anchor for the plugin. - # @PRE: None. - # @POST: Returns "/migration". - # @RETURN: str - def ui_route(self) -> str: - with belief_scope("MigrationPlugin.ui_route"): - return "/migration" - # [/DEF:ui_route:Function] - - # [DEF:get_schema:Function] - # @PURPOSE: Generates the JSON Schema for the plugin execution form dynamically. - # @PRE: ConfigManager is accessible and environments are defined. - # @POST: Returns a JSON Schema dict matching current system environments. - # @RETURN: Dict[str, Any] - def get_schema(self) -> Dict[str, Any]: - with belief_scope("MigrationPlugin.get_schema"): - app_logger.reason("Generating migration UI schema") - config_manager = get_config_manager() - envs = [e.name for e in config_manager.get_environments()] - - schema = { - "type": "object", - "properties": { - "from_env": { - "type": "string", - "title": "Source Environment", - "description": "The environment to migrate from.", - "enum": envs if envs else ["dev", "prod"], - }, - "to_env": { - "type": "string", - "title": "Target Environment", - "description": "The environment to migrate to.", - "enum": envs if envs else ["dev", "prod"], - }, - "dashboard_regex": { - "type": "string", - "title": "Dashboard Regex", - "description": "A regular expression to filter dashboards to migrate.", - }, - "replace_db_config": { - "type": "boolean", - "title": "Replace DB Config", - "description": "Whether to replace the database configuration.", - "default": False, - }, - "from_db_id": { - "type": "integer", - "title": "Source DB ID", - "description": "The ID of the source database to replace (if replacing).", - }, - "to_db_id": { - "type": "integer", - "title": "Target DB ID", - "description": "The ID of the target database to replace with (if replacing).", - }, - }, - "required": ["from_env", "to_env", "dashboard_regex"], - } - app_logger.reflect("Schema generated successfully", extra={"environments_count": len(envs)}) - return schema - # [/DEF:get_schema:Function] - - # [DEF:execute:Function] - # @PURPOSE: Orchestrates the dashboard migration pipeline including extraction, AST mutation, and ingestion. - # @PARAM: params (Dict[str, Any]) - Extracted parameters from UI/API execution request. - # @PARAM: context (Optional[TaskContext]) - Dependency injected TaskContext for IO tracing. - # @PRE: Source and target environments must resolve. Matching dashboards must exist. - # @POST: Dashboard ZIP bundles are transformed and imported. ID mappings are synchronized. - # @SIDE_EFFECT: Creates temp files, mutates target Superset state, blocks on user input (passwords/mappings). - # @TEST_CONTRACT: Dict[str, Any] -> Dict[str, Any] - # @TEST_SCENARIO: successful_dashboard_transfer -> ZIP is downloaded, DB mappings applied via AST, target import succeeds. - # @TEST_SCENARIO: missing_password_injection -> Target import fails on auth, TaskManager pauses for user input, retries with password successfully. - # @TEST_SCENARIO: empty_selection -> Returns NO_MATCHES gracefully when regex finds zero dashboards. - # @TEST_EDGE: missing_env_field -> [ValueError: Could not resolve source or target environment] - # @TEST_EDGE: invalid_regex_pattern -> [Regex compilation exception is thrown or caught gracefully] - # @TEST_EDGE: target_api_timeout -> [Dashboard added to failed_dashboards, task concludes with PARTIAL_SUCCESS] - async def execute(self, params: Dict[str, Any], context: Optional[TaskContext] = None): - with belief_scope("MigrationPlugin.execute"): - app_logger.reason("Evaluating migration task parameters", extra={"params": params}) - - source_env_id = params.get("source_env_id") - target_env_id = params.get("target_env_id") - selected_ids = params.get("selected_ids") - - from_env_name = params.get("from_env") - to_env_name = params.get("to_env") - dashboard_regex = params.get("dashboard_regex") - replace_db_config = params.get("replace_db_config", False) - fix_cross_filters = params.get("fix_cross_filters", True) - - task_id = params.get("_task_id") - from ..dependencies import get_task_manager - tm = get_task_manager() - - log = context.logger if context else app_logger - superset_log = log.with_source("superset_api") if context else log - migration_log = log.with_source("migration") if context else log - - log.info("Starting migration task.") - - try: - config_manager = get_config_manager() - environments = config_manager.get_environments() - - # Resolve environments - src_env = next((e for e in environments if e.id == source_env_id), None) if source_env_id else next((e for e in environments if e.name == from_env_name), None) - tgt_env = next((e for e in environments if e.id == target_env_id), None) if target_env_id else next((e for e in environments if e.name == to_env_name), None) - - if not src_env or not tgt_env: - app_logger.explore("Environment resolution failed", extra={"src": source_env_id or from_env_name, "tgt": target_env_id or to_env_name}) - raise ValueError(f"Could not resolve source or target environment. Source: {source_env_id or from_env_name}, Target: {target_env_id or to_env_name}") - - from_env_name = src_env.name - to_env_name = tgt_env.name - - app_logger.reason("Environments resolved successfully", extra={"from": from_env_name, "to": to_env_name}) - - migration_result = { - "status": "SUCCESS", - "source_environment": from_env_name, - "target_environment": to_env_name, - "selected_dashboards": 0, - "migrated_dashboards": [], - "failed_dashboards": [], - "mapping_count": 0 - } - - from_c = SupersetClient(src_env) - to_c = SupersetClient(tgt_env) - - if not from_c or not to_c: - raise ValueError(f"Clients not initialized for environments: {from_env_name}, {to_env_name}") - - _, all_dashboards = from_c.get_dashboards() - - # Selection Logic - if selected_ids: - dashboards_to_migrate = [d for d in all_dashboards if d["id"] in selected_ids] - elif dashboard_regex: - regex_pattern = re.compile(str(dashboard_regex), re.IGNORECASE) - dashboards_to_migrate = [d for d in all_dashboards if regex_pattern.search(d.get("dashboard_title", ""))] - else: - app_logger.explore("No deterministic selection criteria provided") - migration_result["status"] = "NO_SELECTION" - return migration_result - - if not dashboards_to_migrate: - app_logger.explore("Zero dashboards match selection criteria") - migration_result["status"] = "NO_MATCHES" - return migration_result - - migration_result["selected_dashboards"] = len(dashboards_to_migrate) - - # Database Mapping Resolution - db_mapping = params.get("db_mappings", {}) - if not isinstance(db_mapping, dict): - db_mapping = {} - - if replace_db_config: - app_logger.reason("Fetching environment DB mappings from catalog") - db = SessionLocal() - try: - src_env_db = db.query(Environment).filter(Environment.name == from_env_name).first() - tgt_env_db = db.query(Environment).filter(Environment.name == to_env_name).first() - - if src_env_db and tgt_env_db: - stored_mappings = db.query(DatabaseMapping).filter( - DatabaseMapping.source_env_id == src_env_db.id, - DatabaseMapping.target_env_id == tgt_env_db.id - ).all() - stored_map_dict = {m.source_db_uuid: m.target_db_uuid for m in stored_mappings} - stored_map_dict.update(db_mapping) - db_mapping = stored_map_dict - log.info(f"Loaded {len(stored_mappings)} database mappings from database.") - finally: - db.close() - - migration_result["mapping_count"] = len(db_mapping) - engine = MigrationEngine() - - # Migration Loop - for dash in dashboards_to_migrate: - dash_id, dash_slug, title = dash["id"], dash.get("slug"), dash["dashboard_title"] - app_logger.reason(f"Starting pipeline for dashboard '{title}'", extra={"dash_id": dash_id}) - - try: - exported_content, _ = from_c.export_dashboard(dash_id) - with create_temp_file(content=exported_content, dry_run=True, suffix=".zip") as tmp_zip_path: - with create_temp_file(suffix=".zip", dry_run=True) as tmp_new_zip: - - success = engine.transform_zip( - str(tmp_zip_path), - str(tmp_new_zip), - db_mapping, - strip_databases=False, - target_env_id=tgt_env.id if tgt_env else None, - fix_cross_filters=fix_cross_filters - ) - - if not success and replace_db_config: - if task_id: - app_logger.explore("Missing mapping blocks AST transform. Pausing task for user intervention.", extra={"task_id": task_id}) - await tm.wait_for_resolution(task_id) - - app_logger.reason("Task resumed, re-evaluating mapping states") - db = SessionLocal() - try: - src_env_rt = db.query(Environment).filter(Environment.name == from_env_name).first() - tgt_env_rt = db.query(Environment).filter(Environment.name == to_env_name).first() - mappings = db.query(DatabaseMapping).filter( - DatabaseMapping.source_env_id == src_env_rt.id, - DatabaseMapping.target_env_id == tgt_env_rt.id - ).all() - db_mapping = {m.source_db_uuid: m.target_db_uuid for m in mappings} - finally: - db.close() - - success = engine.transform_zip( - str(tmp_zip_path), - str(tmp_new_zip), - db_mapping, - strip_databases=False, - target_env_id=tgt_env.id if tgt_env else None, - fix_cross_filters=fix_cross_filters - ) - - if success: - app_logger.reason("Pushing transformed ZIP to target Superset") - to_c.import_dashboard(file_name=tmp_new_zip, dash_id=dash_id, dash_slug=dash_slug) - migration_result["migrated_dashboards"].append({"id": dash_id, "title": title}) - app_logger.reflect("Import successful", extra={"title": title}) - else: - app_logger.explore("Transformation strictly failed, bypassing ingestion") - migration_log.error(f"Failed to transform ZIP for dashboard {title}") - migration_result["failed_dashboards"].append({ - "id": dash_id, "title": title, "error": "Failed to transform ZIP" - }) - - except Exception as exc: - error_msg = str(exc) - if "Must provide a password for the database" in error_msg: - db_name = "unknown" - match = re.search(r"databases/([^.]+)\.yaml", error_msg) - if match: - db_name = match.group(1) - else: - match_alt = re.search(r"database '([^']+)'", error_msg) - if match_alt: - db_name = match_alt.group(1) - - app_logger.explore(f"Missing DB password detected during ingestion. Escalating to UI.", extra={"db_name": db_name}) - - if task_id: - tm.await_input(task_id, { - "type": "database_password", - "databases": [db_name], - "error_message": error_msg - }) - - await tm.wait_for_input(task_id) - task = tm.get_task(task_id) - passwords = task.params.get("passwords", {}) - - if passwords: - app_logger.reason(f"Retrying import for {title} with injected credentials") - to_c.import_dashboard(file_name=tmp_new_zip, dash_id=dash_id, dash_slug=dash_slug, passwords=passwords) - migration_result["migrated_dashboards"].append({"id": dash_id, "title": title}) - app_logger.reflect("Password injection unblocked import") - if "passwords" in task.params: - del task.params["passwords"] - continue - - app_logger.explore(f"Catastrophic dashboard ingestion failure: {exc}") - migration_result["failed_dashboards"].append({"id": dash_id, "title": title, "error": str(exc)}) - - if migration_result["failed_dashboards"]: - migration_result["status"] = "PARTIAL_SUCCESS" - - # Post-Migration ID Mapping Synchronization - try: - app_logger.reason("Executing incremental ID catalog sync on target") - db_session = SessionLocal() - mapping_service = IdMappingService(db_session) - mapping_service.sync_environment(tgt_env.id, to_c, incremental=True) - db_session.close() - app_logger.reflect("Incremental catalog sync closed out cleanly") - except Exception as sync_exc: - app_logger.explore(f"ID Mapping sync failed, mapping state might be degraded: {sync_exc}") - - app_logger.reflect("Migration cycle fully resolved", extra={"result": migration_result}) - return migration_result - - except Exception as e: - app_logger.explore(f"Fatal plugin failure: {e}", exc_info=True) - raise e - # [/DEF:execute:Function] -# [/DEF:MigrationPlugin:Class] +# [DEF:MigrationPlugin:Module] +# @COMPLEXITY: 5 +# @SEMANTICS: migration, superset, automation, dashboard, plugin, transformation +# @PURPOSE: Orchestrates export, DB-mapping transformation, and import of Superset dashboards across environments. +# @LAYER: App +# @RELATION: IMPLEMENTS -> PluginBase +# @RELATION: DEPENDS_ON -> SupersetClient +# @RELATION: DEPENDS_ON -> MigrationEngine +# @RELATION: DEPENDS_ON -> IdMappingService +# @RELATION: USES -> TaskContext +# @INVARIANT: Dashboards must never be imported with unmapped/source DB connections to prevent data leaks or cross-environment pollution. + +from typing import Dict, Any, Optional +import re + +from ..core.plugin_base import PluginBase +from ..core.logger import belief_scope, logger as app_logger +from ..core.superset_client import SupersetClient +from ..core.utils.fileio import create_temp_file +from ..dependencies import get_config_manager +from ..core.migration_engine import MigrationEngine +from ..core.database import SessionLocal +from ..models.mapping import DatabaseMapping, Environment +from ..core.mapping_service import IdMappingService +from ..core.task_manager.context import TaskContext + +# [DEF:MigrationPlugin:Class] +# @PURPOSE: Implementation of the migration plugin workflow and transformation orchestration. +# @PRE: Plugin loader must register this instance. +# @POST: Provides migration UI schema and executes atomic dashboard transfers. +# @TEST_FIXTURE: superset_export_zip -> file:backend/tests/fixtures/migration/dashboard_export.zip +# @TEST_FIXTURE: db_mapping_payload -> INLINE_JSON: {"db_mappings": {"source_uuid_1": "target_uuid_2"}} +# @TEST_FIXTURE: password_inject_payload -> INLINE_JSON: {"passwords": {"PostgreSQL": "secret123"}} +# @TEST_INVARIANT: strict_db_isolation -> VERIFIED_BY: [successful_dashboard_transfer, missing_mapping_resolution] +class MigrationPlugin(PluginBase): + """ + A plugin to migrate Superset dashboards between environments. + """ + + @property + # [DEF:id:Function] + # @PURPOSE: Returns the unique identifier for the migration plugin. + # @PRE: None. + # @POST: Returns stable string "superset-migration". + # @RETURN: str + def id(self) -> str: + with belief_scope("MigrationPlugin.id"): + return "superset-migration" + # [/DEF:id:Function] + + @property + # [DEF:name:Function] + # @PURPOSE: Returns the human-readable name of the plugin. + # @PRE: None. + # @POST: Returns "Superset Dashboard Migration". + # @RETURN: str + def name(self) -> str: + with belief_scope("MigrationPlugin.name"): + return "Superset Dashboard Migration" + # [/DEF:name:Function] + + @property + # [DEF:description:Function] + # @PURPOSE: Returns the semantic description of the plugin. + # @PRE: None. + # @POST: Returns description string. + # @RETURN: str + def description(self) -> str: + with belief_scope("MigrationPlugin.description"): + return "Migrates dashboards between Superset environments." + # [/DEF:description:Function] + + @property + # [DEF:version:Function] + # @PURPOSE: Returns the semantic version of the migration plugin. + # @PRE: None. + # @POST: Returns "1.0.0". + # @RETURN: str + def version(self) -> str: + with belief_scope("MigrationPlugin.version"): + return "1.0.0" + # [/DEF:version:Function] + + @property + # [DEF:ui_route:Function] + # @PURPOSE: Returns the frontend routing anchor for the plugin. + # @PRE: None. + # @POST: Returns "/migration". + # @RETURN: str + def ui_route(self) -> str: + with belief_scope("MigrationPlugin.ui_route"): + return "/migration" + # [/DEF:ui_route:Function] + + # [DEF:get_schema:Function] + # @PURPOSE: Generates the JSON Schema for the plugin execution form dynamically. + # @PRE: ConfigManager is accessible and environments are defined. + # @POST: Returns a JSON Schema dict matching current system environments. + # @RETURN: Dict[str, Any] + def get_schema(self) -> Dict[str, Any]: + with belief_scope("MigrationPlugin.get_schema"): + app_logger.reason("Generating migration UI schema") + config_manager = get_config_manager() + envs = [e.name for e in config_manager.get_environments()] + + schema = { + "type": "object", + "properties": { + "from_env": { + "type": "string", + "title": "Source Environment", + "description": "The environment to migrate from.", + "enum": envs if envs else ["dev", "prod"], + }, + "to_env": { + "type": "string", + "title": "Target Environment", + "description": "The environment to migrate to.", + "enum": envs if envs else ["dev", "prod"], + }, + "dashboard_regex": { + "type": "string", + "title": "Dashboard Regex", + "description": "A regular expression to filter dashboards to migrate.", + }, + "replace_db_config": { + "type": "boolean", + "title": "Replace DB Config", + "description": "Whether to replace the database configuration.", + "default": False, + }, + "from_db_id": { + "type": "integer", + "title": "Source DB ID", + "description": "The ID of the source database to replace (if replacing).", + }, + "to_db_id": { + "type": "integer", + "title": "Target DB ID", + "description": "The ID of the target database to replace with (if replacing).", + }, + }, + "required": ["from_env", "to_env", "dashboard_regex"], + } + app_logger.reflect("Schema generated successfully", extra={"environments_count": len(envs)}) + return schema + # [/DEF:get_schema:Function] + + # [DEF:execute:Function] + # @PURPOSE: Orchestrates the dashboard migration pipeline including extraction, AST mutation, and ingestion. + # @PARAM: params (Dict[str, Any]) - Extracted parameters from UI/API execution request. + # @PARAM: context (Optional[TaskContext]) - Dependency injected TaskContext for IO tracing. + # @PRE: Source and target environments must resolve. Matching dashboards must exist. + # @POST: Dashboard ZIP bundles are transformed and imported. ID mappings are synchronized. + # @SIDE_EFFECT: Creates temp files, mutates target Superset state, blocks on user input (passwords/mappings). + # @TEST_CONTRACT: Dict[str, Any] -> Dict[str, Any] + # @TEST_SCENARIO: successful_dashboard_transfer -> ZIP is downloaded, DB mappings applied via AST, target import succeeds. + # @TEST_SCENARIO: missing_password_injection -> Target import fails on auth, TaskManager pauses for user input, retries with password successfully. + # @TEST_SCENARIO: empty_selection -> Returns NO_MATCHES gracefully when regex finds zero dashboards. + # @TEST_EDGE: missing_env_field -> [ValueError: Could not resolve source or target environment] + # @TEST_EDGE: invalid_regex_pattern -> [Regex compilation exception is thrown or caught gracefully] + # @TEST_EDGE: target_api_timeout -> [Dashboard added to failed_dashboards, task concludes with PARTIAL_SUCCESS] + async def execute(self, params: Dict[str, Any], context: Optional[TaskContext] = None): + with belief_scope("MigrationPlugin.execute"): + app_logger.reason("Evaluating migration task parameters", extra={"params": params}) + + source_env_id = params.get("source_env_id") + target_env_id = params.get("target_env_id") + selected_ids = params.get("selected_ids") + + from_env_name = params.get("from_env") + to_env_name = params.get("to_env") + dashboard_regex = params.get("dashboard_regex") + replace_db_config = params.get("replace_db_config", False) + fix_cross_filters = params.get("fix_cross_filters", True) + + task_id = params.get("_task_id") + from ..dependencies import get_task_manager + tm = get_task_manager() + + log = context.logger if context else app_logger + superset_log = log.with_source("superset_api") if context else log + migration_log = log.with_source("migration") if context else log + + log.info("Starting migration task.") + + try: + config_manager = get_config_manager() + environments = config_manager.get_environments() + + # Resolve environments + src_env = next((e for e in environments if e.id == source_env_id), None) if source_env_id else next((e for e in environments if e.name == from_env_name), None) + tgt_env = next((e for e in environments if e.id == target_env_id), None) if target_env_id else next((e for e in environments if e.name == to_env_name), None) + + if not src_env or not tgt_env: + app_logger.explore("Environment resolution failed", extra={"src": source_env_id or from_env_name, "tgt": target_env_id or to_env_name}) + raise ValueError(f"Could not resolve source or target environment. Source: {source_env_id or from_env_name}, Target: {target_env_id or to_env_name}") + + from_env_name = src_env.name + to_env_name = tgt_env.name + + app_logger.reason("Environments resolved successfully", extra={"from": from_env_name, "to": to_env_name}) + + migration_result = { + "status": "SUCCESS", + "source_environment": from_env_name, + "target_environment": to_env_name, + "selected_dashboards": 0, + "migrated_dashboards": [], + "failed_dashboards": [], + "mapping_count": 0 + } + + from_c = SupersetClient(src_env) + to_c = SupersetClient(tgt_env) + + if not from_c or not to_c: + raise ValueError(f"Clients not initialized for environments: {from_env_name}, {to_env_name}") + + _, all_dashboards = from_c.get_dashboards() + + # Selection Logic + if selected_ids: + dashboards_to_migrate = [d for d in all_dashboards if d["id"] in selected_ids] + elif dashboard_regex: + regex_pattern = re.compile(str(dashboard_regex), re.IGNORECASE) + dashboards_to_migrate = [d for d in all_dashboards if regex_pattern.search(d.get("dashboard_title", ""))] + else: + app_logger.explore("No deterministic selection criteria provided") + migration_result["status"] = "NO_SELECTION" + return migration_result + + if not dashboards_to_migrate: + app_logger.explore("Zero dashboards match selection criteria") + migration_result["status"] = "NO_MATCHES" + return migration_result + + migration_result["selected_dashboards"] = len(dashboards_to_migrate) + + # Database Mapping Resolution + db_mapping = params.get("db_mappings", {}) + if not isinstance(db_mapping, dict): + db_mapping = {} + + if replace_db_config: + app_logger.reason("Fetching environment DB mappings from catalog") + db = SessionLocal() + try: + src_env_db = db.query(Environment).filter(Environment.name == from_env_name).first() + tgt_env_db = db.query(Environment).filter(Environment.name == to_env_name).first() + + if src_env_db and tgt_env_db: + stored_mappings = db.query(DatabaseMapping).filter( + DatabaseMapping.source_env_id == src_env_db.id, + DatabaseMapping.target_env_id == tgt_env_db.id + ).all() + stored_map_dict = {m.source_db_uuid: m.target_db_uuid for m in stored_mappings} + stored_map_dict.update(db_mapping) + db_mapping = stored_map_dict + log.info(f"Loaded {len(stored_mappings)} database mappings from database.") + finally: + db.close() + + migration_result["mapping_count"] = len(db_mapping) + engine = MigrationEngine() + + # Migration Loop + for dash in dashboards_to_migrate: + dash_id, dash_slug, title = dash["id"], dash.get("slug"), dash["dashboard_title"] + app_logger.reason(f"Starting pipeline for dashboard '{title}'", extra={"dash_id": dash_id}) + + try: + exported_content, _ = from_c.export_dashboard(dash_id) + with create_temp_file(content=exported_content, dry_run=True, suffix=".zip") as tmp_zip_path: + with create_temp_file(suffix=".zip", dry_run=True) as tmp_new_zip: + + success = engine.transform_zip( + str(tmp_zip_path), + str(tmp_new_zip), + db_mapping, + strip_databases=False, + target_env_id=tgt_env.id if tgt_env else None, + fix_cross_filters=fix_cross_filters + ) + + if not success and replace_db_config: + if task_id: + app_logger.explore("Missing mapping blocks AST transform. Pausing task for user intervention.", extra={"task_id": task_id}) + await tm.wait_for_resolution(task_id) + + app_logger.reason("Task resumed, re-evaluating mapping states") + db = SessionLocal() + try: + src_env_rt = db.query(Environment).filter(Environment.name == from_env_name).first() + tgt_env_rt = db.query(Environment).filter(Environment.name == to_env_name).first() + mappings = db.query(DatabaseMapping).filter( + DatabaseMapping.source_env_id == src_env_rt.id, + DatabaseMapping.target_env_id == tgt_env_rt.id + ).all() + db_mapping = {m.source_db_uuid: m.target_db_uuid for m in mappings} + finally: + db.close() + + success = engine.transform_zip( + str(tmp_zip_path), + str(tmp_new_zip), + db_mapping, + strip_databases=False, + target_env_id=tgt_env.id if tgt_env else None, + fix_cross_filters=fix_cross_filters + ) + + if success: + app_logger.reason("Pushing transformed ZIP to target Superset") + to_c.import_dashboard(file_name=tmp_new_zip, dash_id=dash_id, dash_slug=dash_slug) + migration_result["migrated_dashboards"].append({"id": dash_id, "title": title}) + app_logger.reflect("Import successful", extra={"title": title}) + else: + app_logger.explore("Transformation strictly failed, bypassing ingestion") + migration_log.error(f"Failed to transform ZIP for dashboard {title}") + migration_result["failed_dashboards"].append({ + "id": dash_id, "title": title, "error": "Failed to transform ZIP" + }) + + except Exception as exc: + error_msg = str(exc) + if "Must provide a password for the database" in error_msg: + db_name = "unknown" + match = re.search(r"databases/([^.]+)\.yaml", error_msg) + if match: + db_name = match.group(1) + else: + match_alt = re.search(r"database '([^']+)'", error_msg) + if match_alt: + db_name = match_alt.group(1) + + app_logger.explore(f"Missing DB password detected during ingestion. Escalating to UI.", extra={"db_name": db_name}) + + if task_id: + tm.await_input(task_id, { + "type": "database_password", + "databases": [db_name], + "error_message": error_msg + }) + + await tm.wait_for_input(task_id) + task = tm.get_task(task_id) + passwords = task.params.get("passwords", {}) + + if passwords: + app_logger.reason(f"Retrying import for {title} with injected credentials") + to_c.import_dashboard(file_name=tmp_new_zip, dash_id=dash_id, dash_slug=dash_slug, passwords=passwords) + migration_result["migrated_dashboards"].append({"id": dash_id, "title": title}) + app_logger.reflect("Password injection unblocked import") + if "passwords" in task.params: + del task.params["passwords"] + continue + + app_logger.explore(f"Catastrophic dashboard ingestion failure: {exc}") + migration_result["failed_dashboards"].append({"id": dash_id, "title": title, "error": str(exc)}) + + if migration_result["failed_dashboards"]: + migration_result["status"] = "PARTIAL_SUCCESS" + + # Post-Migration ID Mapping Synchronization + try: + app_logger.reason("Executing incremental ID catalog sync on target") + db_session = SessionLocal() + mapping_service = IdMappingService(db_session) + mapping_service.sync_environment(tgt_env.id, to_c, incremental=True) + db_session.close() + app_logger.reflect("Incremental catalog sync closed out cleanly") + except Exception as sync_exc: + app_logger.explore(f"ID Mapping sync failed, mapping state might be degraded: {sync_exc}") + + app_logger.reflect("Migration cycle fully resolved", extra={"result": migration_result}) + return migration_result + + except Exception as e: + app_logger.explore(f"Fatal plugin failure: {e}", exc_info=True) + raise e + # [/DEF:execute:Function] +# [/DEF:MigrationPlugin:Class] # [/DEF:MigrationPlugin:Module] \ No newline at end of file diff --git a/backend/src/schemas/__tests__/test_settings_and_health_schemas.py b/backend/src/schemas/__tests__/test_settings_and_health_schemas.py index 56ce4e31..312d510a 100644 --- a/backend/src/schemas/__tests__/test_settings_and_health_schemas.py +++ b/backend/src/schemas/__tests__/test_settings_and_health_schemas.py @@ -1,5 +1,5 @@ # [DEF:backend.src.schemas.__tests__.test_settings_and_health_schemas:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Regression tests for settings and health schema contracts updated in 026 fix batch. import pytest diff --git a/backend/src/schemas/auth.py b/backend/src/schemas/auth.py index dccf7a40..3c4bcf08 100644 --- a/backend/src/schemas/auth.py +++ b/backend/src/schemas/auth.py @@ -1,6 +1,6 @@ # [DEF:backend.src.schemas.auth:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: auth, schemas, pydantic, user, token # @PURPOSE: Pydantic schemas for authentication requests and responses. # @LAYER: API @@ -15,7 +15,7 @@ from datetime import datetime # [/SECTION] # [DEF:Token:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Represents a JWT access token response. class Token(BaseModel): access_token: str @@ -23,7 +23,7 @@ class Token(BaseModel): # [/DEF:Token:Class] # [DEF:TokenData:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Represents the data encoded in a JWT token. class TokenData(BaseModel): username: Optional[str] = None @@ -31,7 +31,7 @@ class TokenData(BaseModel): # [/DEF:TokenData:Class] # [DEF:PermissionSchema:Class] -# @TIER: TRIVIAL +# @COMPLEXITY: 1 # @PURPOSE: Represents a permission in API responses. class PermissionSchema(BaseModel): id: Optional[str] = None diff --git a/backend/src/schemas/health.py b/backend/src/schemas/health.py index e778c41a..908e44c4 100644 --- a/backend/src/schemas/health.py +++ b/backend/src/schemas/health.py @@ -1,5 +1,5 @@ # [DEF:backend.src.schemas.health:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: health, schemas, pydantic # @PURPOSE: Pydantic schemas for dashboard health summary. # @LAYER: Domain diff --git a/backend/src/schemas/profile.py b/backend/src/schemas/profile.py index 14dc7aae..8fd36844 100644 --- a/backend/src/schemas/profile.py +++ b/backend/src/schemas/profile.py @@ -1,6 +1,6 @@ # [DEF:backend.src.schemas.profile:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: profile, schemas, pydantic, preferences, superset, lookup, security, git, ux # @PURPOSE: Defines API schemas for profile preference persistence, security read-only snapshot, and Superset account lookup. # @LAYER: API @@ -16,7 +16,7 @@ from pydantic import BaseModel, Field # [DEF:ProfilePermissionState:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Represents one permission badge state for profile read-only security view. class ProfilePermissionState(BaseModel): key: str @@ -25,7 +25,7 @@ class ProfilePermissionState(BaseModel): # [DEF:ProfileSecuritySummary:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Read-only security and access snapshot for current user. class ProfileSecuritySummary(BaseModel): read_only: bool = True @@ -38,7 +38,7 @@ class ProfileSecuritySummary(BaseModel): # [DEF:ProfilePreference:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Represents persisted profile preference for a single authenticated user. class ProfilePreference(BaseModel): user_id: str @@ -69,7 +69,7 @@ class ProfilePreference(BaseModel): # [DEF:ProfilePreferenceUpdateRequest:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Request payload for updating current user's profile settings. class ProfilePreferenceUpdateRequest(BaseModel): superset_username: Optional[str] = Field( @@ -128,7 +128,7 @@ class ProfilePreferenceUpdateRequest(BaseModel): # [DEF:ProfilePreferenceResponse:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Response envelope for profile preference read/update endpoints. class ProfilePreferenceResponse(BaseModel): status: Literal["success", "error"] = "success" @@ -140,7 +140,7 @@ class ProfilePreferenceResponse(BaseModel): # [DEF:SupersetAccountLookupRequest:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Query contract for Superset account lookup by selected environment. class SupersetAccountLookupRequest(BaseModel): environment_id: str @@ -153,7 +153,7 @@ class SupersetAccountLookupRequest(BaseModel): # [DEF:SupersetAccountCandidate:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Canonical account candidate projected from Superset users payload. class SupersetAccountCandidate(BaseModel): environment_id: str @@ -165,7 +165,7 @@ class SupersetAccountCandidate(BaseModel): # [DEF:SupersetAccountLookupResponse:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Response envelope for Superset account lookup (success or degraded mode). class SupersetAccountLookupResponse(BaseModel): status: Literal["success", "degraded"] diff --git a/backend/src/schemas/settings.py b/backend/src/schemas/settings.py index 32932e18..8f025bda 100644 --- a/backend/src/schemas/settings.py +++ b/backend/src/schemas/settings.py @@ -1,5 +1,5 @@ # [DEF:backend.src.schemas.settings:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: settings, schemas, pydantic, validation # @PURPOSE: Pydantic schemas for application settings and automation policies. # @LAYER: Domain diff --git a/backend/src/scripts/clean_release_cli.py b/backend/src/scripts/clean_release_cli.py index 7b8f58d3..6afb6f1d 100644 --- a/backend/src/scripts/clean_release_cli.py +++ b/backend/src/scripts/clean_release_cli.py @@ -1,5 +1,5 @@ # [DEF:backend.src.scripts.clean_release_cli:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: cli, clean-release, candidate, artifacts, manifest # @PURPOSE: Provide headless CLI commands for candidate registration, artifact import and manifest build. # @LAYER: Scripts diff --git a/backend/src/scripts/clean_release_tui.py b/backend/src/scripts/clean_release_tui.py index 4565f501..a59d4cc0 100644 --- a/backend/src/scripts/clean_release_tui.py +++ b/backend/src/scripts/clean_release_tui.py @@ -1,5 +1,5 @@ # [DEF:backend.src.scripts.clean_release_tui:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: clean-release, tui, ncurses, interactive-validator # @PURPOSE: Interactive terminal interface for Enterprise Clean Release compliance validation. # @LAYER: UI diff --git a/backend/src/scripts/create_admin.py b/backend/src/scripts/create_admin.py index 09cdb7ac..95f699a7 100644 --- a/backend/src/scripts/create_admin.py +++ b/backend/src/scripts/create_admin.py @@ -1,6 +1,6 @@ # [DEF:backend.src.scripts.create_admin:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: admin, setup, user, auth, cli # @PURPOSE: CLI tool for creating the initial admin user. # @LAYER: Scripts diff --git a/backend/src/scripts/migrate_sqlite_to_postgres.py b/backend/src/scripts/migrate_sqlite_to_postgres.py index bd7ee2aa..39c25eb2 100644 --- a/backend/src/scripts/migrate_sqlite_to_postgres.py +++ b/backend/src/scripts/migrate_sqlite_to_postgres.py @@ -1,6 +1,6 @@ # [DEF:backend.src.scripts.migrate_sqlite_to_postgres:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: migration, sqlite, postgresql, config, task_logs, task_records # @PURPOSE: Migrates legacy config and task history from SQLite/file storage to PostgreSQL. # @LAYER: Scripts @@ -36,7 +36,7 @@ DEFAULT_TARGET_URL = os.getenv( # [DEF:_json_load_if_needed:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Parses JSON-like values from SQLite TEXT/JSON columns to Python objects. # @PRE: value is scalar JSON/text/list/dict or None. # @POST: Returns normalized Python object or original scalar value. diff --git a/backend/src/scripts/seed_superset_load_test.py b/backend/src/scripts/seed_superset_load_test.py index 7bcfadab..08f74007 100644 --- a/backend/src/scripts/seed_superset_load_test.py +++ b/backend/src/scripts/seed_superset_load_test.py @@ -1,6 +1,6 @@ # [DEF:backend.src.scripts.seed_superset_load_test:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: superset, load-test, charts, dashboards, seed, stress # @PURPOSE: Creates randomized load-test data in Superset by cloning chart configurations and creating dashboards in target environments. # @LAYER: Scripts diff --git a/backend/src/services/__init__.py b/backend/src/services/__init__.py index 51736c0a..3af445b0 100644 --- a/backend/src/services/__init__.py +++ b/backend/src/services/__init__.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: services, package, init # @PURPOSE: Package initialization for services module # @LAYER: Core diff --git a/backend/src/services/__tests__/test_encryption_manager.py b/backend/src/services/__tests__/test_encryption_manager.py index 284c5db1..a9cf6b76 100644 --- a/backend/src/services/__tests__/test_encryption_manager.py +++ b/backend/src/services/__tests__/test_encryption_manager.py @@ -1,5 +1,5 @@ # [DEF:test_encryption_manager:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: encryption, security, fernet, api-keys, tests # @PURPOSE: Unit tests for EncryptionManager encrypt/decrypt functionality. # @LAYER: Domain diff --git a/backend/src/services/__tests__/test_health_service.py b/backend/src/services/__tests__/test_health_service.py index 87384b18..d05f1bc2 100644 --- a/backend/src/services/__tests__/test_health_service.py +++ b/backend/src/services/__tests__/test_health_service.py @@ -5,7 +5,7 @@ from src.services.health_service import HealthService from src.models.llm import ValidationRecord # [DEF:test_health_service:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Unit tests for HealthService aggregation logic. @pytest.mark.asyncio diff --git a/backend/src/services/__tests__/test_llm_plugin_persistence.py b/backend/src/services/__tests__/test_llm_plugin_persistence.py index 37a94abf..76109823 100644 --- a/backend/src/services/__tests__/test_llm_plugin_persistence.py +++ b/backend/src/services/__tests__/test_llm_plugin_persistence.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.__tests__.test_llm_plugin_persistence:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Regression test for ValidationRecord persistence fields populated from task context. import types diff --git a/backend/src/services/__tests__/test_llm_prompt_templates.py b/backend/src/services/__tests__/test_llm_prompt_templates.py index 861abb8e..f74598b0 100644 --- a/backend/src/services/__tests__/test_llm_prompt_templates.py +++ b/backend/src/services/__tests__/test_llm_prompt_templates.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.__tests__.test_llm_prompt_templates:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: tests, llm, prompts, templates, settings # @PURPOSE: Validate normalization and rendering behavior for configurable LLM prompt templates. # @LAYER: Domain Tests @@ -18,7 +18,7 @@ from src.services.llm_prompt_templates import ( # [DEF:test_normalize_llm_settings_adds_default_prompts:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Ensure legacy/partial llm settings are expanded with all prompt defaults. # @PRE: Input llm settings do not contain complete prompts object. # @POST: Returned structure includes required prompt templates with fallback defaults. @@ -39,7 +39,7 @@ def test_normalize_llm_settings_adds_default_prompts(): # [DEF:test_normalize_llm_settings_keeps_custom_prompt_values:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Ensure user-customized prompt values are preserved during normalization. # @PRE: Input llm settings contain custom prompt override. # @POST: Custom prompt value remains unchanged in normalized output. @@ -54,7 +54,7 @@ def test_normalize_llm_settings_keeps_custom_prompt_values(): # [DEF:test_render_prompt_replaces_known_placeholders:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Ensure template placeholders are deterministically replaced. # @PRE: Template contains placeholders matching provided variables. # @POST: Rendered prompt string contains substituted values. @@ -69,7 +69,7 @@ def test_render_prompt_replaces_known_placeholders(): # [DEF:test_is_multimodal_model_detects_known_vision_models:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Ensure multimodal model detection recognizes common vision-capable model names. def test_is_multimodal_model_detects_known_vision_models(): assert is_multimodal_model("gpt-4o") is True @@ -80,7 +80,7 @@ def test_is_multimodal_model_detects_known_vision_models(): # [DEF:test_resolve_bound_provider_id_prefers_binding_then_default:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Verify provider binding resolution priority. def test_resolve_bound_provider_id_prefers_binding_then_default(): settings = { @@ -93,7 +93,7 @@ def test_resolve_bound_provider_id_prefers_binding_then_default(): # [DEF:test_normalize_llm_settings_keeps_assistant_planner_settings:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Ensure assistant planner provider/model fields are preserved and normalized. def test_normalize_llm_settings_keeps_assistant_planner_settings(): normalized = normalize_llm_settings( diff --git a/backend/src/services/__tests__/test_rbac_permission_catalog.py b/backend/src/services/__tests__/test_rbac_permission_catalog.py index 476b143e..822755ca 100644 --- a/backend/src/services/__tests__/test_rbac_permission_catalog.py +++ b/backend/src/services/__tests__/test_rbac_permission_catalog.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.__tests__.test_rbac_permission_catalog:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: tests, rbac, permissions, catalog, discovery, sync # @PURPOSE: Verifies RBAC permission catalog discovery and idempotent synchronization behavior. # @LAYER: Service Tests diff --git a/backend/src/services/__tests__/test_resource_service.py b/backend/src/services/__tests__/test_resource_service.py index 120f6644..2e100550 100644 --- a/backend/src/services/__tests__/test_resource_service.py +++ b/backend/src/services/__tests__/test_resource_service.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.__tests__.test_resource_service:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: resource-service, tests, dashboards, datasets, activity # @PURPOSE: Unit tests for ResourceService # @LAYER: Service diff --git a/backend/src/services/auth_service.py b/backend/src/services/auth_service.py index 511effa0..7064c9f2 100644 --- a/backend/src/services/auth_service.py +++ b/backend/src/services/auth_service.py @@ -1,6 +1,6 @@ # [DEF:backend.src.services.auth_service:Module] # -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: auth, service, business-logic, login, jwt, adfs, jit-provisioning # @PURPOSE: Orchestrates credential authentication and ADFS JIT user provisioning. # @LAYER: Domain @@ -27,11 +27,11 @@ from ..core.logger import belief_scope # [/SECTION] # [DEF:AuthService:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Provides high-level authentication services. class AuthService: # [DEF:__init__:Function] - # @TIER: TRIVIAL + # @COMPLEXITY: 1 # @PURPOSE: Initializes the authentication service with repository access over an active DB session. # @PRE: db is a valid SQLAlchemy Session instance bound to the auth persistence context. # @POST: self.repo is initialized and ready for auth user/role CRUD operations. @@ -43,7 +43,7 @@ class AuthService: # [/DEF:__init__:Function] # [DEF:authenticate_user:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Validates credentials and account state for local username/password authentication. # @PRE: username and password are non-empty credential inputs. # @POST: Returns User only when user exists, is active, and password hash verification succeeds; otherwise returns None. @@ -69,7 +69,7 @@ class AuthService: # [/DEF:authenticate_user:Function] # [DEF:create_session:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Issues an access token payload for an already authenticated user. # @PRE: user is a valid User entity containing username and iterable roles with role.name values. # @POST: Returns session dict with non-empty access_token and token_type='bearer'. @@ -95,7 +95,7 @@ class AuthService: # [/DEF:create_session:Function] # [DEF:provision_adfs_user:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Performs ADFS Just-In-Time provisioning and role synchronization from AD group mappings. # @PRE: user_info contains identity claims where at least one of 'upn' or 'email' is present; 'groups' may be absent. # @POST: Returns persisted user entity with roles synchronized to mapped AD groups and refreshed state. diff --git a/backend/src/services/clean_release/__init__.py b/backend/src/services/clean_release/__init__.py index 4907bd6d..19c14da0 100644 --- a/backend/src/services/clean_release/__init__.py +++ b/backend/src/services/clean_release/__init__.py @@ -1,5 +1,5 @@ # [DEF:clean_release:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Redesigned clean release compliance subsystem. # @LAYER: Domain diff --git a/backend/src/services/clean_release/__tests__/test_audit_service.py b/backend/src/services/clean_release/__tests__/test_audit_service.py index 68b63e4f..2889670e 100644 --- a/backend/src/services/clean_release/__tests__/test_audit_service.py +++ b/backend/src/services/clean_release/__tests__/test_audit_service.py @@ -1,5 +1,5 @@ # [DEF:backend.tests.services.clean_release.test_audit_service:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: tests, clean-release, audit, logging # @PURPOSE: Validate audit hooks emit expected log patterns for clean release lifecycle. # @LAYER: Infra diff --git a/backend/src/services/clean_release/__tests__/test_compliance_orchestrator.py b/backend/src/services/clean_release/__tests__/test_compliance_orchestrator.py index 4d24fc4a..595fb375 100644 --- a/backend/src/services/clean_release/__tests__/test_compliance_orchestrator.py +++ b/backend/src/services/clean_release/__tests__/test_compliance_orchestrator.py @@ -1,5 +1,5 @@ # [DEF:backend.tests.services.clean_release.test_compliance_orchestrator:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: tests, clean-release, orchestrator, stage-state-machine # @PURPOSE: Validate compliance orchestrator stage transitions and final status derivation. # @LAYER: Domain diff --git a/backend/src/services/clean_release/__tests__/test_manifest_builder.py b/backend/src/services/clean_release/__tests__/test_manifest_builder.py index 9cc653ed..b3dab71b 100644 --- a/backend/src/services/clean_release/__tests__/test_manifest_builder.py +++ b/backend/src/services/clean_release/__tests__/test_manifest_builder.py @@ -1,5 +1,5 @@ # [DEF:backend.tests.services.clean_release.test_manifest_builder:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: tests, clean-release, manifest, deterministic # @PURPOSE: Validate deterministic manifest generation behavior for US1. # @LAYER: Domain diff --git a/backend/src/services/clean_release/__tests__/test_preparation_service.py b/backend/src/services/clean_release/__tests__/test_preparation_service.py index e2ef35c0..188e8b80 100644 --- a/backend/src/services/clean_release/__tests__/test_preparation_service.py +++ b/backend/src/services/clean_release/__tests__/test_preparation_service.py @@ -1,5 +1,5 @@ # [DEF:backend.tests.services.clean_release.test_preparation_service:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: tests, clean-release, preparation, flow # @PURPOSE: Validate release candidate preparation flow, including policy evaluation and manifest persisting. # @LAYER: Domain diff --git a/backend/src/services/clean_release/__tests__/test_report_builder.py b/backend/src/services/clean_release/__tests__/test_report_builder.py index 5cab53b2..2c210ae5 100644 --- a/backend/src/services/clean_release/__tests__/test_report_builder.py +++ b/backend/src/services/clean_release/__tests__/test_report_builder.py @@ -1,5 +1,5 @@ # [DEF:backend.tests.services.clean_release.test_report_builder:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: tests, clean-release, report-builder, counters # @PURPOSE: Validate compliance report builder counter integrity and blocked-run constraints. # @LAYER: Domain diff --git a/backend/src/services/clean_release/__tests__/test_source_isolation.py b/backend/src/services/clean_release/__tests__/test_source_isolation.py index b1157b7d..c7b8deb2 100644 --- a/backend/src/services/clean_release/__tests__/test_source_isolation.py +++ b/backend/src/services/clean_release/__tests__/test_source_isolation.py @@ -1,5 +1,5 @@ # [DEF:backend.tests.services.clean_release.test_source_isolation:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: tests, clean-release, source-isolation, internal-only # @PURPOSE: Verify internal source registry validation behavior. # @LAYER: Domain diff --git a/backend/src/services/clean_release/__tests__/test_stages.py b/backend/src/services/clean_release/__tests__/test_stages.py index 72c74a52..c2c90564 100644 --- a/backend/src/services/clean_release/__tests__/test_stages.py +++ b/backend/src/services/clean_release/__tests__/test_stages.py @@ -1,5 +1,5 @@ # [DEF:backend.tests.services.clean_release.test_stages:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: tests, clean-release, compliance, stages # @PURPOSE: Validate final status derivation logic from stage results. # @LAYER: Domain diff --git a/backend/src/services/clean_release/approval_service.py b/backend/src/services/clean_release/approval_service.py index 77043c5c..e42cdbc7 100644 --- a/backend/src/services/clean_release/approval_service.py +++ b/backend/src/services/clean_release/approval_service.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.clean_release.approval_service:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: clean-release, approval, decision, lifecycle, gate # @PURPOSE: Enforce approval/rejection gates over immutable compliance reports. # @LAYER: Domain diff --git a/backend/src/services/clean_release/artifact_catalog_loader.py b/backend/src/services/clean_release/artifact_catalog_loader.py index cc3b5b80..e1b7abb1 100644 --- a/backend/src/services/clean_release/artifact_catalog_loader.py +++ b/backend/src/services/clean_release/artifact_catalog_loader.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.clean_release.artifact_catalog_loader:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: clean-release, artifacts, bootstrap, json, tui # @PURPOSE: Load bootstrap artifact catalogs for clean release real-mode flows. # @LAYER: Domain diff --git a/backend/src/services/clean_release/audit_service.py b/backend/src/services/clean_release/audit_service.py index e06f5fcf..30536f10 100644 --- a/backend/src/services/clean_release/audit_service.py +++ b/backend/src/services/clean_release/audit_service.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.clean_release.audit_service:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: clean-release, audit, lifecycle, logging # @PURPOSE: Provide lightweight audit hooks for clean release preparation/check/report lifecycle. # @LAYER: Infra diff --git a/backend/src/services/clean_release/candidate_service.py b/backend/src/services/clean_release/candidate_service.py index ad68c51a..7d3d8db6 100644 --- a/backend/src/services/clean_release/candidate_service.py +++ b/backend/src/services/clean_release/candidate_service.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.clean_release.candidate_service:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: clean-release, candidate, artifacts, lifecycle, validation # @PURPOSE: Register release candidates with validated artifacts and advance lifecycle through legal transitions. # @LAYER: Domain diff --git a/backend/src/services/clean_release/compliance_execution_service.py b/backend/src/services/clean_release/compliance_execution_service.py index 84908e7c..7fb7dad2 100644 --- a/backend/src/services/clean_release/compliance_execution_service.py +++ b/backend/src/services/clean_release/compliance_execution_service.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.clean_release.compliance_execution_service:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: clean-release, compliance, execution, stages, immutable-evidence # @PURPOSE: Create and execute compliance runs with trusted snapshots, deterministic stages, violations and immutable report persistence. # @LAYER: Domain diff --git a/backend/src/services/clean_release/compliance_orchestrator.py b/backend/src/services/clean_release/compliance_orchestrator.py index 4bc57d64..f20db67c 100644 --- a/backend/src/services/clean_release/compliance_orchestrator.py +++ b/backend/src/services/clean_release/compliance_orchestrator.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.clean_release.compliance_orchestrator:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: clean-release, orchestrator, compliance-gate, stages # @PURPOSE: Execute mandatory clean compliance stages and produce final COMPLIANT/BLOCKED/FAILED outcome. # @LAYER: Domain diff --git a/backend/src/services/clean_release/demo_data_service.py b/backend/src/services/clean_release/demo_data_service.py index 77d4b302..adaf6e8d 100644 --- a/backend/src/services/clean_release/demo_data_service.py +++ b/backend/src/services/clean_release/demo_data_service.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.clean_release.demo_data_service:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: clean-release, demo-mode, namespace, isolation, repository # @PURPOSE: Provide deterministic namespace helpers and isolated in-memory repository creation for demo and real modes. # @LAYER: Domain diff --git a/backend/src/services/clean_release/dto.py b/backend/src/services/clean_release/dto.py index 9c10e3c9..60f8455b 100644 --- a/backend/src/services/clean_release/dto.py +++ b/backend/src/services/clean_release/dto.py @@ -1,5 +1,5 @@ # [DEF:clean_release_dto:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Data Transfer Objects for clean release compliance subsystem. # @LAYER: Application diff --git a/backend/src/services/clean_release/enums.py b/backend/src/services/clean_release/enums.py index eacf381a..5c977e0a 100644 --- a/backend/src/services/clean_release/enums.py +++ b/backend/src/services/clean_release/enums.py @@ -1,5 +1,5 @@ # [DEF:clean_release_enums:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Canonical enums for clean release lifecycle and compliance. # @LAYER: Domain diff --git a/backend/src/services/clean_release/exceptions.py b/backend/src/services/clean_release/exceptions.py index 499d8c24..df66acae 100644 --- a/backend/src/services/clean_release/exceptions.py +++ b/backend/src/services/clean_release/exceptions.py @@ -1,5 +1,5 @@ # [DEF:clean_release_exceptions:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Domain exceptions for clean release compliance subsystem. # @LAYER: Domain diff --git a/backend/src/services/clean_release/facade.py b/backend/src/services/clean_release/facade.py index a412b4d1..078282de 100644 --- a/backend/src/services/clean_release/facade.py +++ b/backend/src/services/clean_release/facade.py @@ -1,5 +1,5 @@ # [DEF:clean_release_facade:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Unified entry point for clean release operations. # @LAYER: Application diff --git a/backend/src/services/clean_release/manifest_builder.py b/backend/src/services/clean_release/manifest_builder.py index c653a83f..6eae11ab 100644 --- a/backend/src/services/clean_release/manifest_builder.py +++ b/backend/src/services/clean_release/manifest_builder.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.clean_release.manifest_builder:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: clean-release, manifest, deterministic-hash, summary # @PURPOSE: Build deterministic distribution manifest from classified artifact input. # @LAYER: Domain diff --git a/backend/src/services/clean_release/manifest_service.py b/backend/src/services/clean_release/manifest_service.py index 53334096..ecd91272 100644 --- a/backend/src/services/clean_release/manifest_service.py +++ b/backend/src/services/clean_release/manifest_service.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.clean_release.manifest_service:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: clean-release, manifest, versioning, immutability, lifecycle # @PURPOSE: Build immutable distribution manifests with deterministic digest and version increment. # @LAYER: Domain diff --git a/backend/src/services/clean_release/mappers.py b/backend/src/services/clean_release/mappers.py index 02053bd5..2ae40ba0 100644 --- a/backend/src/services/clean_release/mappers.py +++ b/backend/src/services/clean_release/mappers.py @@ -1,5 +1,5 @@ # [DEF:clean_release_mappers:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Map between domain entities (SQLAlchemy models) and DTOs. # @LAYER: Application diff --git a/backend/src/services/clean_release/policy_engine.py b/backend/src/services/clean_release/policy_engine.py index e28f5f7b..32b1c74a 100644 --- a/backend/src/services/clean_release/policy_engine.py +++ b/backend/src/services/clean_release/policy_engine.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.clean_release.policy_engine:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: clean-release, policy, classification, source-isolation # @PURPOSE: Evaluate artifact/source policies for enterprise clean profile with deterministic outcomes. # @LAYER: Domain diff --git a/backend/src/services/clean_release/policy_resolution_service.py b/backend/src/services/clean_release/policy_resolution_service.py index 5875c846..5ed44a94 100644 --- a/backend/src/services/clean_release/policy_resolution_service.py +++ b/backend/src/services/clean_release/policy_resolution_service.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.clean_release.policy_resolution_service:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: clean-release, policy, registry, trusted-resolution, immutable-snapshots # @PURPOSE: Resolve trusted policy and registry snapshots from ConfigManager without runtime overrides. # @LAYER: Domain diff --git a/backend/src/services/clean_release/preparation_service.py b/backend/src/services/clean_release/preparation_service.py index f5d761da..d022ec41 100644 --- a/backend/src/services/clean_release/preparation_service.py +++ b/backend/src/services/clean_release/preparation_service.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.clean_release.preparation_service:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: clean-release, preparation, manifest, policy-evaluation # @PURPOSE: Prepare release candidate by policy evaluation and deterministic manifest creation. # @LAYER: Domain diff --git a/backend/src/services/clean_release/publication_service.py b/backend/src/services/clean_release/publication_service.py index 4c344199..163500ec 100644 --- a/backend/src/services/clean_release/publication_service.py +++ b/backend/src/services/clean_release/publication_service.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.clean_release.publication_service:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: clean-release, publication, revoke, gate, lifecycle # @PURPOSE: Enforce publication and revocation gates with append-only publication records. # @LAYER: Domain diff --git a/backend/src/services/clean_release/report_builder.py b/backend/src/services/clean_release/report_builder.py index 17b53f7c..37981b9a 100644 --- a/backend/src/services/clean_release/report_builder.py +++ b/backend/src/services/clean_release/report_builder.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.clean_release.report_builder:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: clean-release, report, audit, counters, violations # @PURPOSE: Build and persist compliance reports with consistent counter invariants. # @LAYER: Domain diff --git a/backend/src/services/clean_release/repositories/__init__.py b/backend/src/services/clean_release/repositories/__init__.py index 456e1784..b2528bb3 100644 --- a/backend/src/services/clean_release/repositories/__init__.py +++ b/backend/src/services/clean_release/repositories/__init__.py @@ -1,5 +1,5 @@ # [DEF:clean_release_repositories:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Export all clean release repositories. from .candidate_repository import CandidateRepository diff --git a/backend/src/services/clean_release/repositories/approval_repository.py b/backend/src/services/clean_release/repositories/approval_repository.py index 8c82abbe..a5651bf5 100644 --- a/backend/src/services/clean_release/repositories/approval_repository.py +++ b/backend/src/services/clean_release/repositories/approval_repository.py @@ -1,5 +1,5 @@ # [DEF:approval_repository:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Persist and query approval decisions. # @LAYER: Infra diff --git a/backend/src/services/clean_release/repositories/artifact_repository.py b/backend/src/services/clean_release/repositories/artifact_repository.py index b5a64bd0..6042386d 100644 --- a/backend/src/services/clean_release/repositories/artifact_repository.py +++ b/backend/src/services/clean_release/repositories/artifact_repository.py @@ -1,5 +1,5 @@ # [DEF:artifact_repository:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Persist and query candidate artifacts. # @LAYER: Infra diff --git a/backend/src/services/clean_release/repositories/audit_repository.py b/backend/src/services/clean_release/repositories/audit_repository.py index a18715e2..3fa94d59 100644 --- a/backend/src/services/clean_release/repositories/audit_repository.py +++ b/backend/src/services/clean_release/repositories/audit_repository.py @@ -1,5 +1,5 @@ # [DEF:audit_repository:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Persist and query audit logs for clean release operations. # @LAYER: Infra diff --git a/backend/src/services/clean_release/repositories/candidate_repository.py b/backend/src/services/clean_release/repositories/candidate_repository.py index 96e74f19..0a2ebc40 100644 --- a/backend/src/services/clean_release/repositories/candidate_repository.py +++ b/backend/src/services/clean_release/repositories/candidate_repository.py @@ -1,5 +1,5 @@ # [DEF:candidate_repository:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Persist and query release candidates. # @LAYER: Infra diff --git a/backend/src/services/clean_release/repositories/compliance_repository.py b/backend/src/services/clean_release/repositories/compliance_repository.py index 422e3f16..89927802 100644 --- a/backend/src/services/clean_release/repositories/compliance_repository.py +++ b/backend/src/services/clean_release/repositories/compliance_repository.py @@ -1,5 +1,5 @@ # [DEF:compliance_repository:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Persist and query compliance runs, stage runs, and violations. # @LAYER: Infra diff --git a/backend/src/services/clean_release/repositories/manifest_repository.py b/backend/src/services/clean_release/repositories/manifest_repository.py index 40a7adb5..5f4dfc93 100644 --- a/backend/src/services/clean_release/repositories/manifest_repository.py +++ b/backend/src/services/clean_release/repositories/manifest_repository.py @@ -1,5 +1,5 @@ # [DEF:manifest_repository:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Persist and query distribution manifests. # @LAYER: Infra diff --git a/backend/src/services/clean_release/repositories/policy_repository.py b/backend/src/services/clean_release/repositories/policy_repository.py index 0b0b6c20..f6a35b70 100644 --- a/backend/src/services/clean_release/repositories/policy_repository.py +++ b/backend/src/services/clean_release/repositories/policy_repository.py @@ -1,5 +1,5 @@ # [DEF:policy_repository:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Persist and query policy and registry snapshots. # @LAYER: Infra diff --git a/backend/src/services/clean_release/repositories/publication_repository.py b/backend/src/services/clean_release/repositories/publication_repository.py index 6333bda6..c45d0480 100644 --- a/backend/src/services/clean_release/repositories/publication_repository.py +++ b/backend/src/services/clean_release/repositories/publication_repository.py @@ -1,5 +1,5 @@ # [DEF:publication_repository:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Persist and query publication records. # @LAYER: Infra diff --git a/backend/src/services/clean_release/repositories/report_repository.py b/backend/src/services/clean_release/repositories/report_repository.py index 40f91c78..bd63cd0b 100644 --- a/backend/src/services/clean_release/repositories/report_repository.py +++ b/backend/src/services/clean_release/repositories/report_repository.py @@ -1,5 +1,5 @@ # [DEF:report_repository:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Persist and query compliance reports. # @LAYER: Infra diff --git a/backend/src/services/clean_release/repository.py b/backend/src/services/clean_release/repository.py index 2f088396..f92a6a7b 100644 --- a/backend/src/services/clean_release/repository.py +++ b/backend/src/services/clean_release/repository.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.clean_release.repository:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: clean-release, repository, persistence, in-memory # @PURPOSE: Provide repository adapter for clean release entities with deterministic access methods. # @LAYER: Infra diff --git a/backend/src/services/clean_release/source_isolation.py b/backend/src/services/clean_release/source_isolation.py index 3ce11b7c..915b5da2 100644 --- a/backend/src/services/clean_release/source_isolation.py +++ b/backend/src/services/clean_release/source_isolation.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.clean_release.source_isolation:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: clean-release, source-isolation, internal-only, validation # @PURPOSE: Validate that all resource endpoints belong to the approved internal source registry. # @LAYER: Domain diff --git a/backend/src/services/clean_release/stages/__init__.py b/backend/src/services/clean_release/stages/__init__.py index fa94b980..c7057bc4 100644 --- a/backend/src/services/clean_release/stages/__init__.py +++ b/backend/src/services/clean_release/stages/__init__.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.clean_release.stages:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: clean-release, compliance, stages, state-machine # @PURPOSE: Define compliance stage order and helper functions for deterministic run-state evaluation. # @LAYER: Domain diff --git a/backend/src/services/clean_release/stages/base.py b/backend/src/services/clean_release/stages/base.py index cc2dadd7..abcc3c94 100644 --- a/backend/src/services/clean_release/stages/base.py +++ b/backend/src/services/clean_release/stages/base.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.clean_release.stages.base:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: clean-release, compliance, stages, contracts, base # @PURPOSE: Define shared contracts and helpers for pluggable clean-release compliance stages. # @LAYER: Domain diff --git a/backend/src/services/clean_release/stages/data_purity.py b/backend/src/services/clean_release/stages/data_purity.py index 6145bf54..b3cc52d2 100644 --- a/backend/src/services/clean_release/stages/data_purity.py +++ b/backend/src/services/clean_release/stages/data_purity.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.clean_release.stages.data_purity:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: clean-release, compliance-stage, data-purity # @PURPOSE: Evaluate manifest purity counters and emit blocking violations for prohibited artifacts. # @LAYER: Domain diff --git a/backend/src/services/clean_release/stages/internal_sources_only.py b/backend/src/services/clean_release/stages/internal_sources_only.py index 2a3a06a5..8c19a89e 100644 --- a/backend/src/services/clean_release/stages/internal_sources_only.py +++ b/backend/src/services/clean_release/stages/internal_sources_only.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.clean_release.stages.internal_sources_only:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: clean-release, compliance-stage, source-isolation, registry # @PURPOSE: Verify manifest-declared sources belong to trusted internal registry allowlist. # @LAYER: Domain diff --git a/backend/src/services/clean_release/stages/manifest_consistency.py b/backend/src/services/clean_release/stages/manifest_consistency.py index 297d1838..643cdeae 100644 --- a/backend/src/services/clean_release/stages/manifest_consistency.py +++ b/backend/src/services/clean_release/stages/manifest_consistency.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.clean_release.stages.manifest_consistency:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: clean-release, compliance-stage, manifest, consistency, digest # @PURPOSE: Ensure run is bound to the exact manifest snapshot and digest used at run creation time. # @LAYER: Domain diff --git a/backend/src/services/clean_release/stages/no_external_endpoints.py b/backend/src/services/clean_release/stages/no_external_endpoints.py index 79659f60..88cb1dcf 100644 --- a/backend/src/services/clean_release/stages/no_external_endpoints.py +++ b/backend/src/services/clean_release/stages/no_external_endpoints.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.clean_release.stages.no_external_endpoints:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: clean-release, compliance-stage, endpoints, network # @PURPOSE: Block manifest payloads that expose external endpoints outside trusted schemes and hosts. # @LAYER: Domain diff --git a/backend/src/services/git_service.py b/backend/src/services/git_service.py index 6ffe3e46..8a0a06e0 100644 --- a/backend/src/services/git_service.py +++ b/backend/src/services/git_service.py @@ -1,6 +1,6 @@ # [DEF:backend.src.services.git_service:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: git, service, gitpython, repository, version_control # @PURPOSE: Core Git logic using GitPython to manage dashboard repositories. # @LAYER: Service @@ -32,7 +32,7 @@ from src.models.config import AppConfigRecord from src.core.database import SessionLocal # [DEF:backend.src.services.git_service.GitService:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Wrapper for GitPython operations with semantic logging and error handling. class GitService: """ diff --git a/backend/src/services/health_service.py b/backend/src/services/health_service.py index 189093ce..68478803 100644 --- a/backend/src/services/health_service.py +++ b/backend/src/services/health_service.py @@ -1,5 +1,5 @@ # [DEF:health_service:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: health, aggregation, dashboards # @PURPOSE: Business logic for aggregating dashboard health status from validation records. # @LAYER: Domain/Service @@ -20,7 +20,7 @@ from ..core.task_manager.cleanup import TaskCleanupService from ..core.task_manager import TaskManager # [DEF:HealthService:Class] -# @TIER: STANDARD +# @COMPLEXITY: 4 # @PURPOSE: Aggregate latest dashboard validation state and manage persisted health report lifecycle. # @RELATION: [DEPENDS_ON] ->[backend.src.models.llm.ValidationRecord] # @RELATION: [DEPENDS_ON] ->[backend.src.schemas.health.DashboardHealthItem] @@ -35,7 +35,7 @@ class HealthService: @PURPOSE: Service for managing and querying dashboard health data. """ # [DEF:HealthService.__init__:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Initialize health service with DB session and optional config access for dashboard metadata resolution. # @PRE: db is a valid SQLAlchemy session. # @POST: Service is ready to aggregate summaries and delete health reports. @@ -46,7 +46,7 @@ class HealthService: # [/DEF:HealthService.__init__:Function] # [DEF:HealthService._prime_dashboard_meta_cache:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Warm dashboard slug/title cache with one Superset list fetch per environment. # @PRE: records may contain mixed numeric and slug dashboard identifiers. # @POST: Numeric dashboard ids for known environments are cached when discoverable. @@ -127,7 +127,7 @@ class HealthService: # [/DEF:HealthService._prime_dashboard_meta_cache:Function] # [DEF:HealthService._resolve_dashboard_meta:Function] - # @TIER: TRIVIAL + # @COMPLEXITY: 1 # @PURPOSE: Resolve slug/title for a dashboard referenced by persisted validation record. # @PRE: dashboard_id may be numeric or slug-like; environment_id may be empty. # @POST: Returns dict with `slug` and `title` keys, using cache when possible. @@ -154,7 +154,7 @@ class HealthService: # [/DEF:HealthService._resolve_dashboard_meta:Function] # [DEF:HealthService.get_health_summary:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Aggregate latest validation status per dashboard and enrich rows with dashboard slug/title. # @PRE: environment_id may be omitted to aggregate across all environments. # @POST: Returns HealthSummaryResponse with counts and latest record row per dashboard. @@ -232,7 +232,7 @@ class HealthService: # [/DEF:HealthService.get_health_summary:Function] # [DEF:HealthService.delete_validation_report:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Delete one persisted health report and optionally clean linked task/log artifacts. # @PRE: record_id is a validation record identifier. # @POST: Returns True only when a matching record was deleted. diff --git a/backend/src/services/llm_prompt_templates.py b/backend/src/services/llm_prompt_templates.py index fed46d89..8d368835 100644 --- a/backend/src/services/llm_prompt_templates.py +++ b/backend/src/services/llm_prompt_templates.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.llm_prompt_templates:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: llm, prompts, templates, settings # @PURPOSE: Provide default LLM prompt templates and normalization helpers for runtime usage. # @LAYER: Domain @@ -13,7 +13,7 @@ from typing import Dict, Any, Optional # [DEF:DEFAULT_LLM_PROMPTS:Constant] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Default prompt templates used by documentation, dashboard validation, and git commit generation. DEFAULT_LLM_PROMPTS: Dict[str, str] = { "dashboard_validation_prompt": ( @@ -62,7 +62,7 @@ DEFAULT_LLM_PROMPTS: Dict[str, str] = { # [DEF:DEFAULT_LLM_PROVIDER_BINDINGS:Constant] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Default provider binding per task domain. DEFAULT_LLM_PROVIDER_BINDINGS: Dict[str, str] = { "dashboard_validation": "", @@ -73,7 +73,7 @@ DEFAULT_LLM_PROVIDER_BINDINGS: Dict[str, str] = { # [DEF:DEFAULT_LLM_ASSISTANT_SETTINGS:Constant] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Default planner settings for assistant chat intent model/provider resolution. DEFAULT_LLM_ASSISTANT_SETTINGS: Dict[str, str] = { "assistant_planner_provider": "", @@ -83,7 +83,7 @@ DEFAULT_LLM_ASSISTANT_SETTINGS: Dict[str, str] = { # [DEF:normalize_llm_settings:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Ensure llm settings contain stable schema with prompts section and default templates. # @PRE: llm_settings is dictionary-like value or None. # @POST: Returned dict contains prompts with all required template keys. @@ -127,7 +127,7 @@ def normalize_llm_settings(llm_settings: Any) -> Dict[str, Any]: # [DEF:is_multimodal_model:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Heuristically determine whether model supports image input required for dashboard validation. # @PRE: model_name may be empty or mixed-case. # @POST: Returns True when model likely supports multimodal input. @@ -169,7 +169,7 @@ def is_multimodal_model(model_name: str, provider_type: Optional[str] = None) -> # [DEF:resolve_bound_provider_id:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Resolve provider id configured for a task binding with fallback to default provider. # @PRE: llm_settings is normalized or raw dict from config. # @POST: Returns configured provider id or fallback id/empty string when not defined. @@ -185,7 +185,7 @@ def resolve_bound_provider_id(llm_settings: Any, task_key: str) -> str: # [DEF:render_prompt:Function] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Render prompt template using deterministic placeholder replacement with graceful fallback. # @PRE: template is a string and variables values are already stringifiable. # @POST: Returns rendered prompt text with known placeholders substituted. diff --git a/backend/src/services/llm_provider.py b/backend/src/services/llm_provider.py index bee73c22..9656d10e 100644 --- a/backend/src/services/llm_provider.py +++ b/backend/src/services/llm_provider.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.llm_provider:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: service, llm, provider, encryption # @PURPOSE: Service for managing LLM provider configurations with encrypted API keys. # @LAYER: Domain @@ -19,7 +19,7 @@ if TYPE_CHECKING: MASKED_API_KEY_PLACEHOLDER = "********" # [DEF:_require_fernet_key:Function] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @PURPOSE: Load and validate the Fernet key used for secret encryption. # @PRE: ENCRYPTION_KEY environment variable must be set to a valid Fernet key. # @POST: Returns validated key bytes ready for Fernet initialization. @@ -34,7 +34,7 @@ def _require_fernet_key() -> bytes: # [/DEF:_require_fernet_key:Function] # [DEF:EncryptionManager:Class] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @PURPOSE: Handles encryption and decryption of sensitive data like API keys. # @INVARIANT: Uses only a validated secret key from environment. # @@ -79,7 +79,7 @@ class EncryptionManager: # [/DEF:EncryptionManager:Class] # [DEF:LLMProviderService:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Service to manage LLM provider lifecycle. class LLMProviderService: # [DEF:LLMProviderService.__init__:Function] @@ -92,7 +92,7 @@ class LLMProviderService: # [/DEF:LLMProviderService.__init__:Function] # [DEF:get_all_providers:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Returns all configured LLM providers. # @PRE: Database connection must be active. # @POST: Returns list of all LLMProvider records. @@ -102,7 +102,7 @@ class LLMProviderService: # [/DEF:get_all_providers:Function] # [DEF:get_provider:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Returns a single LLM provider by ID. # @PRE: provider_id must be a valid string. # @POST: Returns LLMProvider or None if not found. @@ -112,7 +112,7 @@ class LLMProviderService: # [/DEF:get_provider:Function] # [DEF:create_provider:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Creates a new LLM provider with encrypted API key. # @PRE: config must contain valid provider configuration. # @POST: New provider created and persisted to database. @@ -134,7 +134,7 @@ class LLMProviderService: # [/DEF:create_provider:Function] # [DEF:update_provider:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Updates an existing LLM provider. # @PRE: provider_id must exist, config must be valid. # @POST: Provider updated and persisted to database. @@ -163,7 +163,7 @@ class LLMProviderService: # [/DEF:update_provider:Function] # [DEF:delete_provider:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Deletes an LLM provider. # @PRE: provider_id must exist. # @POST: Provider removed from database. @@ -178,7 +178,7 @@ class LLMProviderService: # [/DEF:delete_provider:Function] # [DEF:get_decrypted_api_key:Function] - # @TIER: STANDARD + # @COMPLEXITY: 3 # @PURPOSE: Returns the decrypted API key for a provider. # @PRE: provider_id must exist with valid encrypted key. # @POST: Returns decrypted API key or None on failure. diff --git a/backend/src/services/notifications/__tests__/test_notification_service.py b/backend/src/services/notifications/__tests__/test_notification_service.py index cbdfaef7..e7ae0fd2 100644 --- a/backend/src/services/notifications/__tests__/test_notification_service.py +++ b/backend/src/services/notifications/__tests__/test_notification_service.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.notifications.__tests__.test_notification_service:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Unit tests for NotificationService routing and dispatch logic. import pytest diff --git a/backend/src/services/notifications/providers.py b/backend/src/services/notifications/providers.py index 720c132c..84b17e20 100644 --- a/backend/src/services/notifications/providers.py +++ b/backend/src/services/notifications/providers.py @@ -1,6 +1,6 @@ # [DEF:backend.src.services.notifications.providers:Module] # -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: notifications, providers, smtp, slack, telegram, abstraction # @PURPOSE: Defines abstract base and concrete implementations for external notification delivery. # @LAYER: Infra diff --git a/backend/src/services/notifications/service.py b/backend/src/services/notifications/service.py index d0047ae2..0aceab7c 100644 --- a/backend/src/services/notifications/service.py +++ b/backend/src/services/notifications/service.py @@ -1,6 +1,6 @@ # [DEF:backend.src.services.notifications.service:Module] # -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: notifications, service, routing, dispatch, background-tasks # @PURPOSE: Orchestrates notification routing based on user preferences and policy context. # @LAYER: Domain diff --git a/backend/src/services/profile_service.py b/backend/src/services/profile_service.py index 265c6fd6..9aae19f1 100644 --- a/backend/src/services/profile_service.py +++ b/backend/src/services/profile_service.py @@ -1,6 +1,6 @@ # [DEF:backend.src.services.profile_service:Module] # -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: profile, service, validation, ownership, filtering, superset, preferences # @PURPOSE: Orchestrates profile preference persistence, Superset account lookup, and deterministic actor matching. # @LAYER: Domain @@ -51,7 +51,7 @@ SUPPORTED_DENSITIES = {"compact", "comfortable"} # [DEF:ProfileValidationError:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Domain validation error for profile preference update requests. class ProfileValidationError(Exception): def __init__(self, errors: Sequence[str]): @@ -61,7 +61,7 @@ class ProfileValidationError(Exception): # [DEF:EnvironmentNotFoundError:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Raised when environment_id from lookup request is unknown in app configuration. class EnvironmentNotFoundError(Exception): pass @@ -69,7 +69,7 @@ class EnvironmentNotFoundError(Exception): # [DEF:ProfileAuthorizationError:Class] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Raised when caller attempts cross-user preference mutation. class ProfileAuthorizationError(Exception): pass @@ -77,7 +77,7 @@ class ProfileAuthorizationError(Exception): # [DEF:ProfileService:Class] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @PURPOSE: Implements profile preference read/update flow and Superset account lookup degradation strategy. class ProfileService: # [DEF:__init__:Function] diff --git a/backend/src/services/rbac_permission_catalog.py b/backend/src/services/rbac_permission_catalog.py index 17007245..d401b2a0 100644 --- a/backend/src/services/rbac_permission_catalog.py +++ b/backend/src/services/rbac_permission_catalog.py @@ -1,6 +1,6 @@ # [DEF:backend.src.services.rbac_permission_catalog:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: rbac, permissions, catalog, sync, discovery # @PURPOSE: Discovers declared RBAC permissions from API routes/plugins and synchronizes them into auth database. # @LAYER: Service diff --git a/backend/src/services/reports/__tests__/test_report_normalizer.py b/backend/src/services/reports/__tests__/test_report_normalizer.py index f3d211ab..c0acb893 100644 --- a/backend/src/services/reports/__tests__/test_report_normalizer.py +++ b/backend/src/services/reports/__tests__/test_report_normalizer.py @@ -1,5 +1,5 @@ # [DEF:backend.tests.test_report_normalizer:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: tests, reports, normalizer, fallback # @PURPOSE: Validate unknown task type fallback and partial payload normalization behavior. # @LAYER: Domain (Tests) diff --git a/backend/src/services/reports/__tests__/test_report_service.py b/backend/src/services/reports/__tests__/test_report_service.py index 6663d4d3..dd14d8af 100644 --- a/backend/src/services/reports/__tests__/test_report_service.py +++ b/backend/src/services/reports/__tests__/test_report_service.py @@ -1,5 +1,5 @@ # [DEF:test_report_service:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Unit tests for ReportsService list/detail operations # @LAYER: Domain # @RELATION: TESTS -> backend.src.services.reports.report_service.ReportsService diff --git a/backend/src/services/reports/normalizer.py b/backend/src/services/reports/normalizer.py index 78281bfc..9a9c01f2 100644 --- a/backend/src/services/reports/normalizer.py +++ b/backend/src/services/reports/normalizer.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.reports.normalizer:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: reports, normalization, tasks, fallback # @PURPOSE: Convert task manager task objects into canonical unified TaskReport entities with deterministic fallback behavior. # @LAYER: Domain diff --git a/backend/src/services/reports/report_service.py b/backend/src/services/reports/report_service.py index 7f4b77ae..b81a7f63 100644 --- a/backend/src/services/reports/report_service.py +++ b/backend/src/services/reports/report_service.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.reports.report_service:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: reports, service, aggregation, filtering, pagination, detail # @PURPOSE: Aggregate, normalize, filter, and paginate task reports for unified list/detail API use cases. # @LAYER: Domain @@ -23,7 +23,7 @@ from .normalizer import normalize_task_report # [DEF:ReportsService:Class] # @PURPOSE: Service layer for list/detail report retrieval and normalization. -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @PRE: TaskManager dependency is initialized. # @POST: Provides deterministic list/detail report responses. # @INVARIANT: Service methods are read-only over task history source. @@ -42,7 +42,7 @@ from .normalizer import normalize_task_report # @TEST_INVARIANT: consistent_pagination -> verifies: [valid_service] class ReportsService: # [DEF:__init__:Function] - # @TIER: CRITICAL + # @COMPLEXITY: 5 # @PURPOSE: Initialize service with TaskManager dependency. # @PRE: task_manager is a live TaskManager instance. # @POST: self.task_manager is assigned and ready for read operations. diff --git a/backend/src/services/reports/type_profiles.py b/backend/src/services/reports/type_profiles.py index 9a18a7eb..b80acb26 100644 --- a/backend/src/services/reports/type_profiles.py +++ b/backend/src/services/reports/type_profiles.py @@ -1,5 +1,5 @@ # [DEF:backend.src.services.reports.type_profiles:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: reports, type_profiles, normalization, fallback # @PURPOSE: Deterministic mapping of plugin/task identifiers to canonical report task types and fallback profile metadata. # @LAYER: Domain diff --git a/backend/src/services/resource_service.py b/backend/src/services/resource_service.py index b23b877a..b66cb9cf 100644 --- a/backend/src/services/resource_service.py +++ b/backend/src/services/resource_service.py @@ -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' diff --git a/backend/tests/core/migration/test_archive_parser.py b/backend/tests/core/migration/test_archive_parser.py index 050bca32..11dd8277 100644 --- a/backend/tests/core/migration/test_archive_parser.py +++ b/backend/tests/core/migration/test_archive_parser.py @@ -1,6 +1,6 @@ # [DEF:backend.tests.core.migration.test_archive_parser:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Unit tests for MigrationArchiveParser ZIP extraction contract. # @LAYER: Domain # @RELATION: VERIFIES -> backend.src.core.migration.archive_parser diff --git a/backend/tests/core/migration/test_dry_run_orchestrator.py b/backend/tests/core/migration/test_dry_run_orchestrator.py index 20ba409a..6f26113f 100644 --- a/backend/tests/core/migration/test_dry_run_orchestrator.py +++ b/backend/tests/core/migration/test_dry_run_orchestrator.py @@ -1,6 +1,6 @@ # [DEF:backend.tests.core.migration.test_dry_run_orchestrator:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Unit tests for MigrationDryRunService diff and risk computation contracts. # @LAYER: Domain # @RELATION: VERIFIES -> backend.src.core.migration.dry_run_orchestrator diff --git a/backend/tests/core/test_git_service_gitea_pr.py b/backend/tests/core/test_git_service_gitea_pr.py index 2fadeb7a..8a826e51 100644 --- a/backend/tests/core/test_git_service_gitea_pr.py +++ b/backend/tests/core/test_git_service_gitea_pr.py @@ -1,5 +1,5 @@ # [DEF:backend.tests.core.test_git_service_gitea_pr:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: tests, git, gitea, pull_request, fallback # @PURPOSE: Validate Gitea PR creation fallback behavior when configured server URL is stale. # @LAYER: Domain diff --git a/backend/tests/core/test_mapping_service.py b/backend/tests/core/test_mapping_service.py index 5a695248..dd7f2102 100644 --- a/backend/tests/core/test_mapping_service.py +++ b/backend/tests/core/test_mapping_service.py @@ -1,6 +1,6 @@ # [DEF:backend.tests.core.test_mapping_service:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Unit tests for the IdMappingService matching UUIDs to integer IDs. # @LAYER: Domain # @RELATION: VERIFIES -> backend.src.core.mapping_service diff --git a/backend/tests/core/test_migration_engine.py b/backend/tests/core/test_migration_engine.py index db3bb637..8a0005c5 100644 --- a/backend/tests/core/test_migration_engine.py +++ b/backend/tests/core/test_migration_engine.py @@ -1,6 +1,6 @@ # [DEF:backend.tests.core.test_migration_engine:Module] # -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Unit tests for MigrationEngine's cross-filter patching algorithms. # @LAYER: Domain # @RELATION: VERIFIES -> backend.src.core.migration_engine diff --git a/backend/tests/scripts/test_clean_release_cli.py b/backend/tests/scripts/test_clean_release_cli.py index 45f6b42e..5868dced 100644 --- a/backend/tests/scripts/test_clean_release_cli.py +++ b/backend/tests/scripts/test_clean_release_cli.py @@ -1,5 +1,5 @@ # [DEF:test_clean_release_cli:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Smoke tests for the redesigned clean release CLI. # @LAYER: Domain diff --git a/backend/tests/scripts/test_clean_release_tui.py b/backend/tests/scripts/test_clean_release_tui.py index f8ad731d..a25ac2ce 100644 --- a/backend/tests/scripts/test_clean_release_tui.py +++ b/backend/tests/scripts/test_clean_release_tui.py @@ -1,5 +1,5 @@ # [DEF:backend.tests.scripts.test_clean_release_tui:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: tests, tui, clean-release, curses # @PURPOSE: Unit tests for the interactive curses TUI of the clean release process. # @LAYER: Scripts diff --git a/backend/tests/scripts/test_clean_release_tui_v2.py b/backend/tests/scripts/test_clean_release_tui_v2.py index 77185611..02e30e46 100644 --- a/backend/tests/scripts/test_clean_release_tui_v2.py +++ b/backend/tests/scripts/test_clean_release_tui_v2.py @@ -1,5 +1,5 @@ # [DEF:test_clean_release_tui_v2:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Smoke tests for thin-client TUI action dispatch and blocked transition behavior. # @LAYER: Domain # @RELATION: TESTS -> backend.src.scripts.clean_release_tui diff --git a/backend/tests/services/clean_release/test_approval_service.py b/backend/tests/services/clean_release/test_approval_service.py index 9b9f583e..dd0ee41b 100644 --- a/backend/tests/services/clean_release/test_approval_service.py +++ b/backend/tests/services/clean_release/test_approval_service.py @@ -1,5 +1,5 @@ # [DEF:backend.tests.services.clean_release.test_approval_service:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: tests, clean-release, approval, lifecycle, gate # @PURPOSE: Define approval gate contracts for approve/reject operations over immutable compliance evidence. # @LAYER: Tests diff --git a/backend/tests/services/clean_release/test_candidate_manifest_services.py b/backend/tests/services/clean_release/test_candidate_manifest_services.py index 88089578..27db45eb 100644 --- a/backend/tests/services/clean_release/test_candidate_manifest_services.py +++ b/backend/tests/services/clean_release/test_candidate_manifest_services.py @@ -1,5 +1,5 @@ # [DEF:test_candidate_manifest_services:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Test lifecycle and manifest versioning for release candidates. # @LAYER: Tests diff --git a/backend/tests/services/clean_release/test_compliance_execution_service.py b/backend/tests/services/clean_release/test_compliance_execution_service.py index 58643e1b..a6a6b03e 100644 --- a/backend/tests/services/clean_release/test_compliance_execution_service.py +++ b/backend/tests/services/clean_release/test_compliance_execution_service.py @@ -1,5 +1,5 @@ # [DEF:backend.tests.services.clean_release.test_compliance_execution_service:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: tests, clean-release, compliance, pipeline, run-finalization # @PURPOSE: Validate stage pipeline and run finalization contracts for compliance execution. # @LAYER: Tests diff --git a/backend/tests/services/clean_release/test_compliance_task_integration.py b/backend/tests/services/clean_release/test_compliance_task_integration.py index f27d2916..b70ddf02 100644 --- a/backend/tests/services/clean_release/test_compliance_task_integration.py +++ b/backend/tests/services/clean_release/test_compliance_task_integration.py @@ -1,5 +1,5 @@ # [DEF:backend.tests.services.clean_release.test_compliance_task_integration:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: tests, clean-release, compliance, task-manager, integration # @PURPOSE: Verify clean release compliance runs execute through TaskManager lifecycle with observable success/failure outcomes. # @LAYER: Tests diff --git a/backend/tests/services/clean_release/test_demo_mode_isolation.py b/backend/tests/services/clean_release/test_demo_mode_isolation.py index 30f19485..3a32cd20 100644 --- a/backend/tests/services/clean_release/test_demo_mode_isolation.py +++ b/backend/tests/services/clean_release/test_demo_mode_isolation.py @@ -1,5 +1,5 @@ # [DEF:backend.tests.services.clean_release.test_demo_mode_isolation:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: clean-release, demo-mode, isolation, namespace, repository # @PURPOSE: Verify demo and real mode namespace isolation contracts before TUI integration. # @LAYER: Tests diff --git a/backend/tests/services/clean_release/test_policy_resolution_service.py b/backend/tests/services/clean_release/test_policy_resolution_service.py index 516715ef..f59f4c1a 100644 --- a/backend/tests/services/clean_release/test_policy_resolution_service.py +++ b/backend/tests/services/clean_release/test_policy_resolution_service.py @@ -1,5 +1,5 @@ # [DEF:backend.tests.services.clean_release.test_policy_resolution_service:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: clean-release, policy-resolution, trusted-snapshots, contracts # @PURPOSE: Verify trusted policy snapshot resolution contract and error guards. # @LAYER: Tests diff --git a/backend/tests/services/clean_release/test_publication_service.py b/backend/tests/services/clean_release/test_publication_service.py index 8ecdd917..301ab136 100644 --- a/backend/tests/services/clean_release/test_publication_service.py +++ b/backend/tests/services/clean_release/test_publication_service.py @@ -1,5 +1,5 @@ # [DEF:backend.tests.services.clean_release.test_publication_service:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: tests, clean-release, publication, revoke, gate # @PURPOSE: Define publication gate contracts over approved candidates and immutable publication records. # @LAYER: Tests diff --git a/backend/tests/services/clean_release/test_report_audit_immutability.py b/backend/tests/services/clean_release/test_report_audit_immutability.py index 5baab052..6e1c817a 100644 --- a/backend/tests/services/clean_release/test_report_audit_immutability.py +++ b/backend/tests/services/clean_release/test_report_audit_immutability.py @@ -1,5 +1,5 @@ # [DEF:backend.tests.services.clean_release.test_report_audit_immutability:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: tests, clean-release, report, audit, immutability, append-only # @PURPOSE: Validate report snapshot immutability expectations and append-only audit hook behavior for US2. # @LAYER: Tests diff --git a/backend/tests/test_dashboards_api.py b/backend/tests/test_dashboards_api.py index 9f9d03ea..13636940 100644 --- a/backend/tests/test_dashboards_api.py +++ b/backend/tests/test_dashboards_api.py @@ -1,5 +1,5 @@ # [DEF:backend.tests.test_dashboards_api:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @PURPOSE: Comprehensive contract-driven tests for Dashboard Hub API # @LAYER: Domain (Tests) # @SEMANTICS: tests, dashboards, api, contract, remediation diff --git a/backend/tests/test_log_persistence.py b/backend/tests/test_log_persistence.py index 0192b922..1378ca3c 100644 --- a/backend/tests/test_log_persistence.py +++ b/backend/tests/test_log_persistence.py @@ -3,7 +3,7 @@ # @PURPOSE: Unit tests for TaskLogPersistenceService. # @LAYER: Test # @RELATION: TESTS -> TaskLogPersistenceService -# @TIER: CRITICAL +# @COMPLEXITY: 5 # [SECTION: IMPORTS] from datetime import datetime @@ -19,7 +19,7 @@ from src.core.task_manager.models import LogEntry, LogFilter # [DEF:TestLogPersistence:Class] # @PURPOSE: Test suite for TaskLogPersistenceService. -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @TEST_DATA: log_entry -> {"task_id": "test-task-1", "level": "INFO", "source": "test_source", "message": "Test message"} class TestLogPersistence: diff --git a/backend/tests/test_logger.py b/backend/tests/test_logger.py index b87a73fa..36ea13b9 100644 --- a/backend/tests/test_logger.py +++ b/backend/tests/test_logger.py @@ -1,5 +1,5 @@ # [DEF:tests.test_logger:Module] -# @TIER: STANDARD +# @COMPLEXITY: 3 # @SEMANTICS: logging, tests, belief_state # @PURPOSE: Unit tests for the custom logger formatters and configuration context manager. # @LAYER: Logging (Tests) diff --git a/backend/tests/test_task_logger.py b/backend/tests/test_task_logger.py index 4a883f21..ae398508 100644 --- a/backend/tests/test_task_logger.py +++ b/backend/tests/test_task_logger.py @@ -3,7 +3,7 @@ # @PURPOSE: Unit tests for TaskLogger and TaskContext. # @LAYER: Test # @RELATION: TESTS -> TaskLogger, TaskContext -# @TIER: STANDARD +# @COMPLEXITY: 3 # [SECTION: IMPORTS] from unittest.mock import Mock @@ -14,7 +14,7 @@ from src.core.task_manager.context import TaskContext # [DEF:TestTaskLogger:Class] # @PURPOSE: Test suite for TaskLogger. -# @TIER: STANDARD +# @COMPLEXITY: 3 class TestTaskLogger: # [DEF:setup_method:Function] @@ -220,7 +220,7 @@ class TestTaskLogger: # [DEF:TestTaskContext:Class] # @PURPOSE: Test suite for TaskContext. -# @TIER: STANDARD +# @COMPLEXITY: 3 class TestTaskContext: # [DEF:setup_method:Function] diff --git a/backend/tests/test_task_manager.py b/backend/tests/test_task_manager.py index c4b2207c..44459d01 100644 --- a/backend/tests/test_task_manager.py +++ b/backend/tests/test_task_manager.py @@ -1,5 +1,5 @@ # [DEF:test_task_manager:Module] -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @SEMANTICS: task-manager, lifecycle, CRUD, log-buffer, filtering, tests # @PURPOSE: Unit tests for TaskManager lifecycle, CRUD, log buffering, and filtering. # @LAYER: Core diff --git a/backend/tests/test_task_persistence.py b/backend/tests/test_task_persistence.py index 103940d4..e3c83b75 100644 --- a/backend/tests/test_task_persistence.py +++ b/backend/tests/test_task_persistence.py @@ -3,7 +3,7 @@ # @PURPOSE: Unit tests for TaskPersistenceService. # @LAYER: Test # @RELATION: TESTS -> TaskPersistenceService -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @TEST_DATA: valid_task -> {"id": "test-uuid-1", "plugin_id": "backup", "status": "PENDING"} # [SECTION: IMPORTS] @@ -22,7 +22,7 @@ from src.core.task_manager.models import Task, TaskStatus, LogEntry # [DEF:TestTaskPersistenceHelpers:Class] # @PURPOSE: Test suite for TaskPersistenceService static helper methods. -# @TIER: CRITICAL +# @COMPLEXITY: 5 class TestTaskPersistenceHelpers: # [DEF:test_json_load_if_needed_none:Function] @@ -111,7 +111,7 @@ class TestTaskPersistenceHelpers: # [DEF:TestTaskPersistenceService:Class] # @PURPOSE: Test suite for TaskPersistenceService CRUD operations. -# @TIER: CRITICAL +# @COMPLEXITY: 5 # @TEST_DATA: valid_task -> {"id": "test-uuid-1", "plugin_id": "backup", "status": "PENDING"} class TestTaskPersistenceService: diff --git a/frontend/src/components/DashboardGrid.svelte b/frontend/src/components/DashboardGrid.svelte index 87053982..a63c2ba9 100644 --- a/frontend/src/components/DashboardGrid.svelte +++ b/frontend/src/components/DashboardGrid.svelte @@ -1,6 +1,6 @@ - - -
{JSON.stringify($selectedTask.params, null, 2)}
- {JSON.stringify($selectedTask.params, null, 2)}
+ {$t.tasks?.select_task}
{/if}