Card Evolution Phase 1: card-evolution → next-release #110
No reviewers
Labels
No Label
ai-changes-requested
ai-failed
ai-merged
ai-pr-opened
ai-reviewed
ai-reviewing
ai-reviewing
ai-working
bug
enhancement
evolution
performance
phase-0
phase-1a
phase-1b
phase-1c
phase-1d
security
tech-debt
todo
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/paper-dynasty-database#110
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "card-evolution"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Merges the complete Card Evolution Phase 1 (Phases 1a + 1b + 1c) into next-release for dev Docker deployment.
Phase 1a — Schema & Data Foundation
Phase 1b — API & Evaluation Engine
Phase 1c — Post-Game Callback
Add two endpoints for reading EvolutionCardState: GET /api/v2/teams/{team_id}/evolutions - Optional filters: card_type, tier - Pagination: page / per_page (default 10, max 100) - Joins EvolutionTrack so card_type filter is a single query - Returns {count, items} with full card state + threshold context GET /api/v2/evolution/cards/{card_id} - Resolves card_id -> (player_id, team_id) via Card table - Duplicate cards for same player+team share one state row - Returns 404 when card missing or has no evolution state Both endpoints: - Require bearer token auth (valid_token dependency) - Embed the EvolutionTrack in each item (not just the FK id) - Compute next_threshold: threshold for tier above current (null at T4) - Share _build_card_state_response() helper in evolution.py Also cleans up 30 pre-existing ruff violations in teams.py that were blocking the pre-commit hook: F541 bare f-strings, E712 boolean comparisons (now noqa where Peewee ORM requires == False/True), and F841 unused variable assignments. Tests: tests/test_evolution_state_api.py — 10 integration tests that skip automatically without POSTGRES_HOST, following the same pattern as test_evolution_track_api.py. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>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>