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> |
||
|---|---|---|
| .. | ||
| .claude | ||
| app | ||
| scripts | ||
| terminal_client | ||
| tests | ||
| .dockerignore | ||
| .env.example | ||
| .python-version | ||
| CLAUDE.md | ||
| clean_test_data.py | ||
| docker-compose.yml | ||
| Dockerfile | ||
| mypy.ini | ||
| pyproject.toml | ||
| pyrightconfig.json | ||
| pytest.ini | ||
| README.md | ||
| requirements-dev.txt | ||
| requirements.txt | ||
| test_db_playground.py | ||
| test_pd_api_live.py | ||
| test_pd_api_mock.py | ||
| test_redis_cache.py | ||
| uv.lock | ||
Paper Dynasty Backend
FastAPI-based real-time baseball game engine with WebSocket support.
Quick Start
# Install UV
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install dependencies
uv sync
# Run server
uv run python -m app.main
Documentation
See CLAUDE.md for full documentation.