fix: validate player positions in lineup before game start #9
No reviewers
Labels
No Label
ai-changes-requested
ai-failed
ai-pr-opened
ai-reviewed
ai-reviewing
ai-working
ai-working
bug
enhancement
feature
in-queue
performance
security
tech-debt
todo
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/paper-dynasty-discord#9
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/position-validation-lineup"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary- Adds early position validation in
get_lineups_from_sheetsthat checks a player's pos_1-pos_8 fields against the assigned lineup position before the game starts- Wrapsget_positioncalls inread_lineupwith properPositionNotFoundExceptionhandling for a safety net- CatchesPositionNotFoundExceptionat all 3read_lineupcall sites incogs/gameplay.py, deactivates the game on failure, and sends a clear error message to the user## ContextA user reported:PositionNotFoundException: C ratings not found for 2024 Aaron Judge— their Google Sheet had an outfielder (Aaron Judge) listed at Catcher. Previously this crashed the command and left the game stuck in an active state with no plays.## Changes-command_logic/logic_gameplay.py: Position validation inget_lineups_from_sheets+ error handling inread_lineup-cogs/gameplay.py:PositionNotFoundExceptionhandling at mlb-campaign, gauntlet, and set-lineup call sites## Test plan- [ ] Start an mlb-campaign with a player at an invalid position → should get a clear error and game should be deactivated- [ ] Start an mlb-campaign with valid positions → should work as before- [ ] DH position should not be validated (any player can DH)