Fix simulator correctness bugs and reduce test iteration counts #61

Merged
chrisp merged 2 commits from fix/simulator-review-cleanups into main 2026-05-31 17:39:44 +00:00

2 commits

Author SHA1 Message Date
Chris Parsons
c0f674f648 Fix darts simulator timeout and world-cup bracket edge case
All checks were successful
🚀 Deploy / 🧪 Test (pull_request) Successful in 2m26s
🚀 Deploy / ʦ TypeScript (pull_request) Successful in 1m16s
🚀 Deploy / 🔍 Lint (pull_request) Successful in 48s
🚀 Deploy / 🐳 Build (pull_request) Has been skipped
🚀 Deploy / 🚀 Deploy (pull_request) Has been skipped
- Add numSimulations constructor param to DartsSimulator (same pattern as
  WorldCupSimulator); drop default from 50k→10k; update manifest to match
- Pass 200 iterations in the slow darts column-sum test to prevent CI timeout
- Fix world-cup "SF losers" test to use 48 participants — with only 8,
  the R32 pool has 6 teams and SF never runs, leaving all placement counts
  at 0 and normalization producing probFirst=probThird=1 for one team
- Add manifest iterations: 10_000 override for darts_bracket

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 10:34:47 -07:00
Chris Parsons
c3b7c77f09 Fix simulator correctness bugs and reduce test iteration counts
Some checks failed
🚀 Deploy / 🧪 Test (pull_request) Failing after 2m31s
🚀 Deploy / ʦ TypeScript (pull_request) Successful in 1m18s
🚀 Deploy / 🔍 Lint (pull_request) Successful in 48s
🚀 Deploy / 🐳 Build (pull_request) Has been skipped
🚀 Deploy / 🚀 Deploy (pull_request) Has been skipped
- Fix EPL Elo/odds fallback to populate odds-derived Elo for teams
  missing sourceElo even when other teams have it (was silently throwing)
- Reduce WorldCupSimulator default iterations 50k→10k; test iterations
  500→100 (WorldCup) and 10k→500 (EPL) to prevent timeouts on slow CI
- Override manifest defaultConfig iterations to 10k for world_cup and
  epl_standings so production fallback matches source-level defaults
- Extract runKnockoutRound out of the 10k-iteration simulation loop
- Replace hot-loop toSorted() on 2-element arrays with a conditional
  string comparison (eliminates allocation+sort on every group pair)
- Remove local normalizeProbabilities duplicate; use shared
  normalizeSimulationResultColumns from simulation-probabilities.ts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 10:28:48 -07:00