6.1 KiB
Tasks: Task Logging System (Separated Per-Task Logs)
Input: Design documents from /specs/018-task-logging-v2/
Prerequisites: plan.md (required), spec.md (required for user stories), ux_reference.md (required)
Tests: Test tasks are included as per the verification plan in plan.md.
Organization: Tasks are grouped by user story to enable independent implementation and testing of each story.
Format: [ID] [P?] [Story] Description
- [P]: Can run in parallel (different files, no dependencies)
- [Story]: Which user story this task belongs to (e.g., US1, US2, US3)
- Include exact file paths in descriptions
Path Conventions
- Web app:
backend/src/,frontend/src/
Phase 1: Setup (Shared Infrastructure)
Purpose: Project initialization and basic structure
- T001 Create database migration for
task_logstable inbackend/src/models/task.py - T002 [P] Define
LogEntryandTaskLogschemas inbackend/src/core/task_manager/models.py - T003 [P] Create
TaskLoggerclass inbackend/src/core/task_manager/task_logger.py - T004 [P] Create
TaskContextclass inbackend/src/core/task_manager/context.py
Phase 2: Foundational (Blocking Prerequisites)
Purpose: Core infrastructure that MUST be complete before ANY user story can be implemented
⚠️ CRITICAL: No user story work can begin until this phase is complete
- T005 Implement
TaskLogPersistenceServiceinbackend/src/core/task_manager/persistence.py - T006 Update
TaskManagerto include log buffer and flusher thread inbackend/src/core/task_manager/manager.py - T007 Implement
_flush_logsand_add_log(new signature) inbackend/src/core/task_manager/manager.py - T008 Update
_run_taskto supportTaskContextand backward compatibility inbackend/src/core/task_manager/manager.py - T009 [P] Update
TaskCleanupServiceto delete logs inbackend/src/core/task_manager/cleanup.py
Checkpoint: Foundation ready - user story implementation can now begin in parallel
Phase 3: User Story 2 - Persistent Log History (Priority: P1) 🎯 MVP
Goal: Ensure logs are saved to the database and accessible after server restart.
Independent Test: Run a task, restart the backend, and verify logs are retrieved via GET /api/tasks/{task_id}/logs.
Implementation for User Story 2
- T010 [P] [US2] Implement
GET /api/tasks/{task_id}/logsendpoint inbackend/src/api/routes/tasks.py - T011 [P] [US2] Implement
GET /api/tasks/{task_id}/logs/statsand/sourcesinbackend/src/api/routes/tasks.py - T012 [US2] Update
get_task_logsinTaskManagerto fetch from persistence for completed tasks inbackend/src/core/task_manager/manager.py - T013 [US2] Verify implementation matches ux_reference.md (Happy Path & Errors)
Checkpoint: User Story 2 complete - logs are persistent and accessible via API.
Phase 4: User Story 1 - Real-time Filtered Logging (Priority: P1)
Goal: Real-time log streaming with server-side filtering.
Independent Test: Connect to WebSocket with ?source=plugin and verify only plugin logs are received.
Implementation for User Story 1
- T014 [US1] Update WebSocket endpoint in
backend/src/app.pyto supportsourceandlevelquery parameters - T015 [US1] Implement server-side filtering logic for WebSocket broadcast in
backend/src/core/task_manager/manager.py - T016 [P] [US1] Create
LogFilterBarcomponent infrontend/src/components/tasks/LogFilterBar.svelte - T017 [P] [US1] Create
LogEntryRowcomponent infrontend/src/components/tasks/LogEntryRow.svelte - T018 [US1] Create
TaskLogPanelcomponent infrontend/src/components/tasks/TaskLogPanel.svelte - T019 [US1] Refactor
TaskLogViewerto useTaskLogPanelinfrontend/src/components/TaskLogViewer.svelte - T020 [US1] Update
TaskRunnerto pass filter parameters to WebSocket infrontend/src/components/TaskRunner.svelte - T021 [US1] Verify implementation matches ux_reference.md (Happy Path & Errors)
Checkpoint: User Story 1 complete - real-time filtered logging is functional.
Phase 5: User Story 3 - Component Attribution (Priority: P2)
Goal: Migrate plugins to use the new TaskContext and TaskLogger.
Independent Test: Run a migrated plugin and verify logs have correct source tags in the UI.
Implementation for User Story 3
- T022 [P] [US3] Migrate
BackupPluginto useTaskContextinbackend/src/plugins/backup.py - T023 [P] [US3] Migrate
MigrationPluginto useTaskContextinbackend/src/plugins/migration.py - T024 [P] [US3] Migrate
GitPluginto useTaskContextinbackend/src/plugins/git_plugin.py - T025 [US3] Verify implementation matches ux_reference.md (Happy Path & Errors)
Phase 6: Polish & Cross-Cutting Concerns
Purpose: Improvements that affect multiple user stories
- T026 [P] Add unit tests for
LogPersistenceServiceinbackend/tests/test_log_persistence.py - T027 [P] Add unit tests for
TaskLoggerandTaskContextinbackend/tests/test_task_logger.py - T028 [P] Update
docs/plugin_dev.mdwith new logging instructions - T029 Final verification of all success criteria (SC-001 to SC-004)
Dependencies & Execution Order
Phase Dependencies
- Setup (Phase 1): No dependencies.
- Foundational (Phase 2): Depends on Phase 1.
- User Stories (Phase 3-5): Depend on Phase 2. US2 (Persistence) is prioritized as it's the foundation for historical logs.
- Polish (Phase 6): Depends on all user stories.
Parallel Opportunities
- T002, T003, T004 can run in parallel.
- T010, T011 can run in parallel.
- T016, T017 can run in parallel.
- Plugin migrations (T022-T024) can run in parallel.
Implementation Strategy
MVP First (User Story 2)
- Complete Setup & Foundational phases.
- Implement US2 (Persistence & API).
- STOP and VALIDATE: Verify logs are saved and retrieved after restart.
Incremental Delivery
- Add US1 (Real-time & UI) → Test filtering.
- Add US3 (Plugin Migration) → Test source attribution.