paper-dynasty-database/app/services
Cal Corum 6a176af7da feat: Refractor Phase 2 integration — wire boost into evaluate-game
When a card reaches a new Refractor tier during game evaluation, the
system now creates a boosted variant card with modified ratings. This
connects the Phase 2 Foundation pure functions (PR #176) to the live
evaluate-game endpoint.

Key changes:
- evaluate_card() gains dry_run parameter so apply_tier_boost() is the
  sole writer of current_tier, ensuring atomicity with variant creation
- apply_tier_boost() orchestrates the full boost flow: source card
  lookup, boost application, variant card + ratings creation, audit
  record, and atomic state mutations inside db.atomic()
- evaluate_game() calls evaluate_card(dry_run=True) then loops through
  intermediate tiers on tier-up, with error isolation per player
- Display stat helpers compute fresh avg/obp/slg for variant cards
- REFRACTOR_BOOST_ENABLED env var provides a kill switch
- 51 new tests: unit tests for display stats, integration tests for
  orchestration, HTTP endpoint tests for multi-tier jumps, pitcher
  path, kill switch, atomicity, idempotency, and cross-player isolation
- Clarified all "79-sum" references to note the 108-total card invariant

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 13:04:52 -05:00
..
__init__.py feat: formula engine for evolution value computation (WP-09) 2026-03-12 19:34:40 -05:00
formula_engine.py refactor: rename evolution system to refractor 2026-03-23 13:31:55 -05:00
refractor_boost.py feat: Refractor Phase 2 integration — wire boost into evaluate-game 2026-03-30 13:04:52 -05:00
refractor_evaluator.py feat: Refractor Phase 2 integration — wire boost into evaluate-game 2026-03-30 13:04:52 -05:00
refractor_init.py fix: complete remaining evolution→refractor renames from review 2026-03-23 14:17:03 -05:00
season_stats.py fix: add pitcher_id null guard in _get_player_pairs 2026-03-23 12:50:16 -05:00