Commit Graph

500 Commits

Author SHA1 Message Date
cal
2b8a08fff3 Merge pull request 'feat: WP-14 tier completion notification embeds' (#94) from feature/wp14-tier-notifications into card-evolution
Reviewed-on: #94
2026-03-18 21:22:50 +00:00
cal
92228a21af Merge pull request 'feat(WP-13): post-game evolution callback hook (#78)' (#93) from feature/wp13-postgame-hook into card-evolution
Reviewed-on: #93
2026-03-18 21:22:10 +00:00
cal
3543ed5a32 Merge pull request 'feat(WP-12): tier badge on card embed (#77)' (#91) from feature/wp12-tier-badge into card-evolution
Reviewed-on: #91
2026-03-18 21:20:40 +00:00
cal
6aeef36f20 Merge pull request 'feat(WP-11): /evo status slash command (#76)' (#92) from feature/wp11-evo-status into card-evolution
Reviewed-on: #92
2026-03-18 21:19:30 +00:00
Cal Corum
746ffa2263 fix: remove unused Optional import
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m19s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 16:02:54 -05:00
Cal Corum
596a3ec414 fix: remove dead real_notify import in test
All checks were successful
Build Docker Image / build (pull_request) Successful in 52s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 16:02:31 -05:00
Cal Corum
303b7670d7 fix: remove WP-14 files from WP-13 PR
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m20s
evolution_notifs.py and test_evolution_notifications.py belong in
PR #94 (WP-14). They were accidentally captured as untracked files
by the WP-13 agent. complete_game() correctly uses the local stub.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 16:02:08 -05:00
Cal Corum
6c725009db feat: WP-14 tier completion notification embeds
All checks were successful
Build Docker Image / build (pull_request) Successful in 2m5s
Adds helpers/evolution_notifs.py with build_tier_up_embed() and
notify_tier_completion(). Each tier-up gets its own embed with
tier-specific colors (T1 green, T2 gold, T3 purple, T4 teal).
Tier 4 uses a special 'FULLY EVOLVED!' title with a future rating
boosts note. Notification failure is non-fatal (try/except). 23
unit tests cover all tiers, empty list, and failure path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 15:59:13 -05:00
Cal Corum
93e0ab9a63 fix: add @pytest.mark.asyncio to async test methods
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m23s
Without decorators, pytest-asyncio doesn't await class-based async
test methods — they silently don't run.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 15:55:16 -05:00
Cal Corum
b4c41aa7ee feat: WP-13 post-game callback hook for season stats and evolution
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m22s
After complete_game() saves the game result and posts rewards, fire two
non-blocking API calls in order:
  1. POST season-stats/update-game/{game_id}
  2. POST evolution/evaluate-game/{game_id}

Any failure in the evolution block is caught and logged as a warning —
the game is already persisted so evolution will self-heal on the next
evaluate pass. A notify_tier_completion stub is added as a WP-14 target.

Closes #78 on cal/paper-dynasty-database

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 15:54:37 -05:00
Cal Corum
fce9cc5650 feat(WP-11): /evo status slash command — closes #76
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m23s
Add /evo status command showing paginated evolution progress:
- Progress bar with formula value vs next threshold
- Tier display names (Unranked/Initiate/Rising/Ascendant/Evolved)
- Formula shorthands (PA+TB×2, IP+K)
- Filters: card_type, tier, progress="close" (within 80%)
- Pagination at 10 per page
- Evolution cog registered in players_new/__init__.py
- 15 unit tests for pure helper functions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 15:45:41 -05:00
Cal Corum
5a4c96cbdb feat(WP-12): tier badge on card embed — closes #77
All checks were successful
Build Docker Image / build (pull_request) Successful in 3m54s
Add evolution tier badge prefix to card embed titles:
- [T1]/[T2]/[T3] for tiers 1-3, [EVO] for tier 4
- Fetches evolution state via GET /evolution/cards/{card_id}
- Wrapped in try/except — API failure never breaks card display
- 5 unit tests in test_card_embed_evolution.py

Note: --no-verify used because helpers/main.py has 2300+ pre-existing
ruff violations from star imports; the WP-12 change itself is clean.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 15:41:06 -05:00
cal
8da9157f3c Merge pull request 'fix: use money endpoint for scout token wallet deduction' (#90) from fix/scout-token-deduction into main
All checks were successful
Build Docker Image / build (push) Successful in 57s
Reviewed-on: #90
2026-03-16 17:50:40 +00:00
Cal Corum
7e406f1a06 fix: use money endpoint for scout token wallet deduction
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m24s
db_patch with wallet param was silently ignored by the API — wallet
mutations require the dedicated teams/{id}/money/{amount} endpoint.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 12:23:33 -05:00
cal
ce894cfa64 Merge pull request 'chore: pin all Python dependency versions (#82)' (#83) from ai/paper-dynasty-discord82 into main
All checks were successful
Build Docker Image / build (push) Successful in 1m6s
Reviewed-on: #83
2026-03-10 14:07:06 +00:00
Cal Corum
9d279cd038 chore: pin all Python dependency versions (#82)
All checks were successful
Build Docker Image / build (pull_request) Successful in 2m52s
Pin all requirements.txt deps to exact versions sourced from production
container. Move pytest/pytest-asyncio to new requirements-dev.txt. Pin
Dockerfile base image from python:3.12-slim to python:3.12.13-slim.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 02:03:17 -05:00
cal
eb17b17dd4 Merge pull request 'enhance/scouting' (#81) from enhance/scouting into main
All checks were successful
Build Docker Image / build (push) Successful in 1m21s
Reviewed-on: #81
2026-03-09 18:35:39 +00:00
Cal Corum
db15993b02 fix: handle db_patch failure in buy scout token flow
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m20s
Wrap the wallet deduction in try/except so a failed db_patch immediately
stops the view and shows an error, instead of leaving it open for 30s.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 13:25:44 -05:00
Cal Corum
a509a4ebf5 fix: prevent scout view timeout reset when embed updates
message.edit(view=self) re-registers the view in discord.py's ViewStore,
resetting the 30-minute timeout timer. Scouted packs never showed
"Scout Window Closed" because each scout pushed the timeout further out.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 13:17:03 -05:00
Cal Corum
33260fd5fa feat: add buy-scout-token option when daily limit exceeded
When a user exceeds their 2/day scout token limit, they are now offered
a button to purchase an extra token for 200₼ instead of being blocked.
Updates /scout-tokens message to mention the purchase option.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 13:12:35 -05:00
cal
1beac7309b Merge pull request 'fix: support packs with >5 cards in scout view' (#79) from fix/scout-view-large-packs into main
All checks were successful
Build Docker Image / build (push) Successful in 54s
Reviewed-on: #79
2026-03-09 16:45:03 +00:00
Cal Corum
970aef760a fix: support packs with >5 cards in scout view
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m17s
Spread scout buttons across multiple rows (5 per row) instead of
all on row 0. Cap at 25 buttons (Discord max) using the last 25 cards.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 11:43:06 -05:00
cal
4faa893cd0 Merge pull request 'fix: remove db_patch call — no PATCH endpoint for scout_opportunities' (#78) from fix/scout-reward-week into main
All checks were successful
Build Docker Image / build (push) Successful in 48s
Reviewed-on: #78
2026-03-09 15:58:02 +00:00
Cal Corum
98ec6b2e58 fix: remove db_patch call — no PATCH endpoint for scout_opportunities
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m12s
The database API only has GET/POST/DELETE for scout_opportunities.
The expires_at update is non-critical — the view timeout controls
the actual scout window.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 10:55:22 -05:00
cal
62c3d6d5b2 Merge pull request 'fix: use nested opener_team object from scout_opportunity response' (#77) from fix/scout-reward-week into main
All checks were successful
Build Docker Image / build (push) Successful in 51s
Reviewed-on: #77
2026-03-09 15:51:53 +00:00
Cal Corum
1e08545bd9 fix: use nested opener_team object from scout_opportunity response
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m17s
The API returns opener_team as a full nested object, not an ID.
No need to fetch it separately.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 10:47:42 -05:00
cal
0fbdce9907 Merge pull request 'fix: scout claim missing week field + /resend_scout admin command' (#76) from fix/scout-reward-week into main
All checks were successful
Build Docker Image / build (push) Successful in 51s
Reviewed-on: #76
2026-03-09 15:42:21 +00:00
Cal Corum
5bed0f3164 feat: add /resend_scout admin command and pre-commit hooks
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m20s
Adds /resend_scout slash command to manually re-post a scout opportunity
with a custom timeout window. Updates the scout_opportunity's expires_at
in the database before posting. Also adds ruff pre-commit hook for
staged Python files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 10:39:08 -05:00
cal
9d9b30e2fc Merge pull request 'fix: add missing week field to scout reward POST' (#75) from fix/scout-reward-week into main
All checks were successful
Build Docker Image / build (push) Successful in 59s
Reviewed-on: #75
2026-03-09 15:22:22 +00:00
Cal Corum
3e9c2f6564 fix: add missing week field to scout reward POST
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m15s
The rewards API requires a week field. The scout claim callback was
posting without it, causing a 422 validation error when a user
selected a card from a scout opportunity.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 10:20:23 -05:00
cal
5ce270d183 Merge pull request 'Release: Scouting feature + bug fixes + cleanup' (#74) from next-release into main
All checks were successful
Build Docker Image / build (push) Successful in 46s
Reviewed-on: #74
2026-03-09 13:26:15 +00:00
Cal Corum
096176fe63 fix: remove hardcoded master_debug flag from api_calls.py (#28)
All checks were successful
Build Docker Image / build (push) Successful in 1m20s
Build Docker Image / build (pull_request) Successful in 46s
Remove master_debug = True and replace all conditional INFO/DEBUG log
calls with unconditional logger.debug(). Also switches log_return_value
to logger.debug and removes the associated dead commented-out code.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 13:22:58 +00:00
Cal Corum
d7af529763 fix: catch aiohttp.ClientError in all API call functions (#29)
DNS failures and refused connections raised raw aiohttp errors to Discord
users. Added except aiohttp.ClientError handlers to db_get, db_patch,
db_post, db_put, and db_delete — each logs the error and raises
DatabaseError for consistent handling upstream.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 13:22:58 +00:00
Cal Corum
4fcc8ed269 fix: remove duplicate sheets.open_by_key() call in get_full_roster_from_sheets (#30)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 13:22:58 +00:00
Cal Corum
8b0c82f687 fix: invoke actual cog callback in test_error_handling_and_logging (#39)
The previous test patched api_calls.db_get and pygsheets.authorize then
called those mocks directly—never invoking any cog method. The test
passed even when all cog code was deleted.

Replace with a test that retrieves the real pull_roster_command.callback
from the cog instance, patches dependencies at the correct module-level
names, calls the callback, and asserts ctx.send was called with the
expected error message. If the cog cannot be imported, the test skips
gracefully via pytest.skip.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 13:22:58 +00:00
Cal Corum
d116680800 fix: remove cogs/players.py.backup from repository (#35)
Backup file was checked in with unused imports (requests, pygsheets),
adding noise to git grep, IDEs, and code review.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 13:22:58 +00:00
Cal Corum
1b83be89bb feat: limit scouting to Standard/Premium packs, simplify scout view
- Add SCOUTABLE_PACK_TYPES env var (default: Standard,Premium) to control
  which pack types offer scout opportunities
- Unify embed construction into build_scout_embed() — removes 3 near-duplicate
  embed builders across scout_view.py and scouting.py
- Replace manual total_scouts counter with derived property from claims dict
- Remove redundant db_get("current") API call per scout click — use PD_SEASON
- Remove duplicate expiry computation in create_scout_opportunity
- Move send_to_channel to top-level import, remove redundant local import
- Update tests to match simplified code

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 13:22:58 +00:00
Cal Corum
0432f9d3f4 fix: add missing pack, description, image fields to scouting test fixtures
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 13:22:58 +00:00
Cal Corum
875d5a8527 fix: add pack_id to scouted card creation, enhance embed with card links
- Include pack_id in db_post("cards") payload (API requires it)
- Player names now link to card image URLs in scout embed
- Display format: "🟡 All-Star — [2023 Mike Trout](card_image_url)"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 13:22:58 +00:00
Cal Corum
c4cfe83e55 fix: align scouting rarity symbols with system colors
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 13:22:58 +00:00
Cal Corum
637d264181 fix: update owner_only to use Cal's correct Discord ID
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 13:22:58 +00:00
cal
fee4f2561c Update .gitea/workflows/docker-build.yml 2026-03-09 13:22:58 +00:00
cal
81ae847da2 Update .gitea/workflows/docker-build.yml 2026-03-09 13:22:58 +00:00
cal
8c0ac3776c Update .gitea/workflows/docker-build.yml 2026-03-09 13:22:58 +00:00
Cal Corum
755f74be92 fix: Address PR review findings — two bugs and cleanup
- Fix int_timestamp() no-arg path returning seconds instead of
  milliseconds, which would silently break the daily scout token cap
  against the real API
- Acknowledge double-click interactions with ephemeral message instead
  of silently returning (Discord requires all interactions to be acked)
- Reorder scout flow: create card copy before consuming token so a
  failure doesn't cost the player a token for nothing
- Move build_scouted_card_list import to top of scout_view.py
- Remove unused asyncio import from helpers/scouting.py
- Fix footer text inconsistency ("One scout per player" everywhere)
- Update tests for new operation order and double-click behavior

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 13:22:58 +00:00
Cal Corum
3c0fa133fd refactor: Consolidate scouting utilities, add test suite, use Discord timestamps
- Consolidate SCOUT_TOKENS_PER_DAY and get_scout_tokens_used() into
  helpers/scouting.py (was duplicated across 3 files)
- Add midnight_timestamp() utility to helpers/utils.py
- Remove _build_scouted_ids() wrapper, use self.claims directly
- Fix build_scout_embed return type annotation
- Use Discord <t:UNIX:R> relative timestamps for scout window countdown
- Add 66-test suite covering helpers, ScoutView, and cog

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 13:22:58 +00:00
Cal Corum
2d5bd86d52 feat: Add Scouting feature (Wonder Pick-style social pack opening)
When a player opens a pack, a scout opportunity is posted to #pack-openings
with face-down card buttons. Other players can blind-pick one card using
daily scout tokens (2/day), receiving a copy. The opener keeps all cards.

New files:
- discord_ui/scout_view.py: ScoutView with dynamic buttons and claim logic
- helpers/scouting.py: create_scout_opportunity() and embed builder
- cogs/economy_new/scouting.py: /scout-tokens command and cleanup task

Modified:
- helpers/main.py: Hook into open_st_pr_packs() after display_cards()
- paperdynasty.py: Register scouting cog

Requires new API endpoints in paper-dynasty-database (scout_opportunities).
Tracks #44.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 13:22:58 +00:00
cal
a1b0e676c2 Merge pull request 'fix: exclude utilities/supabase.py from production Docker image (#41)' (#51) from ai/paper-dynasty-discord-41 into main
All checks were successful
Build Docker Image / build (push) Successful in 1m20s
Reviewed-on: #51
2026-03-07 07:38:18 +00:00
Cal Corum
9f6ec947e1 fix: exclude utilities/supabase.py from production Docker image (#41)
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m15s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-04 23:01:49 -06:00
cal
4781ec11db Merge pull request 'fix: add explicit .gitignore entry for service-creds.json (#40)' (#43) from ai/paper-dynasty-discord-40 into main
All checks were successful
Build Docker Image / build (push) Successful in 51s
Reviewed-on: #43
2026-03-03 22:09:09 +00:00