fix: update evolution/cards endpoint to refractor/cards (#113) #114
No reviewers
Labels
No Label
ai-changes-requested
ai-failed
ai-pr-opened
ai-reviewed
ai-reviewing
ai-working
ai-working
bug
enhancement
feature
in-queue
performance
security
tech-debt
todo
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/paper-dynasty-discord#114
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "issue/113-update-evolution-cards-endpoint-to-refractor-cards"
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?
Closes #113
Summary
Updates the API endpoint in
get_card_embeds()fromevolution/cards/{card_id}torefractor/cards/{card_id}to match the database API rename.Changes
helpers/main.pyline 118:evolution/cards/{card['id']}→refractor/cards/{card['id']}Notes
The existing
try/exceptfallback means card display won't hard-break if the endpoint is temporarily unavailable — badges will simply not appear. This PR should be merged after confirming the/refractor/cards/endpoint is live on prod (pddev.manticorum.com/pd.manticorum.com).Tests
No test suite changes required — single string constant change. Ruff lint passed.
AI Code Review
Files Reviewed
helpers/main.py(modified)tests/test_card_embed_refractor.py(not in diff — reviewed for breakage)Findings
Correctness
Blocking: stale endpoint string in test mocks
tests/test_card_embed_refractor.pywas not included in this PR, but the production change breaks it. The mock routing in_patch_db_getstill checks for the old endpoint:After this PR merges,
get_card_embeds()callsdb_get(f"refractor/cards/{card['id']}"). The mock never matches that string, falls through toreturn None, andevo_stateis alwaysNone— meaning all badge-presence assertions fail silently:test_tier_one_badge— expects[BC] Mike Trout, getsMike Trouttest_tier_two_badge— expects[R] Mike Trout, getsMike Trouttest_tier_three_badge— expects[GR] Mike Trout, getsMike Trouttest_tier_four_superfractor_badge— expects[SF] Mike Trout, getsMike Trouttest_badge_prepended_to_player_name— expects[R]prefix, gets nonetest_fully_evolved_badge— expects[SF]prefix, gets noneThe PR body states "No test suite changes required — single string constant change." This is incorrect; the mock strings are also constants tied to the endpoint.
Fix: Update both occurrences in
tests/test_card_embed_refractor.py:Security
No issues found. The endpoint path contains only
card['id']which is an API-sourced integer, not user input.Style & Conventions
No issues found. The change follows the existing
db_get(f"<path>/<id>")pattern.Suggestions
/refractor/cards/is live on prod. Worth confirming this before merging, as thetry/exceptsilently suppresses the badge rather than surfacing a deployment mismatch.Verdict: REQUEST_CHANGES
The production change is correct, but the test mock strings must be updated in the same PR. Without the fix, the test suite gives false confidence — all badge tests pass (because
evo_state=Nonetriggers the no-badge fallback) while the badge rendering is broken.Automated review by Claude PR Reviewer (posted as COMMENT — Gitea blocks self-review)
Addressed review feedback (commit
a4a3fbd):Fixed: Updated both stale
"evolution/cards/"mock routing strings intests/test_card_embed_refractor.pyto"refractor/cards/":_patch_db_getside effect) — was falling through toreturn None, makingevo_statealwaysNoneand all badge-presence tests pass vacuously_failing_db_get) — same issue, ConnectionError was never raised for the new endpointThe production change in
helpers/main.pyand both test mock strings are now consistent onrefractor/cards/.Review: APPROVED
Previous blocking issue resolved. Ready to merge.
What Changed Since Last Review
The blocking issue from the prior review has been fixed:
tests/test_card_embed_refractor.pyline 74: mock routing updated from"evolution/cards/"→"refractor/cards/"✓tests/test_card_embed_refractor.pyline 207: same fix ✓Both mock routing occurrences are now consistent with the production endpoint. Badge-presence assertions will no longer pass vacuously.
Additional Notes
.gitea/workflows/docker-build.ymlin diff — These changes (dev tag support) are already inmainvia merged PR #115. They'll be no-ops on merge. Not a blocker.PR body stale — Body says "No test suite changes required" but the diff includes two test file changes. Minor documentation gap, not a functional issue.
Checklist
refractor/cards/{id})try/exceptdegrades gracefully)(Gitea blocks self-approval — posting as COMMENT. Approve manually to merge.)
AI Code Review
Files Reviewed
helpers/main.py(modified)tests/test_card_embed_refractor.py(modified).gitea/workflows/docker-build.yml(modified — no-op, already in main via PR #115)Findings
Correctness
helpers/main.py:118:evolution/cards/{card['id']}→refractor/cards/{card['id']}is correct and matches the database API rename.tests/test_card_embed_refractor.py:74and:207: both mock side_effect checks updated torefractor/cards/— tests correctly track the production change.docker-build.yml: dev tag support was already merged tomainvia PR #115; this hunk is a no-op on merge.try/except Exception: passat lines 123–124 ensures graceful degradation — if the endpoint is temporarily unavailable, badges are silently suppressed and the embed still renders correctly.Security
Style & Conventions
Suggestions
Verdict: APPROVED
Clean, minimal, and correct. All three touch points (production code + two test mocks) are updated consistently. The docker-build.yml hunk is inert on merge. The try/except fallback guarantees no card embed regressions if prod cutover is delayed.
Automated review by Claude PR Reviewer
4dd204471ftofddac59f7eReviewed. The functional change is a one-line endpoint rename in
helpers/main.py(evolution/cards/ → refractor/cards/) and the matching test mock update intest_card_embed_refractor.py. Both are correct and consistent with the database rename that landed in DB PR #131. The workflow file changes are already on main from PRs #115/#116 — the diff shows them because the merge base predates those, but git confirms no actual diff on that file vs main. Approved.