Fixed state_manager._rebuild_state_from_data to provide required current_batter field when recovering games from database. The GameState model now requires current_batter as a LineupPlayerState object, but recovery was not populating this field, causing validation errors. Changes: - state_manager.py: Create placeholder current_batter during recovery - Build LineupPlayerState from first active batter (batting_order=1) - Fallback to first available lineup if no #1 batter found - Raise error if no lineups exist (invalid game state) - _prepare_next_play() will correct the batter after recovery - Moved get_lineup_player helper to top of method (removed duplicate) - tests/unit/core/test_state_manager.py: Update test to use new structure - test_update_state_nonexistent_raises_error: Create LineupPlayerState instead of using old current_batter_lineup_id field All 26 state_manager unit tests passing. Game recovery now works correctly in terminal client - fixes "current_batter Field required" validation error when running status command on recovered games. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| api | ||
| config | ||
| core | ||
| data | ||
| database | ||
| models | ||
| services | ||
| utils | ||
| websocket | ||
| __init__.py | ||
| config.py | ||
| main.py | ||