Commit Graph

613 Commits

Author SHA1 Message Date
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
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
Cal Corum
b9deb14b62 feat: add Prev/Next navigation buttons to /refractor status
All checks were successful
Ruff Lint / lint (pull_request) Successful in 24s
- RefractorPaginationView with ◀ Prev / Next ▶ buttons
- Buttons re-fetch from API on each page change
- Prev disabled on page 1, Next disabled on last page
- Only the command invoker can use the buttons
- Buttons auto-disable after 2 min timeout
- Single-page results show no buttons

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 17:43:06 -05:00
cal
48392a9bbe Merge pull request 'feat: use Discord Choice menus for /refractor status parameters' (#126) from enhancement/refractor-choice-params into main
All checks were successful
Build Docker Image / build (push) Successful in 2m40s
2026-03-25 22:16:53 +00:00
Cal Corum
a53cc5cac3 feat: use Discord Choice menus for /refractor status parameters
All checks were successful
Ruff Lint / lint (pull_request) Successful in 22s
Replace freeform text inputs with dropdown selections:
- card_type: Batter, Starting Pitcher, Relief Pitcher
- tier: T0-T4 with names (Base Card through Superfractor)
- progress: "Close to next tier" option
- Removed season param (not useful for current UX)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 17:16:26 -05:00
cal
a8b4d6cdbb Merge pull request 'fix: round refractor values to integers in display' (#125) from fix/refractor-round-values into main
All checks were successful
Build Docker Image / build (push) Successful in 2m39s
2026-03-25 21:55:24 +00:00
Cal Corum
8d2cdc81fe fix: round refractor values to integers in display
All checks were successful
Ruff Lint / lint (pull_request) Successful in 19s
Cast current_value and next_threshold to int to avoid ugly floating
point numbers like 53.0/149.0 in the progress display.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 16:55:03 -05:00
cal
27ce8b3617 Merge pull request 'fix: add debug logging for successful refractor API responses' (#124) from fix/refractor-debug-logging into main
All checks were successful
Build Docker Image / build (push) Successful in 2m47s
2026-03-25 21:47:41 +00:00
Cal Corum
17d124feb4 fix: add debug logging for successful refractor API responses
All checks were successful
Ruff Lint / lint (pull_request) Successful in 9s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 16:46:01 -05:00
Cal Corum
1c21f674c2 fix: add error logging and user-facing message for API failures
All checks were successful
Ruff Lint / lint (pull_request) Successful in 20s
- Log API error detail when refractor endpoint returns an error
- Show "Something went wrong" instead of misleading "No refractor data"
- Log empty response case for debugging

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 16:44:20 -05:00
Cal Corum
a9ef04d102 fix: use server-side pagination and fix limit=500 exceeding API max
- Switch from client-side pagination (fetch all, slice) to server-side
  (pass limit/offset/progress params to API)
- Fixes limit=500 rejection (API max is 100)
- Footer now shows total_count from API response
- progress=close filter delegated to API instead of client-side

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 16:43:58 -05:00