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
+15
View File
@@ -37,6 +37,9 @@ is only echoed for correlation; it grants no authority.
unpaused match may submit movement intent.
- `drop_key`: `{}`. Only a player in an active, unpaused match may submit the
key-drop intent.
- `restart`: `{}`. Only connected Player 1 may reset a finished match, and both
players must be connected. Sessions are preserved while a new authoritative
maze and game state are created.
- `heartbeat`: `{}` after a session has been joined or restored.
## Server messages
@@ -57,6 +60,8 @@ is only echoed for correlation; it grants no authority.
- `resume`: reports that both players are attached and authoritative gameplay
has resumed.
- `match_result`: reports the terminal winner or draw.
- `reset`: reports the authoritative return from a finished match to the
waiting lobby.
- `ack`: successful heartbeat correlation.
- `error`: a stable English `code` and Russian player-facing `message`.
@@ -67,3 +72,13 @@ so a refresh can restore it. A player disconnect pauses the game for at most 60
seconds; restoration reattaches the same state, while expiry produces a draw.
A disconnected observer token may be restored until its bounded slot is reused
by a new observer, and observer disconnects never pause the match.
## Runtime diagnostics
`GET /diagnostics` returns bounded operational counters and internal-memory
samples without exposing session tokens, Wi-Fi credentials, or hidden maze
state. Counters cover connection and queue high-water marks, sent/dropped/
failed messages, malformed and rate-limited input, accepted game commands,
match cycles, maximum WebSocket handler/send duration, and current/minimum
internal free heap and largest block. The response also publishes the fixed
limits used by the Milestone 010 physical stress client.