feat(simulation): error handling and recovery — panic supervision, state hash, structured errors (#85)

Protocol v17: add state_hash (desync detection) and sim_errors
(structured error reporting) to ObserverSnapshot. Add SimError,
SimErrorKind, SimErrorBuffer types. Wrap main loop app.update() in
catch_unwind — on panic, send a final SimError snapshot before exit.
Report recoverable deserialization errors to client via SimErrorBuffer.
Compute per-tick state hash from player position + NPC count + tick.
Update all test fixtures and golden files for protocol v17.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-27 17:46:27 +01:00
co-authored by Claude Opus 4.6
parent c2cae1f618
commit d31ac1cc70
23 changed files with 557 additions and 7 deletions
+4
View File
@@ -314,6 +314,8 @@ mod tests {
player_knowledge: None,
save_result: None,
triangle_crisis_events: vec![],
state_hash: None,
sim_errors: vec![],
}
}
@@ -450,6 +452,8 @@ mod tests {
player_knowledge: None,
save_result: None,
triangle_crisis_events: vec![],
state_hash: None,
sim_errors: vec![],
};
let text = format_snapshot_text(&snap);
assert!(text.contains("Tick 0"));