beb939b32a
5 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
beb939b32a |
CLAUDE: Fix all unit test failures and implement 100% test requirement
Test Fixes (609/609 passing): - Fixed DiceSystem API to accept team_id/player_id parameters for audit trails - Fixed dice roll history timing issue in test - Fixed terminal client mock to match resolve_play signature (X-Check params) - Fixed result chart test mocks with missing pitching fields - Fixed flaky test by using groundball_a (exists in both batting/pitching) Documentation Updates: - Added Testing Policy section to backend/CLAUDE.md - Added Testing Policy section to tests/CLAUDE.md - Documented 100% unit test requirement before commits - Added git hook setup instructions Git Hook System: - Created .git-hooks/pre-commit script (enforces 100% test pass) - Created .git-hooks/install-hooks.sh (easy installation) - Created .git-hooks/README.md (hook documentation) - Hook automatically runs all unit tests before each commit - Blocks commits if any test fails All 609 unit tests now passing (100%) Integration tests have known asyncpg connection issues (documented) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
bb78de2b84 |
CLAUDE: Add X-Check testing to resolve_with command
Added ability to test X-Check defensive plays directly in the terminal client using the resolve_with command. This allows testing the complete X-Check resolution system (defense tables, error charts, runner advancement) with actual player ratings. Changes: - repl.py: Updated do_resolve_with() to parse "x-check <position>" syntax - Accepts "x-check", "xcheck", or "x_check" followed by position - Validates position (P, C, 1B, 2B, 3B, SS, LF, CF, RF) - Passes xcheck_position parameter through to commands - commands.py: Updated resolve_play() to accept xcheck_position parameter - Passes xcheck_position to game_engine.resolve_play() - Shows "🎯 Forcing X-Check to: <position>" message - game_engine.py: Updated resolve_play() to accept xcheck_position parameter - For X_CHECK outcomes, uses xcheck_position as hit_location - Enables full X-Check resolution with defense tables and error charts - help_text.py: Updated resolve_with help documentation - Added x-check usage syntax and examples - Documented position parameter requirement - Added note about using actual player ratings Usage: ⚾ > defensive ⚾ > offensive ⚾ > resolve_with x-check SS # Test X-Check to shortstop ⚾ > resolve_with x-check LF # Test X-Check to left field This integrates the existing play_resolver._resolve_x_check() logic, providing a way to test the complete X-Check system including defense range adjustments, table lookups, SPD tests, G2#/G3# conversion, error charts, and runner advancement. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
8fb740fe3e |
CLAUDE: Add X-Check commands to terminal client help system
Added documentation for 8 X-Check testing and gameplay commands that were implemented but missing from the help system: X-Check Testing Commands: - roll_jump: Roll jump dice for stolen base testing - test_jump: Test jump roll distribution statistics - roll_fielding: Roll fielding check dice for X-Check defensive plays - test_fielding: Test fielding roll distribution Testing & Development: - test_location: Test hit location distribution - rollback: Roll back the last N plays Interrupt Plays: - force_wild_pitch: Force a wild pitch interrupt play - force_passed_ball: Force a passed ball interrupt play Changes: - help_text.py: Added new command categories to show_command_list() - "X-Check Testing" section with 4 dice testing commands - "Interrupt Plays" section with 2 force commands - Moved test_location and rollback to "Testing & Development" - help_text.py: Added detailed HELP_DATA entries for all 8 commands - Complete usage, options, examples, and notes for each - Includes dice component explanations and expected distributions Users can now run 'help' to see all commands or 'help <command>' for detailed information about X-Check testing features. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
d7caa75310 |
CLAUDE: Add manual outcome testing to terminal client and Phase 3 planning
Terminal Client Enhancements: - Added list_outcomes command to display all PlayOutcome values - Added resolve_with <outcome> command for testing specific scenarios - TAB completion for all outcome names - Full help documentation and examples - Infrastructure ready for Week 7 integration Files Modified: - terminal_client/commands.py - list_outcomes() and forced outcome support - terminal_client/repl.py - do_list_outcomes() and do_resolve_with() commands - terminal_client/completions.py - VALID_OUTCOMES and complete_resolve_with() - terminal_client/help_text.py - Help entries for new commands Phase 3 Planning: - Created comprehensive Week 7 implementation plan (25 pages) - 6 major tasks covering strategic decisions and result charts - Updated 00-index.md to mark Week 6 as 100% complete - Documented manual outcome testing feature Week 6: 100% Complete ✅ Phase 3 Week 7: Ready to begin 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
1c32787195 |
CLAUDE: Refactor game models and modularize terminal client
This commit includes cleanup from model refactoring and terminal client
modularization for better code organization and maintainability.
## Game Models Refactor
**Removed RunnerState class:**
- Eliminated separate RunnerState model (was redundant)
- Replaced runners: List[RunnerState] with direct base references:
- on_first: Optional[LineupPlayerState]
- on_second: Optional[LineupPlayerState]
- on_third: Optional[LineupPlayerState]
- Updated helper methods:
- get_runner_at_base() now returns LineupPlayerState directly
- get_all_runners() returns List[Tuple[int, LineupPlayerState]]
- is_runner_on_X() simplified to direct None checks
**Benefits:**
- Matches database structure (plays table has on_first_id, etc.)
- Simpler state management (direct references vs list management)
- Better type safety (LineupPlayerState vs generic runner)
- Easier to work with in game engine logic
**Updated files:**
- app/models/game_models.py - Removed RunnerState, updated GameState
- app/core/play_resolver.py - Use get_all_runners() instead of state.runners
- app/core/validators.py - Updated runner access patterns
- tests/unit/models/test_game_models.py - Updated test assertions
- tests/unit/core/test_play_resolver.py - Updated test data
- tests/unit/core/test_validators.py - Updated test data
## Terminal Client Refactor
**Modularization (DRY principle):**
Created separate modules for better code organization:
1. **terminal_client/commands.py** (10,243 bytes)
- Shared command functions for game operations
- Used by both CLI (main.py) and REPL (repl.py)
- Functions: submit_defensive_decision, submit_offensive_decision,
resolve_play, quick_play_sequence
- Single source of truth for command logic
2. **terminal_client/arg_parser.py** (7,280 bytes)
- Centralized argument parsing and validation
- Handles defensive/offensive decision arguments
- Validates formats (alignment, depths, hold runners, steal attempts)
3. **terminal_client/completions.py** (10,357 bytes)
- TAB completion support for REPL mode
- Command completions, option completions, dynamic completions
- Game ID completions, defensive/offensive option suggestions
4. **terminal_client/help_text.py** (10,839 bytes)
- Centralized help text and command documentation
- Detailed command descriptions
- Usage examples for all commands
**Updated main modules:**
- terminal_client/main.py - Simplified by using shared commands module
- terminal_client/repl.py - Cleaner with shared functions and completions
**Benefits:**
- DRY: Behavior consistent between CLI and REPL modes
- Maintainability: Changes in one place affect both interfaces
- Testability: Can test commands module independently
- Organization: Clear separation of concerns
## Documentation
**New files:**
- app/models/visual_model_relationships.md
- Visual documentation of model relationships
- Helps understand data flow between models
- terminal_client/update_docs/ (6 phase documentation files)
- Phased documentation for terminal client evolution
- Historical context for implementation decisions
## Tests
**New test files:**
- tests/unit/terminal_client/__init__.py
- tests/unit/terminal_client/test_arg_parser.py
- tests/unit/terminal_client/test_commands.py
- tests/unit/terminal_client/test_completions.py
- tests/unit/terminal_client/test_help_text.py
**Updated tests:**
- Integration tests updated for new runner model
- Unit tests updated for model changes
- All tests passing with new structure
## Summary
- ✅ Simplified game state model (removed RunnerState)
- ✅ Better alignment with database structure
- ✅ Modularized terminal client (DRY principle)
- ✅ Shared command logic between CLI and REPL
- ✅ Comprehensive test coverage
- ✅ Improved documentation
Total changes: 26 files modified/created
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|