feat: tier completion notification embeds (WP-14) (#79) #89
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#89
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "ai/paper-dynasty-database-79"
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 paper-dynasty-database#79
Summary
Implements Discord embed builders for evolution tier completion notifications, per the WP-14 spec.
utilities/evolution_notifications.py— two public functions:tier_up_embed(player_name, tier, tier_name, track_name)— builds a single embed; T4 uses the "FULLY EVOLVED!" title, description without tier number, and Phase 2 teaser footerbuild_tier_embeds(tier_ups)— accepts a list of tier-up dicts and returns one embed per event; returns[]when the list is emptyTIER_COLORSdict (T1 green, T2 gold, T3 purple, T4 teal) exported for use by the callerTests
tests/test_evolution_notifications.py— 12 pure unit tests (no DB, no bot):build_tier_embeds: empty list → no embeds; single event; multiple events → separate embeds; T4 in a batchAll 12 tests pass (
python -m pytest tests/test_evolution_notifications.py -v).Files changed
utilities/evolution_notifications.py(new)tests/test_evolution_notifications.py(new)AI Code Review
Files Reviewed
utilities/evolution_notifications.py(added)tests/test_evolution_notifications.py(added)Findings
Correctness
tier == MAX_TIER.tier_nameis intentionally not used in the T4 description — correct per spec ("maximum evolution…" without tier label).TIER_COLORS.get(tier, 0xFFFFFF)provides a clean white fallback for any out-of-range tier value.build_tier_embedscorrectly passes all four dict keys as keyword args; docstring documents the expected shape.Security
Style & Conventions
0x57F287) rather than theint(SBA_COLOR, 16)pattern inutilities/embeds.py. Both are validdiscord.Embedinput and the integer form is arguably cleaner for hardcoded values — no convention mismatch.utilities/has no__init__.py(consistent with existing files in that directory — Python 3.12 namespace packages handle the import correctly).list— consistent with the rest of the codebase.Suggestions
build_tier_embedswould raiseKeyErroron a malformed dict (missing key) andTypeErroriftier_upsisNone. Both are acceptable for an internal API with a documented dict shape — no validation needed.Verdict: APPROVED
Clean, minimal implementation that exactly matches the WP-14 spec. 12 pure unit tests cover all branches (T1–T3 standard path, T4 fully-evolved path, empty list, single event, multi-event batch). No correctness, security, or convention issues found.
Automated review by Claude PR Reviewer
Approved — safe fix per PO triage.