Commit Graph

467 Commits

Author SHA1 Message Date
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
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
cal
a8b8f59bff Update VERSION
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m11s
2026-02-04 15:35:58 +00:00
cal
7038924e56 Update VERSION
Some checks failed
Build Docker Image / build (pull_request) Failing after 15s
2026-02-04 15:34:14 +00:00
Cal Corum
89801e1d42 Fix circular import by moving play lock functions to separate module
HOTFIX: Production bot failed to start due to circular import.

Root cause: utilities/dropdown.py importing from command_logic/logic_gameplay.py
while logic_gameplay.py imports from utilities/dropdown.py.

Solution: Created play_lock.py as standalone module containing:
- release_play_lock()
- safe_play_lock()

Both modules now import from play_lock.py instead of each other.

Error message:
  ImportError: cannot import name 'release_play_lock' from partially
  initialized module 'command_logic.logic_gameplay' (most likely due
  to a circular import)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-04 09:33:37 -06:00
cal
d181ee6201 Merge pull request 'Fix play lock system to prevent permanent user lockouts' (#7) from master into main
All checks were successful
Build Docker Image / build (push) Successful in 51s
Reviewed-on: #7
2026-02-04 15:27:33 +00:00
cal
5233c04e17 Update VERSION
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m15s
2026-02-04 15:25:17 +00:00
Cal Corum
48c86e54fd Merge remote-tracking branch 'homelab/main'
Some checks failed
Build Docker Image / build (pull_request) Failing after 24s
2026-02-04 09:24:15 -06:00