brackt/app/services/simulations
Claude d83f6976bf
All checks were successful
🚀 Deploy / 🧪 Test (pull_request) Successful in 3m14s
🚀 Deploy / ʦ🔍 Typecheck & Lint (pull_request) Successful in 1m18s
🚀 Deploy / 🐳 Build (pull_request) Has been skipped
🚀 Deploy / 🚀 Deploy (pull_request) Has been skipped
Stop the simulator re-run from trampling its caller's side effects
A review of this branch found four problems, all downstream of one decision:
calling runSportsSeasonSimulation from inside the result path. That function
does three jobs — recompute probabilities, recalculate standings, write the
daily EV snapshot — and the result path wants only the first.

1. The Discord standings post was silently suppressed on every scored match,
   for all 13 bracket-aware sports.

   recalculateAffectedLeagues detects change by snapshotting teamStandings,
   recalculating, then diffing; changedTeamIds gates the notification. But
   processMatchResult runs updateProbabilitiesAfterResult first, which now
   reached the runner's own recalculateStandings. The new totals were therefore
   already written when the "before" snapshot was taken, the diff came back
   empty, and the post never fired. previousRank went the same way:
   recalculateStandings rolls it forward on every call, so the extra one erased
   rank movement.

   runSportsSeasonSimulation now takes skipStandingsRecalc / skipSnapshots and
   the probability updater passes both. The snapshot is skipped because it is a
   per-day series keyed by snapshotDate — writing it per match result just
   overwrites the day's row with intra-day values.

2. finalizeQualifyingPoints marks the season completed immediately before
   calling the updater, and the runner rejects a completed season outright. With
   the ICM fallback gone that failed every time, stranding anyone still in the
   unfinished set on permanently stale probabilities — reachable for
   cs2_major_qualifying_points, the one bracket-aware qualifying-points sport.

   A completed season is not this branch's case rather than a failure: every
   placement is final and the floor it protects can no longer be contradicted.
   shouldRerunSimulator now excludes it and it falls through to ICM as before.
   The genuine failure modes still leave probabilities alone rather than falling
   back to the path being replaced.

3. match-sync calls processMatchResult in a per-match loop with no
   skipSideEffects, so each synced match ran a full Monte Carlo plus EV rewrite,
   snapshot and standings recalc. processMatchResult gains skipProbabilities —
   mirroring the option processPlayoffEvent already takes, and narrower than
   skipSideEffects — which match-sync passes in the loop before refreshing once
   at the end. Per-match standings and Discord posts are unchanged.

4. A partially-seeded afl_10 bracket now throws from inside the result path.
   The throw is correct and stays; the concern was that it was silent, which the
   error surfacing in 2 covers.

Two claims from the review did not hold up and were left alone: the batch
bracket route already passes skipSideEffects per match and refreshes once after
the loop, and autoCompleteRoundIfDone already passes skipProbabilities, so there
is no double run per round completion.

Tests: the runner honors both skip flags and still writes EVs; the updater asks
for probabilities only; a completed season takes the ICM path without erroring;
processMatchResult skips the refresh but still announces. The two behavioral
ones were confirmed to fail against the previous behavior.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VPxDnSEKVoKx9HFcQ6gmcS
2026-08-29 03:46:12 +00:00
..
__tests__ Stop the simulator re-run from trampling its caller's side effects 2026-08-29 03:46:12 +00:00
afl-simulator.ts Make the AFL simulator read the bracket that was actually drawn 2026-08-29 02:42:31 +00:00
auto-racing-simulator.ts claude/indycar-ev-sims-probability-fpzfx6 (#139) 2026-08-17 22:50:35 +00:00
bracket-simulator.ts Canonical tournament layer: schema + backfill (1/2) (#365) 2026-05-01 20:13:18 -07:00
brackt-simulator.ts Add Brackt as a league-private meta-sport (#200) (#377) 2026-05-04 20:31:44 -07:00
college-hockey-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
config-access.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
cs-major-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
darts-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
epl-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
golf-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
input-policy.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
llws-simulator.ts Address review findings in LLWS simulator 2026-08-21 22:08:04 +00:00
manifest.ts Route every bracket-aware sport away from ICM, not just AFL 2026-08-29 02:49:17 +00:00
mlb-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
mls-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
nba-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
ncaa-basketball-simulator.ts Upgrade NCAA preseason simulators (#419) 2026-05-12 22:26:25 -07:00
ncaa-football-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
ncaam-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
ncaaw-simulator.ts Fix NCAAW futures odds simulation and admin import UX (#420) 2026-05-13 01:06:16 -07:00
nfl-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
nhl-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
nll-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
race-points.ts claude/indycar-ev-sims-probability-fpzfx6 (#139) 2026-08-17 22:50:35 +00:00
registry.ts Make LLWS simulator bracket-aware and calibrate its futures model 2026-08-21 21:09:47 +00:00
runner.ts Stop the simulator re-run from trampling its caller's side effects 2026-08-29 03:46:12 +00:00
shared-major.ts Unify majors: score once, fan out across windows + tennis bracket EV 2026-06-22 20:32:22 -07:00
simulation-probabilities.ts Deduplicate soccer simulator helpers (#391) 2026-05-07 11:48:57 -07:00
simulator-config.ts Add MLS sport simulator (mls_bracket) (#422) 2026-05-14 12:45:53 -07:00
snooker-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
soccer-helpers.ts Deduplicate soccer simulator helpers (#391) 2026-05-07 11:48:57 -07:00
tennis-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
types.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
ucl-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
wnba-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
world-cup-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00