R4: push enrichment — events carry a state delta, kill the last poll #35
Reference in New Issue
Block a user
Delete Branch "feature/r4-push-enrichment"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Phase R4 of
PRERELEASE.md(TODO 4 + 5). Enriches the in-app live stream into a delta channel so the UI renders a move from the event without a follow-upgame.state, and makes the matchmaking poll a stream-down fallback.What changed
pkg/fbs, trailing fields — backward-compatible):opponent_moved(+move/game/bag_len),your_turn(+move_count),match_found(+state),game_over(+game),notify(+account/invitation/state),MoveResult(+rack/bag_len).notifykeeps ownership of the FB encoding (newencode.go+payload.goinput structs);game/lobby/socialmap their domain types in.emitMovebuilds the move delta;game.Service.InitialStatefeedsmatch_found/game_startedthe recipient's initialStateView; friends/invitationsnotifycarry their account/invitation.submit_play/pass/exchange/resign) now returns the actor's refilled rack + bag size, so the mover renders the next turn without a self-refetch.lib/gamedelta.tsreducer advances the per-game cache keyed onmove_count(idempotent + gap-safe → fetch fallback);app.svelteseeds the cache onmatch_found/game_started;Game.svelteapplies the delta (commit/pass/exchange/resigndrop theirload());NewGamepolls only while the stream is down.ARCHITECTURE§10,FUNCTIONAL(+_ru), service READMEs;PRERELEASER4 → done.Notes for review
notify(friends/invitations): the backend carries the full account/invitation payload (per "all events → push"); the UI seeds the game cache fromgame_startedbut keeps its lightweight authoritative badge refresh for the rare friend/invitation events rather than adding client-side lobby caches. The per-move hot path is fully de-fetched, which was the goal — deeper lobby-cache consumption is an easy follow-up.Verification
go build/vet/gofmtclean;go test -count=1 ./backend/... ./gateway/...+ the integration suite + telegram — all green.pnpm check(0 errors),test:unit(138),test:e2e(72, Chromium + WebKit),build(76 KB gzip, under the 100 KB budget).