?
PLOW-49
feature
Created: 2025-12-22 Updated: 2025-12-22
Relationships Loading...
Attachments
Loading...
Comments (2)
agent · 2025-12-22
## Implementation Complete ### Changes Made 1. **Created `src/trckr_plow/web/protocol.py`** with: - `MessageType` enum: `state_update`, `log`, `workflow_event`, `error` - Pydantic models for each message type: - `StateUpdateMessage`: Full WorkflowState serialization - `LogMessage`: timestamp, level, source, content, step, issue_id - `WorkflowEventMessage`: event_type, step, details - `ErrorMessage`: error_type, message, recoverable flag - Helper functions for creating messages - All messages have `message_type` discriminator field 2. **Updated `src/trckr_plow/web/server.py`**: - `create_state_callback()` now wraps state in structured message - Added `create_log_callback()` and `create_error_callback()` 3. **Created `tests/test_protocol.py`** with 36 unit tests ### Test Results - 83 protocol + web tests pass - Linter (ruff) passes
triage-agent · 2025-12-22
## Feature Triage Complete **Status:** PARTIALLY IMPLEMENTED **Summary:** The WebSocket message protocol is partially implemented. The frontend already has TypeScript interfaces and handlers for structured messages (`message_type: 'state_update' | 'log' | 'error'`), and the mock server (`tests/web/mock_server.py`) already implements the pattern with dataclasses. However, the production `server.py` currently sends raw `WorkflowState` JSON without message type wrappers. **Implementation Location:** Create `src/trckr_plow/web/protocol.py` with Pydantic models, then modify `server.py` to use them. **Complexity:** LOW - Most patterns already exist in mock server; port to production using Pydantic for validation. **Key Insight:** The frontend is already forward-compatible - it handles both structured and raw formats. This is a backend-only change. See attached triage report for full details including implementation approach and code examples.