feat: show refractor progress in post-game summary embed (#147) #160
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
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/paper-dynasty-discord#160
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "issue/147-feat-show-refractor-progress-in-post-game-summary"
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 #147
Summary
Adds a Refractor Progress field to the post-game summary embed so players can see card progression without hunting through
/refractor status.evaluate-gameresponse already captured during post-game processingrefractor/cards?progress=closefor both teams; capped at 5 entries; failures are non-fatalFiles Changed
command_logic/logic_gameplay.py_run_post_game_refractor_hook— now returnsevo_result | None(wasNone)_build_refractor_progress_text— new async helper that formats the field valuecomplete_game— captures hook return value and conditionally adds the fieldTIER_NAMESfromhelpers.refractor_constantstests/test_refractor_progress_embed.py— 11 new tests covering tier-up formatting, near-threshold display, API failure resilience, cap logic, and hook return valueTest Results
104 refractor-related tests pass (13 pre-existing + 11 new + existing suite).
Other Observations
progress=closeAPI filter is server-side (≥80%) — no client-side threshold math neededAI Code Review
Files Reviewed
command_logic/logic_gameplay.py(modified)tests/test_refractor_progress_embed.py(added)Findings
Correctness
No issues found.
_run_post_game_refractor_hookreturn value change is clean:return evo_resulton the success path,return Nonein theexceptblock. All existing callers that ignored the return value are unaffected._build_refractor_progress_text: tier-up formatting is correct —TIER_NAMES.get(new_tier, f"T{new_tier}")provides a safe fallback for unknown tiers.int(card.get("next_threshold") or 0)handlesNone,"", and0cleanly; theif next_threshold:guard prevents division-by-zero.int(card.get("current_value", 0))uses default0only when the key is absent; a present-but-Nonevalue would raise inside the try/except, gracefully dropping the close-cards section — consistent with the non-fatal design.evo_resultis captured beforesession.delete(this_play)and used later for read-only API calls; no session-state issues.Security
No issues found. All data originates from internal API responses; no user input reaches the formatting or API calls.
Style & Conventions
except Exception: passfor best-effort enrichment is appropriate here, consistent with the badge-lookup precedent).dict | None,str | None) match the actual return paths._trigger_variant_renders.Suggestions
close_lines[:5]slices after accumulating cards from both teams. Since the server-sidelimit=5applies per-team call, the winning team can claim all 5 slots if it has enough near-threshold cards, leaving the losing team unrepresented. The current behavior is consistent with the PR description ("capped at 5 entries") so this is not a correctness issue — just worth noting if the product intent is balanced representation.Nonecurrent_value) raises and drops the entire close-cards section for both teams. Per-card try/except would be more resilient, but the current all-or-nothing approach matches the non-fatal philosophy used elsewhere in the file.test_close_cards_capped_at_fivevalidates the cap with 10 cards per team (20 total → sliced to 5). The<= 5assertion is sufficient for the stated goal.Verdict: APPROVED
Clean implementation. Logic is sound, error handling is non-fatal throughout,
TIER_NAMESis correctly imported from the shared constants module (PR #155), and the 11 new tests cover all key paths including API failure resilience and the hook return-value contract. No correctness or security issues.Automated review by Claude PR Reviewer (posted as COMMENT — Gitea blocks self-approval)