diff --git a/.ai/MODULE_MAP.md b/.ai/MODULE_MAP.md index ca7fc004..ade62a64 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-20T11:30:24.325166 +**Generated:** 2026-02-23T11:15:39.876570 ## Summary -- **Total Modules:** 63 -- **Total Entities:** 1214 +- **Total Modules:** 71 +- **Total Entities:** 1340 ## Module Hierarchy @@ -79,9 +79,9 @@ ### π `routes/` - ποΈ **Layers:** API, UI (API), Unknown - - π **Tiers:** CRITICAL: 1, STANDARD: 137, TRIVIAL: 3 - - π **Files:** 15 - - π¦ **Entities:** 141 + - π **Tiers:** CRITICAL: 2, STANDARD: 140, TRIVIAL: 3 + - π **Files:** 16 + - π¦ **Entities:** 145 **Key Entities:** @@ -115,10 +115,10 @@ ### π `__tests__/` - - ποΈ **Layers:** API - - π **Tiers:** STANDARD: 16, TRIVIAL: 2 - - π **Files:** 2 - - π¦ **Entities:** 18 + - ποΈ **Layers:** API, Domain (Tests) + - π **Tiers:** CRITICAL: 3, STANDARD: 16, TRIVIAL: 21 + - π **Files:** 5 + - π¦ **Entities:** 40 **Key Entities:** @@ -126,13 +126,19 @@ - Unit tests for Dashboards API endpoints - π¦ **backend.src.api.routes.__tests__.test_datasets** (Module) - Unit tests for Datasets API endpoints + - π¦ **backend.tests.test_reports_api** (Module) `[CRITICAL]` + - Contract tests for GET /api/reports defaults, pagination, an... + - π¦ **backend.tests.test_reports_detail_api** (Module) `[CRITICAL]` + - Contract tests for GET /api/reports/{report_id} detail endpo... + - π¦ **backend.tests.test_reports_openapi_conformance** (Module) `[CRITICAL]` + - Validate implemented reports payload shape against OpenAPI-r... ### π `core/` - ποΈ **Layers:** Core - - π **Tiers:** STANDARD: 109 + - π **Tiers:** STANDARD: 112, TRIVIAL: 1 - π **Files:** 9 - - π¦ **Entities:** 109 + - π¦ **Entities:** 113 **Key Entities:** @@ -159,6 +165,7 @@ **Dependencies:** + - π DEPENDS_ON -> AppConfigRecord - π DEPENDS_ON -> ConfigModels - π DEPENDS_ON -> PyYAML - π DEPENDS_ON -> sqlalchemy @@ -166,9 +173,9 @@ ### π `auth/` - ποΈ **Layers:** Core - - π **Tiers:** STANDARD: 27 + - π **Tiers:** STANDARD: 26 - π **Files:** 6 - - π¦ **Entities:** 27 + - π¦ **Entities:** 26 **Key Entities:** @@ -224,9 +231,9 @@ ### π `task_manager/` - ποΈ **Layers:** Core - - π **Tiers:** CRITICAL: 7, STANDARD: 63, TRIVIAL: 4 + - π **Tiers:** CRITICAL: 7, STANDARD: 63, TRIVIAL: 8 - π **Files:** 7 - - π¦ **Entities:** 74 + - π¦ **Entities:** 78 **Key Entities:** @@ -298,14 +305,16 @@ ### π `models/` - ποΈ **Layers:** Domain, Model - - π **Tiers:** CRITICAL: 1, STANDARD: 15, TRIVIAL: 17 - - π **Files:** 8 - - π¦ **Entities:** 33 + - π **Tiers:** CRITICAL: 2, STANDARD: 24, TRIVIAL: 21 + - π **Files:** 10 + - π¦ **Entities:** 47 **Key Entities:** - β **ADGroupMapping** (Class) - Maps an Active Directory group to a local System Role. + - β **AppConfigRecord** (Class) + - Stores the single source of truth for application configurat... - β **ConnectionConfig** (Class) `[TRIVIAL]` - Stores credentials for external databases used for column ma... - β **DashboardMetadata** (Class) `[TRIVIAL]` @@ -318,17 +327,16 @@ - Target Superset environments for dashboard deployment. - β **Environment** (Class) - Represents a Superset instance environment. + - β **ErrorContext** (Class) + - Error and recovery context for failed/partial reports. - β **FileCategory** (Class) `[TRIVIAL]` - Enumeration of supported file categories in the storage syst... - - β **GitRepository** (Class) `[TRIVIAL]` - - Tracking for a local Git repository linked to a dashboard. - - β **GitServerConfig** (Class) `[TRIVIAL]` - - Configuration for a Git server connection. **Dependencies:** - π DEPENDS_ON -> Role - π DEPENDS_ON -> TaskRecord + - π DEPENDS_ON -> backend.src.core.task_manager.models - π DEPENDS_ON -> sqlalchemy ### π `__tests__/` @@ -483,9 +491,9 @@ ### π `scripts/` - ποΈ **Layers:** Scripts, Unknown - - π **Tiers:** STANDARD: 7, TRIVIAL: 2 - - π **Files:** 4 - - π¦ **Entities:** 9 + - π **Tiers:** STANDARD: 17, TRIVIAL: 2 + - π **Files:** 5 + - π¦ **Entities:** 19 **Key Entities:** @@ -493,6 +501,8 @@ - CLI tool for creating the initial admin user. - π¦ **backend.src.scripts.init_auth_db** (Module) - Initializes the auth database and creates the necessary tabl... + - π¦ **backend.src.scripts.migrate_sqlite_to_postgres** (Module) + - Migrates legacy config and task history from SQLite/file sto... - π¦ **backend.src.scripts.seed_permissions** (Module) - Populates the auth database with initial system permissions. - π¦ **test_dataset_dashboard_relations** (Module) `[TRIVIAL]` @@ -548,6 +558,44 @@ - π¦ **backend.src.services.__tests__.test_resource_service** (Module) - Unit tests for ResourceService + ### π `reports/` + + - ποΈ **Layers:** Domain + - π **Tiers:** CRITICAL: 5, STANDARD: 13 + - π **Files:** 3 + - π¦ **Entities:** 18 + + **Key Entities:** + + - β **ReportsService** (Class) `[CRITICAL]` + - Service layer for list/detail report retrieval and normaliza... + - π¦ **backend.src.services.reports.normalizer** (Module) `[CRITICAL]` + - Convert task manager task objects into canonical unified Tas... + - π¦ **backend.src.services.reports.report_service** (Module) `[CRITICAL]` + - Aggregate, normalize, filter, and paginate task reports for ... + - π¦ **backend.src.services.reports.type_profiles** (Module) `[CRITICAL]` + - Deterministic mapping of plugin/task identifiers to canonica... + + **Dependencies:** + + - π DEPENDS_ON -> backend.src.core.task_manager.manager.TaskManager + - π DEPENDS_ON -> backend.src.core.task_manager.models.Task + - π DEPENDS_ON -> backend.src.models.report + - π DEPENDS_ON -> backend.src.models.report.TaskType + - π DEPENDS_ON -> backend.src.services.reports.normalizer + + ### π `__tests__/` + + - ποΈ **Layers:** Domain (Tests) + - π **Tiers:** CRITICAL: 1, TRIVIAL: 2 + - π **Files:** 1 + - π¦ **Entities:** 3 + + **Key Entities:** + + - π¦ **backend.tests.test_report_normalizer** (Module) `[CRITICAL]` + - Validate unknown task type fallback and partial payload norm... + ### π `tests/` - ποΈ **Layers:** Domain (Tests), Test, Unknown @@ -675,9 +723,9 @@ ### π `tasks/` - ποΈ **Layers:** UI, Unknown - - π **Tiers:** STANDARD: 4, TRIVIAL: 10 - - π **Files:** 3 - - π¦ **Entities:** 14 + - π **Tiers:** STANDARD: 4, TRIVIAL: 12 + - π **Files:** 4 + - π¦ **Entities:** 16 **Key Entities:** @@ -691,6 +739,8 @@ - Auto-generated module for frontend/src/components/tasks/LogF... - π¦ **TaskLogPanel** (Module) `[TRIVIAL]` - Auto-generated module for frontend/src/components/tasks/Task... + - π¦ **TaskResultPanel** (Module) `[TRIVIAL]` + - Auto-generated module for frontend/src/components/tasks/Task... ### π `tools/` @@ -732,6 +782,22 @@ - π¦ **toasts_module** (Module) - Manages toast notifications using a Svelte writable store. + ### π `api/` + + - ποΈ **Layers:** Infra + - π **Tiers:** CRITICAL: 1, STANDARD: 4 + - π **Files:** 1 + - π¦ **Entities:** 5 + + **Key Entities:** + + - π¦ **frontend.src.lib.api.reports** (Module) `[CRITICAL]` + - Wrapper-based reports API client for list/detail retrieval w... + + **Dependencies:** + + - π DEPENDS_ON -> [DEF:api_module] + ### π `auth/` - ποΈ **Layers:** Feature @@ -747,9 +813,9 @@ ### π `layout/` - ποΈ **Layers:** UI, Unknown - - π **Tiers:** CRITICAL: 3, STANDARD: 4, TRIVIAL: 23 + - π **Tiers:** CRITICAL: 3, STANDARD: 4, TRIVIAL: 24 - π **Files:** 4 - - π¦ **Entities:** 30 + - π¦ **Entities:** 31 **Key Entities:** @@ -770,6 +836,80 @@ - π¦ **TopNavbar** (Module) `[TRIVIAL]` - Auto-generated module for frontend/src/lib/components/layout... + ### π `__tests__/` + + - ποΈ **Layers:** Unknown + - π **Tiers:** TRIVIAL: 3 + - π **Files:** 1 + - π¦ **Entities:** 3 + + **Key Entities:** + + - π¦ **test_breadcrumbs.svelte** (Module) `[TRIVIAL]` + - Auto-generated module for frontend/src/lib/components/layout... + + ### π `reports/` + + - ποΈ **Layers:** UI, Unknown + - π **Tiers:** CRITICAL: 4, STANDARD: 1, TRIVIAL: 9 + - π **Files:** 4 + - π¦ **Entities:** 14 + + **Key Entities:** + + - π§© **ReportCard** (Component) `[CRITICAL]` + - Render one report with explicit textual type label and profi... + - π§© **ReportDetailPanel** (Component) `[CRITICAL]` + - Display detailed report context with diagnostics and actiona... + - π§© **ReportsList** (Component) `[CRITICAL]` + - Render unified list of normalized reports with canonical min... + - π¦ **ReportCard** (Module) `[TRIVIAL]` + - Auto-generated module for frontend/src/lib/components/report... + - π¦ **ReportDetailPanel** (Module) `[TRIVIAL]` + - Auto-generated module for frontend/src/lib/components/report... + - π¦ **ReportsList** (Module) `[TRIVIAL]` + - Auto-generated module for frontend/src/lib/components/report... + - π¦ **frontend.src.lib.components.reports.reportTypeProfiles** (Module) `[CRITICAL]` + - Deterministic mapping from report task_type to visual profil... + + **Dependencies:** + + - π DEPENDS_ON -> frontend/src/lib/i18n/index.ts + + ### π `__tests__/` + + - ποΈ **Layers:** UI, UI (Tests) + - π **Tiers:** CRITICAL: 5, STANDARD: 1, TRIVIAL: 4 + - π **Files:** 6 + - π¦ **Entities:** 10 + + **Key Entities:** + + - π¦ **frontend.src.lib.components.reports.__tests__.report_card.ux** (Module) `[CRITICAL]` + - Test UX states and transitions for ReportCard component + - π¦ **frontend.src.lib.components.reports.__tests__.report_detail.integration** (Module) `[CRITICAL]` + - Validate detail-panel behavior for failed reports and recove... + - π¦ **frontend.src.lib.components.reports.__tests__.report_detail.ux** (Module) `[CRITICAL]` + - Test UX states and recovery for ReportDetailPanel component + - π¦ **frontend.src.lib.components.reports.__tests__.report_type_profiles** (Module) `[CRITICAL]` + - Validate report type profile mapping and unknown fallback be... + - π¦ **frontend.src.lib.components.reports.__tests__.reports_filter_performance** (Module) + - Guard test for report filter responsiveness on moderate in-m... + - π¦ **frontend.src.lib.components.reports.__tests__.reports_page.integration** (Module) `[CRITICAL]` + - Integration-style checks for unified mixed-type reports rend... + + ### π `fixtures/` + + - ποΈ **Layers:** UI + - π **Tiers:** STANDARD: 1 + - π **Files:** 1 + - π¦ **Entities:** 1 + + **Key Entities:** + + - π¦ **reports.fixtures** (Module) + - Shared frontend fixtures for unified reports states. + ### π `i18n/` - ποΈ **Layers:** Infra @@ -907,6 +1047,7 @@ - π¦ **RootLayoutConfig** (Module) `[TRIVIAL]` - Root layout configuration (SPA mode) - π¦ **layout** (Module) + - Bind global layout shell and conditional login/full-app rend... ### π `roles/` @@ -1031,6 +1172,20 @@ - π§© **MappingManagement** (Component) - Page for managing database mappings between environments. + ### π `reports/` + + - ποΈ **Layers:** UI, Unknown + - π **Tiers:** CRITICAL: 1, TRIVIAL: 7 + - π **Files:** 1 + - π¦ **Entities:** 8 + + **Key Entities:** + + - π§© **UnifiedReportsPage** (Component) `[CRITICAL]` + - Unified reports page with filtering and resilient UX states ... + - π¦ **+page** (Module) `[TRIVIAL]` + - Auto-generated module for frontend/src/routes/reports/+page.... + ### π `settings/` - ποΈ **Layers:** UI, Unknown @@ -1082,15 +1237,17 @@ ### π `tasks/` - - ποΈ **Layers:** Page - - π **Tiers:** STANDARD: 5 + - ποΈ **Layers:** Page, Unknown + - π **Tiers:** STANDARD: 4, TRIVIAL: 5 - π **Files:** 1 - - π¦ **Entities:** 5 + - π¦ **Entities:** 9 **Key Entities:** - π§© **TaskManagementPage** (Component) - Page for managing and monitoring tasks. + - π¦ **+page** (Module) `[TRIVIAL]` + - Auto-generated module for frontend/src/routes/tasks/+page.sv... ### π `debug/` @@ -1210,6 +1367,10 @@ graph TD routes-->|DEPENDS_ON|backend routes-->|DEPENDS_ON|backend routes-->|DEPENDS_ON|backend + routes-->|DEPENDS_ON|backend + routes-->|DEPENDS_ON|backend + __tests__-->|TESTS|backend + __tests__-->|TESTS|backend __tests__-->|TESTS|backend __tests__-->|TESTS|backend core-->|USES|backend @@ -1224,11 +1385,14 @@ graph TD utils-->|DEPENDS_ON|backend utils-->|DEPENDS_ON|backend models-->|INHERITS_FROM|backend + models-->|DEPENDS_ON|backend models-->|USED_BY|backend models-->|INHERITS_FROM|backend llm_analysis-->|IMPLEMENTS|backend llm_analysis-->|IMPLEMENTS|backend storage-->|DEPENDS_ON|backend + scripts-->|READS_FROM|backend + scripts-->|READS_FROM|backend scripts-->|USES|backend scripts-->|USES|backend scripts-->|CALLS|backend @@ -1246,5 +1410,20 @@ graph TD services-->|DEPENDS_ON|backend services-->|DEPENDS_ON|backend __tests__-->|TESTS|backend + reports-->|DEPENDS_ON|backend + reports-->|DEPENDS_ON|backend + reports-->|DEPENDS_ON|backend + reports-->|DEPENDS_ON|backend + reports-->|DEPENDS_ON|backend + reports-->|DEPENDS_ON|backend + reports-->|DEPENDS_ON|backend + __tests__-->|TESTS|backend tests-->|TESTS|backend + reports-->|DEPENDS_ON|lib + __tests__-->|TESTS|routes + __tests__-->|TESTS|routes + __tests__-->|TESTS|lib + __tests__-->|TESTS|lib + __tests__-->|TESTS|lib + __tests__-->|TESTS|routes ``` diff --git a/.ai/PROJECT_MAP.md b/.ai/PROJECT_MAP.md index b330c9d3..e2a38595 100644 --- a/.ai/PROJECT_MAP.md +++ b/.ai/PROJECT_MAP.md @@ -234,6 +234,7 @@ - π¦ **frontend.src.lib.stores.__tests__.sidebar** (`Module`) - π Unit tests for sidebar store - ποΈ Layer: Domain (Tests) + - π Invariant: Sidebar store transitions must be deterministic across desktop/mobile toggles. - Ζ **test_sidebar_initial_state** (`Function`) - Ζ **test_toggleSidebar** (`Function`) - Ζ **test_setActiveItem** (`Function`) @@ -248,12 +249,26 @@ - π¦ **frontend.src.lib.stores.__tests__.test_taskDrawer** (`Module`) `[CRITICAL]` - π Unit tests for task drawer store - ποΈ Layer: UI + - π Invariant: Store state transitions remain deterministic for open/close and task-status mapping. - π¦ **navigation** (`Mock`) - π Mock for $app/navigation in tests - π¦ **stores** (`Mock`) - π Mock for $app/stores in tests - π¦ **environment** (`Mock`) - π Mock for $app/environment in tests +- π¦ **frontend.src.lib.api.reports** (`Module`) `[CRITICAL]` + - π Wrapper-based reports API client for list/detail retrieval without direct native fetch usage. + - ποΈ Layer: Infra + - π Invariant: Uses existing api wrapper methods and returns structured errors for UI-state mapping. + - π DEPENDS_ON -> `[DEF:api_module]` + - Ζ **buildReportQueryString** (`Function`) + - π Build query string for reports list endpoint from filter options. + - Ζ **normalizeApiError** (`Function`) + - π Convert unknown API exceptions into deterministic UI-consumable error objects. + - Ζ **getReports** (`Function`) + - π Fetch unified report list using existing request wrapper. + - Ζ **getReportDetail** (`Function`) + - π Fetch one report detail by report_id. - π§© **Select** (`Component`) `[TRIVIAL]` - π Standardized dropdown selection component. - ποΈ Layer: Atom @@ -304,6 +319,89 @@ - π Derived store providing the translation dictionary. - Ζ **_** (`Function`) - π Get translation by key path. +- π§© **ReportCard** (`Component`) `[CRITICAL]` + - π Render one report with explicit textual type label and profile-driven visual variant. + - ποΈ Layer: UI + - π Invariant: Unknown task type always uses fallback profile. + - β‘ Events: select + - β¬ οΈ READS_FROM `lib` + - β‘οΈ WRITES_TO `props` + - β‘οΈ WRITES_TO `derived` +- π¦ **ReportCard** (`Module`) `[TRIVIAL]` + - π Auto-generated module for frontend/src/lib/components/reports/ReportCard.svelte + - ποΈ Layer: Unknown + - Ζ **getStatusClass** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **formatDate** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **onSelect** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) +- π§© **ReportsList** (`Component`) `[CRITICAL]` + - π Render unified list of normalized reports with canonical minimum fields. + - ποΈ Layer: UI + - π Invariant: Every rendered row shows task_type label, status, summary, and updated_at. + - β‘ Events: select + - β‘οΈ WRITES_TO `props` +- π¦ **ReportsList** (`Module`) `[TRIVIAL]` + - π Auto-generated module for frontend/src/lib/components/reports/ReportsList.svelte + - ποΈ Layer: Unknown + - Ζ **handleSelect** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) +- π¦ **frontend.src.lib.components.reports.reportTypeProfiles** (`Module`) `[CRITICAL]` + - π Deterministic mapping from report task_type to visual profile with one fallback. + - ποΈ Layer: UI + - π Invariant: Unknown type always resolves to fallback profile. + - π DEPENDS_ON -> `frontend/src/lib/i18n/index.ts` + - Ζ **getReportTypeProfile** (`Function`) + - π Resolve visual profile by task type with guaranteed fallback. +- π§© **ReportDetailPanel** (`Component`) `[CRITICAL]` + - π Display detailed report context with diagnostics and actionable recovery guidance. + - ποΈ Layer: UI + - π Invariant: Failed/partial reports surface actionable hints when available. + - β¬ οΈ READS_FROM `lib` + - β‘οΈ WRITES_TO `props` + - β¬ οΈ READS_FROM `t` +- π¦ **ReportDetailPanel** (`Module`) `[TRIVIAL]` + - π Auto-generated module for frontend/src/lib/components/reports/ReportDetailPanel.svelte + - ποΈ Layer: Unknown + - Ζ **notProvided** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **formatDate** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) +- π¦ **frontend.src.lib.components.reports.__tests__.reports_filter_performance** (`Module`) + - π Guard test for report filter responsiveness on moderate in-memory dataset. + - ποΈ Layer: UI (Tests) + - Ζ **applyFilters** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **makeDataset** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) +- π¦ **frontend.src.lib.components.reports.__tests__.reports_page.integration** (`Module`) `[CRITICAL]` + - π Integration-style checks for unified mixed-type reports rendering expectations. + - ποΈ Layer: UI (Tests) + - π Invariant: Mixed fixture includes all supported report types in one list. + - Ζ **collectVisibleTypeLabels** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) +- π¦ **frontend.src.lib.components.reports.__tests__.report_type_profiles** (`Module`) `[CRITICAL]` + - π Validate report type profile mapping and unknown fallback behavior. + - ποΈ Layer: UI (Tests) + - π Invariant: Unknown task_type always resolves to the fallback profile. +- π¦ **frontend.src.lib.components.reports.__tests__.report_card.ux** (`Module`) `[CRITICAL]` + - π Test UX states and transitions for ReportCard component + - ποΈ Layer: UI + - π Invariant: Each test asserts at least one observable UX contract outcome. +- π¦ **frontend.src.lib.components.reports.__tests__.report_detail.ux** (`Module`) `[CRITICAL]` + - π Test UX states and recovery for ReportDetailPanel component + - ποΈ Layer: UI + - π Invariant: Detail UX tests keep placeholder-safe rendering and recovery visibility verifiable. +- π¦ **frontend.src.lib.components.reports.__tests__.report_detail.integration** (`Module`) `[CRITICAL]` + - π Validate detail-panel behavior for failed reports and recovery guidance visibility. + - ποΈ Layer: UI (Tests) + - π Invariant: Failed report detail exposes actionable next actions when available. + - Ζ **buildFailedDetailFixture** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) +- π¦ **reports.fixtures** (`Module`) + - π Shared frontend fixtures for unified reports states. + - ποΈ Layer: UI - π§© **Sidebar** (`Component`) `[CRITICAL]` - π Persistent left sidebar with resource categories navigation - ποΈ Layer: UI @@ -383,12 +481,21 @@ - ποΈ Layer: Unknown - Ζ **handleClose** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) + - Ζ **goToTasksPage** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - Ζ **handleOverlayClick** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) - Ζ **connectWebSocket** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) - Ζ **disconnectWebSocket** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) +- π¦ **test_breadcrumbs.svelte** (`Module`) `[TRIVIAL]` + - π Auto-generated module for frontend/src/lib/components/layout/__tests__/test_breadcrumbs.svelte.js + - ποΈ Layer: Unknown + - Ζ **getBreadcrumbs** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **formatBreadcrumbLabel** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - π¦ **ErrorPage** (`Page`) - π Global error page displaying HTTP status and messages - ποΈ Layer: UI @@ -402,20 +509,32 @@ - Ζ **load** (`Function`) - π Loads initial plugin data for the dashboard. - π¦ **layout** (`Module`) + - π Bind global layout shell and conditional login/full-app rendering. + - ποΈ Layer: UI + - π Invariant: Login route bypasses shell; all other routes are wrapped by ProtectedRoute. - π§© **TaskManagementPage** (`Component`) - π Page for managing and monitoring tasks. - ποΈ Layer: Page - β¬ οΈ READS_FROM `lib` - β‘οΈ WRITES_TO `t` - β¬ οΈ READS_FROM `t` - - Ζ **loadInitialData** (`Function`) + - Ζ **loadTasks** (`Function`) - π Loads tasks and environments on page initialization. - Ζ **refreshTasks** (`Function`) - π Periodically refreshes the task list. - Ζ **handleSelectTask** (`Function`) - π Updates the selected task ID when a task is clicked. - - Ζ **handleRunBackup** (`Function`) - - π Triggers a manual backup task for the selected environment. +- π¦ **+page** (`Module`) `[TRIVIAL]` + - π Auto-generated module for frontend/src/routes/tasks/+page.svelte + - ποΈ Layer: Unknown + - Ζ **handleTaskTypeChange** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **handlePageSizeChange** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **goToPrevPage** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **goToNextPage** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - π¦ **DatasetHub** (`Page`) `[CRITICAL]` - π Dataset Hub - Dedicated hub for datasets with mapping progress - ποΈ Layer: UI @@ -472,6 +591,28 @@ - π Auto-detected function (orphan) - Ζ **getMappingProgress** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) +- π§© **UnifiedReportsPage** (`Component`) `[CRITICAL]` + - π Unified reports page with filtering and resilient UX states for mixed task types. + - ποΈ Layer: UI + - π Invariant: List state remains deterministic for active filter set. + - β¬ οΈ READS_FROM `lib` + - β¬ οΈ READS_FROM `t` + - β‘οΈ WRITES_TO `t` +- π¦ **+page** (`Module`) `[TRIVIAL]` + - π Auto-generated module for frontend/src/routes/reports/+page.svelte + - ποΈ Layer: Unknown + - Ζ **buildQuery** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **loadReports** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **hasActiveFilters** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **clearFilters** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **onFilterChange** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **onSelectReport** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - π§© **LoginPage** (`Component`) - π Provides the user interface for local and ADFS authentication. - ποΈ Layer: UI @@ -961,6 +1102,11 @@ - β‘οΈ WRITES_TO `derived` - Ζ **formatTime** (`Function`) - π Format ISO timestamp to HH:MM:SS */ +- π¦ **TaskResultPanel** (`Module`) `[TRIVIAL]` + - π Auto-generated module for frontend/src/components/tasks/TaskResultPanel.svelte + - ποΈ Layer: Unknown + - Ζ **statusColor** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - π§© **FileList** (`Component`) - π Displays a table of files with metadata and actions. - ποΈ Layer: UI @@ -1205,6 +1351,27 @@ - ποΈ Layer: Unknown - Ζ **test_dashboard_dataset_relations** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) +- π¦ **backend.src.scripts.migrate_sqlite_to_postgres** (`Module`) + - π Migrates legacy config and task history from SQLite/file storage to PostgreSQL. + - ποΈ Layer: Scripts + - π Invariant: Script is idempotent for task_records and app_configurations. + - π¦ **Constants** (`Section`) + - Ζ **_json_load_if_needed** (`Function`) + - π Parses JSON-like values from SQLite TEXT/JSON columns to Python objects. + - Ζ **_find_legacy_config_path** (`Function`) + - π Resolves the existing legacy config.json path from candidates. + - Ζ **_connect_sqlite** (`Function`) + - π Opens a SQLite connection with row factory. + - Ζ **_ensure_target_schema** (`Function`) + - π Ensures required PostgreSQL tables exist before migration. + - Ζ **_migrate_config** (`Function`) + - π Migrates legacy config.json into app_configurations(global). + - Ζ **_migrate_tasks_and_logs** (`Function`) + - π Migrates task_records and task_logs from SQLite into PostgreSQL. + - Ζ **run_migration** (`Function`) + - π Orchestrates migration from SQLite/file to PostgreSQL. + - Ζ **main** (`Function`) + - π CLI entrypoint. - π¦ **backend.src.scripts.seed_permissions** (`Module`) - π Populates the auth database with initial system permissions. - ποΈ Layer: Scripts @@ -1313,21 +1480,28 @@ - Ζ **_validate_import_file** (`Function`) - π Validates that the file to be imported is a valid ZIP with metadata.yaml. - π¦ **ConfigManagerModule** (`Module`) - - π Manages application configuration, including loading/saving to JSON and CRUD for environments. + - π Manages application configuration persisted in database with one-time migration from JSON. - ποΈ Layer: Core - π Invariant: Configuration must always be valid according to AppConfig model. - π DEPENDS_ON -> `ConfigModels` + - π DEPENDS_ON -> `AppConfigRecord` - π CALLS -> `logger` - β **ConfigManager** (`Class`) - π A class to handle application configuration persistence and management. - Ζ **__init__** (`Function`) - π Initializes the ConfigManager. + - Ζ **_default_config** (`Function`) + - π Returns default application configuration. + - Ζ **_load_from_legacy_file** (`Function`) + - π Loads legacy configuration from config.json for migration fallback. + - Ζ **_get_record** (`Function`) + - π Loads config record from DB. - Ζ **_load_config** (`Function`) - - π Loads the configuration from disk or creates a default one. - - Ζ **_save_config_to_disk** (`Function`) - - π Saves the provided configuration object to disk. + - π Loads the configuration from DB or performs one-time migration from JSON file. + - Ζ **_save_config_to_db** (`Function`) + - π Saves the provided configuration object to DB. - Ζ **save** (`Function`) - - π Saves the current configuration state to disk. + - π Saves the current configuration state to DB. - Ζ **get_config** (`Function`) - π Returns the current configuration. - Ζ **update_global_settings** (`Function`) @@ -1377,14 +1551,14 @@ - π¦ **AppConfig** (`DataClass`) - π The root configuration model containing all application settings. - π¦ **backend.src.core.database** (`Module`) - - π Configures the SQLite database connection and session management. + - π Configures database connection and session management (PostgreSQL-first). - ποΈ Layer: Core - π Invariant: A single engine instance is used for the entire application. - π DEPENDS_ON -> `sqlalchemy` - π¦ **BASE_DIR** (`Variable`) - - π Base directory for the backend (where .db files should reside). + - π Base directory for the backend. - π¦ **DATABASE_URL** (`Constant`) - - π URL for the main mappings database. + - π URL for the main application database. - π¦ **TASKS_DATABASE_URL** (`Constant`) - π URL for the tasks execution database. - π¦ **AUTH_DATABASE_URL** (`Constant`) @@ -1409,6 +1583,8 @@ - π Dependency for getting a tasks database session. - Ζ **get_auth_db** (`Function`) - π Dependency for getting an authentication database session. + - Ζ **_build_engine** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - π¦ **LoggerModule** (`Module`) - π Configures the application's logging system, including a custom handler for buffering logs and streaming them over WebSockets. - ποΈ Layer: Core @@ -1531,8 +1707,6 @@ - ποΈ Layer: Core - π Invariant: Uses bcrypt for hashing with standard work factor. - π DEPENDS_ON -> `passlib` - - π¦ **pwd_context** (`Variable`) - - π Passlib CryptContext for password management. - Ζ **verify_password** (`Function`) - π Verifies a plain password against a hashed password. - Ζ **get_password_hash** (`Function`) @@ -1778,6 +1952,12 @@ - π Delete all logs for a specific task. - Ζ **delete_logs_for_tasks** (`Function`) - π Delete all logs for multiple tasks. + - Ζ **_json_load_if_needed** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_parse_datetime** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_resolve_environment_id** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - Ζ **json_serializable** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) - π¦ **TaskManagerModule** (`Module`) @@ -1831,6 +2011,8 @@ - π Resume a task that is awaiting input with provided passwords. - Ζ **clear_tasks** (`Function`) - π Clears tasks based on status filter (also deletes associated logs). + - Ζ **sort_key** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - π¦ **TaskManagerModels** (`Module`) - π Defines the data models and enumerations used by the Task Manager. - ποΈ Layer: Core @@ -2169,6 +2351,18 @@ - Ζ **download_file** (`Function`) - π Retrieve a file for download. - π CALLS -> `StoragePlugin.get_file_path` +- π¦ **ReportsRouter** (`Module`) `[CRITICAL]` + - π FastAPI router for unified task report list and detail retrieval endpoints. + - ποΈ Layer: UI (API) + - π Invariant: Endpoints are read-only and do not trigger long-running tasks. + - π DEPENDS_ON -> `backend.src.services.reports.report_service.ReportsService` + - π DEPENDS_ON -> `backend.src.dependencies` + - Ζ **_parse_csv_enum_list** (`Function`) + - π Parse comma-separated query value into enum list. + - Ζ **list_reports** (`Function`) + - π Return paginated unified reports list. + - Ζ **get_report_detail** (`Function`) + - π Return one normalized report detail with diagnostics and next actions. - π¦ **__init__** (`Module`) `[TRIVIAL]` - π Auto-generated module for backend/src/api/routes/__init__.py - ποΈ Layer: Unknown @@ -2240,15 +2434,71 @@ - π Auto-detected function (orphan) - Ζ **mock_get_dashboards** (`Function`) `[TRIVIAL]` - π Auto-detected function (orphan) +- π¦ **backend.tests.test_reports_openapi_conformance** (`Module`) `[CRITICAL]` + - π Validate implemented reports payload shape against OpenAPI-required top-level contract fields. + - ποΈ Layer: Domain (Tests) + - π Invariant: List and detail payloads include required contract keys. + - Ζ **__init__** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **get_all_tasks** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_admin_user** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_task** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_reports_list_openapi_required_keys** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_reports_detail_openapi_required_keys** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) +- π¦ **backend.tests.test_reports_api** (`Module`) `[CRITICAL]` + - π Contract tests for GET /api/reports defaults, pagination, and filtering behavior. + - ποΈ Layer: Domain (Tests) + - π Invariant: API response contract contains {items,total,page,page_size,has_next,applied_filters}. + - Ζ **__init__** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **get_all_tasks** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_admin_user** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_make_task** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_get_reports_default_pagination_contract** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_get_reports_filter_and_pagination** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_get_reports_invalid_filter_returns_400** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - π¦ **backend.src.api.routes.__tests__.test_datasets** (`Module`) - π Unit tests for Datasets API endpoints - ποΈ Layer: API + - π Invariant: Endpoint contracts remain stable for success and validation failure paths. - Ζ **test_get_datasets_success** (`Function`) - Ζ **test_get_datasets_env_not_found** (`Function`) - Ζ **test_get_datasets_invalid_pagination** (`Function`) - Ζ **test_map_columns_success** (`Function`) - Ζ **test_map_columns_invalid_source_type** (`Function`) - Ζ **test_generate_docs_success** (`Function`) +- π¦ **backend.tests.test_reports_detail_api** (`Module`) `[CRITICAL]` + - π Contract tests for GET /api/reports/{report_id} detail endpoint behavior. + - ποΈ Layer: Domain (Tests) + - Ζ **__init__** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **get_all_tasks** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_admin_user** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_make_task** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_get_report_detail_success** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_get_report_detail_not_found** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) +- π¦ **backend.src.models.config** (`Module`) + - π Defines database schema for persisted application configuration. + - ποΈ Layer: Domain + - π DEPENDS_ON -> `sqlalchemy` + - β **AppConfigRecord** (`Class`) + - π Stores the single source of truth for application configuration. - π¦ **backend.src.models.llm** (`Module`) - π SQLAlchemy models for LLM provider configuration and validation results. - ποΈ Layer: Domain @@ -2298,6 +2548,33 @@ - π Represents a mapping between source and target databases. - β **MigrationJob** (`Class`) `[TRIVIAL]` - π Represents a single migration execution job. +- π¦ **backend.src.models.report** (`Module`) `[CRITICAL]` + - π Canonical report schemas for unified task reporting across heterogeneous task types. + - ποΈ Layer: Domain + - π Invariant: Canonical report fields are always present for every report item. + - π DEPENDS_ON -> `backend.src.core.task_manager.models` + - β **TaskType** (`Class`) + - π Supported normalized task report types. + - β **ReportStatus** (`Class`) + - π Supported normalized report status values. + - β **ErrorContext** (`Class`) + - π Error and recovery context for failed/partial reports. + - β **TaskReport** (`Class`) + - π Canonical normalized report envelope for one task execution. + - β **ReportQuery** (`Class`) + - π Query object for server-side report filtering, sorting, and pagination. + - β **ReportCollection** (`Class`) + - π Paginated collection of normalized task reports. + - β **ReportDetailView** (`Class`) + - π Detailed report representation including diagnostics and recovery actions. + - Ζ **_non_empty_str** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_validate_sort_by** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_validate_sort_order** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **_validate_time_range** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - π¦ **backend.src.models.storage** (`Module`) `[TRIVIAL]` - π Data models for the storage system. - ποΈ Layer: Domain @@ -2477,12 +2754,75 @@ - π¦ **backend.src.services.__tests__.test_resource_service** (`Module`) - π Unit tests for ResourceService - ποΈ Layer: Service + - π Invariant: Resource summaries preserve task linkage and status projection behavior. - Ζ **test_get_dashboards_with_status** (`Function`) - Ζ **test_get_datasets_with_status** (`Function`) - Ζ **test_get_activity_summary** (`Function`) - Ζ **test_get_git_status_for_dashboard_no_repo** (`Function`) - Ζ **test_get_last_task_for_resource** (`Function`) - Ζ **test_extract_resource_name_from_task** (`Function`) +- π¦ **backend.src.services.reports.normalizer** (`Module`) `[CRITICAL]` + - π Convert task manager task objects into canonical unified TaskReport entities with deterministic fallback behavior. + - ποΈ Layer: Domain + - π Invariant: Unknown task types and partial payloads remain visible via fallback mapping. + - π DEPENDS_ON -> `backend.src.core.task_manager.models.Task` + - π DEPENDS_ON -> `backend.src.models.report` + - π DEPENDS_ON -> `backend.src.services.reports.type_profiles` + - Ζ **status_to_report_status** (`Function`) + - π Normalize internal task status to canonical report status. + - Ζ **build_summary** (`Function`) + - π Build deterministic user-facing summary from task payload and status. + - Ζ **extract_error_context** (`Function`) + - π Extract normalized error context and next actions for failed/partial reports. + - Ζ **normalize_task_report** (`Function`) + - π Convert one Task to canonical TaskReport envelope. +- π¦ **backend.src.services.reports.type_profiles** (`Module`) `[CRITICAL]` + - π Deterministic mapping of plugin/task identifiers to canonical report task types and fallback profile metadata. + - ποΈ Layer: Domain + - π Invariant: Unknown input always resolves to TaskType.UNKNOWN with a single fallback profile. + - π DEPENDS_ON -> `backend.src.models.report.TaskType` + - π¦ **PLUGIN_TO_TASK_TYPE** (`Data`) + - π Maps plugin identifiers to normalized report task types. + - π¦ **TASK_TYPE_PROFILES** (`Data`) + - π Profile metadata registry for each normalized task type. + - Ζ **resolve_task_type** (`Function`) + - π Resolve canonical task type from plugin/task identifier with guaranteed fallback. + - Ζ **get_type_profile** (`Function`) + - π Return deterministic profile metadata for a task type. +- π¦ **backend.src.services.reports.report_service** (`Module`) `[CRITICAL]` + - π Aggregate, normalize, filter, and paginate task reports for unified list/detail API use cases. + - ποΈ Layer: Domain + - π Invariant: List responses are deterministic and include applied filter echo metadata. + - π DEPENDS_ON -> `backend.src.core.task_manager.manager.TaskManager` + - π DEPENDS_ON -> `backend.src.models.report` + - π DEPENDS_ON -> `backend.src.services.reports.normalizer` + - β **ReportsService** (`Class`) `[CRITICAL]` + - π Service layer for list/detail report retrieval and normalization. + - π Invariant: Service methods are read-only over task history source. + - Ζ **__init__** (`Function`) `[CRITICAL]` + - π Initialize service with TaskManager dependency. + - π Invariant: Constructor performs no task mutations. + - Ζ **_load_normalized_reports** (`Function`) + - π Build normalized reports from all available tasks. + - π Invariant: Every returned item is a TaskReport. + - Ζ **_matches_query** (`Function`) + - π Apply query filtering to a report. + - π Invariant: Filter evaluation is side-effect free. + - Ζ **_sort_reports** (`Function`) + - π Sort reports deterministically according to query settings. + - π Invariant: Sorting criteria are deterministic for equal input. + - Ζ **list_reports** (`Function`) + - π Return filtered, sorted, paginated report collection. + - Ζ **get_report_detail** (`Function`) + - π Return one normalized report with timeline/diagnostics/next actions. +- π¦ **backend.tests.test_report_normalizer** (`Module`) `[CRITICAL]` + - π Validate unknown task type fallback and partial payload normalization behavior. + - ποΈ Layer: Domain (Tests) + - π Invariant: Unknown plugin types are mapped to canonical unknown task type. + - Ζ **test_unknown_type_maps_to_unknown_profile** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) + - Ζ **test_partial_payload_keeps_report_visible_with_placeholders** (`Function`) `[TRIVIAL]` + - π Auto-detected function (orphan) - π¦ **BackupPlugin** (`Module`) - π A plugin that provides functionality to back up Superset dashboards. - ποΈ Layer: App diff --git a/.ai/shots/frontend_component.svelte b/.ai/shots/frontend_component.svelte index 53099398..0f87cc17 100644 --- a/.ai/shots/frontend_component.svelte +++ b/.ai/shots/frontend_component.svelte @@ -1,6 +1,5 @@ - @@ -70,8 +71,8 @@ {#each tasks as task (task.id)}
{$t.tasks?.select_task || 'No recent tasks'}
{$t.reports?.not_provided || 'Not provided'}
+ {:else} +ID: {notProvided(detail.report.report_id)}
+Type: {notProvided(detail.report.task_type)}
+Status: {notProvided(detail.report.status)}
+Summary: {notProvided(detail.report.summary)}
+Updated: {formatDate(detail.report.updated_at)}
+Diagnostics
+{JSON.stringify(detail.diagnostics || { note: $t.reports?.not_provided || 'Not provided' }, null, 2)}
+ Next actions
+{error}
+ +{$t.reports?.filtered_empty || 'No reports match your filters.'}
+ +ΠΡΠ±Π΅ΡΠΈΡΠ΅ Π·Π°Π΄Π°ΡΡ ΠΈΠ· ΡΠΏΠΈΡΠΊΠ° ΡΠ»Π΅Π²Π°
-