Rule 3 locks the odds on a week added after its own Wednesday #435
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
johnsturgeon/tgfp-web#435
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Dispatcher rule 3 flips
odds_statePRELIMINARY -> LOCKED as soon asweek.utc_lock_odds_atis in the past, and it is evaluated before rule 4 (fetch odds).So a week first inserted after its own Wednesday 6am Pacific locks immediately and never fetches odds. Every game keeps the insert defaults: home favored, spread 0.0.
Normally
fetch_new_week_if_existsadds a week days ahead of the lock instant, so this does not bite. It bites on a cold start against an emptyweektable -- which is exactly what a rebuilt production database is.Bites: first boot on a fresh database mid-week, or any week added late.
Confirmed in production, 2026-08-31
The rebuild-and-deploy landed mid-preseason-week-4:
update_odds_current_weekhas nojobstaterow at all -- it has never run. Harmless here (preseason, nobody picks), and it should self-correct for regular-season week 1, which gets created days before its Wednesday.Note that flipping the week back to PRELIMINARY does not help: rule 3 re-locks it on the next tick before rule 4 is ever reached.
Second half: the write barrier is only in the dispatcher
update_odds_current_weekdoes not checkodds_stateitself -- rule 4's guard is the only thing preventing a locked week's spreads from being overwritten. Anything that invokes the job directly (an admin button, a manual run, a future caller) bypasses the barrier entirely.The guard belongs in the job as well as the rule.
Closing: accepted risk.
The week has to first appear in the database after the Wednesday 6am Pacific
preceding its own first kickoff. That needs either a mid-week database rebuild
or
fetch_new_week_if_existsbeing down from Tuesday through Wednesdaymorning. If the week row exists before its Wednesday -- which is every normal
week -- rule 3 stays false for a day or more and rule 4 fetches odds hourly
throughout.
Observed once, on the 2026-08-31 production rebuild, against a preseason week
nobody picks.
Recovery if it ever does happen: the week has no picks yet, so setting
odds_stateback toPRELIMINARYby hand is legal (see theOddsStatedocstring) and rule 4 picks it up on the next tick.