feat: tier completion notification embeds (WP-14) (#79) #89

Merged
Claude merged 3 commits from ai/paper-dynasty-database-79 into main 2026-03-23 03:59:15 +00:00
Collaborator

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 footer
    • build_tier_embeds(tier_ups) — accepts a list of tier-up dicts and returns one embed per event; returns [] when the list is empty
  • TIER_COLORS dict (T1 green, T2 gold, T3 purple, T4 teal) exported for use by the caller

Tests

tests/test_evolution_notifications.py — 12 pure unit tests (no DB, no bot):

  • Tier-up embed title, description format, per-tier color, no footer on T1–T3
  • Fully-evolved embed title, description, footer, and color
  • build_tier_embeds: empty list → no embeds; single event; multiple events → separate embeds; T4 in a batch

All 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)
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 footer - `build_tier_embeds(tier_ups)` — accepts a list of tier-up dicts and returns one embed per event; returns `[]` when the list is empty - `TIER_COLORS` dict (T1 green, T2 gold, T3 purple, T4 teal) exported for use by the caller ## Tests `tests/test_evolution_notifications.py` — 12 pure unit tests (no DB, no bot): - Tier-up embed title, description format, per-tier color, no footer on T1–T3 - Fully-evolved embed title, description, footer, and color - `build_tier_embeds`: empty list → no embeds; single event; multiple events → separate embeds; T4 in a batch All 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)
Claude added 1 commit 2026-03-13 22:34:31 +00:00
feat: tier completion notification embeds (WP-14) (#79)
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m25s
208efd11a6
Closes paper-dynasty-database#79

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude added the
ai-reviewing
label 2026-03-13 22:45:51 +00:00
Claude reviewed 2026-03-13 22:47:48 +00:00
Claude left a comment
Author
Collaborator

AI Code Review

Files Reviewed

  • utilities/evolution_notifications.py (added)
  • tests/test_evolution_notifications.py (added)

Findings

Correctness

  • No issues found. Both T4 ("FULLY EVOLVED!") and T1–T3 ("Evolution Tier Up!") paths are correctly branched on tier == MAX_TIER.
  • tier_name is 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_embeds correctly passes all four dict keys as keyword args; docstring documents the expected shape.

Security

  • No issues. Pure in-memory embed construction — no DB, no I/O, no user-controlled queries.

Style & Conventions

  • Color values use integer hex literals (0x57F287) rather than the int(SBA_COLOR, 16) pattern in utilities/embeds.py. Both are valid discord.Embed input 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).
  • Type hints use bare list — consistent with the rest of the codebase.

Suggestions

  • No blocking suggestions. Minor note: build_tier_embeds would raise KeyError on a malformed dict (missing key) and TypeError if tier_ups is None. 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

## AI Code Review ### Files Reviewed - `utilities/evolution_notifications.py` (added) - `tests/test_evolution_notifications.py` (added) ### Findings #### Correctness - No issues found. Both T4 ("FULLY EVOLVED!") and T1–T3 ("Evolution Tier Up!") paths are correctly branched on `tier == MAX_TIER`. - `tier_name` is 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_embeds` correctly passes all four dict keys as keyword args; docstring documents the expected shape. #### Security - No issues. Pure in-memory embed construction — no DB, no I/O, no user-controlled queries. #### Style & Conventions - Color values use integer hex literals (`0x57F287`) rather than the `int(SBA_COLOR, 16)` pattern in `utilities/embeds.py`. Both are valid `discord.Embed` input 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). - Type hints use bare `list` — consistent with the rest of the codebase. #### Suggestions - No blocking suggestions. Minor note: `build_tier_embeds` would raise `KeyError` on a malformed dict (missing key) and `TypeError` if `tier_ups` is `None`. 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*
Claude added
ai-reviewed
and removed
ai-reviewing
labels 2026-03-13 22:48:09 +00:00
cal approved these changes 2026-03-23 03:54:11 +00:00
cal left a comment
Owner

Approved — safe fix per PO triage.

Approved — safe fix per PO triage.
Claude added 1 commit 2026-03-23 03:54:16 +00:00
Merge branch 'main' into ai/paper-dynasty-database-79
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m31s
791b991538
Claude added 1 commit 2026-03-23 03:59:10 +00:00
Merge branch 'main' into ai/paper-dynasty-database-79
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m11s
d98f8ea8ab
Claude merged commit 841216c679 into main 2026-03-23 03:59:15 +00:00
Claude deleted branch ai/paper-dynasty-database-79 2026-03-23 03:59:16 +00:00
Sign in to join this conversation.
No reviewers
cal
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#89
No description provided.