Commit Graph

6 Commits

Author SHA1 Message Date
aaf82e3a5c feat(infrastructure): add dependency injection factories with TDD stubs
- Add relay controller factory with retry/fallback logic (T039a stub)
- Add label repository factory with mock/SQLite selection (T039b stub)
- Include comprehensive test suites for expected factory behavior
- Update module exports to expose factory functions
2026-03-04 12:46:20 +01:00
0b7636c80c feat(domain,presentation,tests): implement Relay entity, DTOs, and API errors
- Add Relay entity with constructors and business logic methods
- Add RelayDto for API responses with From<Relay> conversion
- Add ApiError with ResponseError trait for unified error handling
- Add dependency injection tests for mock infrastructure in test mode
2026-03-04 12:30:29 +01:00
5287baadbb feat(application): implement US1 relay control use cases
Add GetAllRelaysUseCase (T043) for retrieving all 8 relay states with
labels, coordinating controller reads and repository label lookups
with comprehensive error handling and logging.

Implement ToggleRelayUseCase (T041) for toggling individual relay
states with read-before-write pattern, state validation, and label
retrieval.

Add use_cases module (T044) with trait-based dependency injection for
testability, exposing both use cases for presentation layer
integration.

Comprehensive test coverage includes 7 toggle tests (state
transitions, error handling, double-toggle idempotency) and 9 get-all
tests (count, ordering, state correctness, label inclusion, error
scenarios).

Ref: T041 T042 T043 T044 (specs/001-modbus-relay-control/tasks.org)
2026-03-04 12:27:19 +01:00
29ebe015fd feat(infrastructure): implement SQLite repository for relay labels
Add complete SQLite implementation of RelayLabelRepository trait with
all CRUD operations (get_label, save_label, delete_label, get_all_labels).

Key changes:
- Create infrastructure entities module with RelayLabelRecord struct
- Implement TryFrom traits for converting between database records and domain types
- Add From<sqlx::Error> and From<RelayLabelError> for RepositoryError
- Write comprehensive functional tests covering all repository operations
- Verify proper handling of edge cases (empty results, overwrites, max length)

TDD phase: GREEN - All repository trait tests now passing with SQLite implementation

Ref: T036 (specs/001-modbus-relay-control/tasks.md)
2026-03-04 12:27:19 +01:00
6d0a2bdb9e feat(application): HealthMonitor service and hardware integration test
Add HealthMonitor service for tracking system health status with
comprehensive state transition logic and thread-safe operations.
Includes 16 unit tests covering all functionality including concurrent
access scenarios.

Add optional Modbus hardware integration tests with 7 test cases for
real device testing. Tests are marked as ignored and can be run with

Ref: T034, T039, T040 (specs/001-modbus-relay-control/tasks.org)
2026-03-04 12:27:19 +01:00
4636cb457a refactor(specs): switch tasks to org format 2026-03-04 12:27:19 +01:00