Skip to content

feat: add 4v4 gamemode support (R1 + R2)#314

Merged
Amund211 merged 2 commits into
mainfrom
4v4-support
Jul 6, 2026
Merged

feat: add 4v4 gamemode support (R1 + R2)#314
Amund211 merged 2 commits into
mainfrom
4v4-support

Conversation

@Amund211

@Amund211 Amund211 commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Implements steps R1 (core gamemode plumbing) and R2 (wrapped page) of plans/2026-07-06-4v4-full-support.md, one commit each.

Warning

Merge gate: do not merge until flashlight F1–F4 are deployed (plan step F5). A rainbow built with this change crashes on PIT responses that lack the "4v4" block.

R1 — core gamemode plumbing (feat(stats))

  • "4v4" added to ALL_GAMEMODE_KEYS (between fours and overall — controls selector/chart order), gamemode labels, and GAMEMODE_COLORS (#ef4444)
  • APIPlayerDataPIT / PlayerDataPIT / apiToPlayerDataPIT gain the "4v4" stats block
  • Persisted query-cache buster bumped "1""2" (shape change). The session-detail-page branch also uses "2"; it will be rebased on top of this later.
  • MSW mock keeps the overall = Σ(modes) invariant (* 4* 5)
  • Two unit-test fixtures typed against PlayerDataPIT needed the new key (caught by type-aware oxlint, which checks tests even though tsc doesn't)

Everything else (zod ?gamemode=4v4 search params, selectors, chart series, stat helpers) is data-driven off ALL_GAMEMODE_KEYS and needs no edits.

R2 — wrapped page (feat(wrapped))

  • "4v4" added to both streak maps (winstreaks / finalKillStreaks) in the wrapped query types, mirroring the existing modes' non-optional typing
  • Streaks section renders the new mode; MSW wrapped mock and UI-test fixture updated

Verification

Both commits: pnpm run tsc clean, pnpm test:unit 622/622, pnpm test:ui:chromium 201/201, pnpm lint:check clean (also enforced by pre-commit hooks).

Follow-up after this lands on main: R3 — rebase #256 and promote 4v4 on the session detail page.

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings July 6, 2026 19:33
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 6, 2026

Copy link
Copy Markdown

Deploying rainbow with  Cloudflare Pages  Cloudflare Pages

Latest commit: 390b686
Status: ✅  Deploy successful!
Preview URL: https://34c5f6f6.rainbow-ctx.pages.dev
Branch Preview URL: https://4v4-support.rainbow-ctx.pages.dev

View logs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds end-to-end client support for a new "4v4" gamemode key, wiring it into shared gamemode constants, PIT data shapes/conversion, wrapped-session streak typing/rendering, and associated mocks/fixtures so the UI can display 4v4 alongside existing modes.

Changes:

  • Extends core gamemode registries (keys, labels, colors) to include "4v4".
  • Updates PIT query types/conversion and bumps persisted query-cache buster to reflect the new data shape.
  • Extends Wrapped session streak types/UI and updates MSW/UI fixtures to include "4v4".

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/theme/tokens.ts Adds an accent color entry for the new "4v4" gamemode.
src/stats/progression.unit.test.ts Updates test builder fixtures to include "4v4" stats.
src/stats/labels.ts Adds a label mapping for "4v4".
src/stats/keys.ts Adds "4v4" to ALL_GAMEMODE_KEYS (ordering between fours and overall).
src/routes/wrapped/$uuid.tsx Includes "4v4" in the modes rendered by the Wrapped streaks section.
src/routes/wrapped/-uuid.ui.test.tsx Updates Wrapped UI test fixtures to provide "4v4" streak data.
src/queries/wrapped.ts Extends Wrapped session streak types to require "4v4" entries.
src/queries/playerdata.ts Extends PIT data types and conversion to include a "4v4" stats block.
src/mocks/data.ts Updates mock PIT data and Wrapped response mocks to include "4v4" and keep overall invariants.
src/helpers/session.unit.test.ts Updates session helper fixtures to include "4v4" in PlayerDataPIT.
src/App.tsx Bumps persisted query cache buster to invalidate old cached shapes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/queries/playerdata.ts
Comment on lines 58 to 60
fours: apiPlayerData.fours,
"4v4": apiPlayerData["4v4"],
overall: apiPlayerData.overall,
Amund211 and others added 2 commits July 6, 2026 21:36
Add "4v4" to ALL_GAMEMODE_KEYS, gamemode labels, chart identity colors,
the PlayerDataPIT types/mapper, and the MSW mock data (overall mock
stays the sum of the five modes). Everything else — zod search params,
gamemode selectors, chart series, stat helpers — is data-driven off
ALL_GAMEMODE_KEYS and picks the new mode up automatically.

PlayerDataPIT changed shape, so the persisted query cache buster is
bumped to "2". The session-detail-page branch also uses "2"; it will
be rebased on top of this later.

Must not be deployed before flashlight serves the "4v4" block in its
PIT responses — parsing crashes on payloads without it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add "4v4" to both streak maps (winstreaks / finalKillStreaks) in the
wrapped query types, to the mode list rendered by the Streaks section,
and to the MSW wrapped mock and UI-test fixture.

Mirrors the existing modes' handling: the StreakInfo fields stay
non-optional in TS even though flashlight omits absent streaks on the
wire, matching how solo/doubles/threes/fours are typed today.

Requires flashlight to serve 4v4 wrapped streaks (plan step F4/F5)
before this reaches production.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Amund211 Amund211 merged commit 7e93bac into main Jul 6, 2026
8 checks passed
@Amund211 Amund211 deleted the 4v4-support branch July 6, 2026 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants