picks_form swallows every IntegrityError as a duplicate submission #438

Closed
opened 2026-08-31 16:42:58 +02:00 by johnsturgeon · 0 comments
Owner
    try:
        session.commit()
    except sqlalchemy.exc.IntegrityError:
        # Race condition: concurrent submission passed the earlier check
        session.rollback()

The comment describes uq_playergamepick_player_game, but the handler catches every constraint on the table — NOT NULLs and uq_one_lock_per_week included — then renders the success template.

That is how the missing week_id went unnoticed: every pick failed the NOT NULL check, rolled back as a "race", and the page said it worked.

Narrow it to the unique constraint, or at minimum log before swallowing.

```python try: session.commit() except sqlalchemy.exc.IntegrityError: # Race condition: concurrent submission passed the earlier check session.rollback() ``` The comment describes `uq_playergamepick_player_game`, but the handler catches every constraint on the table — NOT NULLs and `uq_one_lock_per_week` included — then renders the success template. That is how the missing `week_id` went unnoticed: every pick failed the NOT NULL check, rolled back as a "race", and the page said it worked. Narrow it to the unique constraint, or at minimum log before swallowing.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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
johnsturgeon/tgfp-web#438
No description provided.