Commit Graph

622 Commits

Author SHA1 Message Date
cal
5d86641fda Merge pull request 'feat: show refractor progress in post-game summary embed (#147)' (#160) from issue/147-feat-show-refractor-progress-in-post-game-summary into main
Reviewed-on: #160
2026-04-08 23:21:57 +00:00
Cal Corum
39424f7157 feat: show refractor progress in post-game summary embed (#147)
All checks were successful
Ruff Lint / lint (pull_request) Successful in 24s
Closes #147

Adds a "Refractor Progress" field to the game summary embed showing:
- Cards that tiered up during this game (⬆ Name → Tier Name)
- Cards currently ≥80% toward their next tier on either team (◈ Name (pct%))

The field is omitted entirely when there is nothing to show.

Implementation:
- _run_post_game_refractor_hook() now returns evo_result (or None on failure)
- New _build_refractor_progress_text() fetches close-to-tier cards from both
  teams via refractor/cards?progress=close and formats the combined output
- complete_game() adds the field between Rewards and Highlights sections

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 13:36:32 -05:00
cal
8842d80f26 Merge pull request 'feat: include refractor card image in tier-up notification embed (#144)' (#159) from issue/144-feat-tier-up-notification-should-include-refractor into main 2026-04-08 15:25:50 +00:00
Cal Corum
25b63b407f feat: include refractor card image in tier-up notification embed (#144)
All checks were successful
Ruff Lint / lint (pull_request) Successful in 21s
Closes #144

- build_tier_up_embed() accepts optional image_url and calls set_image() when provided
- notify_tier_completion() accepts optional image_url and passes it through
- _trigger_variant_renders() now captures the render response image_url per player and returns a player_id->image_url dict
- _run_post_game_refractor_hook() triggers renders first (to obtain image URLs), then sends notifications with card art included
- Updated test_post_game_refractor_hook.py to reflect new render-before-notify ordering and image_url kwarg in notify calls

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 09:38:43 -05:00
cal
bd6c387902 Merge pull request 'test: mock-based integration tests for post-game refractor hook (#148)' (#158) from issue/148-test-mock-based-integration-tests-for-post-game-re into main 2026-04-08 14:26:05 +00:00
Cal Corum
eb022c3d66 test: mock-based integration tests for post-game refractor hook (#148)
All checks were successful
Ruff Lint / lint (pull_request) Successful in 28s
Extract _run_post_game_refractor_hook() from complete_game() so the hook
logic can be tested directly without a live game session. Add 13 tests
covering endpoint ordering, tier-up notification dispatch, variant render
triggers, and non-fatal error handling.

Closes #148

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 08:34:50 -05:00
cal
63a25ea0ba Merge pull request 'perf: parallelize scout opportunity creation and remove sleep(2) (#101)' (#156) from issue/101-perf-parallelize-scout-opportunity-creation-and-re into main 2026-04-08 10:26:17 +00:00
cal
e5ec88f794 Merge branch 'main' into issue/101-perf-parallelize-scout-opportunity-creation-and-re
All checks were successful
Ruff Lint / lint (pull_request) Successful in 15s
2026-04-08 10:26:10 +00:00
cal
ff57b8fea3 Merge pull request 'perf: parallelize get_card_embeds calls in display_cards (#98)' (#157) from issue/98-perf-parallelize-get-card-embeds-calls-in-display into main 2026-04-08 10:26:04 +00:00
Cal Corum
2f22a11e17 perf: parallelize get_card_embeds calls in display_cards (#98)
All checks were successful
Ruff Lint / lint (pull_request) Successful in 17s
Closes #98

Replace sequential await-in-list-comprehension with asyncio.gather() so
all card embed fetches run concurrently. Cuts 50 sequential DB round-trips
(5 packs × 5 cards × 2 calls each) down to ~2 concurrent batches.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 02:32:56 -05:00
Cal Corum
8ddd58101c perf: parallelize scout opportunity creation and remove sleep(2) (#101)
All checks were successful
Ruff Lint / lint (pull_request) Successful in 12s
Closes #101

Replace sequential for-loop with asyncio.gather() so all scout
opportunities are created concurrently. Remove asyncio.sleep(2) that
added ~8s of post-display delay for multi-pack opens. create_scout_opportunity()
already guards against empty pack_cards with an early return.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 01:02:10 -05:00
cal
24420268cf Merge pull request 'refactor: extract TIER_NAMES/TIER_COLORS to shared constants module (#146)' (#155) from issue/146-refactor-extract-tier-names-tier-colors-to-shared into main 2026-04-08 05:25:33 +00:00
Cal Corum
21bad7af51 refactor: extract TIER_NAMES/TIER_COLORS to shared constants module (#146)
All checks were successful
Ruff Lint / lint (pull_request) Successful in 12s
Closes #146

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 00:03:46 -05:00
cal
224250b03d Merge pull request 'fix: add logging to silent error swallowing in badge lookup (#150)' (#152) from issue/150-fix-add-logging-to-silent-error-swallowing-in-badg into main 2026-04-08 03:25:41 +00:00
Cal Corum
1a3f8994a9 fix: add debug logging to silent badge lookup exception in get_card_embeds
All checks were successful
Ruff Lint / lint (pull_request) Successful in 22s
Replaces bare `except Exception: pass` with `logging.debug(..., exc_info=True)`
so badge lookup failures are traceable in logs without affecting card display.

Closes #150

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 22:02:00 -05:00
cal
f67c1c41a7 Merge pull request 'feat: add team param to _build_refractor_response for collection view (#138)' (#140) from issue/138-feat-collection-view-refractor-card-images-in-web into main 2026-04-08 01:45:24 +00:00
cal
435bfd376f Merge branch 'main' into issue/138-feat-collection-view-refractor-card-images-in-web
All checks were successful
Ruff Lint / lint (pull_request) Successful in 27s
2026-04-08 01:45:19 +00:00
cal
c01167b097 Merge pull request 'docs: update refractor test plan with 2026-04-07 results' (#143) from docs/update-refractor-test-plan into main 2026-04-08 01:45:16 +00:00
Cal Corum
59a41e0c39 docs: update refractor integration test plan with 2026-04-07 results
All checks were successful
Ruff Lint / lint (pull_request) Successful in 25s
Fix incorrect command names (/card→/player, /roster→/team, /buy→/buy card-by-name,
/openpack→/open-packs, /scout→/scout-tokens). Update execution checklist with full
Playwright test session results — API tests, filter tests, pagination, edge cases
all passing. Note badge propagation design gap and REF-22 fix (discord#141).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 16:08:37 -05:00
cal
3210d5d6a4 Merge pull request 'fix: move health server from port 8080 to 8081 (#130)' (#131) from issue/130-move-bot-health-server-off-port-8080-to-avoid-admi into main
All checks were successful
Build Docker Image / build (push) Successful in 3m2s
Reviewed-on: #131
2026-04-07 15:54:03 +00:00
Cal Corum
8e5242a6b7 fix: move health server from port 8080 to 8081 (#130)
All checks were successful
Ruff Lint / lint (pull_request) Successful in 18s
Adminer is exposed on host port 8080, shadowing the bot health endpoint.
Change health server default to 8081 to avoid the conflict.

Closes #130

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 15:53:33 +00:00
cal
8f9242bed8 Merge pull request 'fix: clamp page overflow to last page in /refractor status (#141)' (#142) from issue/141-bug-refractor-status-page-overflow-shows-no-data-i into main
Reviewed-on: #142
2026-04-07 15:52:06 +00:00
Cal Corum
cb17b99220 fix: clamp page overflow to last page in /refractor status (#141)
All checks were successful
Ruff Lint / lint (pull_request) Successful in 30s
When page exceeds total pages, API returns empty items but non-zero
count. Now detects this case and re-fetches the last valid page.

Closes #141

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 10:31:55 -05:00
Cal Corum
ddc9a28023 fix: use Optional[dict] for team param type annotation
All checks were successful
Ruff Lint / lint (pull_request) Successful in 12s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 17:36:04 -05:00
Cal Corum
f488cb66e0 feat: add team param to _build_refractor_response for collection view (#138)
Closes #138

The test suite passes `team` to _build_refractor_response but the
function signature did not accept it. Adds `team: dict = None` so
tests for the refractor card image collection view pass without
changing any existing behavior.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 17:35:46 -05:00
cal
5cfddaa89a Merge pull request 'feat: refractor card art pipeline — render trigger + /player view' (#139) from feat/refractor-card-art-pipeline into main 2026-04-06 22:34:01 +00:00
Cal Corum
78f313663e fix: review feedback — variant 0 guard, remove dead team param
All checks were successful
Ruff Lint / lint (pull_request) Successful in 11s
- Use `variant is None` instead of `not variant` to avoid skipping
  variant 0 tier-ups (0 is falsy in Python)
- Remove unused `team` parameter from _build_refractor_response
- Update tests to match

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 17:33:36 -05:00
Cal Corum
46744d139c feat: add /player refractor_tier parameter for viewing evolved cards
All checks were successful
Ruff Lint / lint (pull_request) Successful in 13s
Adds optional refractor_tier parameter to the /player slash command.
When provided: looks up the user's team refractor data, shows the
evolved card image if available, triggers on-demand render if image
not yet generated, or shows top 5 refractor cards as fallback.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 17:21:28 -05:00
Cal Corum
730d4b4f60 feat: trigger variant card renders after post-game tier-ups
After refractor tier-ups, the bot hits the card render URL for each
variant card to trigger Playwright render + S3 upload as a side
effect. Fire-and-forget — failures are logged but never raised.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 17:10:13 -05:00
cal
9ee4a76cd6 Merge pull request 'fix: remove stale Superfractor "Rating Boosts" teaser' (#137) from fix/remove-stale-superfractor-text into main 2026-04-06 20:13:36 +00:00
Cal Corum
80e99b075f chore: fix stale docstring referencing removed note field
All checks were successful
Ruff Lint / lint (pull_request) Successful in 15s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 15:09:21 -05:00
Cal Corum
ef270ec1ab fix: remove stale "Rating Boosts coming soon" from Superfractor notification
All checks were successful
Ruff Lint / lint (pull_request) Successful in 52s
Tier boosts shipped in Phase 2 — the teaser field in the T4 tier-up
embed was outdated. Remove it and update tests + test plan to match.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 14:59:56 -05:00
cal
b65d91a65b Merge pull request 'fix: remove docker-compose.yml from tracking, add example template' (#136) from fix/docker-compose-secrets-untrack into main 2026-04-01 18:02:35 +00:00
cal
4bda3bf0de Merge branch 'main' into fix/docker-compose-secrets-untrack
All checks were successful
Ruff Lint / lint (pull_request) Successful in 15s
2026-04-01 18:02:29 +00:00
cal
ff768c95f5 Merge pull request 'chore: add .env.example with placeholder values' (#135) from chore/add-env-example into main 2026-04-01 18:02:17 +00:00
Cal Corum
fb545ef34a fix: remove docker-compose.yml from tracking, add example template
All checks were successful
Ruff Lint / lint (pull_request) Successful in 21s
docker-compose.yml contains hardcoded credentials (BOT_TOKEN, API_TOKEN,
RESTART_WEBHOOK_URL) and should never be committed. The *compose.yml gitignore
rule already excluded it but docker-compose.example.yml was not provided as a
reference for contributors.

- Add !docker-compose.example.yml negation to .gitignore so example is tracked
- Add docker-compose.example.yml with placeholder values for all secrets

Closes paper-dynasty-database#9

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 12:59:40 -05:00
Cal Corum
f704b09933 chore: add .env.example with placeholder values
All checks were successful
Ruff Lint / lint (pull_request) Successful in 29s
Document all required environment variables for running the Discord bot,
including bot token, API credentials, database config, and webhook URL.

References paper-dynasty-database#9
2026-04-01 11:59:44 -05:00
Cal Corum
94f3b1dc97 fix: apply open-packs hotfix to cogs/economy.py
Port the Check-In Player pack fix from the hotfix branch to the legacy
economy.py cog (which production currently loads instead of economy_new).

- Filter auto-open pack types from the manual open-packs menu
- Add pretty_name fallback for hyphenated pack type names
- Add ruff noqa for pre-existing star import warnings

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 13:04:19 -05:00
cal
fca85d583f Merge pull request 'fix: prevent crash when Check-In Player packs in open-packs' (#134) from hotfix/open-packs-checkin into main 2026-03-26 13:50:09 +00:00
cal
b6592b8a70 Merge branch 'main' into hotfix/open-packs-checkin
All checks were successful
Ruff Lint / lint (pull_request) Successful in 22s
2026-03-26 13:50:01 +00:00
Cal Corum
01f6fb50d5 fix: prevent crash when Check-In Player packs appear in open-packs menu
All checks were successful
Build Docker Image / build (pull_request) Successful in 3m17s
Check-In Player packs (auto-opened by daily check-in) could end up orphaned
in inventory if roll_for_cards failed. The open-packs command crashed because:
1. The hyphenated pack type name bypassed the pretty_name logic, producing an
   empty select menu that Discord rejected (400 Bad Request)
2. Even if displayed, selecting it would raise KeyError in the callback since
   "Check-In Player".split("-") doesn't match any known pack type token

Fixes:
- Filter auto-open pack types out of the manual open-packs menu
- Add fallback for hyphenated pack type names in pretty_name logic
- Replace KeyError with graceful user-facing message for unknown pack types
- Change "contact an admin" to "contact Cal" in all user-facing messages

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 08:45:51 -05:00
cal
f843b45099 Merge pull request 'fix: clean up refractor status — suffix tags, compact layout' (#133) from fix/refractor-status-cleanup into main
All checks were successful
Build Docker Image / build (push) Successful in 2m47s
2026-03-26 06:00:32 +00:00
Cal Corum
bbad1daba2 fix: clean up refractor status display — suffix tags, compact layout, dead code removal
All checks were successful
Ruff Lint / lint (pull_request) Successful in 20s
- Tier labels as suffix tags: **Name** — Base Chrome [T1] (T0 gets no suffix)
- Compact progress line: bar value/threshold (pct) — removed formula and tier arrow
- Fully evolved shows `MAX` instead of FULLY EVOLVED
- Deleted unused FORMULA_LABELS dict
- Added _FULL_BAR constant, moved T0-branch lookups into else
- Fixed mock API shape in test (cards → items)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 00:22:35 -05:00
cal
2d7c19814e Merge pull request 'fix: replace abstract tier symbols with readable labels' (#132) from fix/refractor-tier-labels into main
All checks were successful
Build Docker Image / build (push) Successful in 2m46s
2026-03-26 04:49:19 +00:00
Cal Corum
c3ff85fd2d fix: replace abstract tier symbols with readable labels in /refractor status
All checks were successful
Ruff Lint / lint (pull_request) Successful in 11s
Unicode symbols (○ ◈ ◆ ✦ ★) were too similar to distinguish at a glance.
Now uses T1/T2/T3/T4★ prefixes with no prefix for base cards (T0).
Summary header reads "Base: 1  T1: 9 — 64 total" instead of cryptic symbols.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 23:47:03 -05:00
cal
64c656ce91 Merge pull request 'feat: redesign /refractor status with rich Unicode display' (#129) from feat/refractor-status-redesign into main
All checks were successful
Build Docker Image / build (push) Successful in 2m42s
2026-03-26 03:50:41 +00:00
Cal Corum
cd822857bf feat: redesign /refractor status with rich Unicode display and team branding
All checks were successful
Ruff Lint / lint (pull_request) Successful in 21s
Replace plain ASCII progress bars and text badges with a polished embed:
- Unicode block progress bars (▰▱) replacing ASCII [===---]
- Tier-specific symbols (○ ◈ ◆ ✦ ★) instead of [BC]/[R]/[GR]/[SF] badges
- Team-branded embeds via get_team_embed (color, logo, season footer)
- Tier distribution summary header in code block
- Percentage display and backtick-wrapped values
- Tier-specific accent colors for single-tier filtered views
- Sparkle treatment for fully evolved cards (✧ FULLY EVOLVED ✧)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 22:46:38 -05:00
cal
34774290b8 Merge pull request 'fix: context-aware empty state messages for /refractor status' (#128) from fix/refractor-empty-filter-message into main
All checks were successful
Build Docker Image / build (push) Successful in 3m29s
2026-03-25 23:57:53 +00:00
Cal Corum
6239f1177c fix: context-aware empty state messages for /refractor status
All checks were successful
Ruff Lint / lint (pull_request) Successful in 23s
When filters are active and return 0 results, show which filters were
applied and suggest removing them, instead of the misleading
"No refractor data found for your team."

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 18:57:32 -05:00
cal
dea6316201 Merge pull request 'feat: add Prev/Next navigation buttons to /refractor status' (#127) from feat/refractor-pagination-buttons into main
All checks were successful
Build Docker Image / build (push) Successful in 3m8s
2026-03-25 22:43:29 +00:00