Fix play lock system to prevent permanent user lockouts #7

Merged
cal merged 3 commits from master into main 2026-02-04 15:27:35 +00:00
Owner

CRITICAL BUG FIX: Play locks were never released on exceptions, causing
permanent user lockouts. Found 13 stuck plays in production.

Changes:

  1. Added lock_play parameter to checks_log_interaction() (default True)
  2. Removed unnecessary locks from read-only commands:
    • /settings-ingame (game settings, not play state)
    • /show-card defense (read-only display)
    • /substitute commands (just show UI, lock in callback)
  3. Added safe_play_lock() context manager for automatic lock release
  4. Added play locking to substitution callbacks:
    • SelectBatterSub.callback()
    • SelectReliefPitcher.callback()
  5. Global error handler now releases stuck locks automatically

Architecture:

  • Commands that display UI or read data: No lock
  • Commands that modify play state: Lock at last possible moment
  • 3-layer defense: manual release, context manager, global handler

Resolves race condition from concurrent play modifications.

Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com

CRITICAL BUG FIX: Play locks were never released on exceptions, causing permanent user lockouts. Found 13 stuck plays in production. Changes: 1. Added lock_play parameter to checks_log_interaction() (default True) 2. Removed unnecessary locks from read-only commands: - /settings-ingame (game settings, not play state) - /show-card defense (read-only display) - /substitute commands (just show UI, lock in callback) 3. Added safe_play_lock() context manager for automatic lock release 4. Added play locking to substitution callbacks: - SelectBatterSub.callback() - SelectReliefPitcher.callback() 5. Global error handler now releases stuck locks automatically Architecture: - Commands that display UI or read data: No lock - Commands that modify play state: Lock at last possible moment - 3-layer defense: manual release, context manager, global handler Resolves race condition from concurrent play modifications. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
cal added 1 commit 2026-02-04 15:22:19 +00:00
CRITICAL BUG FIX: Play locks were never released on exceptions, causing
permanent user lockouts. Found 13 stuck plays in production.

Changes:
1. Added lock_play parameter to checks_log_interaction() (default True)
2. Removed unnecessary locks from read-only commands:
   - /settings-ingame (game settings, not play state)
   - /show-card defense (read-only display)
   - /substitute commands (just show UI, lock in callback)
3. Added safe_play_lock() context manager for automatic lock release
4. Added play locking to substitution callbacks:
   - SelectBatterSub.callback()
   - SelectReliefPitcher.callback()
5. Global error handler now releases stuck locks automatically

Architecture:
- Commands that display UI or read data: No lock
- Commands that modify play state: Lock at last possible moment
- 3-layer defense: manual release, context manager, global handler

Resolves race condition from concurrent play modifications.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
cal added 1 commit 2026-02-04 15:24:25 +00:00
Merge remote-tracking branch 'homelab/main'
Some checks failed
Build Docker Image / build (pull_request) Failing after 24s
48c86e54fd
cal added 1 commit 2026-02-04 15:25:20 +00:00
Update VERSION
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m15s
5233c04e17
cal merged commit d181ee6201 into main 2026-02-04 15:27:35 +00:00
cal deleted branch master 2026-02-04 15:27:48 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/paper-dynasty-discord#7
No description provided.