brackt/app/routes/api
Chris Parsons f33e39264d
fix: harden draft timer system with race-condition safety and DRY refactor (#34)
- Fix settings action silently resetting timer values when draft speed
  select is disabled (add null guard before overwriting draftInitialTime/
  draftIncrementTime)
- Make timer decrement and pick increment atomic using SQL expressions to
  prevent read-modify-write races between the timer loop and HTTP handlers
- Add UNIQUE INDEX on (season_id, pick_number) in draft_picks to prevent
  duplicate picks from concurrent requests (TOCTOU guard)
- Add socket join-draft team ownership validation via DB query
- Add iteration cap to autodraft chain while loop (max = totalTeams)
- Add draftPaused re-check before firing autodraft chain in make-pick
  and force-manual-pick
- Consolidate all snake draft calculations into calculatePickInfo (DRY);
  remove duplicated logic from timer.ts, make-pick, force-manual-pick,
  executeAutoPick, and checkAndTriggerNextAutodraft
- Fix calculatePickInfo to return snake-adjusted pickInRound matching
  draftOrder values instead of raw pre-snake value
- Fix timer-update socket events to emit nextPickNumber after a pick
  instead of the already-completed currentPickNumber
- Fix force-manual-pick to validate submitted teamId matches the team
  whose turn it actually is at the given pick number
- Replace inline timer init in draft.start with deleteSeasonTimers +
  initializeDraftTimers model functions (dead code fix)
- Fix draft loader to not crash when getTeamQueue fails (returns [])
- Fix misleading 403 message for commissioner picks
- Remove dead hidden inputs from league settings form
- Document connectedTeams single-instance limitation in socket.ts

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-23 23:23:24 -08:00
..
__tests__ fix: harden draft timer system with race-condition safety and DRY refactor (#34) 2026-02-23 23:23:24 -08:00
webhooks refactor: simplify user update logic in Clerk webhook handler to reuse findOrCreateUser 2025-10-14 21:50:07 -07:00
autodraft.update.ts Claude/fix pick timer ghll n (#29) 2026-02-22 19:29:29 -08:00
draft.adjust-time-bank.ts Claude/fix pick timer ghll n (#29) 2026-02-22 19:29:29 -08:00
draft.force-autopick.ts Claude/fix pick timer ghll n (#29) 2026-02-22 19:29:29 -08:00
draft.force-manual-pick.ts fix: harden draft timer system with race-condition safety and DRY refactor (#34) 2026-02-23 23:23:24 -08:00
draft.make-pick.ts fix: harden draft timer system with race-condition safety and DRY refactor (#34) 2026-02-23 23:23:24 -08:00
draft.pause.ts Claude/fix pick timer ghll n (#29) 2026-02-22 19:29:29 -08:00
draft.replace-pick.ts Claude/fix pick timer ghll n (#29) 2026-02-22 19:29:29 -08:00
draft.resume.ts Claude/fix pick timer ghll n (#29) 2026-02-22 19:29:29 -08:00
draft.rollback.ts Claude/fix pick timer ghll n (#29) 2026-02-22 19:29:29 -08:00
draft.start.ts fix: harden draft timer system with race-condition safety and DRY refactor (#34) 2026-02-23 23:23:24 -08:00
queue.add.ts Claude/fix pick timer ghll n (#29) 2026-02-22 19:29:29 -08:00
queue.clear.ts Claude/fix pick timer ghll n (#29) 2026-02-22 19:29:29 -08:00
queue.remove.ts Claude/fix pick timer ghll n (#29) 2026-02-22 19:29:29 -08:00
queue.reorder.ts Claude/fix pick timer ghll n (#29) 2026-02-22 19:29:29 -08:00