feat(runtime): add integration hardening and diagnostics

This commit is contained in:
2026-09-05 21:56:09 +03:00
parent ffdaa299bc
commit c730cb818d
19 changed files with 956 additions and 160 deletions
+45
View File
@@ -0,0 +1,45 @@
# Runtime resource budget
Milestone 010 fixes and exposes the following production limits. They are
compile-time bounds, not targets that may grow with match duration.
| Resource | Limit | Defensive behavior |
| --- | ---: | --- |
| WebSocket connections | 6 | A seventh WebSocket handshake is rejected. |
| LwIP sockets | 16 | ESP-IDF remains configured by `sdkconfig.defaults`. |
| Client message | 512 bytes | An oversized frame is counted and disconnected. |
| Outgoing message | 768 bytes | An over-limit message cannot enter the queue. |
| Outgoing queue | 12 entries | Queue overflow is counted; memory cannot grow. |
| Game command queue | 16 entries | Excess commands receive `queue_full`. |
| Input rate | 20 messages/second | Excess messages are rejected; sustained abuse above 40 in the same window is disconnected. |
| Player response budget | 250 ms | The physical stress client fails above this round-trip threshold. |
| Observer update policy | Latest bounded projection | A busy observer may lose intermediate dynamic chunks and recover on a newer projection. Failed or stalled required sends close the socket. |
| Reconnect deadline | 60,000 ms | Gameplay pauses, then ends in a draw at expiry. |
## Build-time measurements
The Milestone 010 production build on 2026-09-05 reported 124,276 of 327,680
static RAM bytes and 1,028,600 of 2,097,152 application bytes. The independent
binary check measured 1,029,232 bytes in the 2 MiB factory partition, leaving
1,067,920 bytes of application margin. The compressed web
payload totals 19,253 bytes against its 1.5 MiB budget, leaving 1,553,611 bytes
of payload margin. LittleFS remains the fixed 1,984 KiB partition and its image
is checked against `partitions.csv` on every build.
The global authoritative gateway, including its one maze, one projection
buffer, fixed queues, sessions, timers, and metrics, occupies 86,840 bytes of
static storage in the production ELF. It does not allocate a maze or
projection per client. No production source or test requires PSRAM or a GPIO.
## Runtime measurements
`GET /diagnostics` returns current and minimum internal 8-bit heap values and
the largest internal free block. It deliberately samples
`MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT`, so external RAM cannot make a failing
internal-memory result appear healthy. Serial samples use the same capability
mask.
Final six-client, slow-client, repeated-match, and network-recovery samples
belong in the active milestone evidence in `PLANS.md`. Build-time numbers in
this document must be refreshed if the production image changes before that
evidence is recorded.