Debug delta diffing: add diagnostics + empty-delta fallback

- All game action handlers: move ToDto() call to after SaveStateAsync()
  so the ACK's StateVersion matches the pushed delta (stale-version fix)
- GameHandlerBase.PushStateToPlayersAsync: add empty-delta safety fallback
  — when ComputeDelta() returns all-null content fields, fall back to a
  full game.state_update push so clients always see the correct state
- Add Console.WriteLine diagnostics to PushStateToPlayersAsync to expose
  prev/next phase, turn, active player, and whether prevStateJson matches
  the post-mutation session.StateJson (root cause investigation)
- Game.gd: wire game.activity push to game_activity signal

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
dingo
2026-03-21 21:52:45 -04:00
co-authored by Claude Happy
parent 663b92a56b
commit d27c7f67c3
14 changed files with 113 additions and 41 deletions
@@ -60,10 +60,10 @@ internal sealed class GameConcedeHandler : GameHandlerBase, IMessageHandler
session.WinCondition = "concede";
session.EndedAt = DateTimeOffset.UtcNow;
var dto = GameEngine.ToDto(newState, actorId);
await SaveStateAsync(_gameDb, session, newState, actorId, "game.concede",
JsonSerializer.Serialize(req), ct, JsonSerializer.Serialize(dto));
JsonSerializer.Serialize(req), ct);
var dto = GameEngine.ToDto(newState, actorId);
await FinalizeGameAsync(
_gameDb, _identityDb, _clientPush, _eventBus,
session,