strat-gameplay-webapp/backend
Cal Corum a696473d0a CLAUDE: Integrate flyball advancement with RunnerAdvancement system
Major Phase 2 refactoring to consolidate runner advancement logic:

**Flyball System Enhancement**:
- Add FLYOUT_BQ variant (medium-shallow depth)
- 4 flyball types with clear semantics: A (deep), B (medium), BQ (medium-shallow), C (shallow)
- Updated helper methods to include FLYOUT_BQ

**RunnerAdvancement Integration**:
- Extend runner_advancement.py to handle both groundballs AND flyballs
- advance_runners() routes to _advance_runners_groundball() or _advance_runners_flyball()
- Comprehensive flyball logic with proper DECIDE mechanics per flyball type
- No-op movements recorded for state recovery consistency

**PlayResolver Refactoring**:
- Consolidate all 4 flyball outcomes to delegate to RunnerAdvancement (DRY)
- Eliminate duplicate flyball resolution code
- Rename helpers for clarity: _advance_on_single_1/_advance_on_single_2 (was _advance_on_single)
- Fix single/double advancement logic for different hit types

**State Recovery Fix**:
- Fix state_manager.py game recovery to build LineupPlayerState objects properly
- Use get_lineup_player() helper to construct from lineup data
- Correctly track runners in on_first/on_second/on_third fields (matches Phase 2 model)

**Database Support**:
- Add runner tracking fields to play data for accurate recovery
- Include batter_id, on_first_id, on_second_id, on_third_id, and *_final fields

**Type Safety Improvements**:
- Fix lineup_id access throughout runner_advancement.py (was accessing on_first directly, now on_first.lineup_id)
- Make current_batter_lineup_id non-optional (always set by _prepare_next_play)
- Add type: ignore for known SQLAlchemy false positives

**Documentation**:
- Update CLAUDE.md with comprehensive flyball documentation
- Add flyball types table, usage examples, and test coverage notes
- Document differences between groundball and flyball mechanics

**Testing**:
- Add test_flyball_advancement.py with 21 flyball tests
- Coverage: all 4 types, DECIDE scenarios, no-op movements, edge cases

🚀 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-31 17:04:23 -05:00
..
.claude CLAUDE: Refactor GameEngine to forward-looking play tracking pattern 2025-10-25 22:18:15 -05:00
app CLAUDE: Integrate flyball advancement with RunnerAdvancement system 2025-10-31 17:04:23 -05:00
scripts CLAUDE: Refactor GameEngine to forward-looking play tracking pattern 2025-10-25 22:18:15 -05:00
terminal_client CLAUDE: Implement Week 7 Task 7 - WebSocket manual outcome handlers 2025-10-30 22:51:31 -05:00
tests CLAUDE: Integrate flyball advancement with RunnerAdvancement system 2025-10-31 17:04:23 -05:00
.dockerignore CLAUDE: Initial project setup - documentation and infrastructure 2025-10-21 16:21:13 -05:00
.env.example CLAUDE: Complete Phase 1 backend infrastructure setup 2025-10-21 19:46:16 -05:00
CLAUDE.md CLAUDE: Implement Week 6 league configuration and play outcome systems 2025-10-28 22:46:12 -05:00
clean_test_data.py CLAUDE: Refactor game models and modularize terminal client 2025-10-28 14:16:38 -05:00
docker-compose.yml CLAUDE: Complete Phase 1 backend infrastructure setup 2025-10-21 19:46:16 -05:00
Dockerfile CLAUDE: Initial project setup - documentation and infrastructure 2025-10-21 16:21:13 -05:00
mypy.ini CLAUDE: Refactor GameEngine to forward-looking play tracking pattern 2025-10-25 22:18:15 -05:00
pyrightconfig.json Clean up false positive Pylance errors 2025-10-23 09:10:41 -05:00
pytest.ini CLAUDE: Complete Week 4 - State Management & Persistence 2025-10-22 12:01:03 -05:00
requirements-dev.txt CLAUDE: Complete Phase 1 backend infrastructure setup 2025-10-21 19:46:16 -05:00
requirements.txt CLAUDE: Add interactive terminal client for game engine testing 2025-10-26 12:51:01 -05:00
test_db_playground.py Add scripts to test models in dev database 2025-10-23 09:10:55 -05:00