Implements T025-T027 from TDD workflow (red-green-refactor):
- T025 (red): Tests for ModbusAddress with From<RelayId> conversion
- T026 (green): ModbusAddress newtype (#[repr(transparent)]) with offset mapping
- T027 (red+green): HealthStatus enum with state transitions
ModbusAddress wraps u16 and converts user-facing relay IDs (1-8) to
Modbus addresses (0-7) at the domain boundary. HealthStatus tracks
relay health with Healthy, Degraded, and Unhealthy states supporting
error tracking and recovery monitoring.
Ref: T025, T026, T027 (specs/001-modbus-relay-control)
Implemented the Relay aggregate as the primary domain entity for relay
control operations. Added RelayLabel newtype for validated human-readable
relay labels.
Relay aggregate features:
- Construction with id, state, and optional label
- State control methods: toggle(), turn_on(), turn_off()
- Accessor methods: id(), state(), label()
- All methods use const where possible for compile-time optimization
RelayLabel newtype features:
- Validation: non-empty, max 50 characters
- Smart constructor with Result-based error handling
- Default implementation: "Unlabeled"
- Transparent representation for zero-cost abstraction
Additional changes:
- Made RelayId derive Copy for ergonomic value semantics
- All public APIs include documentation and #[must_use] attributes
TDD phase: GREEN - Tests pass for Relay aggregate (T021 tests now pass)
Ref: T022, T024 (specs/001-modbus-relay-control/tasks.md)
Created test suite for Relay entity covering construction, state toggling,
and explicit state control methods. Tests intentionally fail as Relay
struct is not yet implemented.
Tests cover:
- Relay::new() with id, state, and optional label
- toggle() flipping state between On/Off
- turn_on() setting state to On
- turn_off() setting state to Off
TDD phase: RED - Tests written, implementation pending (T022)
Ref: T021 (specs/001-modbus-relay-control/tasks.md)
Tests verify serialization and deserialization of RelayState enum with
"on" and "off" states. Red phase of TDD - tests define expected behavior
before implementation.
Ref: T019 (specs/001-modbus-relay-control/tasks.md)
Implement smart constructor that validates relay IDs are within valid
range (1-8 for 8-channel relay controller). Add accessor method as_u8()
for safe access to inner value. Add comprehensive documentation to satisfy
clippy requirements.
TDD green phase: Tests from T017 now pass.
Ref: T018 (specs/001-modbus-relay-control/tasks.md)
Convert project from single backend to monorepo structure with separate
frontend (Vue 3 + TypeScript + Vite) and backend directories. Updates
all configuration files and build system to support both workspaces.
Ref: T007 (specs/001-modbus-relay-control)