Compare commits

2 Commits

Author SHA1 Message Date
a8f7147500 test now STANDARD tier 2026-02-26 18:38:26 +03:00
ce684bc5d1 update test data 2026-02-26 18:38:02 +03:00
20 changed files with 41 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
# [DEF:backend.tests.test_reports_api:Module]
# @TIER: CRITICAL
# @TIER: STANDARD
# @SEMANTICS: tests, reports, api, contract, pagination, filtering
# @PURPOSE: Contract tests for GET /api/reports defaults, pagination, and filtering behavior.
# @LAYER: Domain (Tests)

View File

@@ -1,5 +1,5 @@
# [DEF:backend.tests.test_reports_detail_api:Module]
# @TIER: CRITICAL
# @TIER: STANDARD
# @SEMANTICS: tests, reports, api, detail, diagnostics
# @PURPOSE: Contract tests for GET /api/reports/{report_id} detail endpoint behavior.
# @LAYER: Domain (Tests)

View File

@@ -1,5 +1,5 @@
# [DEF:backend.tests.test_reports_openapi_conformance:Module]
# @TIER: CRITICAL
# @TIER: STANDARD
# @SEMANTICS: tests, reports, openapi, conformance
# @PURPOSE: Validate implemented reports payload shape against OpenAPI-required top-level contract fields.
# @LAYER: Domain (Tests)

View File

@@ -6,6 +6,17 @@
# @RELATION: Depends on PluginLoader to get plugin instances. It is used by the API layer to create and query tasks.
# @INVARIANT: Task IDs are unique.
# @CONSTRAINT: Must use belief_scope for logging.
# @TEST_CONTRACT: TaskManagerModule -> {
# required_fields: {plugin_loader: PluginLoader},
# optional_fields: {},
# invariants: ["Must use belief_scope for logging"]
# }
# @TEST_FIXTURE: valid_module -> {"manager_initialized": true}
# @TEST_EDGE: missing_required_field -> {"plugin_loader": null}
# @TEST_EDGE: empty_response -> {"tasks": []}
# @TEST_EDGE: invalid_type -> {"plugin_loader": "string_instead_of_object"}
# @TEST_EDGE: external_failure -> {"db_unavailable": true}
# @TEST_INVARIANT: logger_compliance -> verifies: [valid_module]
# [SECTION: IMPORTS]
import asyncio
@@ -28,7 +39,17 @@ from ..logger import logger, belief_scope, should_log_task_level
# @INVARIANT: Task IDs are unique within the registry.
# @INVARIANT: Each task has exactly one status at any time.
# @INVARIANT: Log entries are never deleted after being added to a task.
class TaskManager:
# @TEST_CONTRACT: TaskManager -> {
# required_fields: {plugin_id: str, params: dict},
# optional_fields: {user_id: str},
# invariants: ["Task IDs are unique within the registry", "Each task has exactly one status at any time"]
# }
# @TEST_FIXTURE: create_valid_task -> {"plugin_id": "migration_plugin", "params": {"source": "A", "target": "B"}}
# @TEST_EDGE: missing_required_field -> {"plugin_id": null}
# @TEST_EDGE: empty_response -> {"params": {}}
# @TEST_EDGE: invalid_type -> {"params": "string_instead_of_dict"}
# @TEST_EDGE: external_failure -> {"plugin_not_found": true}
# @TEST_INVARIANT: single_status -> verifies: [create_valid_task, external_failure]
"""
Manages the lifecycle of tasks, including their creation, execution, and state tracking.
"""

View File

@@ -1,5 +1,5 @@
# [DEF:test_report_models:Module]
# @TIER: CRITICAL
# @TIER: STANDARD
# @PURPOSE: Unit tests for report Pydantic models and their validators
# @LAYER: Domain
# @RELATION: TESTS -> backend.src.models.report

View File

@@ -1,5 +1,5 @@
# [DEF:test_encryption_manager:Module]
# @TIER: CRITICAL
# @TIER: STANDARD
# @SEMANTICS: encryption, security, fernet, api-keys, tests
# @PURPOSE: Unit tests for EncryptionManager encrypt/decrypt functionality.
# @LAYER: Domain

View File

@@ -1,5 +1,5 @@
# [DEF:backend.tests.test_report_normalizer:Module]
# @TIER: CRITICAL
# @TIER: STANDARD
# @SEMANTICS: tests, reports, normalizer, fallback
# @PURPOSE: Validate unknown task type fallback and partial payload normalization behavior.
# @LAYER: Domain (Tests)

View File

@@ -1,5 +1,5 @@
# [DEF:test_report_service:Module]
# @TIER: CRITICAL
# @TIER: STANDARD
# @PURPOSE: Unit tests for ReportsService list/detail operations
# @LAYER: Domain
# @RELATION: TESTS -> backend.src.services.reports.report_service.ReportsService

View File

@@ -1,5 +1,5 @@
// [DEF:frontend.src.components.__tests__.task_log_viewer:Module]
// @TIER: CRITICAL
// @TIER: STANDARD
// @SEMANTICS: tests, task-log, viewer, mount, components
// @PURPOSE: Unit tests for TaskLogViewer component by mounting it and observing the DOM.
// @LAYER: UI (Tests)

View File

@@ -1,5 +1,5 @@
// [DEF:frontend.src.lib.api.__tests__.reports_api:Module]
// @TIER: CRITICAL
// @TIER: STANDARD
// @SEMANTICS: tests, reports, api-client, query-string, error-normalization
// @PURPOSE: Unit tests for reports API client functions: query string building, error normalization, and fetch wrappers.
// @LAYER: Infra (Tests)

View File

@@ -41,7 +41,7 @@ describe('AssistantChatPanel integration contract', () => {
const source = fs.readFileSync(COMPONENT_PATH, 'utf-8');
expect(source).toContain('<!-- [DEF' + ':AssistantChatPanel:Component] -->');
expect(source).toContain('@TIER: CRITICAL');
expect(source).toContain('@TIER: STANDARD');
expect(source).toContain('@UX_STATE: LoadingHistory');
expect(source).toContain('@UX_STATE: Sending');
expect(source).toContain('@UX_STATE: Error');

View File

@@ -1,5 +1,5 @@
// [DEF:__tests__/test_sidebar:Module]
// @TIER: CRITICAL
// @TIER: STANDARD
// @PURPOSE: Unit tests for Sidebar.svelte component
// @LAYER: UI
// @RELATION: VERIFIES -> frontend/src/lib/components/layout/Sidebar.svelte

View File

@@ -1,5 +1,5 @@
// [DEF:__tests__/test_taskDrawer:Module]
// @TIER: CRITICAL
// @TIER: STANDARD
// @PURPOSE: Unit tests for TaskDrawer.svelte component
// @LAYER: UI
// @RELATION: VERIFIES -> frontend/src/lib/components/layout/TaskDrawer.svelte

View File

@@ -1,5 +1,5 @@
// [DEF:__tests__/test_topNavbar:Module]
// @TIER: CRITICAL
// @TIER: STANDARD
// @PURPOSE: Unit tests for TopNavbar.svelte component
// @LAYER: UI
// @RELATION: VERIFIES -> frontend/src/lib/components/layout/TopNavbar.svelte

View File

@@ -2,7 +2,7 @@
* @vitest-environment jsdom
*/
// [DEF:frontend.src.lib.components.reports.__tests__.report_card.ux:Module]
// @TIER: CRITICAL
// @TIER: STANDARD
// @SEMANTICS: reports, ux-tests, card, states, recovery
// @PURPOSE: Test UX states and transitions for ReportCard component
// @LAYER: UI

View File

@@ -1,5 +1,5 @@
// [DEF:frontend.src.lib.components.reports.__tests__.report_detail.integration:Module]
// @TIER: CRITICAL
// @TIER: STANDARD
// @SEMANTICS: tests, reports, detail, recovery-guidance, integration
// @PURPOSE: Validate detail-panel behavior for failed reports and recovery guidance visibility.
// @LAYER: UI (Tests)

View File

@@ -2,7 +2,7 @@
* @vitest-environment jsdom
*/
// [DEF:frontend.src.lib.components.reports.__tests__.report_detail.ux:Module]
// @TIER: CRITICAL
// @TIER: STANDARD
// @SEMANTICS: reports, ux-tests, detail, diagnostics, recovery
// @PURPOSE: Test UX states and recovery for ReportDetailPanel component
// @LAYER: UI

View File

@@ -1,5 +1,5 @@
// [DEF:frontend.src.lib.components.reports.__tests__.report_type_profiles:Module]
// @TIER: CRITICAL
// @TIER: STANDARD
// @SEMANTICS: tests, reports, type-profiles, fallback
// @PURPOSE: Validate report type profile mapping and unknown fallback behavior.
// @LAYER: UI (Tests)

View File

@@ -1,5 +1,5 @@
// [DEF:frontend.src.lib.components.reports.__tests__.reports_page.integration:Module]
// @TIER: CRITICAL
// @TIER: STANDARD
// @SEMANTICS: tests, reports, integration, mixed-types, rendering
// @PURPOSE: Integration-style checks for unified mixed-type reports rendering expectations.
// @LAYER: UI (Tests)

View File

@@ -1,5 +1,5 @@
// [DEF:frontend.src.lib.stores.__tests__.test_taskDrawer:Module]
// @TIER: CRITICAL
// @TIER: STANDARD
// @SEMANTICS: task-drawer, store, mapping, tests
// @PURPOSE: Unit tests for task drawer store
// @LAYER: UI