Daeseon Yoo
Back to project
·Tech retro·4 min

Phase 4 — Redis-backed stateless PvP (game store, cross-worker pub/sub, 149 tests)

Phase 4 externalized all in-memory PvP state to Redis, added per-player pub/sub for cross-worker routing, and used optimistic concurrency for atomic two-player turns — landing the full suite at 149 tests passing in ~23s.

What Phase 4 did

Phase 4 made PvP stateless. All in-memory game state moved to Redis, workers became stateless façades over that state, and cross-worker messaging went through per-player Redis pub/sub. The log calls this the most architecturally consequential change in the project so far, so the design was locked in (DR-12..15) before any code was written.

The Python implementation here is intended as the reference spec for Phase 5 (the Go rewrite): storage representation, pub/sub topology, and concurrency model were all chosen to be language-agnostic and translate directly.

Total scope: ~1,480 LOC of distributed-systems engineering. Full suite after Phase 4: 149 tests passing in ~23s. Phase 4 added 23 tests (16 + 7).

Sub-phases

4.1 — Redis-backed game store (app/core/game_store.py)

4.2 + 4.3 — Stateless PvPGameSession + matchmaking (commit 84a71d1)

4.4 — Per-player pub/sub (commit 9df2fc3)

4.5 — Two-process integration test (deferred)

Production behaviors unlocked

Decisions

Metrics

Commits