We now log what happened, and raise #449
No reviewers
Labels
No labels
Kestra
bug
enhancement
someday
subtask
☁️ api
🎛️ infrastructure
🐞 sentry
📆 2025 Season
📝 pages
allpicks
📝 pages
picks
📝 pages
standings
🚀 performance
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
johnsturgeon/tgfp-web!449
Loading…
Reference in a new issue
No description provided.
Delete branch "picks-form-swallows-every-integrityerror-as-a-duplicate-submission-438"
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?
Resolves #438
I now have a complete picture. Let me write the review.
Review
This is a small, well-targeted change that replaces a silently-swallowed
IntegrityErrorwith a "log-and-raise for genuine failures, render success only for a real concurrent-submission race" split, resolving #438. The logic is correct and matches the intent; my only substantive concern is that the new behavior is entirely untested, plus a couple of nits.Worth fixing
app/main.py:441-449). The route'sexcept IntegrityErrorbranch is effectively unreachable through validated form input — a submitted pick for a started game is rejected earlier by_picks_not_valid(app/main.py:207), and malformed values are zeroed by_form_int's.isdigit()check (app/main.py:354) and caught as missed picks, soTestAMalformedSubmissionandTestAStaleFormnever actually reach the commit failure their docstrings describe. That means the newraisepath and the benign-race fall-through are both new, load-bearing behavior with zero coverage. Consider a test that forces the failure (e.g. monkeypatchsession.committo raiseIntegrityError, or seed a conflicting row) and asserts: (a) with no existing picks → the request raises / returns 500, and (b) with picks already present for the week → the success page renders and nothing is re-raised. While there, the stale docstrings onTestAMalformedSubmission/TestAStaleFormclaiming they exercise theIntegrityErrorcatch are now doubly misleading and could be corrected.Nits
app/main.py:447).week.season_typerenders as e.g.2;Week.season_type_name(app/models/week.py:50) exists and yields a readable label (pre/reg/post). Using it would make the Sentry message self-explanatory.app/main.py:445-449). Withenable_logs=Truethesentry_logger.error(...)sends a structured log, and the subsequentraisewill also surface theIntegrityErroras an event via the ASGI integration. That's harmless and arguably intentional (the log adds the player/week context the bare exception lacks), just worth being aware of.The version bump to
2.21.1and thepsycopg3.3.4 → 3.3.5patch (with a consistentuv.lockupdate) follow the project conventions correctly.