feat(offline): local game persistence + replay (Phase B2) #192

Merged
developer merged 1 commits from feature/offline-localgame-store into development 2026-07-06 06:34:57 +00:00
Owner

Phase B2 of PWA offline mode, on top of #191. Store an offline game durably and reconstruct it — the offline counterpart of the server's replay rehydration. Not wired into the UI yet (B3).

  • serialize.ts: a LocalGameRecord (seed + rules + seat metadata + the alphabet-index move journal) + replayGame() — reconstruct a live LocalGame by seeding a fresh engine identically and replaying the journal. Board/bag/racks are NOT stored; they are deterministic from the seed + the replayed ops, so the record stays small. The journal is dictionary-independent (index space, stable per variant).
  • store.ts: an IndexedDB store for local games (save/get/list/delete), mirroring lib/dict/store.ts — own DB, best-effort, guarded when IndexedDB is absent.
  • engine.ts: record the swapped tiles on an exchange (needed for exact replay) + expose the rule config.
  • serialize.test.ts: a round-trip — reconstruct a mid-game and a finished game by replay and assert the state (board/racks/bag/scores/turn/log) is identical.

Pure additive library code; no runtime behavior change (bundle unchanged). Local verify green: UI check (611 files) + test:unit (453 passed) + build.

Phase B2 of PWA offline mode, on top of #191. Store an offline game durably and reconstruct it — the offline counterpart of the server's replay rehydration. Not wired into the UI yet (B3). - `serialize.ts`: a `LocalGameRecord` (seed + rules + seat metadata + the alphabet-index move journal) + `replayGame()` — reconstruct a live `LocalGame` by seeding a fresh engine identically and replaying the journal. Board/bag/racks are NOT stored; they are deterministic from the seed + the replayed ops, so the record stays small. The journal is dictionary-independent (index space, stable per variant). - `store.ts`: an IndexedDB store for local games (save/get/list/delete), mirroring `lib/dict/store.ts` — own DB, best-effort, guarded when IndexedDB is absent. - `engine.ts`: record the swapped tiles on an exchange (needed for exact replay) + expose the rule config. - `serialize.test.ts`: a round-trip — reconstruct a mid-game and a finished game by replay and assert the state (board/racks/bag/scores/turn/log) is identical. Pure additive library code; no runtime behavior change (bundle unchanged). Local verify green: UI check (611 files) + test:unit (453 passed) + build.
developer added 1 commit 2026-07-06 06:23:03 +00:00
feat(offline): local game persistence + replay (Phase B2)
CI / changes (pull_request) Successful in 1s
CI / unit (pull_request) Has been skipped
CI / integration (pull_request) Has been skipped
CI / ui (pull_request) Successful in 1m8s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m41s
4fa77bf82c
Store an offline game durably and reconstruct it — the offline counterpart of the
server's replay rehydration. Builds on the engine (#191); not wired into the UI yet
(Phase B3).

- serialize.ts: a LocalGameRecord (seed + rules + seat metadata + the alphabet-index
  move journal) and replayGame() — reconstruct a live LocalGame by seeding a fresh
  engine identically and replaying the journal. The board/bag/racks are not stored; they
  are deterministic from the seed and the replayed operations, so the record stays small.
  The journal is dictionary-independent (alphabet-index space, stable per variant).
- store.ts: an IndexedDB store for local games (save/get/list/delete), mirroring
  lib/dict/store.ts — its own database, best-effort, guarded when IndexedDB is absent.
- engine.ts: record the swapped tiles on an exchange (needed for exact replay) and expose
  the game's rule config.
- serialize.test.ts: a round-trip — reconstruct a mid-game and a finished game by replay
  and assert the state (board/racks/bag/scores/turn/log) is identical.

Pure additive library code; no runtime behavior change (bundle unchanged).
owner approved these changes 2026-07-06 06:34:33 +00:00
developer merged commit 2847412b5b into development 2026-07-06 06:34:57 +00:00
developer deleted branch feature/offline-localgame-store 2026-07-06 06:34:58 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: developer/scrabble-game#192