fix(Communication): add LegacyResponseAdapter — v1 tablets saw device as unavailable while playing (F-061)
LegacyAdapter already translates incoming v1 requests to v2 internal commands, but v2 handler replies used v2-only conventions (namespaced type strings, data nested under "data", UPPERCASE status enum, object-keyed strike_counters). A v1-only Flutter app polling system.status never recognised the reply, hit its own 5s request timeout, and its catch block explicitly set the UI to "unavailable" — even though the device was playing correctly and had already replied in time. Not a connectivity bug; a pure reply-schema mismatch. Adds LegacyResponseAdapter, the reply-side mirror of LegacyAdapter: a narrow, allowlisted translator that rewrites a CommandResult back into v1 shape, but only for replies to requests whose original envelope version was 1. Wired into WebSocket, MQTT, and HTTP's general command path by capturing envelope.version before CommandBus::dispatch() overwrites it to 2. v2 clients and all other reply types are untouched, byte-for-byte. This is deliberately temporary migration scaffolding for the v1→v2 tablet rollout window, not new permanent architecture — designed to be deleted alongside LegacyAdapter in one PR once fleet telemetry shows zero v1 requests. Full rationale and removal steps in docs/architecture/legacy-response-adapter.md. Verified: pio run across all four environments (vesper-std-v1, agnus-v1, agnus-mini-v1, bespoke-rs485-v1). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,7 @@ Bell automation firmware for ESP32 (Kincony KC868-A6).
|
||||
| File | Description |
|
||||
|---|---|
|
||||
| [architecture/communication-refactor-plan.md](architecture/communication-refactor-plan.md) | Full design doc for the v2 Communication subsystem (CommandBus, Handlers, Transports) |
|
||||
| [architecture/legacy-response-adapter.md](architecture/legacy-response-adapter.md) | `LegacyResponseAdapter` — v2→v1 reply translation for the v1→v2 migration window (temporary, with removal steps) |
|
||||
|
||||
## Features
|
||||
|
||||
|
||||
Reference in New Issue
Block a user