strat-gameplay-webapp/backend/app
Cal Corum dd1b087af1 CLAUDE: Fix double play bug after state recovery
Critical bug fix for issue where Groundball A with runner on first would
fail to execute a double play after game recovery from database.

Root cause: current_on_base_code field was not recalculated during state
recovery, defaulting to 0 (empty bases) even when runners were on base.
This caused runner advancement logic to select Result 1 (batter out,
runners hold) instead of Result 2 (double play).

Changes:
- Added calculate_on_base_code() helper method to GameState model
- Updated _prepare_next_play() to use helper (eliminates duplication)
- Fixed state recovery to calculate current_on_base_code from runners
- Fixed X-Check G1 mapping (was GROUNDBALL_B, should be GROUNDBALL_A)
- Added 5 regression tests to prevent recurrence

Testing:
- All 359 unit tests passing
- New regression tests verify fix and demonstrate bug scenario
- Tested in network dev environment - double plays now work correctly

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-07 13:55:10 -06:00
..
api CLAUDE: Add validation to prevent null team metadata in game creation 2026-01-24 18:19:15 -06:00
config CLAUDE: Replace black and flake8 with ruff for formatting and linting 2025-11-20 15:33:21 -06:00
core CLAUDE: Fix double play bug after state recovery 2026-02-07 13:55:10 -06:00
data CLAUDE: Refactor ManualOutcomeSubmission to use PlayOutcome enum + comprehensive documentation 2025-10-31 16:03:54 -05:00
database CLAUDE: Complete in-game UI overhaul with player cards and outcome wizard 2026-01-23 15:23:38 -06:00
middleware CLAUDE: Add rate limiting, pool monitoring, and exception infrastructure 2025-11-28 12:06:10 -06:00
models CLAUDE: Fix double play bug after state recovery 2026-02-07 13:55:10 -06:00
monitoring CLAUDE: Add rate limiting, pool monitoring, and exception infrastructure 2025-11-28 12:06:10 -06:00
services CLAUDE: Add validation to prevent null team metadata in game creation 2026-01-24 18:19:15 -06:00
utils CLAUDE: Add native development workflow for instant startup and hot-reload 2026-02-06 17:56:56 -06:00
websocket CLAUDE: Redesign dice display with team colors and consolidate player cards 2026-01-24 00:16:32 -06:00
__init__.py CLAUDE: Complete Phase 1 backend infrastructure setup 2025-10-21 19:46:16 -05:00
config.py CLAUDE: Add team ownership to auth flow (CRIT-002) 2026-01-13 20:28:08 -06:00
main.py CLAUDE: Add SBA schedule integration with weekly matchup display 2026-01-14 23:39:31 -06:00