Add complete CS2 event reset to clear orphaned results/QP #102

Merged
chrisp merged 1 commit from fix/cs2-complete-event-reset into main 2026-06-20 05:33:17 +00:00
Owner

Problem

The CS2 Major EV simulation showed no change after the last commit's bracket-conditioning work, for IEM Cologne 2026. Root cause:

  • The Champions Stage bracket (playoff_matches) seeds QF1 with "Team Spirit", but the stage assignments (cs2_major_stage_results) list the different participant "Spirit Academy" as the advancing team.
  • The realBracket gate in cs-major-simulator.ts is all-or-nothing: one out-of-field QF participant makes it reject the entire bracket (including the 3 valid completed QFs), so the stage falls back to Elo seeding → EV unchanged.
  • The phantom "Spirit Academy" also left a stray event_results row (33 rows for 32 teams) plus a cached QP total.

The existing "Reset all" button only cleared cs2_major_stage_results, so re-entering with the correct team couldn't remove the phantom result or its cached QP.

Change

  • resetCs2Event (new) clears stage assignments and the event's event_results, then recomputes the affected participants' cached QP totals — all inside one transaction so a mid-operation failure can't leave the event torn (assignments gone but stale QP surviving in standings).
  • Deliberately preserves the Champions Stage bracket (playoff_matches) so re-entry realigns the stage data to it.
  • The reset button now confirms and states it also clears recorded results/QP.

Recovery (operational, after merge)

Reset the event → re-enter stage assignments using "Team Spirit" → re-process the bracket to restore real placements → re-run the EV sim (bracket now drives it).

Tests

  • resetCs2Event: clears both tables inside the transaction and recomputes each distinct participant once; no-op recompute when there are no results.
  • Simulator regression: pins that a single out-of-field QF participant disables the whole bracket (documents the failure mode).
  • Full model suite (682 tests) + typecheck green.

🤖 Generated with Claude Code

## Problem The CS2 Major EV simulation showed **no change** after the last commit's bracket-conditioning work, for **IEM Cologne 2026**. Root cause: - The Champions Stage bracket (`playoff_matches`) seeds QF1 with **"Team Spirit"**, but the stage assignments (`cs2_major_stage_results`) list the *different* participant **"Spirit Academy"** as the advancing team. - The `realBracket` gate in `cs-major-simulator.ts` is all-or-nothing: one out-of-field QF participant makes it reject the **entire** bracket (including the 3 valid completed QFs), so the stage falls back to Elo seeding → EV unchanged. - The phantom "Spirit Academy" also left a stray `event_results` row (33 rows for 32 teams) plus a cached QP total. The existing **"Reset all"** button only cleared `cs2_major_stage_results`, so re-entering with the correct team couldn't remove the phantom result or its cached QP. ## Change - **`resetCs2Event`** (new) clears stage assignments **and** the event's `event_results`, then recomputes the affected participants' cached QP totals — all inside **one transaction** so a mid-operation failure can't leave the event torn (assignments gone but stale QP surviving in standings). - Deliberately **preserves** the Champions Stage bracket (`playoff_matches`) so re-entry realigns the stage data to it. - The reset button now confirms and states it also clears recorded results/QP. ## Recovery (operational, after merge) Reset the event → re-enter stage assignments using **"Team Spirit"** → re-process the bracket to restore real placements → re-run the EV sim (bracket now drives it). ## Tests - `resetCs2Event`: clears both tables inside the transaction and recomputes each distinct participant once; no-op recompute when there are no results. - Simulator regression: pins that a single out-of-field QF participant disables the whole bracket (documents the failure mode). - Full model suite (682 tests) + typecheck green. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
chrisp added 1 commit 2026-06-20 05:22:41 +00:00
Add complete CS2 event reset to clear orphaned results/QP
All checks were successful
🚀 Deploy / 🧪 Test (pull_request) Successful in 3m14s
🚀 Deploy / ʦ🔍 Typecheck & Lint (pull_request) Successful in 1m41s
🚀 Deploy / 🐳 Build (pull_request) Has been skipped
🚀 Deploy / 🚀 Deploy (pull_request) Has been skipped
dfbcb7d953
The CS2 Major EV simulation silently discarded the Champions Stage
bracket for IEM Cologne 2026: the bracket seeded "Team Spirit" in QF1
while the stage assignments listed the (different) "Spirit Academy", so
the realBracket gate found an out-of-field participant and rejected the
whole bracket. The phantom "Spirit Academy" also left a stray
event_results row (33 rows for 32 teams).

The existing "Reset all" button only cleared cs2_major_stage_results, so
re-entering couldn't remove the phantom result or its cached QP total.

Add resetCs2Event, which also deletes the event's event_results and
recomputes the affected participants' cached QP totals — all inside a
single transaction so a mid-operation failure can't leave the event in a
torn state. It deliberately preserves the Champions Stage bracket so
re-entry realigns the stage data to it. The reset button now confirms
and states that results/QP are cleared too.

Tests: resetCs2Event clear+recompute behavior, and a simulator
regression pinning that one out-of-field QF participant disables the
whole bracket.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
chrisp merged commit 4a5ea6fdc5 into main 2026-06-20 05:33:17 +00:00
chrisp deleted branch fix/cs2-complete-event-reset 2026-06-20 05:33:17 +00:00
Sign in to join this conversation.
No description provided.