feat(backend): per-tier, per-kind active-game limits with a guest funnel #234
Reference in New Issue
Block a user
Delete Branch "feature/e8-guest-limits"
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?
What
Per-tier, per-kind caps on a player's simultaneous unfinished games, replacing the flat
MaxActiveQuickGames=10combined cap.backend.configtable holds{guest,durable}_{vs_ai,random,friends}_limit(smallint,-1= unlimited), read through an in-memory cache (internal/gamelimits), loaded at boot and refreshed on an admin edit. Defaults: guest 1/1/0, durable 10/10/10.games.game_kind(0 = unknown/pre-existing, 1 = vs_ai, 2 = random, 3 = friends), set on creation and projected ontogame.Game.Server.ensureUnderGameLimit(kind)gateslobby/enqueue(random/vs_ai) with 409game_limit_reached; the durable friends cap is enforced inCreateInvitation;game.Service.AtGameLimitresolves the tier and counts. Accepting an invitation stays exempt.guest_forbidden) — previously UI-only.Kindcolumn in both game lists (global + user card) and a config editor at/_gm/limits.The
at_game_limitlobby flag now reflects the random-kind cap.Migration
00014_guest_limits.sql— additive (game_kindcolumn +backend.config), applies forward with no data rewrite; an image rollback ignores the new column/table.Tests
gamelimits):Cap/LimitsFortier + kind resolution.inttest/game_limit_test.go):game_kindpersisted per path; guest refused friend/redeem/invitation (domain + HTTP 403); guest blocked from a 2nd vs_ai / 2nd random (+at_game_limit); durable on the higher tier; the durable friends cap + config cache reflecting an admin edit; accept stays exempt.Full local suite green (build, vet, gofmt, unit, integration).
Follow-up
The client-side lock badge + funnel/notice modals and the
Profile.game_limits/GameView.kindwire land in a follow-up PR.