Commit Graph

6 Commits

Author SHA1 Message Date
Cal Corum
6ad18e5314 CLAUDE: Update documentation to reflect current project status
Updated CLAUDE.md with accurate current state information:

Migration Status:
- Phase 2: Core Game Services marked as  COMPLETE
- Phase 3: Game Engine & Routes marked as 🚧 NEXT
- Updated service implementation status

Service Documentation:
- AIService: Complete (369 lines, 72% coverage, 51 tests)
- PlayerService: Complete (53 lines, 100% coverage)
- UIService: Complete (18 lines, 83% coverage)
- BaseService: Complete (19 lines, 84% coverage)
- Added detailed capability descriptions

Model Documentation:
- Updated implemented models list
- Added AI response model descriptions
- Documented relationships and functionality

Testing Documentation:
- Current coverage: 65% overall, 206 total tests
- AIService: 51 tests (22 unit + 29 integration)
- Detailed integration testing approach
- Updated test distribution across suites

Documentation now accurately reflects substantial progress made in
service implementation, model development, and comprehensive testing
infrastructure.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-29 21:35:14 -05:00
Cal Corum
7fd9079425 CLAUDE: Improve AI Service test coverage from 60% to 72% with comprehensive integration tests
Added targeted integration tests to cover previously uncovered conditional branches
and edge cases in AI decision-making logic:

- test_ai_service_focused_coverage.py: 11 tests for key missing branches
  * Steal opportunity conditions (lines 91, 93, 98-99, 108)
  * Steal to third/home scenarios (lines 129, 157, 161)
  * Defensive alignment logic (lines 438, 480)
  * Tag decision branches (lines 204, 253)

- test_ai_service_final_coverage.py: 10 tests for remaining gaps
  * Complex steal conditions (lines 95, 118-119, 132, 136-137, 141)
  * Late inning steal logic (lines 159, 163)
  * Uncapped advance bounds checking (lines 382-388)
  * Complex defensive scenarios (lines 440-449)

- test_ai_service_coverage.py: Comprehensive coverage tests (unused due to complexity)

Fixed:
- Player model relationship syntax (removed unsupported cascade_delete parameter)
- Existing test assertion in test_ai_service_simple.py for steal to home scenario

Coverage improvement: 369 statements, 147→105 missed lines (60%→72% coverage)
All 49 AI Service tests now pass with comprehensive integration testing.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-29 21:28:43 -05:00
Cal Corum
559fe73f07 CLAUDE: Complete Player model migration with service layer and integration test infrastructure
## Player Model Migration
- Migrate Player model from Discord app following Model/Service Architecture pattern
- Extract all business logic from Player model to PlayerService
- Create pure data model with PostgreSQL relationships (Cardset, PositionRating)
- Implement comprehensive PlayerFactory with specialized methods for test data

## PlayerService Implementation
- Extract 5 business logic methods from original Player model:
  - get_batter_card_url() - batting card URL retrieval
  - get_pitcher_card_url() - pitching card URL retrieval
  - generate_name_card_link() - markdown link generation
  - get_formatted_name_with_description() - name formatting
  - get_player_description() - description from object or dict
- Follow BaseService pattern with dependency injection and logging

## Comprehensive Testing
- 35 passing Player tests (14 model + 21 service tests)
- PlayerFactory with specialized methods (batting/pitching cards, positions)
- Test isolation following factory pattern and db_session guidelines
- Fix PostgreSQL integer overflow in test ID generation

## Integration Test Infrastructure
- Create integration test framework for improving service coverage
- Design AIService integration tests targeting uncovered branches
- Demonstrate real database query testing with proper isolation
- Establish patterns for testing complex game scenarios

## Service Coverage Analysis
- Current service coverage: 61% overall
- PlayerService: 100% coverage (excellent migration example)
- AIService: 60% coverage (improvement opportunities identified)
- Integration test strategy designed to achieve 90%+ coverage

## Database Integration
- Update Cardset model to include players relationship
- Update PositionRating model with proper Player foreign key
- Maintain all existing relationships and constraints
- Demonstrate data isolation and automatic cleanup in tests

## Test Suite Status
- 137 tests passing, 0 failures (maintained 100% pass rate)
- Added 35 new tests while preserving all existing functionality
- Integration test infrastructure ready for coverage improvements

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-29 16:20:29 -05:00
Cal Corum
1c24161e76 CLAUDE: Achieve 100% test pass rate with comprehensive AI service testing
- Fix TypeError in check_steal_opportunity by properly mocking catcher defense
- Correct tag_from_third test calculation to account for all adjustment conditions
- Fix pitcher replacement test by setting appropriate allowed runners threshold
- Add comprehensive test coverage for AI service business logic
- Implement VS Code testing panel configuration with pytest integration
- Create pytest.ini for consistent test execution and warning management
- Add test isolation guidelines and factory pattern implementation
- Establish 102 passing tests with zero failures

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-28 17:55:34 -05:00
Cal Corum
c09f9d1302 CLAUDE: Initialize Paper Dynasty web app with Model/Service Architecture
Establishes foundation for migrating baseball simulation from Discord bot to web application using service-oriented architecture pattern.

Key components:
- FastAPI application structure with dependency injection
- Service layer foundation with base classes and container
- Comprehensive directory documentation with README files
- PostgreSQL containerization with Docker Compose
- Testing structure for unit/integration/e2e tests
- Migration planning documentation
- Rotating log configuration per user requirements

Architecture follows Model/Service/Controller pattern to improve testability, maintainability, and scalability over original monolithic Discord app.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-27 21:44:12 -05:00
Cal Corum
a2042401a7 Initial commit 2025-09-26 13:41:33 -05:00