diff --git a/.ai/MODULE_MAP.md b/.ai/MODULE_MAP.md index b3e2481bc..f7ee076b3 100644 --- a/.ai/MODULE_MAP.md +++ b/.ai/MODULE_MAP.md @@ -2,12 +2,12 @@ > High-level module structure for AI Context. Generated automatically. -**Generated:** 2026-02-24T21:04:43.328895 +**Generated:** 2026-02-25T20:19:23.587354 ## Summary -- **Total Modules:** 74 -- **Total Entities:** 1571 +- **Total Modules:** 77 +- **Total Entities:** 1811 ## Module Hierarchy @@ -54,9 +54,9 @@ ### π `routes/` - ποΈ **Layers:** API, UI (API) - - π **Tiers:** CRITICAL: 2, STANDARD: 182, TRIVIAL: 4 + - π **Tiers:** CRITICAL: 2, STANDARD: 187, TRIVIAL: 5 - π **Files:** 17 - - π¦ **Entities:** 188 + - π¦ **Entities:** 194 **Key Entities:** @@ -92,9 +92,9 @@ ### π `__tests__/` - ποΈ **Layers:** API, Domain (Tests), UI (API Tests) - - π **Tiers:** CRITICAL: 3, STANDARD: 33, TRIVIAL: 81 - - π **Files:** 7 - - π¦ **Entities:** 117 + - π **Tiers:** CRITICAL: 3, STANDARD: 36, TRIVIAL: 98 + - π **Files:** 8 + - π¦ **Entities:** 137 **Key Entities:** @@ -126,9 +126,9 @@ ### π `core/` - ποΈ **Layers:** Core - - π **Tiers:** STANDARD: 116, TRIVIAL: 7 - - π **Files:** 9 - - π¦ **Entities:** 123 + - π **Tiers:** CRITICAL: 2, STANDARD: 125, TRIVIAL: 8 + - π **Files:** 10 + - π¦ **Entities:** 135 **Key Entities:** @@ -138,6 +138,8 @@ - Custom logging formatter that adds belief state prefixes to ... - β **ConfigManager** (Class) - A class to handle application configuration persistence and ... + - β **IdMappingService** (Class) `[CRITICAL]` + - Service handling the cataloging and retrieval of remote Supe... - β **LogEntry** (Class) - A Pydantic model representing a single, structured log entry... - β **MigrationEngine** (Class) @@ -150,8 +152,6 @@ - Scans a specified directory for Python modules, dynamically ... - β **SchedulerService** (Class) - Provides a service to manage scheduled backup tasks. - - β **SessionLocal** (Class) `[TRIVIAL]` - - A session factory for the main mappings database. **Dependencies:** @@ -159,7 +159,7 @@ - π DEPENDS_ON -> ConfigModels - π DEPENDS_ON -> PyYAML - π DEPENDS_ON -> backend.src.core.auth.config - - π DEPENDS_ON -> backend.src.models.mapping + - π DEPENDS_ON -> backend.src.core.logger ### π `auth/` @@ -210,9 +210,9 @@ ### π `__tests__/` - ποΈ **Layers:** Infra - - π **Tiers:** STANDARD: 9 + - π **Tiers:** STANDARD: 11, TRIVIAL: 1 - π **Files:** 1 - - π¦ **Entities:** 9 + - π¦ **Entities:** 12 **Key Entities:** @@ -296,9 +296,9 @@ ### π `models/` - ποΈ **Layers:** Domain, Model - - π **Tiers:** CRITICAL: 9, STANDARD: 21, TRIVIAL: 21 + - π **Tiers:** CRITICAL: 9, STANDARD: 22, TRIVIAL: 22 - π **Files:** 11 - - π¦ **Entities:** 51 + - π¦ **Entities:** 53 **Key Entities:** @@ -334,14 +334,16 @@ ### π `__tests__/` - ποΈ **Layers:** Domain - - π **Tiers:** STANDARD: 1, TRIVIAL: 1 - - π **Files:** 1 - - π¦ **Entities:** 2 + - π **Tiers:** CRITICAL: 1, STANDARD: 1, TRIVIAL: 27 + - π **Files:** 2 + - π¦ **Entities:** 29 **Key Entities:** - π¦ **test_models** (Module) `[TRIVIAL]` - Unit tests for data models + - π¦ **test_report_models** (Module) `[CRITICAL]` + - Unit tests for report Pydantic models and their validators ### π `plugins/` @@ -483,9 +485,9 @@ ### π `scripts/` - ποΈ **Layers:** Scripts, Unknown - - π **Tiers:** STANDARD: 17, TRIVIAL: 2 - - π **Files:** 5 - - π¦ **Entities:** 19 + - π **Tiers:** STANDARD: 26, TRIVIAL: 2 + - π **Files:** 6 + - π¦ **Entities:** 28 **Key Entities:** @@ -497,6 +499,8 @@ - Migrates legacy config and task history from SQLite/file sto... - π¦ **backend.src.scripts.seed_permissions** (Module) - 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... - π¦ **test_dataset_dashboard_relations** (Module) `[TRIVIAL]` - Auto-generated module for backend/src/scripts/test_dataset_d... @@ -540,17 +544,21 @@ ### π `__tests__/` - - ποΈ **Layers:** Domain Tests, Service - - π **Tiers:** STANDARD: 14 - - π **Files:** 2 - - π¦ **Entities:** 14 + - ποΈ **Layers:** Domain, Domain Tests, Service + - π **Tiers:** CRITICAL: 1, STANDARD: 21, TRIVIAL: 7 + - π **Files:** 3 + - π¦ **Entities:** 29 **Key Entities:** + - β **TestEncryptionManager** (Class) + - Validate EncryptionManager encrypt/decrypt roundtrip, unique... - π¦ **backend.src.services.__tests__.test_llm_prompt_templates** (Module) - Validate normalization and rendering behavior for configurab... - π¦ **backend.src.services.__tests__.test_resource_service** (Module) - Unit tests for ResourceService + - π¦ **test_encryption_manager** (Module) `[CRITICAL]` + - Unit tests for EncryptionManager encrypt/decrypt functionali... **Dependencies:** @@ -584,41 +592,63 @@ ### π `__tests__/` - - ποΈ **Layers:** Domain (Tests) - - π **Tiers:** CRITICAL: 1, TRIVIAL: 2 - - π **Files:** 1 - - π¦ **Entities:** 3 + - ποΈ **Layers:** Domain, Domain (Tests) + - π **Tiers:** CRITICAL: 2, TRIVIAL: 19 + - π **Files:** 2 + - π¦ **Entities:** 21 **Key Entities:** - π¦ **backend.tests.test_report_normalizer** (Module) `[CRITICAL]` - Validate unknown task type fallback and partial payload norm... + - π¦ **test_report_service** (Module) `[CRITICAL]` + - Unit tests for ReportsService list/detail operations ### π `tests/` - - ποΈ **Layers:** Domain (Tests), Test, Unknown - - π **Tiers:** STANDARD: 54, TRIVIAL: 19 - - π **Files:** 7 - - π¦ **Entities:** 73 + - ποΈ **Layers:** Core, Domain (Tests), Test, Unknown + - π **Tiers:** CRITICAL: 6, STANDARD: 80, TRIVIAL: 57 + - π **Files:** 10 + - π¦ **Entities:** 143 **Key Entities:** - - β **TestLogPersistence** (Class) + - β **TestLogPersistence** (Class) `[CRITICAL]` - Test suite for TaskLogPersistenceService. - β **TestTaskContext** (Class) - Test suite for TaskContext. - β **TestTaskLogger** (Class) - Test suite for TaskLogger. + - β **TestTaskPersistenceHelpers** (Class) `[CRITICAL]` + - Test suite for TaskPersistenceService static helper methods. + - β **TestTaskPersistenceService** (Class) `[CRITICAL]` + - Test suite for TaskPersistenceService CRUD operations. - π¦ **backend.tests.test_dashboards_api** (Module) - Contract-driven tests for Dashboard Hub API - π¦ **test_auth** (Module) `[TRIVIAL]` - Auto-generated module for backend/tests/test_auth.py - - π¦ **test_log_persistence** (Module) + - π¦ **test_log_persistence** (Module) `[CRITICAL]` - Unit tests for TaskLogPersistenceService. - π¦ **test_resource_hubs** (Module) `[TRIVIAL]` - Auto-generated module for backend/tests/test_resource_hubs.p... - - π¦ **test_task_logger** (Module) - - Unit tests for TaskLogger and TaskContext. + - π¦ **test_smoke_plugins** (Module) `[TRIVIAL]` + - Auto-generated module for backend/tests/test_smoke_plugins.p... + + ### π `core/` + + - ποΈ **Layers:** Domain, Unknown + - π **Tiers:** STANDARD: 2, TRIVIAL: 31 + - π **Files:** 3 + - π¦ **Entities:** 33 + + **Key Entities:** + + - π¦ **backend.tests.core.test_mapping_service** (Module) + - Unit tests for the IdMappingService matching UUIDs to intege... + - π¦ **backend.tests.core.test_migration_engine** (Module) + - Unit tests for MigrationEngine's cross-filter patching algor... + - π¦ **test_defensive_guards** (Module) `[TRIVIAL]` + - Auto-generated module for backend/tests/core/test_defensive_... ### π `components/` @@ -650,6 +680,18 @@ - π§© **TaskList** (Component) - Displays a list of tasks with their status and execution det... + ### π `__tests__/` + + - ποΈ **Layers:** UI (Tests) + - π **Tiers:** CRITICAL: 1 + - π **Files:** 1 + - π¦ **Entities:** 1 + + **Key Entities:** + + - π¦ **frontend.src.components.__tests__.task_log_viewer** (Module) `[CRITICAL]` + - Unit tests for TaskLogViewer component by mounting it and ob... + ### π `auth/` - ποΈ **Layers:** Component @@ -811,6 +853,24 @@ - π DEPENDS_ON -> [DEF:api_module] - π DEPENDS_ON -> frontend.src.lib.api.api_module + ### π `__tests__/` + + - ποΈ **Layers:** Infra (Tests) + - π **Tiers:** CRITICAL: 1, STANDARD: 3 + - π **Files:** 1 + - π¦ **Entities:** 4 + + **Key Entities:** + + - β **TestBuildReportQueryString** (Class) + - Validate query string construction from filter options. + - β **TestGetReportsAsync** (Class) + - Validate getReports and getReportDetail with mocked api.fetc... + - β **TestNormalizeApiError** (Class) + - Validate error normalization for UI-state mapping. + - π¦ **frontend.src.lib.api.__tests__.reports_api** (Module) `[CRITICAL]` + - Unit tests for reports API client functions: query string bu... + ### π `auth/` - ποΈ **Layers:** Feature @@ -1027,9 +1087,15 @@ ### π `mocks/` - - π **Tiers:** STANDARD: 3 - - π **Files:** 3 - - π¦ **Entities:** 3 + - ποΈ **Layers:** UI (Tests) + - π **Tiers:** STANDARD: 4 + - π **Files:** 4 + - π¦ **Entities:** 4 + + **Key Entities:** + + - π¦ **mock_env_public** (Module) + - Mock for $env/static/public SvelteKit module in vitest ### π `ui/` @@ -1148,9 +1214,9 @@ ### π `dashboards/` - ποΈ **Layers:** UI, Unknown - - π **Tiers:** CRITICAL: 1, TRIVIAL: 27 + - π **Tiers:** CRITICAL: 1, TRIVIAL: 37 - π **Files:** 1 - - π¦ **Entities:** 28 + - π¦ **Entities:** 38 **Key Entities:** @@ -1259,9 +1325,9 @@ ### π `settings/` - ποΈ **Layers:** UI, Unknown - - π **Tiers:** CRITICAL: 1, STANDARD: 1, TRIVIAL: 14 + - π **Tiers:** CRITICAL: 1, STANDARD: 1, TRIVIAL: 23 - π **Files:** 2 - - π¦ **Entities:** 16 + - π¦ **Entities:** 25 **Key Entities:** @@ -1445,10 +1511,13 @@ graph TD __tests__-->|TESTS|backend __tests__-->|DEPENDS_ON|backend __tests__-->|DEPENDS_ON|backend + __tests__-->|VERIFIES|backend core-->|USES|backend core-->|USES|backend core-->|DEPENDS_ON|backend core-->|DEPENDS_ON|backend + core-->|DEPENDS_ON|backend + core-->|DEPENDS_ON|backend auth-->|USES|backend auth-->|USES|backend auth-->|USES|backend @@ -1461,9 +1530,12 @@ graph TD models-->|DEPENDS_ON|backend models-->|USED_BY|backend models-->|INHERITS_FROM|backend + __tests__-->|TESTS|backend llm_analysis-->|IMPLEMENTS|backend llm_analysis-->|IMPLEMENTS|backend storage-->|DEPENDS_ON|backend + scripts-->|USES|backend + scripts-->|USES|backend scripts-->|READS_FROM|backend scripts-->|READS_FROM|backend scripts-->|USES|backend @@ -1483,6 +1555,7 @@ graph TD services-->|USES|backend services-->|DEPENDS_ON|backend services-->|DEPENDS_ON|backend + __tests__-->|TESTS|backend __tests__-->|DEPENDS_ON|backend __tests__-->|TESTS|backend reports-->|DEPENDS_ON|backend @@ -1493,7 +1566,11 @@ graph TD reports-->|DEPENDS_ON|backend reports-->|DEPENDS_ON|backend __tests__-->|TESTS|backend + __tests__-->|TESTS|backend tests-->|TESTS|backend + tests-->|TESTS|backend + core-->|VERIFIES|backend + core-->|VERIFIES|backend __tests__-->|VERIFIES|components __tests__-->|VERIFIES|lib __tests__-->|VERIFIES|lib diff --git a/.ai/PROJECT_MAP.md b/.ai/PROJECT_MAP.md index 853a50841..348a6cd72 100644 --- a/.ai/PROJECT_MAP.md +++ b/.ai/PROJECT_MAP.md @@ -280,6 +280,9 @@ - π Mock for $app/stores in tests - π¦ **environment** (`Mock`) - π Mock for $app/environment in tests +- π¦ **mock_env_public** (`Module`) + - π Mock for $env/static/public SvelteKit module in vitest + - ποΈ Layer: UI (Tests) - π¦ **frontend.src.lib.api.reports** (`Module`) `[CRITICAL]` - π Wrapper-based reports API client for list/detail retrieval without direct native fetch usage. - ποΈ Layer: Infra @@ -308,6 +311,16 @@ - π Retrieve paginated assistant conversation history. - Ζ **getAssistantConversations** (`Function`) - π Retrieve paginated conversation list for assistant sidebar/history switcher. +- π¦ **frontend.src.lib.api.__tests__.reports_api** (`Module`) `[CRITICAL]` + - π 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`) + - π Validate query string construction from filter options. + - β **TestNormalizeApiError** (`Class`) + - π Validate error normalization for UI-state mapping. + - β **TestGetReportsAsync** (`Class`) + - π Validate getReports and getReportDetail with mocked api.fetchApi. - π§© **Select** (`Component`) `[TRIVIAL]` - π Standardized dropdown selection component. - ποΈ Layer: Atom @@ -696,7 +709,8 @@ - ποΈ Layer: UI - π Invariant: Shows both local login form and ADFS SSO button. - β¬ οΈ READS_FROM `app` - - β¬ οΈ READS_FROM `auth` + - β¬ οΈ READS_FROM `lib` + - β‘οΈ WRITES_TO `t` - Ζ **handleLogin** (`Function`) - π Submits the local login form to the backend. - Ζ **handleADFSLogin** (`Function`) @@ -765,6 +779,26 @@ - π Auto-detected function (orphan) - Ζ **getStatusBadgeClass** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) + - Ζ **isGitBusy** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **setGitBusy** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **ensureGitConfigs** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **updateDashboardGitState** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **refreshDashboardGitState** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **handleGitInit** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **handleGitSync** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **handleGitCommit** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **handleGitPull** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **handleGitPush** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - Ζ **getTaskStatusIcon** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) - Ζ **getPaginationRange** (`Function`) `[TRIVIAL]` @@ -789,8 +823,8 @@ - ποΈ Layer: Domain - π Invariant: Only accessible by users with Admin role. - β¬ οΈ READS_FROM `lib` - - β¬ οΈ READS_FROM `t` - β‘οΈ WRITES_TO `t` + - β¬ οΈ READS_FROM `t` - Ζ **loadData** (`Function`) - π Fetches roles and available permissions. - Ζ **openCreateModal** (`Function`) @@ -806,8 +840,8 @@ - ποΈ Layer: Feature - π Invariant: Only accessible by users with "admin:users" permission. - β¬ οΈ READS_FROM `lib` - - β¬ οΈ READS_FROM `t` - β‘οΈ WRITES_TO `t` + - β¬ οΈ READS_FROM `t` - Ζ **loadData** (`Function`) - π Fetches users and roles from the backend. - Ζ **openCreateModal** (`Function`) @@ -905,10 +939,12 @@ - π Page for the dataset column mapper tool. - ποΈ Layer: UI - β¬ οΈ READS_FROM `lib` + - β‘οΈ WRITES_TO `t` - π§© **DebugPage** (`Component`) `[TRIVIAL]` - π Page for system diagnostics and debugging. - ποΈ Layer: UI - β¬ οΈ READS_FROM `lib` + - β‘οΈ WRITES_TO `t` - π¦ **SettingsPage** (`Page`) `[CRITICAL]` - π Consolidated Settings Page - All settings in one place with tabbed navigation - ποΈ Layer: UI @@ -916,6 +952,12 @@ - π¦ **+page** (`Module`) `[TRIVIAL]` - π Auto-generated module for frontend/src/routes/settings/+page.svelte - ποΈ Layer: Unknown + - Ζ **normalizeTab** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **readTabFromUrl** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **writeTabToUrl** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - Ζ **loadSettings** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) - Ζ **normalizeLlmSettings** (`Function`) `[TRIVIAL]` @@ -928,7 +970,19 @@ - π Auto-detected function (orphan) - Ζ **handleTabChange** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) - - Ζ **getTabClass** (`Function`) `[TRIVIAL]` + - Ζ **loadMigrationSettings** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **loadMappingsPage** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **onMappingsSearchInput** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **onMappingsFilterChange** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **goToMappingsPage** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **saveMigrationSettings** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **triggerSyncNow** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) - Ζ **handleSave** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) @@ -947,6 +1001,8 @@ - π§© **ConnectionsSettingsPage** (`Component`) - π Page for managing database connection configurations. - ποΈ Layer: UI + - β¬ οΈ READS_FROM `lib` + - β‘οΈ WRITES_TO `t` - Ζ **handleSuccess** (`Function`) - π Refreshes the connection list after a successful creation. - π§© **GitSettingsPage** (`Component`) @@ -954,6 +1010,8 @@ - ποΈ Layer: Page - π Invariant: All configurations must be validated via connection test. - β¬ οΈ READS_FROM `lib` + - β¬ οΈ READS_FROM `t` + - β‘οΈ WRITES_TO `t` - Ζ **loadConfigs** (`Function`) - π Fetches existing git configurations. - Ζ **handleTest** (`Function`) @@ -983,6 +1041,8 @@ - π 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` - Ζ **loadSettings** (`Function`) - π Loads settings from the backend. - Ζ **handleSaveGlobal** (`Function`) @@ -1084,7 +1144,9 @@ - ποΈ Layer: Feature - π Invariant: Each source database can be mapped to one target database. - β‘ Events: update + - β¬ οΈ READS_FROM `lib` - β‘οΈ WRITES_TO `props` + - β‘οΈ WRITES_TO `t` - Ζ **updateMapping** (`Function`) - π Updates a mapping for a specific source database. - Ζ **getSuggestion** (`Function`) @@ -1161,6 +1223,7 @@ - ποΈ Layer: UI - β¬ οΈ READS_FROM `selectedTask` - β‘οΈ WRITES_TO `selectedTask` + - β¬ οΈ READS_FROM `t` - Ζ **fetchTasks** (`Function`) - π Fetches the list of recent tasks from the API. - Ζ **clearTasks** (`Function`) @@ -1180,9 +1243,9 @@ - π§© **TaskRunner** (`Component`) - π Connects to a WebSocket to display real-time logs for a running task with filtering support. - ποΈ Layer: UI + - β¬ οΈ READS_FROM `t` - β¬ οΈ READS_FROM `selectedTask` - - β‘οΈ WRITES_TO `selectedTask` - - β‘οΈ WRITES_TO `taskLogs` + - β‘οΈ WRITES_TO `t` - Ζ **connect** (`Function`) - π Establishes WebSocket connection with exponential backoff and filter parameters. - Ζ **handleFilterChange** (`Function`) @@ -1285,6 +1348,10 @@ - ποΈ Layer: Unknown - Ζ **statusColor** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) +- π¦ **frontend.src.components.__tests__.task_log_viewer** (`Module`) `[CRITICAL]` + - π Unit tests for TaskLogViewer component by mounting it and observing the DOM. + - ποΈ Layer: UI (Tests) + - π Invariant: Duplicate logs are never appended. Polling only active for in-progress tasks. - π§© **FileList** (`Component`) - π Displays a table of files with metadata and actions. - ποΈ Layer: UI @@ -1538,6 +1605,26 @@ - π Dependency for checking if the current user has a specific permission. - Ζ **permission_checker** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) +- π¦ **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`) + - π Parses CLI arguments for load-test data generation. + - Ζ **_extract_result_payload** (`Function`) + - π Normalizes Superset API payloads that may be wrapped in `result`. + - Ζ **_extract_created_id** (`Function`) + - π Extracts object ID from create/update API response. + - Ζ **_generate_unique_name** (`Function`) + - π Generates globally unique random names for charts/dashboards. + - Ζ **_resolve_target_envs** (`Function`) + - π Resolves requested environment IDs from configuration. + - Ζ **_build_chart_template_pool** (`Function`) + - π Builds a pool of source chart templates to clone in one environment. + - Ζ **seed_superset_load_data** (`Function`) + - π Creates dashboards and cloned charts for load testing across target environments. + - Ζ **main** (`Function`) + - π 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 - ποΈ Layer: Unknown @@ -1679,6 +1766,8 @@ - π 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. - Ζ **extract_dataset_id_from_form_data** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) - Ζ **walk** (`Function`) `[TRIVIAL]` @@ -1854,10 +1943,16 @@ - π DEPENDS_ON -> `PyYAML` - β **MigrationEngine** (`Class`) - π Engine for transforming Superset export ZIPs. + - Ζ **__init__** (`Function`) + - π Initializes the migration engine with optional ID mapping service. - Ζ **transform_zip** (`Function`) - - π Extracts ZIP, replaces database UUIDs in YAMLs, and re-packages. + - π Extracts ZIP, replaces database UUIDs in YAMLs, patches cross-filters, and re-packages. - Ζ **_transform_yaml** (`Function`) - π Replaces database_uuid in a single YAML file. + - Ζ **_extract_chart_uuids_from_archive** (`Function`) + - π Scans the unpacked ZIP to map local exported integer IDs back to their UUIDs. + - Ζ **_patch_dashboard_metadata** (`Function`) + - π Replaces integer IDs in json_metadata. - β **PluginBase** (`Class`) - π 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 @@ -1881,6 +1976,26 @@ - β **PluginConfig** (`Class`) - π 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 +- π¦ **backend.src.core.mapping_service** (`Module`) `[CRITICAL]` + - π Service for tracking and synchronizing Superset Resource IDs (UUID <-> Integer ID) + - ποΈ Layer: Core + - π Invariant: sync_environment must handle remote API failures gracefully. + - π DEPENDS_ON -> `backend.src.models.mapping (ResourceMapping, ResourceType)` + - π DEPENDS_ON -> `backend.src.core.logger` + - β **IdMappingService** (`Class`) `[CRITICAL]` + - π Service handling the cataloging and retrieval of remote Superset Integer IDs. + - Ζ **__init__** (`Function`) + - π Initializes the mapping service. + - Ζ **start_scheduler** (`Function`) + - π Starts the background scheduler with a given cron string. + - Ζ **sync_environment** (`Function`) + - π Fully synchronizes mapping for a specific environment. + - Ζ **get_remote_id** (`Function`) + - π Retrieves the remote integer ID for a given universal UUID. + - Ζ **get_remote_ids_batch** (`Function`) + - π Retrieves remote integer IDs for a list of universal UUIDs efficiently. + - Ζ **sync_all** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - π¦ **backend.src.core.auth.config** (`Module`) - π Centralized configuration for authentication and authorization. - ποΈ Layer: Core @@ -2108,6 +2223,12 @@ - π Test that configure_logger updates task_log_level. - Ζ **test_enable_belief_state_flag** (`Function`) - π Test that enable_belief_state flag controls belief_scope logging. + - Ζ **test_belief_scope_missing_anchor** (`Function`) + - π Test @PRE condition: anchor_id must be provided + - Ζ **test_configure_logger_post_conditions** (`Function`) + - π Test @POST condition: Logger level, handlers, belief state flag, and task log level are updated. + - Ζ **reset_logger_state** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - π¦ **TaskLoggerModule** (`Module`) `[CRITICAL]` - π Provides a dedicated logger for tasks with automatic source attribution. - ποΈ Layer: Core @@ -2429,6 +2550,14 @@ - π Fetch all dashboards from the specified environment for the grid. - Ζ **execute_migration** (`Function`) - π Execute the migration of selected dashboards. + - Ζ **get_migration_settings** (`Function`) + - π Get current migration Cron string explicitly. + - Ζ **update_migration_settings** (`Function`) + - π Update migration Cron string. + - Ζ **get_resource_mappings** (`Function`) + - π Fetch synchronized object mappings with search, filtering, and pagination. + - Ζ **trigger_sync_now** (`Function`) + - π Triggers an immediate ID synchronization for all environments. - π¦ **PluginsRouter** (`Module`) - π Defines the FastAPI router for plugin-related endpoints, allowing clients to list available plugins. - ποΈ Layer: UI (API) @@ -2611,6 +2740,8 @@ - π Build current-user tool catalog for LLM planner with operation contracts and defaults. - Ζ **_coerce_intent_entities** (`Function`) - π Normalize intent entity value types from LLM output to route-compatible values. + - Ζ **_confirmation_summary** (`Function`) + - π Build human-readable confirmation prompt for an intent before execution. - Ζ **_clarification_text_for_intent** (`Function`) - π Convert technical missing-parameter errors into user-facing clarification prompts. - Ζ **_plan_intent_with_llm** (`Function`) @@ -2631,6 +2762,8 @@ - π Retrieve paginated assistant conversation history for current user. - Ζ **get_assistant_audit** (`Function`) - π Return assistant audit decisions for current user from persistent and in-memory stores. + - Ζ **_label** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - π¦ **storage_routes** (`Module`) - π API endpoints for file storage management (backups and repositories). - ποΈ Layer: API @@ -2702,9 +2835,14 @@ - π¦ **DashboardChartItem** (`DataClass`) - π¦ **DashboardDatasetItem** (`DataClass`) - π¦ **DashboardDetailResponse** (`DataClass`) + - π¦ **DatabaseMapping** (`DataClass`) + - π¦ **DatabaseMappingsResponse** (`DataClass`) - Ζ **get_dashboards** (`Function`) - π Fetch list of dashboards from a specific environment with Git status and last task status - π CALLS -> `ResourceService.get_dashboards_with_status` + - Ζ **get_database_mappings** (`Function`) + - π Get database mapping suggestions between source and target environments + - π CALLS -> `MappingService.get_suggestions` - Ζ **get_dashboard_detail** (`Function`) - π Fetch detailed dashboard info with related charts and datasets - π CALLS -> `SupersetClient.get_dashboard_detail` @@ -2719,11 +2857,6 @@ - π Trigger bulk backup of dashboards with optional cron schedule - π DISPATCHES -> `BackupPlugin` - π CALLS -> `task_manager.create_task` - - π¦ **DatabaseMapping** (`DataClass`) - - π¦ **DatabaseMappingsResponse** (`DataClass`) - - Ζ **get_database_mappings** (`Function`) - - π Get database mapping suggestions between source and target environments - - π CALLS -> `MappingService.get_suggestions` - π¦ **backend.src.api.routes.__tests__.test_dashboards** (`Module`) - π Unit tests for Dashboards API endpoints - ποΈ Layer: API @@ -2910,14 +3043,18 @@ - π Task status command must surface current status text for existing task id. - Ζ **test_status_query_without_task_id_returns_latest_user_task** (`Function`) - π Status command without explicit task_id should resolve to latest task for current user. - - Ζ **test_llm_validation_missing_dashboard_returns_needs_clarification** (`Function`) - - π LLM validation command without resolvable dashboard id must request clarification instead of generic failure. - - Ζ **test_list_conversations_groups_by_conversation_and_marks_archived** (`Function`) - - π Conversations endpoint must group messages and compute archived marker by inactivity threshold. - - Ζ **test_history_from_latest_returns_recent_page_first** (`Function`) - - π History endpoint from_latest mode must return newest page while preserving chronological order in chunk. - - Ζ **test_list_conversations_archived_only_filters_active** (`Function`) - - π archived_only mode must return only archived conversations. + - Ζ **test_llm_validation_with_dashboard_ref_requires_confirmation** (`Function`) + - π LLM validation with dashboard_ref should now require confirmation before dispatch. + - Ζ **test_list_conversations_groups_by_conversation_and_marks_archived** (`Function`) + - π Conversations endpoint must group messages and compute archived marker by inactivity threshold. + - Ζ **test_history_from_latest_returns_recent_page_first** (`Function`) + - π History endpoint from_latest mode must return newest page while preserving chronological order in chunk. + - Ζ **test_list_conversations_archived_only_filters_active** (`Function`) + - π archived_only mode must return only archived conversations. + - Ζ **test_guarded_operation_always_requires_confirmation** (`Function`) + - π Non-dangerous (guarded) commands must still require confirmation before execution. + - Ζ **test_guarded_operation_confirm_roundtrip** (`Function`) + - π Guarded operation must execute successfully after explicit confirmation. - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) - Ζ **__init__** (`Function`) `[TRIVIAL]` @@ -2958,6 +3095,43 @@ - π Auto-detected function (orphan) - Ζ **rollback** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) +- π¦ **backend.src.api.routes.__tests__.test_migration_routes** (`Module`) + - π Unit tests for migration API route handlers. + - ποΈ Layer: API + - Ζ **db_session** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_make_config_manager** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_get_migration_settings_returns_default_cron** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_get_migration_settings_returns_fallback_when_no_cron** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_update_migration_settings_saves_cron** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_update_migration_settings_rejects_missing_cron** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_get_resource_mappings_returns_formatted_list** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_get_resource_mappings_respects_pagination** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_get_resource_mappings_search_by_name** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_get_resource_mappings_filter_by_env** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_get_resource_mappings_filter_by_type** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_mock_env** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_make_sync_config_manager** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_trigger_sync_now_creates_env_row_and_syncs** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_trigger_sync_now_rejects_empty_environments** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_trigger_sync_now_handles_partial_failure** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_trigger_sync_now_idempotent_env_upsert** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - π¦ **backend.src.models.config** (`Module`) - π Defines database schema for persisted application configuration. - ποΈ Layer: Domain @@ -3005,6 +3179,8 @@ - ποΈ Layer: Domain - π Invariant: All primary keys are UUID strings. - π DEPENDS_ON -> `sqlalchemy` + - β **ResourceType** (`Class`) `[TRIVIAL]` + - π Enumeration of possible Superset resource types for ID mapping. - β **MigrationStatus** (`Class`) `[TRIVIAL]` - π Enumeration of possible migration job statuses. - β **Environment** (`Class`) @@ -3013,6 +3189,8 @@ - π Represents a mapping between source and target databases. - β **MigrationJob** (`Class`) `[TRIVIAL]` - π Represents a single migration execution job. + - β **ResourceMapping** (`Class`) + - π Maps a universal UUID for a resource to its actual ID on a specific environment. - π¦ **backend.src.models.report** (`Module`) `[CRITICAL]` - π Canonical report schemas for unified task reporting across heterogeneous task types. - ποΈ Layer: Domain @@ -3098,6 +3276,61 @@ - ποΈ Layer: Domain - Ζ **test_environment_model** (`Function`) - π Tests that Environment model correctly stores values. +- π¦ **test_report_models** (`Module`) `[CRITICAL]` + - π Unit tests for report Pydantic models and their validators + - ποΈ Layer: Domain + - Ζ **test_enum_values** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_enum_values** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_valid_creation** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_minimal_creation** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_make_report** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_valid_creation** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_empty_report_id_raises** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_whitespace_report_id_raises** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_empty_task_id_raises** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_empty_summary_raises** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_summary_whitespace_trimmed** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_optional_fields** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_with_error_context** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_defaults** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_invalid_sort_by_raises** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_valid_sort_by_values** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_invalid_sort_order_raises** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_valid_sort_order_values** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_time_range_validation_valid** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_time_range_validation_invalid** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_page_ge_1** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_page_size_bounds** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_valid_creation** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_with_items** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_valid_creation** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_with_all_fields** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - π¦ **backend.src.services.resource_service** (`Module`) - π Shared service for fetching resource data with Git status and task status - ποΈ Layer: Service @@ -3253,6 +3486,38 @@ - π Helper to get an initialized SupersetClient for an environment. - Ζ **get_suggestions** (`Function`) - π Fetches databases from both environments and returns fuzzy matching suggestions. +- π¦ **test_encryption_manager** (`Module`) `[CRITICAL]` + - π Unit tests for EncryptionManager encrypt/decrypt functionality. + - ποΈ Layer: Domain + - π Invariant: Encrypt+decrypt roundtrip always returns original plaintext. + - β **TestEncryptionManager** (`Class`) + - π Validate EncryptionManager encrypt/decrypt roundtrip, uniqueness, and error handling. + - Ζ **test_encrypt_decrypt_roundtrip** (`Function`) + - π Encrypt then decrypt returns original plaintext. + - Ζ **test_encrypt_produces_different_output** (`Function`) + - π Same plaintext produces different ciphertext (Fernet uses random IV). + - Ζ **test_different_inputs_yield_different_ciphertext** (`Function`) + - π Different inputs produce different ciphertexts. + - Ζ **test_decrypt_invalid_data_raises** (`Function`) + - π Decrypting invalid data raises InvalidToken. + - Ζ **test_encrypt_empty_string** (`Function`) + - π Encrypting and decrypting an empty string works. + - Ζ **test_custom_key_roundtrip** (`Function`) + - π Custom Fernet key produces valid roundtrip. + - Ζ **_make_manager** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **__init__** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **encrypt** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **decrypt** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **__init__** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **encrypt** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **decrypt** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - π¦ **backend.src.services.__tests__.test_llm_prompt_templates** (`Module`) - π Validate normalization and rendering behavior for configurable LLM prompt templates. - ποΈ Layer: Domain Tests @@ -3341,6 +3606,43 @@ - π Return filtered, sorted, paginated report collection. - Ζ **get_report_detail** (`Function`) - π Return one normalized report with timeline/diagnostics/next actions. +- π¦ **test_report_service** (`Module`) `[CRITICAL]` + - π Unit tests for ReportsService list/detail operations + - ποΈ Layer: Domain + - Ζ **_make_task** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_make_service** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_empty_tasks_returns_empty_collection** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_single_task_normalized** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_pagination_first_page** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_pagination_last_page** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_filter_by_status** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_filter_by_task_type** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_search_filter** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_sort_by_status** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_applied_filters_echoed** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_make_service** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_detail_found** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_detail_not_found** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_detail_includes_timeline** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_detail_failed_task_has_next_actions** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_detail_success_task_no_error_next_actions** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - π¦ **backend.tests.test_report_normalizer** (`Module`) `[CRITICAL]` - π Validate unknown task type fallback and partial payload normalization behavior. - ποΈ Layer: Domain (Tests) @@ -3633,8 +3935,139 @@ - ποΈ Layer: Unknown - Ζ **__init__** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) +- π¦ **test_task_persistence** (`Module`) `[CRITICAL]` + - π Unit tests for TaskPersistenceService. + - ποΈ Layer: Test + - β **TestTaskPersistenceHelpers** (`Class`) `[CRITICAL]` + - π Test suite for TaskPersistenceService static helper methods. + - Ζ **test_json_load_if_needed_none** (`Function`) + - π Test _json_load_if_needed with None input. + - Ζ **test_json_load_if_needed_dict** (`Function`) + - π Test _json_load_if_needed with dict input. + - Ζ **test_json_load_if_needed_list** (`Function`) + - π Test _json_load_if_needed with list input. + - Ζ **test_json_load_if_needed_json_string** (`Function`) + - π Test _json_load_if_needed with JSON string. + - Ζ **test_json_load_if_needed_empty_string** (`Function`) + - π Test _json_load_if_needed with empty/null strings. + - Ζ **test_json_load_if_needed_plain_string** (`Function`) + - π Test _json_load_if_needed with non-JSON string. + - Ζ **test_json_load_if_needed_integer** (`Function`) + - π Test _json_load_if_needed with integer. + - Ζ **test_parse_datetime_none** (`Function`) + - π Test _parse_datetime with None. + - Ζ **test_parse_datetime_datetime_object** (`Function`) + - π Test _parse_datetime with datetime object. + - Ζ **test_parse_datetime_iso_string** (`Function`) + - π Test _parse_datetime with ISO string. + - Ζ **test_parse_datetime_invalid_string** (`Function`) + - π Test _parse_datetime with invalid string. + - Ζ **test_parse_datetime_integer** (`Function`) + - π Test _parse_datetime with non-string, non-datetime. + - β **TestTaskPersistenceService** (`Class`) `[CRITICAL]` + - π Test suite for TaskPersistenceService CRUD operations. + - Ζ **setup_class** (`Function`) + - π Setup in-memory test database. + - Ζ **teardown_class** (`Function`) + - π Dispose of test database. + - Ζ **setup_method** (`Function`) + - π Clean task_records table before each test. + - Ζ **test_persist_task_new** (`Function`) + - π Test persisting a new task creates a record. + - Ζ **test_persist_task_update** (`Function`) + - π Test updating an existing task. + - Ζ **test_persist_task_with_logs** (`Function`) + - π Test persisting a task with log entries. + - Ζ **test_persist_task_failed_extracts_error** (`Function`) + - π Test that FAILED task extracts last error message. + - Ζ **test_persist_tasks_batch** (`Function`) + - π Test persisting multiple tasks. + - Ζ **test_load_tasks** (`Function`) + - π Test loading tasks from database. + - Ζ **test_load_tasks_with_status_filter** (`Function`) + - π Test loading tasks filtered by status. + - Ζ **test_load_tasks_with_limit** (`Function`) + - π Test loading tasks with limit. + - Ζ **test_delete_tasks** (`Function`) + - π Test deleting tasks by ID list. + - Ζ **test_delete_tasks_empty_list** (`Function`) + - π Test deleting with empty list (no-op). + - Ζ **test_persist_task_with_datetime_in_params** (`Function`) + - π Test json_serializable handles datetime in params. + - Ζ **_patched** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_make_task** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - Ζ **test_environment_model** (`Function`) - π Tests that Environment model correctly stores values. +- π¦ **test_task_manager** (`Module`) `[CRITICAL]` + - π Unit tests for TaskManager lifecycle, CRUD, log buffering, and filtering. + - ποΈ Layer: Core + - π Invariant: TaskManager state changes are deterministic and testable with mocked dependencies. + - Ζ **_make_manager** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_cleanup_manager** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_init_creates_empty_tasks** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_init_loads_persisted_tasks** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_init_starts_flusher_thread** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_get_task_returns_none_for_missing** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_get_task_returns_existing** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_get_all_tasks** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_get_tasks_with_status_filter** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_get_tasks_with_plugin_filter** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_get_tasks_with_pagination** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_get_tasks_completed_only** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_create_task_success** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_create_task_unknown_plugin_raises** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_create_task_invalid_params_raises** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_add_log_appends_to_task_and_buffer** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_add_log_skips_nonexistent_task** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_flush_logs_writes_to_persistence** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_flush_task_logs_writes_single_task** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_flush_logs_requeues_on_failure** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_clear_all_non_active** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_clear_by_status** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_clear_preserves_awaiting_input** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_subscribe_creates_queue** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_unsubscribe_removes_queue** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_multiple_subscribers** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_await_input_sets_status** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_await_input_not_running_raises** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_await_input_nonexistent_raises** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_resume_with_password** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_resume_not_awaiting_raises** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_resume_empty_passwords_raises** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - π¦ **backend.tests.test_dashboards_api** (`Module`) - π Contract-driven tests for Dashboard Hub API - ποΈ Layer: Domain (Tests) @@ -3714,6 +4147,13 @@ - π Test sub-context logger uses new source. - Ζ **test_multiple_sub_contexts** (`Function`) - π Test creating multiple sub-contexts. +- π¦ **test_smoke_plugins** (`Module`) `[TRIVIAL]` + - π Auto-generated module for backend/tests/test_smoke_plugins.py + - ποΈ Layer: Unknown + - Ζ **test_plugins_load_successfully** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_task_manager_initializes_with_plugins** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - Ζ **test_belief_scope_logs_entry_action_exit_at_debug** (`Function`) - π Test that belief_scope generates [ID][Entry], [ID][Action], and [ID][Exit] logs at DEBUG level. - Ζ **test_belief_scope_error_handling** (`Function`) @@ -3751,23 +4191,23 @@ - π Auto-detected function (orphan) - Ζ **test_ad_group_mapping** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) -- π¦ **test_log_persistence** (`Module`) +- π¦ **test_log_persistence** (`Module`) `[CRITICAL]` - π Unit tests for TaskLogPersistenceService. - ποΈ Layer: Test - - β **TestLogPersistence** (`Class`) + - β **TestLogPersistence** (`Class`) `[CRITICAL]` - π Test suite for TaskLogPersistenceService. - Ζ **setup_class** (`Function`) - π Setup test database and service instance. - Ζ **teardown_class** (`Function`) - π Clean up test database. - Ζ **setup_method** (`Function`) - - π Setup for each test method. - - Ζ **teardown_method** (`Function`) - - π Cleanup after each test method. - - Ζ **test_add_log_single** (`Function`) + - π Setup for each test method β clean task_logs table. + - Ζ **test_add_logs_single** (`Function`) - π Test adding a single log entry. - - Ζ **test_add_log_batch** (`Function`) + - Ζ **test_add_logs_batch** (`Function`) - π Test adding multiple log entries in batch. + - Ζ **test_add_logs_empty** (`Function`) + - π Test adding empty log list (should be no-op). - Ζ **test_get_logs_by_task_id** (`Function`) - π Test retrieving logs by task ID. - Ζ **test_get_logs_with_filters** (`Function`) @@ -3778,7 +4218,82 @@ - π Test retrieving logs with search query. - Ζ **test_get_log_stats** (`Function`) - π Test retrieving log statistics. - - Ζ **test_get_log_sources** (`Function`) + - Ζ **test_get_sources** (`Function`) - π Test retrieving unique log sources. - - Ζ **test_delete_logs_by_task_id** (`Function`) + - Ζ **test_delete_logs_for_task** (`Function`) - π Test deleting logs by task ID. + - Ζ **test_delete_logs_for_tasks** (`Function`) + - π Test deleting logs for multiple tasks. + - Ζ **test_delete_logs_for_tasks_empty** (`Function`) + - π Test deleting with empty list (no-op). + - Ζ **_patched** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) +- π¦ **backend.tests.core.test_mapping_service** (`Module`) + - π Unit tests for the IdMappingService matching UUIDs to integer IDs. + - ποΈ Layer: Domain + - Ζ **db_session** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **__init__** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **get_all_resources** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_sync_environment_upserts_correctly** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_get_remote_id_returns_integer** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_get_remote_ids_batch_returns_dict** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_sync_environment_updates_existing_mapping** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_sync_environment_skips_resources_without_uuid** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_sync_environment_handles_api_error_gracefully** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **get_all_resources** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_get_remote_id_returns_none_for_missing** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_get_remote_ids_batch_returns_empty_for_empty_input** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_mapping_service_alignment_with_test_data** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_sync_environment_requires_existing_env** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_sync_environment_deletes_stale_mappings** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) +- π¦ **test_defensive_guards** (`Module`) `[TRIVIAL]` + - π Auto-generated module for backend/tests/core/test_defensive_guards.py + - ποΈ Layer: Unknown + - Ζ **test_git_service_get_repo_path_guard** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_superset_client_import_dashboard_guard** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) +- π¦ **backend.tests.core.test_migration_engine** (`Module`) + - π Unit tests for MigrationEngine's cross-filter patching algorithms. + - ποΈ Layer: Domain + - Ζ **__init__** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **get_remote_ids_batch** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_write_dashboard_yaml** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_patch_dashboard_metadata_replaces_chart_ids** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_patch_dashboard_metadata_replaces_dataset_ids** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_patch_dashboard_metadata_skips_when_no_metadata** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_patch_dashboard_metadata_handles_missing_targets** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_extract_chart_uuids_from_archive** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_transform_yaml_replaces_database_uuid** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_transform_yaml_ignores_unmapped_uuid** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_transform_zip_end_to_end** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_transform_zip_invalid_path** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_transform_yaml_nonexistent_file** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) diff --git a/backend/src/api/routes/dashboards.py b/backend/src/api/routes/dashboards.py index 69d292244..64f64583c 100644 --- a/backend/src/api/routes/dashboards.py +++ b/backend/src/api/routes/dashboards.py @@ -24,7 +24,9 @@ router = APIRouter(prefix="/api/dashboards", tags=["Dashboards"]) # [DEF:GitStatus:DataClass] class GitStatus(BaseModel): branch: Optional[str] = None - sync_status: Optional[str] = Field(None, pattern="^OK|DIFF$") + sync_status: Optional[str] = Field(None, pattern="^OK|DIFF|NO_REPO|ERROR$") + has_repo: Optional[bool] = None + has_changes_for_commit: Optional[bool] = None # [/DEF:GitStatus:DataClass] # [DEF:LastTask:DataClass] diff --git a/backend/src/core/superset_client.py b/backend/src/core/superset_client.py index 351909a24..5fbf1960e 100644 --- a/backend/src/core/superset_client.py +++ b/backend/src/core/superset_client.py @@ -788,7 +788,9 @@ class SupersetClient: # @POST: Returns a dictionary with at least page and page_size. def _validate_query_params(self, query: Optional[Dict]) -> Dict: with belief_scope("_validate_query_params"): - base_query = {"page": 0, "page_size": 1000} + # Superset list endpoints commonly cap page_size at 100. + # Using 100 avoids partial fetches when larger values are silently truncated. + base_query = {"page": 0, "page_size": 100} return {**base_query, **(query or {})} # [/DEF:_validate_query_params:Function] diff --git a/backend/src/services/resource_service.py b/backend/src/services/resource_service.py index 11825fb2d..9b1a43795 100644 --- a/backend/src/services/resource_service.py +++ b/backend/src/services/resource_service.py @@ -161,7 +161,12 @@ class ResourceService: try: repo = self.git_service.get_repo(dashboard_id) if not repo: - return None + return { + 'branch': None, + 'sync_status': 'NO_REPO', + 'has_repo': False, + 'has_changes_for_commit': False + } # Check if there are uncommitted changes try: @@ -170,6 +175,7 @@ class ResourceService: # Check for uncommitted changes is_dirty = repo.is_dirty() + has_changes_for_commit = repo.is_dirty(untracked_files=True) # Check for unpushed commits unpushed = len(list(repo.iter_commits(f'{branch}@{{u}}..{branch}'))) if '@{u}' in str(repo.refs) else 0 @@ -181,14 +187,26 @@ class ResourceService: return { 'branch': branch, - 'sync_status': sync_status + 'sync_status': sync_status, + 'has_repo': True, + 'has_changes_for_commit': has_changes_for_commit } except Exception: logger.warning(f"[ResourceService][Warning] Failed to get git status for dashboard {dashboard_id}") - return None + return { + 'branch': None, + 'sync_status': 'ERROR', + 'has_repo': True, + 'has_changes_for_commit': False + } except Exception: # No repo exists for this dashboard - return None + return { + 'branch': None, + 'sync_status': 'NO_REPO', + 'has_repo': False, + 'has_changes_for_commit': False + } # [/DEF:_get_git_status_for_dashboard:Function] # [DEF:_get_last_task_for_resource:Function] diff --git a/frontend/src/lib/i18n/locales/en.json b/frontend/src/lib/i18n/locales/en.json index afc3a4105..5ddf21051 100644 --- a/frontend/src/lib/i18n/locales/en.json +++ b/frontend/src/lib/i18n/locales/en.json @@ -359,6 +359,10 @@ "task_done": "Done", "task_failed": "Failed", "task_waiting": "Waiting", + "status_repo": "Repo linked", + "status_no_repo": "No repo", + "status_changes": "Changes pending", + "status_no_changes": "No changes", "status_synced": "Synced", "status_diff": "Diff", "status_error": "Error", diff --git a/frontend/src/lib/i18n/locales/ru.json b/frontend/src/lib/i18n/locales/ru.json index 1b89af7c3..abca7a9f9 100644 --- a/frontend/src/lib/i18n/locales/ru.json +++ b/frontend/src/lib/i18n/locales/ru.json @@ -357,6 +357,10 @@ "task_done": "ΠΠΎΡΠΎΠ²ΠΎ", "task_failed": "ΠΡΠΈΠ±ΠΊΠ°", "task_waiting": "ΠΠΆΠΈΠ΄Π°Π½ΠΈΠ΅", + "status_repo": "ΠΡΡΡ ΡΠ΅ΠΏΠΎ", + "status_no_repo": "ΠΠ΅Ρ ΡΠ΅ΠΏΠΎ", + "status_changes": "ΠΡΡΡ ΠΈΠ·ΠΌΠ΅Π½Π΅Π½ΠΈΡ", + "status_no_changes": "ΠΠ΅Ρ ΠΈΠ·ΠΌΠ΅Π½Π΅Π½ΠΈΠΉ", "status_synced": "Π‘ΠΈΠ½Ρ ΡΠΎΠ½ΠΈΠ·ΠΈΡΠΎΠ²Π°Π½ΠΎ", "status_diff": "Π Π°Π·Π»ΠΈΡΠΈΡ", "status_error": "ΠΡΠΈΠ±ΠΊΠ°", diff --git a/frontend/src/routes/dashboards/+page.svelte b/frontend/src/routes/dashboards/+page.svelte index ef7daa6f8..a20744b32 100644 --- a/frontend/src/routes/dashboards/+page.svelte +++ b/frontend/src/routes/dashboards/+page.svelte @@ -23,6 +23,8 @@ import { openDrawerForTask } from "$lib/stores/taskDrawer.js"; import { api } from "$lib/api.js"; import { debounce } from "$lib/utils/debounce.js"; + import { addToast } from "$lib/toasts.js"; + import { gitService } from "../../services/gitService.js"; import MappingTable from "$components/MappingTable.svelte"; // State @@ -65,6 +67,8 @@ // Validation state let validatingIds = new Set(); + let gitBusyIds = new Set(); + let cachedGitConfigs = []; // Environment options - will be loaded from API let environments = []; @@ -142,7 +146,12 @@ id: d.id, title: d.title, slug: d.slug, - gitStatus: d.git_status?.sync_status?.toLowerCase() || null, + git: { + status: d.git_status?.sync_status?.toLowerCase() || "no_repo", + branch: d.git_status?.branch || null, + hasRepo: d.git_status?.has_repo === true, + hasChangesForCommit: d.git_status?.has_changes_for_commit === true, + }, lastTask: d.last_task ? { status: d.last_task.status?.toLowerCase() || null, @@ -510,6 +519,147 @@ } } + function isGitBusy(dashboardId) { + return gitBusyIds.has(dashboardId); + } + + function setGitBusy(dashboardId, busy) { + if (busy) { + gitBusyIds.add(dashboardId); + } else { + gitBusyIds.delete(dashboardId); + } + gitBusyIds = new Set(gitBusyIds); + } + + async function ensureGitConfigs() { + if (cachedGitConfigs.length > 0) return cachedGitConfigs; + cachedGitConfigs = await gitService.getConfigs(); + return cachedGitConfigs; + } + + function updateDashboardGitState(dashboardId, nextGit) { + dashboards = dashboards.map((dashboard) => + dashboard.id === dashboardId + ? { ...dashboard, git: { ...dashboard.git, ...nextGit } } + : dashboard, + ); + } + + async function refreshDashboardGitState(dashboardId) { + try { + const status = await gitService.getStatus(dashboardId); + updateDashboardGitState(dashboardId, { + status: status?.is_dirty ? "diff" : "ok", + branch: status?.current_branch || null, + hasRepo: true, + hasChangesForCommit: Boolean(status?.is_dirty), + }); + } catch (_err) { + updateDashboardGitState(dashboardId, { + status: "no_repo", + branch: null, + hasRepo: false, + hasChangesForCommit: false, + }); + } + } + + async function handleGitInit(dashboard) { + setGitBusy(dashboard.id, true); + try { + const configs = await ensureGitConfigs(); + if (!configs.length) { + addToast($t.git?.no_servers_configured || "No Git config found", "error"); + return; + } + + const config = configs[0]; + const defaultRemote = config?.default_repository + ? `${String(config.url || "").replace(/\/$/, "")}/${config.default_repository}.git` + : ""; + const remoteUrl = prompt($t.git?.remote_url || "Remote URL", defaultRemote); + if (!remoteUrl) return; + + await gitService.initRepository(dashboard.id, config.id, remoteUrl.trim()); + addToast($t.git?.init_success || "Repository initialized", "success"); + await refreshDashboardGitState(dashboard.id); + } catch (err) { + addToast(err?.message || "Git init failed", "error"); + } finally { + setGitBusy(dashboard.id, false); + } + } + + async function handleGitSync(dashboard) { + setGitBusy(dashboard.id, true); + try { + await gitService.sync(dashboard.id, selectedEnv || null); + addToast($t.git?.sync_success || "Synced", "success"); + await refreshDashboardGitState(dashboard.id); + } catch (err) { + addToast(err?.message || "Git sync failed", "error"); + } finally { + setGitBusy(dashboard.id, false); + } + } + + async function handleGitCommit(dashboard) { + if (!dashboard.git?.hasRepo) { + addToast($t.git?.not_linked || "Repository not linked", "error"); + return; + } + if (!dashboard.git?.hasChangesForCommit) { + addToast($t.git?.nothing_to_commit || "No changes to commit", "error"); + return; + } + + const message = prompt( + $t.git?.commit_message || "Commit message", + `Update dashboard ${dashboard.title}`, + ); + if (!message?.trim()) return; + + setGitBusy(dashboard.id, true); + try { + await gitService.commit(dashboard.id, message.trim()); + addToast($t.git?.commit_success || "Committed", "success"); + await refreshDashboardGitState(dashboard.id); + } catch (err) { + addToast(err?.message || "Git commit failed", "error"); + } finally { + setGitBusy(dashboard.id, false); + } + } + + async function handleGitPull(dashboard) { + if (!dashboard.git?.hasRepo) return; + setGitBusy(dashboard.id, true); + try { + await gitService.pull(dashboard.id); + addToast($t.git?.pull_success || "Pulled", "success"); + await refreshDashboardGitState(dashboard.id); + } catch (err) { + addToast(err?.message || "Git pull failed", "error"); + } finally { + setGitBusy(dashboard.id, false); + } + } + + async function handleGitPush(dashboard) { + if (!dashboard.git?.hasRepo) return; + setGitBusy(dashboard.id, true); + try { + await gitService.push(dashboard.id); + addToast($t.git?.push_success || "Pushed", "success"); + await refreshDashboardGitState(dashboard.id); + } catch (err) { + addToast(err?.message || "Git push failed", "error"); + } finally { + setGitBusy(dashboard.id, false); + } + } + // Get task status icon function getTaskStatusIcon(status) { if (!status) return ""; @@ -736,19 +886,24 @@