paper-dynasty-database/tests
Cal Corum a2d2aa3d31 feat(WP-13): post-game callback endpoints for season stats and evolution
Implements two new API endpoints the bot calls after a game completes:

  POST /api/v2/season-stats/update-game/{game_id}
    Delegates to update_season_stats() service (WP-05). Returns
    {"updated": N, "skipped": bool} with idempotency via ProcessedGame ledger.

  POST /api/v2/evolution/evaluate-game/{game_id}
    Finds all (player_id, team_id) pairs from the game's StratPlay rows,
    calls evaluate_card() for each pair that has an EvolutionCardState,
    and returns {"evaluated": N, "tier_ups": [...]} with full tier-up detail.

New files:
  app/services/evolution_evaluator.py — evaluate_card() service (WP-08)
  tests/test_postgame_evolution.py    — 10 integration tests (all pass)

Modified files:
  app/routers_v2/season_stats.py — rewritten to delegate to the service
  app/routers_v2/evolution.py    — evaluate-game endpoint added
  app/main.py                    — season_stats router registered

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 16:05:21 -05:00
..
__init__.py feat: evolution track seed data and tests (WP-03) (#68) 2026-03-12 17:35:12 -05:00
conftest.py fix: add missing pg_conn fixture to conftest.py 2026-03-18 15:33:02 -05:00
test_evolution_evaluator.py fix: align naming between evaluator, formula engine, and DB models 2026-03-18 15:31:44 -05:00
test_evolution_init.py feat(WP-10): pack opening hook — evolution_card_state initialization 2026-03-18 13:41:05 -05:00
test_evolution_models.py feat(WP-10): pack opening hook — evolution_card_state initialization 2026-03-18 13:41:05 -05:00
test_evolution_seed.py test: add Phase 1a test suite (25 tests) 2026-03-17 19:33:49 -05:00
test_evolution_state_api.py feat(WP-07): card state API endpoints — closes #72 2026-03-18 15:33:02 -05:00
test_evolution_track_api.py feat: Track Catalog API endpoints (WP-06) (#71) 2026-03-12 20:40:38 -05:00
test_formula_engine.py fix: align tier_from_value with DB model field names (t1_threshold) 2026-03-18 15:07:07 -05:00
test_postgame_evolution.py feat(WP-13): post-game callback endpoints for season stats and evolution 2026-03-18 16:05:21 -05:00
test_season_stats_model.py refactor: deduplicate pitcher formula and test constants 2026-03-17 09:49:33 -05:00
test_season_stats_update.py feat: add ProcessedGame ledger for full idempotency in update_season_stats() (#105) 2026-03-18 01:05:31 -05:00