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 @@
- {#if dashboard.gitStatus} +
- {#if dashboard.gitStatus.toLowerCase() === "ok"} - βœ“ {$t.dashboard?.status_synced } - {:else if dashboard.gitStatus.toLowerCase() === "diff"} - ! {$t.dashboard?.status_diff } - {/if} + {dashboard.git?.hasRepo + ? ($t.dashboard?.status_repo || "Repo") + : ($t.dashboard?.status_no_repo || "No Repo")} - {:else} - - - {/if} + {#if dashboard.git?.hasRepo} + + {dashboard.git?.hasChangesForCommit + ? ($t.dashboard?.status_changes || "Diff") + : ($t.dashboard?.status_no_changes || "Synced")} + + {/if} +
@@ -785,6 +940,73 @@
+ {#if !dashboard.git?.hasRepo} + + {:else} + + + + + {/if} +
+ {:else if activeTab === "git"} + + {:else if activeTab === "llm"}