Commit Graph

473 Commits

Author SHA1 Message Date
cal
1c3ef0935e Merge pull request 'fix: remove hardcoded master_debug flag from api_calls.py (#28)' (#58) from ai/paper-dynasty-discord-28 into next-release
All checks were successful
Build Docker Image / build (push) Successful in 1m5s
Build Docker Image / build (pull_request) Successful in 1m33s
Reviewed-on: #58
2026-03-07 07:43:41 +00:00
cal
3131adaf76 Merge pull request 'fix: catch aiohttp.ClientError in all API call functions (#29)' (#57) from ai/paper-dynasty-discord-29 into next-release
Some checks failed
Build Docker Image / build (push) Has been cancelled
Reviewed-on: #57
2026-03-07 07:43:03 +00:00
cal
5bd538bb6f Merge pull request 'fix: remove duplicate sheets.open_by_key() call in get_full_roster_from_sheets (#30)' (#56) from ai/paper-dynasty-discord-30 into next-release
Some checks failed
Build Docker Image / build (push) Has been cancelled
Reviewed-on: #56
2026-03-07 07:42:25 +00:00
cal
25bae26f1e Merge pull request 'fix: invoke actual cog callback in test_error_handling_and_logging (#39)' (#54) from ai/paper-dynasty-discord-39 into next-release
All checks were successful
Build Docker Image / build (push) Successful in 46s
Reviewed-on: #54
2026-03-07 07:41:28 +00:00
cal
a1cee6cfa3 Merge pull request 'fix: remove cogs/players.py.backup from repository (#35)' (#53) from ai/paper-dynasty-discord-35 into next-release
All checks were successful
Build Docker Image / build (push) Successful in 1m19s
Reviewed-on: #53
2026-03-07 07:38:56 +00:00
Cal Corum
9d1993bf49 fix: remove hardcoded master_debug flag from api_calls.py (#28)
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-07 01:33:09 -06:00
Cal Corum
d150e66bc7 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-07 01:33:09 -06:00
Cal Corum
ceff1bcb9b 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-07 01:33:09 -06:00
Cal Corum
7b76b429a8 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-07 01:33:09 -06:00
Cal Corum
fb6b609d09 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-07 01:33:09 -06:00
Cal Corum
da55cbe4d4 feat: limit scouting to Standard/Premium packs, simplify scout view
All checks were successful
Build Docker Image / build (push) Successful in 1m17s
- 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-06 21:12:46 -06:00
Cal Corum
e160be4137 fix: add missing pack, description, image fields to scouting test fixtures
All checks were successful
Build Docker Image / build (push) Successful in 51s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 18:47:52 -06:00
Cal Corum
8e605c2140 fix: add pack_id to scouted card creation, enhance embed with card links
All checks were successful
Build Docker Image / build (push) Successful in 1m16s
- 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-06 13:22:57 -06:00
Cal Corum
77c3f3004c fix: align scouting rarity symbols with system colors
All checks were successful
Build Docker Image / build (push) Successful in 1m22s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 13:03:15 -06:00
Cal Corum
ed00a97c0d fix: update owner_only to use Cal's correct Discord ID
All checks were successful
Build Docker Image / build (push) Successful in 1m22s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 15:57:25 -06:00
cal
0aafc3fa46 Merge pull request 'feat: Scouting feature (Wonder Pick-style social pack opening)' (#50) from feature/scouting into next-release
All checks were successful
Build Docker Image / build (push) Successful in 2m51s
Reviewed-on: #50
2026-03-05 03:17:07 +00:00
cal
0ce0707e3e Update .gitea/workflows/docker-build.yml 2026-03-05 03:16:36 +00:00
cal
75b9968149 Update .gitea/workflows/docker-build.yml 2026-03-05 03:15:37 +00:00
cal
89f80727bd Update .gitea/workflows/docker-build.yml 2026-03-05 03:12:20 +00:00
Cal Corum
d569e91905 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-05 03:04:53 +00:00
Cal Corum
d538c679c3 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-05 03:04:53 +00:00
Cal Corum
14103e48b7 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-05 03:04:53 +00: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
Cal Corum
4f691d7aeb fix: add explicit .gitignore entry for service-creds.json (#40)
All checks were successful
Build Docker Image / build (pull_request) Successful in 2m46s
Verified via `git ls-files storage/` that no storage files are tracked.
The existing `storage*` pattern already covers the directory, but adding
an explicit entry for `storage/paper-dynasty-service-creds.json` makes
the intent clear for this sensitive Google Sheets service credential file.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 12:36:26 -06:00
cal
3a32e52971 Merge pull request 'ci: Fix act_runner auth for composite actions' (#17) from ci/fix-action-auth into main
All checks were successful
Build Docker Image / build (push) Successful in 51s
Reviewed-on: #17
2026-02-18 19:48:13 +00:00
Cal Corum
ce9d5ab4bf Fix act_runner auth: short-form local actions + full GitHub URLs
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m21s
DEFAULT_ACTIONS_URL=self requires local actions use short form
(cal/gitea-actions/...) so the runner passes its auth token, and
GitHub actions use full URLs (https://github.com/...) to bypass
local resolution.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 13:32:12 -06:00
cal
3bf7c5cd04 Merge pull request 'ci: switch to CalVer with API-based tagging' (#16) from ci/calver into main
All checks were successful
Build Docker Image / build (push) Successful in 50s
Reviewed-on: #16
2026-02-17 23:17:51 +00:00
Cal Corum
24280032db ci: use Gitea API for tag creation instead of git push
Fixes tag step failing due to branch protection on main rejecting
the runner's git push. Creates tags via REST API which bypasses
branch protection. Also removes the unnecessary VERSION file commit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 23:17:51 +00:00
cal
8c13e00452 Merge pull request 'ci: Switch to CalVer versioning' (#15) from ci/calver into main
Some checks failed
Build Docker Image / build (push) Failing after 48s
Reviewed-on: #15
2026-02-17 23:12:48 +00:00
Cal Corum
d2a4b27ff3 ci: Switch to CalVer (YYYY.MM.BUILD) with auto-generated versions
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m22s
Remove manual semver validation from PR checks. Versions are now
auto-generated on merge to main by counting existing monthly tags.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 16:36:53 -06:00
Cal Corum
73353c2086 Add deployment details to CLAUDE.md (container name, logs, CI/CD)
Align production environment section with Major Domo's format:
container name, remote log command, co-hosted services, tea PR workflow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 19:05:16 -06:00
Cal Corum
b3220f0d25 Remove CLAUDE.md from .gitignore
CLAUDE.md should be tracked in version control.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 08:33:47 -06:00
Cal Corum
9d37e3a190 Optimize CLAUDE.md from 119 to 31 lines
Remove generated architecture docs, vague data flow sections, and boilerplate.
Keep commands, key patterns, and development notes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 08:33:47 -06:00
cal
4a06a80101 Merge pull request 'ci: switch Docker build cache to type=registry' (#14) from ci/registry-cache into main
All checks were successful
Build Docker Image / build (push) Successful in 2m58s
2026-02-11 22:14:25 +00:00
cal
0d60597022 ci: switch Docker build cache from type=gha to type=registry
Some checks failed
Build Docker Image / build (pull_request) Failing after 14s
The gha cache backend silently fails on Gitea Actions due to Docker
networking issues between the Buildx builder container and the
act_runner cache server. Registry-based caching stores layers on
Docker Hub, which is more reliable for self-hosted runners.
2026-02-11 22:12:26 +00:00
cal
066ee7d6f8 Merge pull request 'master' (#13) from master into main
All checks were successful
Build Docker Image / build (push) Successful in 48s
Reviewed-on: #13
2026-02-11 21:37:51 +00:00
cal
272ad102c0 Update VERSION
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m15s
2026-02-11 21:35:13 +00:00
Cal Corum
bc4daeece1 fix: unpack range() objects in pitcher error rating checks
range() objects were used directly in list membership checks instead of
being unpacked with *, causing all pitcher error ratings in range values
(roughly e27+) to silently fail during x-checks. Also fixed two range
boundary mismatches on dice 12 and dice 6.

Closes #12

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 15:33:37 -06:00
cal
128b669b85 Merge pull request 'fix: preserve batter at plate when half-inning ends on caught stealing' (#11) from fix/cs-batter-skip-1.9.1 into main
All checks were successful
Build Docker Image / build (push) Successful in 1m31s
2026-02-11 04:37:53 +00:00
Cal Corum
1eda66a06c fix: preserve batter at plate when half-inning ends on caught stealing
Some checks failed
Build Docker Image / build (pull_request) Failing after 15s
When a half-inning ended with a CS (or pickoff), the batter who was at
the plate was incorrectly skipped in the next inning. The side-switch
code unconditionally advanced the batting order by 1 without checking
whether the last play was a plate appearance. Now checks opponent_play.pa
before incrementing, matching the existing non-side-switch logic.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 22:37:42 -06:00
cal
df97b76294 Merge pull request 'fix/position-validation-lineup' (#10) from fix/position-validation-lineup into main
All checks were successful
Build Docker Image / build (push) Successful in 1m12s
Reviewed-on: #10
2026-02-11 04:15:44 +00:00
cal
0168279f6d Update VERSION
All checks were successful
Build Docker Image / build (pull_request) Successful in 2m20s
2026-02-11 04:12:42 +00:00
Cal Corum
1a9efa8f7e fix: add locked_play context manager to prevent stuck play locks
Early returns in log_chaos, log_sac_bunt, and log_stealing left play
locks permanently stuck because the lock was acquired but never released.
The new locked_play async context manager wraps checks_log_interaction()
and guarantees lock release on exception, early return, or normal exit.

Migrated all 18 locking commands in gameplay.py and removed redundant
double-locking in end_game_command.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 21:54:44 -06:00
cal
a0b5feebf7 Merge pull request 'fix: validate player positions in lineup before game start' (#9) from fix/position-validation-lineup into main
All checks were successful
Build Docker Image / build (push) Successful in 1m20s
Reviewed-on: #9
2026-02-08 03:17:21 +00:00
cal
a79bfbe6eb Update VERSION
All checks were successful
Build Docker Image / build (pull_request) Successful in 5m27s
2026-02-08 03:03:50 +00:00
Cal Corum
c4577ed46f fix: validate player positions in lineup before game start
Some checks failed
Build Docker Image / build (pull_request) Failing after 16s
Prevents PositionNotFoundException from crashing mlb-campaign when a
player is placed at a position they cannot play (e.g. an outfielder
listed at Catcher in the Google Sheet). Adds early validation in
get_lineups_from_sheets and proper error handling at all read_lineup
call sites so the user gets a clear message and the game is cleaned up.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 19:32:27 -06:00
cal
caabf9c6d2 Merge pull request 'master' (#8) from master into main
All checks were successful
Build Docker Image / build (push) Successful in 48s
Reviewed-on: #8
2026-02-04 15:41:29 +00:00
Cal Corum
a9fa2abbd1 Merge homelab/master - resolve VERSION conflict to 1.8.4
All checks were successful
Build Docker Image / build (pull_request) Successful in 44s
2026-02-04 09:40:00 -06:00
Cal Corum
aaca46d72f Merge branch 'main' of https://git.manticorum.com/cal/paper-dynasty-discord 2026-02-04 09:38:43 -06:00
Cal Corum
c98feea295 Merge branch 'master' 2026-02-04 09:38:18 -06:00