feat(WP-13): post-game evolution callback hook (#78) #93

Merged
cal merged 3 commits from feature/wp13-postgame-hook into card-evolution 2026-03-18 21:22:11 +00:00
Owner

Closes cal/paper-dynasty-database#78

Summary

  • Hooks into complete_game() in logic_gameplay.py to fire two API calls after every game:
    1. POST season-stats/update-game/{game_id} — updates player_season_stats
    2. POST evolution/evaluate-game/{game_id} — evaluates evolution for all participating players
  • Non-blocking: wrapped in try/except so evolution failure never prevents game completion
  • Season stats updated BEFORE evolution evaluation (correct ordering)
  • notify_tier_completion stub added for WP-14 to replace
  • 5 unit tests covering endpoint ordering, non-fatal error handling, tier_up processing

Test plan

  • Hook POSTs to both endpoints in order
  • Hook is non-fatal when db_post raises
  • Hook processes tier_ups from evo result
  • No tier_ups doesn't call notify
  • notify_tier_completion stub logs without raising
Closes cal/paper-dynasty-database#78 ## Summary - Hooks into `complete_game()` in `logic_gameplay.py` to fire two API calls after every game: 1. `POST season-stats/update-game/{game_id}` — updates player_season_stats 2. `POST evolution/evaluate-game/{game_id}` — evaluates evolution for all participating players - Non-blocking: wrapped in try/except so evolution failure never prevents game completion - Season stats updated BEFORE evolution evaluation (correct ordering) - `notify_tier_completion` stub added for WP-14 to replace - 5 unit tests covering endpoint ordering, non-fatal error handling, tier_up processing ## Test plan - [x] Hook POSTs to both endpoints in order - [x] Hook is non-fatal when db_post raises - [x] Hook processes tier_ups from evo result - [x] No tier_ups doesn't call notify - [x] notify_tier_completion stub logs without raising
cal added 1 commit 2026-03-18 20:55:42 +00:00
feat: WP-13 post-game callback hook for season stats and evolution
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m22s
b4c41aa7ee
After complete_game() saves the game result and posts rewards, fire two
non-blocking API calls in order:
  1. POST season-stats/update-game/{game_id}
  2. POST evolution/evaluate-game/{game_id}

Any failure in the evolution block is caught and logged as a warning —
the game is already persisted so evolution will self-heal on the next
evaluate pass. A notify_tier_completion stub is added as a WP-14 target.

Closes #78 on cal/paper-dynasty-database

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
cal added 1 commit 2026-03-18 21:02:14 +00:00
fix: remove WP-14 files from WP-13 PR
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m20s
303b7670d7
evolution_notifs.py and test_evolution_notifications.py belong in
PR #94 (WP-14). They were accidentally captured as untracked files
by the WP-13 agent. complete_game() correctly uses the local stub.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
cal added 1 commit 2026-03-18 21:02:33 +00:00
fix: remove dead real_notify import in test
All checks were successful
Build Docker Image / build (pull_request) Successful in 52s
596a3ec414
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Claude approved these changes 2026-03-18 21:16:46 +00:00
Claude left a comment
Collaborator

LGTM — reviewed by automation.

LGTM — reviewed by automation.
cal changed target branch from main to card-evolution 2026-03-18 21:22:05 +00:00
cal merged commit 92228a21af into card-evolution 2026-03-18 21:22:11 +00:00
cal deleted branch feature/wp13-postgame-hook 2026-03-18 21:22:12 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/paper-dynasty-discord#93
No description provided.