brackt/app/services/simulations/__tests__
Chris Parsons 4a167d8cad Formalize simulator system with manifest, input-policy, runner, and admin UI
Introduces three new schema tables (simulator_profiles,
sports_season_simulator_configs, season_participant_simulator_inputs),
a central model layer (app/models/simulator.ts), and a single runner
entry point so every simulator run follows the same prepare → simulate
→ persist → snapshot → recalculate flow.

Key additions:
- manifest.ts: per-simulator display names, default configs, required/
  optional inputs, derivable-input declarations, and setup sections
- input-policy.ts: resolves sourceElo from projectedWins,
  projectedTablePoints, or sourceOdds; resolves ratings from sourceOdds;
  supports block / fallbackElo / averageKnown / worstKnownMinus strategies
- runner.ts: single entry point for admin simulation runs; materialises
  derived inputs, normalises result columns, zeroes omitted participants,
  snapshots EVs, and recalculates linked fantasy standings
- /admin/simulators: inventory page with per-season readiness and bulk run
- /admin/sports-seasons/:id/simulator: per-season setup page with readiness
  summary, input-policy editor, raw JSON config override, and CSV bulk input
- NCAAM/NCAAW simulators now read ratings from season_participant_simulator_inputs,
  falling back to the hardcoded name-keyed maps while DB data is being populated
- Clone flow copies simulator config by default; volatile inputs (odds, Elo)
  only copied when explicitly requested

Code-review fixes included in this commit:
- source field in compatibility bridge checked with !== null instead of !== undefined
- sourceEloRequirementLabel no longer appends "configured fallback" when the
  participant is already excluded from all resolved sources
- Duplicate inline label maps in input-policy.ts replaced with simulatorInputLabel
- save-config preserves existing inputPolicy when the submitted JSON omits it
- Input table truncation label added (Showing 20 of N)
- CSV description notes values must not contain commas
- N+1 comment added to listSportsSeasonSimulatorSummaries
- assertRegistrySchemaDriftFree called in manifest tests
- Runner test suite added covering happy path, already-running guard,
  readiness failure, empty results, and error recovery with status reset

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-11 21:02:56 -07:00
..
afl-simulator.test.ts Add projected-wins input mode to admin Elo Ratings page (#306) 2026-04-17 12:40:08 -07:00
brackt-simulator.test.ts Add Brackt as a league-private meta-sport (#200) (#377) 2026-05-04 20:31:44 -07:00
college-hockey-simulator.test.ts Fix college hockey bracket resolution (#396) 2026-05-08 12:29:39 -07:00
cs-major-simulator.test.ts Fix CS Major simulator bugs and accuracy issues (#276) 2026-04-07 17:28:24 -04:00
darts-simulator.test.ts Add sports season ↔ tournament linking with admin UI (#372) 2026-05-02 12:45:53 -07:00
epl-simulator.test.ts Deduplicate soccer simulator helpers (#391) 2026-05-07 11:48:57 -07:00
golf-simulator.test.ts Add golf qualifying points simulator (Plackett-Luce Monte Carlo) (#223) 2026-03-24 21:46:02 -07:00
input-policy.test.ts Formalize simulator system with manifest, input-policy, runner, and admin UI 2026-05-11 21:02:56 -07:00
llws-simulator.test.ts fix: infer LLWS bracket side from name when externalId is null (#285) 2026-04-09 09:51:16 -04:00
manifest.test.ts Formalize simulator system with manifest, input-policy, runner, and admin UI 2026-05-11 21:02:56 -07:00
mlb-simulator.test.ts Fix simulator brackets: NHL bracket-aware mode, MLB/NBA/WNBA sourceElo support (#358) 2026-04-30 08:33:57 -07:00
nba-simulator.test.ts fix: NBA play-in bracket advancement bugs (#292) 2026-04-12 22:25:32 -07:00
ncaa-football-simulator.test.ts Add NCAA Football CFP simulator (12-team bracket) (#278) 2026-04-08 09:48:32 -04:00
ncaam-simulator.test.ts Add oxlint linting setup with zero errors (#194) 2026-03-21 09:44:05 -07:00
ncaaw-simulator.test.ts Add oxlint linting setup with zero errors (#194) 2026-03-21 09:44:05 -07:00
nfl-simulator.test.ts Add NFL season + playoffs Monte Carlo simulator (#272) 2026-04-07 09:39:34 -04:00
nhl-simulator.test.ts Fix simulator brackets: NHL bracket-aware mode, MLB/NBA/WNBA sourceElo support (#358) 2026-04-30 08:33:57 -07:00
runner.test.ts Formalize simulator system with manifest, input-policy, runner, and admin UI 2026-05-11 21:02:56 -07:00
simulator-config.test.ts Fix college hockey bracket resolution (#396) 2026-05-08 12:29:39 -07:00
snooker-simulator.test.ts Add snooker bracket simulator and Elo ratings admin UI, fixes #119 2026-03-23 08:24:28 -07:00
tennis-simulator.test.ts Add MLB playoff simulator with AL/NL division standings, fixes #121 (#225) 2026-03-25 08:47:02 -07:00
ucl-simulator.test.ts Fix oxlint warnings: no-shadow, consistent-function-scoping, no-non-null-assertion, and others (#196) 2026-03-21 10:59:51 -07:00
wnba-simulator.test.ts Fix simulator brackets: NHL bracket-aware mode, MLB/NBA/WNBA sourceElo support (#358) 2026-04-30 08:33:57 -07:00
world-cup-simulator.test.ts Canonical tournament layer: schema + backfill (1/2) (#365) 2026-05-01 20:13:18 -07:00