brackt/app/services/simulations
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
..
__tests__ Formalize simulator system with manifest, input-policy, runner, and admin UI 2026-05-11 21:02:56 -07:00
afl-simulator.ts Deduplicate soccer simulator helpers (#391) 2026-05-07 11:48:57 -07:00
auto-racing-simulator.ts Canonical tournament layer: schema + backfill (1/2) (#365) 2026-05-01 20:13:18 -07: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 Fix college hockey bracket resolution (#396) 2026-05-08 12:29:39 -07:00
cs-major-simulator.ts Canonical tournament layer: schema + backfill (1/2) (#365) 2026-05-01 20:13:18 -07:00
darts-simulator.ts Canonical tournament layer: schema + backfill (1/2) (#365) 2026-05-01 20:13:18 -07:00
epl-simulator.ts Deduplicate soccer simulator helpers (#391) 2026-05-07 11:48:57 -07:00
golf-simulator.ts Canonical tournament layer: schema + backfill (1/2) (#365) 2026-05-01 20:13:18 -07:00
input-policy.ts Formalize simulator system with manifest, input-policy, runner, and admin UI 2026-05-11 21:02:56 -07:00
llws-simulator.ts Canonical tournament layer: schema + backfill (1/2) (#365) 2026-05-01 20:13:18 -07:00
manifest.ts Formalize simulator system with manifest, input-policy, runner, and admin UI 2026-05-11 21:02:56 -07:00
mlb-simulator.ts Canonical tournament layer: schema + backfill (1/2) (#365) 2026-05-01 20:13:18 -07:00
nba-simulator.ts Canonical tournament layer: schema + backfill (1/2) (#365) 2026-05-01 20:13:18 -07:00
ncaa-football-simulator.ts Canonical tournament layer: schema + backfill (1/2) (#365) 2026-05-01 20:13:18 -07:00
ncaam-simulator.ts Formalize simulator system with manifest, input-policy, runner, and admin UI 2026-05-11 21:02:56 -07:00
ncaaw-simulator.ts Formalize simulator system with manifest, input-policy, runner, and admin UI 2026-05-11 21:02:56 -07:00
nfl-simulator.ts Canonical tournament layer: schema + backfill (1/2) (#365) 2026-05-01 20:13:18 -07:00
nhl-simulator.ts Canonical tournament layer: schema + backfill (1/2) (#365) 2026-05-01 20:13:18 -07:00
registry.ts Fix college hockey bracket resolution (#396) 2026-05-08 12:29:39 -07:00
runner.ts Formalize simulator system with manifest, input-policy, runner, and admin UI 2026-05-11 21:02:56 -07:00
simulation-probabilities.ts Deduplicate soccer simulator helpers (#391) 2026-05-07 11:48:57 -07:00
simulator-config.ts Fix college hockey bracket resolution (#396) 2026-05-08 12:29:39 -07:00
snooker-simulator.ts Canonical tournament layer: schema + backfill (1/2) (#365) 2026-05-01 20:13:18 -07:00
soccer-helpers.ts Deduplicate soccer simulator helpers (#391) 2026-05-07 11:48:57 -07:00
tennis-simulator.ts Canonical tournament layer: schema + backfill (1/2) (#365) 2026-05-01 20:13:18 -07:00
types.ts User/chris/ev f1 framework (#93) 2026-03-09 15:34:31 -07:00
ucl-simulator.ts Canonical tournament layer: schema + backfill (1/2) (#365) 2026-05-01 20:13:18 -07:00
wnba-simulator.ts Canonical tournament layer: schema + backfill (1/2) (#365) 2026-05-01 20:13:18 -07:00
world-cup-simulator.ts Deduplicate soccer simulator helpers (#391) 2026-05-07 11:48:57 -07:00