feat: implement safe state presentation and bounded serialization

This commit is contained in:
2026-08-28 23:04:04 +03:00
parent a691783f58
commit 97bebfd8fb
6 changed files with 205 additions and 5 deletions
+13 -2
View File
@@ -564,7 +564,7 @@ If all criteria pass, set this milestone to `DONE`, append its execution record,
## Milestone 010 — Implement safe state presentation and bounded serialization
**Status:** `READY`
**Status:** `DONE`
**Depends on:** Milestone 009
### Objective
@@ -592,11 +592,22 @@ Produce role-specific state that cannot reveal hidden ships and fits the measure
If all criteria pass, set this milestone to `DONE`, append its execution record, and change Milestone 011 from `BLOCKED` to `READY`.
### Execution record
- Date: 2026-08-28
- Board model and revision: ESP32-C6FH4 QFN32, revision v0.2.
- Toolchain and library versions: PlatformIO Core 6.1.19; `espressif32` 7.0.1; ESP-IDF 6.0.1; `esp_littlefs` 1.20.4.
- Result: PASS.
- Evidence: Added a fixed 512-byte state writer that builds each payload privately and copies it to its caller only on complete success. Player views reveal only their own intact ships; opponents and spectators receive misses and hits only until `FINISHED`, when both boards become public. The presenter emits the locked state schema and lifecycle cumulative wins without serializing session names or retaining per-client state or JSON copies.
- Measurements: `make -C test/host run` passed command queue, domain, bot, lifecycle, and state-presenter suites. Presenter coverage verifies the Player 1, Player 2, spectator, and finished views, locked schema prefix, hidden-cell exclusion, known shot visibility, and unchanged output on insufficient destination capacity. The largest constructed lifecycle payload is 371 B, leaving 141 B (27.5%) below the 512 B hard limit. `pio run -e esp32-c6-devkitm-1` passed with 38,212 / 327,680 B RAM (11.7%) and 1,000,730 / 2,097,152 B flash (47.7%).
- Issues or deviations: HTTP and WebSocket bindings remain Milestones 011 and 012; no transport integration was started.
- Next action: Milestone 011 is ready. Do not start it unless explicitly requested.
---
## Milestone 011 — Implement the production HTTP API
**Status:** `BLOCKED`
**Status:** `READY`
**Depends on:** Milestone 010
### Objective