A game that misses its live window can never reach FINAL #442

Closed
opened 2026-09-01 19:02:30 +02:00 by johnsturgeon · 0 comments
Owner

_in_live_window measures from the scheduled kickoff:

        not game.is_final
        and game.utc_start_time - lead <= now <= game.utc_start_time + tail

with lead 5 minutes and tail 5 hours. Rule 7 is the only caller of
update_scores_current_week, so once that window closes a game can never
reach FINAL.

Two ways in

Bootstrapping into the past. A week whose games have already been played
gets its rows inserted with insert_game's default of SCHEDULED, and the
window is already shut. Confirmed on production after the Aug 2026 rebuild:
preseason week 4, all 16 games SCHEDULED, week stuck at PREGAME, and no
update_scores_current_week row in jobstate at all.

A delayed kickoff. NFL games slip for weather and for the game before them,
and start_time does not move when they do. A 90-minute delay plus a 3.5-hour
game puts the final whistle outside a 5-hour tail measured from the scheduled
start.

What it costs

The game never settles, so the week never reaches ALL_FINAL. Rule 5 then
re-fetches the schedule every 45 minutes forever, and rules 8 and 9 never fire
for that week -- no record recalculation, no awards.

Shape of the fix

The window is the wrong guard for catching up. It answers "is this game
probably live right now", which is right for the 5-minute cadence but wrong as
the only path to a final score.

Something like: while the week is not ALL_FINAL and any game is
started-but-unsettled, poll on a slow cadence -- the existing watermark
machinery already gives a natural way to express that without re-running every
tick. Keep the fast window for games actually in progress.

Note this is the scores half of the same shape as #435, which is the odds half:
both rules only reconcile forward, and neither can recover a week that arrived
after the moment it was watching for.

Urgency

Before Tank01 rolls getNFLCurrentInfo to regular-season week 1. Any week
created mid-flight, or any deploy onto a fresh database during a game day, lands
in the first case.

`_in_live_window` measures from the scheduled kickoff: ```python not game.is_final and game.utc_start_time - lead <= now <= game.utc_start_time + tail ``` with `lead` 5 minutes and `tail` 5 hours. Rule 7 is the only caller of `update_scores_current_week`, so once that window closes a game can never reach `FINAL`. ## Two ways in **Bootstrapping into the past.** A week whose games have already been played gets its rows inserted with `insert_game`'s default of `SCHEDULED`, and the window is already shut. Confirmed on production after the Aug 2026 rebuild: preseason week 4, all 16 games `SCHEDULED`, week stuck at `PREGAME`, and no `update_scores_current_week` row in `jobstate` at all. **A delayed kickoff.** NFL games slip for weather and for the game before them, and `start_time` does not move when they do. A 90-minute delay plus a 3.5-hour game puts the final whistle outside a 5-hour tail measured from the scheduled start. ## What it costs The game never settles, so the week never reaches `ALL_FINAL`. Rule 5 then re-fetches the schedule every 45 minutes forever, and rules 8 and 9 never fire for that week -- no record recalculation, no awards. ## Shape of the fix The window is the wrong guard for catching up. It answers "is this game probably live right now", which is right for the 5-minute cadence but wrong as the *only* path to a final score. Something like: while the week is not `ALL_FINAL` and any game is started-but-unsettled, poll on a slow cadence -- the existing watermark machinery already gives a natural way to express that without re-running every tick. Keep the fast window for games actually in progress. Note this is the scores half of the same shape as #435, which is the odds half: both rules only reconcile forward, and neither can recover a week that arrived after the moment it was watching for. ## Urgency Before Tank01 rolls `getNFLCurrentInfo` to regular-season week 1. Any week created mid-flight, or any deploy onto a fresh database during a game day, lands in the first case.
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#442
No description provided.