fix(hockey): derive the ESPN season window instead of pinning it to 2025-26 - #324
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 25 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
98e0f3c to
8dc588f
Compare
Continuing the season-readiness sweep from #324 across the other sports plugins. The WNBA window was: # WNBA season typically runs from May to September datestring = f"{season_year}0501-{season_year}0930" The regular season does end in September. The playoffs and Finals do not -- 2024's Finals ended on 20 October, 2025's in mid-October. Both fetch calls pass this string as `dates=` and there is no date-less fallback, so no postseason game was ever fetched: the scoreboard went blank exactly when the games matter most. The window now closes on 1 November. Timing: the 2026 regular season ends in early September and the postseason runs from mid-September into October, so this would have started dropping games within weeks. The other three leagues in this plugin were checked and are correct, so they are covered by the test rather than changed: NBA 1 October start, flips on 1 October, reaches the June Finals NCAA M/W no date window at all -- ESPN's `season` parameter, keyed to the year the season ENDS, flipping on 1 November ahead of the early-November openers Swept every other sports plugin for the same shape. Only hockey-scoreboard's data_fetcher.py had pinned dates, fixed separately in #324; MLB, MiLB, NFL, NCAA FB and NCAA hockey all derive their windows correctly and cover their postseasons. Tests: 6 of the new checks fail against the previous window. Suite 12 passed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01STMbQE4YctTacQXfbYqKuW
|
Force-pushed to correct the branch scope — worth flagging since the history changed. This branch had picked up four commits that don't belong to it (#322's soccer registry fix and #323's youtube-stats fix). My mistake: an earlier merge-order test ran Nothing was wrong with the code — all four PRs were green — but merging this one would have silently merged #322 and #323 with it. The branch is now a single commit on top of |
…025-26
Season-readiness check ahead of the NFL and NHL openers.
_get_season_date_range computed `now` and then ignored it, building its range
from literal datetimes:
now = datetime.now() # never used
season_start = datetime(2025, 10, 1)
season_end = datetime(2026, 6, 30)
The result goes straight into the request as `?dates={range}`, so once the
2026-27 season opened this would have kept asking ESPN for last season's
window. It now derives the year with the same August rollover rule
nhl_managers.py uses, so the two agree on which season is current rather than
drifting apart.
Reachability, stated plainly: data_fetcher.py is imported only by
debug_tb_games.py, so this is not on the runtime path today -- the live
fetchers (nhl_managers.py and the two NCAA managers) already derive their
windows correctly. It is still worth fixing: the committed debug script would
have pulled the wrong season, and anyone wiring this module back in inherits a
bug that only shows up once a year.
Also removes a function-local `from datetime import datetime`. The module
already imports it, and the local one shadowed it -- patching the module
attribute had no effect, which is why the derivation could not be tested.
Adds test_season_date_range.py: the window follows the calendar across the
July/August boundary and rolls again the next year, NCAA ends in March rather
than June, an unknown league still gets a current window, and no literal
season year survives in the range builder. 9 of its checks fail against the
previous code.
Also adds test_empty_mode_signals_no_content.py to football-scoreboard, which
had no equivalent of hockey's guard. The two ship separate forks of sports.py,
so a fix in one lineage does not reach the other, and the failure it guards --
an empty mode reporting success and sitting on a blank panel for its whole
duration -- is exactly the state both plugins are in right now, before their
openers. Confirmed it catches the regression: making SportsRecent.display
return None fails 3 checks.
Football needs no version bump; CI excludes root-level test_*.py from the
gate, and nothing shipped changed there.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01STMbQE4YctTacQXfbYqKuW
#316 merged and set hockey-scoreboard to 1.13.4 without adding a changelog entry, so rebasing this branch left both claiming the same version and the version-bump gate failed. Moves this change to 1.13.5 and realigns the changelog with it. Note 1.13.4 still has no entry of its own; that is #316's to fill, not mine to invent. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01STMbQE4YctTacQXfbYqKuW
8dc588f to
04e9d84
Compare
Continuing the season-readiness sweep from #324 across the other sports plugins. The WNBA window was: # WNBA season typically runs from May to September datestring = f"{season_year}0501-{season_year}0930" The regular season does end in September. The playoffs and Finals do not -- 2024's Finals ended on 20 October, 2025's in mid-October. Both fetch calls pass this string as `dates=` and there is no date-less fallback, so no postseason game was ever fetched: the scoreboard went blank exactly when the games matter most. The window now closes on 1 November. Timing: the 2026 regular season ends in early September and the postseason runs from mid-September into October, so this would have started dropping games within weeks. The other three leagues in this plugin were checked and are correct, so they are covered by the test rather than changed: NBA 1 October start, flips on 1 October, reaches the June Finals NCAA M/W no date window at all -- ESPN's `season` parameter, keyed to the year the season ENDS, flipping on 1 November ahead of the early-November openers Swept every other sports plugin for the same shape. Only hockey-scoreboard's data_fetcher.py had pinned dates, fixed separately in #324; MLB, MiLB, NFL, NCAA FB and NCAA hockey all derive their windows correctly and cover their postseasons. Tests: 6 of the new checks fail against the previous window. Suite 12 passed. Claude-Session: https://claude.ai/code/session_01STMbQE4YctTacQXfbYqKuW Co-authored-by: Claude <noreply@anthropic.com>
Season-readiness pass over
football-scoreboardandhockey-scoreboardahead of the openers (NFL ~Sept 10, NHL ~Oct 7). Most of what I checked is already correct — details at the bottom — but two things were worth changing.The pinned season window
hockey-scoreboard/data_fetcher.py::_get_season_date_rangecomputednowand then ignored it:That string goes straight into the request as
?dates={range}, so once the 2026-27 season opened it would have kept asking ESPN for last season. It now derives the year with the same August rollover rulenhl_managers.pyalready uses, so the two agree on which season is current instead of drifting apart:20251001-2026063020251001-2026063020251001-2026063020261001-2027063020251001-2026063020261001-2027063020251001-2026063020271001-20280630Reachability, stated plainly:
data_fetcher.pyis imported only bydebug_tb_games.py, so this is not on the runtime path today — the live fetchers already derive their windows correctly. I still think it's worth fixing: the committed debug script would pull the wrong season, and anyone wiring the module back in inherits a bug that surfaces once a year.Writing the test also turned up a function-local
from datetime import datetimeshadowing the module import. Patching the module attribute had no effect, which is precisely why this couldn't be tested before.The missing football guard
hockey-scoreboardhastest_empty_mode_signals_no_content.py, added after the bug where an empty mode reported success and sat on a blank panel for its full duration.football-scoreboardhad no equivalent — and the two ship separate forks ofsports.py, so a fix in one lineage never reaches the other.That failure mode is exactly the state both plugins are in right now: pre-season, with
recentandliveempty whileupcomingfills in. Confirmed the new test catches it — makingSportsRecent.displayreturnNonefails 3 checks.Football's fork also overrides
display()onSportsLive, which hockey's doesn't. Its only non-delegating paths arereturn False(disabled) andreturn True(celebration); the empty case falls through tosuper().display(). SoSportsLivegets a targeted disabled-path check rather than being forced through the stand-in, which can't satisfysuper().What I checked that was already fine
nfl_managers.pyandnhl_managers.pyderive dynamically and both flipped on 2026-08-01. NFL now requests20260801-20270301(covers a ~Feb 2027 Super Bowl); NHL20260901-20270801(covers a June 2027 Cup).checkbox-groupandcolor-picker, both registered in the web UI.f"{mode_type}_mode_duration",f"{result}_color"), via helpers taking the key as a parameter (_scroll_card_option), and via hockey's nested→flatresolve_value(["teams","favorite_teams"], ["favorite_teams"])all look unwired to a naive scan. I chased each one to the call site rather than trusting the counts.Nonefall-throughs in either plugin'sdisplay()or its delegates.One thing left, for you
hockey.defaults.season_cache_duration_seconds(also inlacrosse-scoreboard) is declared withx-advanced, a default of 86400 and min/max bounds — and is read nowhere in either repo. It's a knob users can set that does nothing. Removing it is a user-facing schema change, so I've left it; say the word and I'll drop it from both.football-scoreboard'sversion(2.19.1) andversions[0](2.18.1) are drifted, one of the eight I flagged on #314. Not touched here since nothing shipped changed in that plugin.Verification
football 16 passed, hockey 12 passed (up from 15 and 11). The season test fails 9 checks against the previous code.
Not verified on hardware — both rigs have been unreachable all day.
🤖 Generated with Claude Code
https://claude.ai/code/session_01STMbQE4YctTacQXfbYqKuW