Skip to content

fix(soccer): look two weeks ahead for fixtures, matching the real fetch - #285

Open
ChuckBuilds wants to merge 1 commit into
mainfrom
fix/soccer-upcoming-horizon
Open

fix(soccer): look two weeks ahead for fixtures, matching the real fetch#285
ChuckBuilds wants to merge 1 commit into
mainfrom
fix/soccer-upcoming-horizon

Conversation

@ChuckBuilds

Copy link
Copy Markdown
Owner

Fixes the user report: Manchester United never appearing, and only Arsenal v Coventry showing when favourites were turned off.

The bug

Two windows in the same code path disagreed:

horizon role
_fetch_soccer_api_data −14d … +14d the real fetch, cached
_get_weeks_data −2w … +7d the partial returned while that runs

The partial exists to stand in for the full fetch, so a fixture inside the real window was missing from the board until the background fetch landed.

That gap is invisible in a league that plays daily, and severe in one that plays weekly — a whole matchweek can fall inside it. Reproduced against ESPN on 2026-08-14:

-2w..+1w   20260731-20260821  ->   1 event    COV @ ARS (21 Aug)
-2w..+4w   20260731-20260911  ->  30 events   MAN @ HUL (22 Aug), CRY @ EVE,
                                              SUN @ IPS, LEE @ NFO, TOT @ BRE ...

The Premier League's opening matchweek was 21–24 August. A +7d horizon on the 14th caught the Friday opener and hid the other nine fixtures — which is exactly the single game the user described seeing, and exactly why their favourite team never appeared.

The fix

Both horizons come from one pair of module constants, so the partial cannot silently end up narrower than the fetch it substitutes for again.

Verification

The test reads the full fetch's span out of soccer_managers.py via the AST and requires the partial to be at least as wide, rather than hard-coding either number — so widening one and forgetting the other fails the test. It also pins the reported case as dates rather than a live API call, keeping it deterministic: a fixture 8 days out must be covered, and must not have been at the old +7d horizon.

Mutation-checked: reverting the horizon, re-hardcoding the window in _get_weeks_data, and narrowing the back-window are all caught.

Safety harness clean; soccer's other tests pass.

Not addressed here

The same reporter raised two other issues. Baseball going blank after changing recent-games 5→1 is not explained by this — recent_games_to_show is scoped to the recent mode and cannot affect upcoming or live, and baseball passes the empty-mode regression test. Their third report (live-mode toggle blanking the board) is plausibly this same thin schedule seen through live priority, but I have not confirmed that chain and am not claiming it.

Reported by a user: Manchester United never appeared even though their
next fixture was 22 August, and with favourites turned off the board
showed exactly one Premier League game, Arsenal v Coventry.

_get_weeks_data() is the partial that serves the display until the
background fetch lands. It looked ahead seven days; _fetch_soccer_api_data(),
the fetch it substitutes for, looks ahead fourteen. So a fixture inside
the real window was simply missing from the board.

That gap is invisible in a league that plays daily and severe in one that
plays weekly, where a whole matchweek can fall inside it. Reproduced
against ESPN on 2026-08-14:

  -2w..+1w  20260731-20260821 ->  1 event   (COV @ ARS, the 21st)
  -2w..+4w  20260731-20260911 -> 30 events  (MAN @ HUL on the 22nd, ...)

The Premier League's opening matchweek was 21-24 August, so a +7d horizon
caught the Friday opener and hid the other nine fixtures -- exactly the
single game the user described.

Both horizons now come from one pair of module constants, so the partial
cannot silently end up narrower than the fetch it stands in for again.
The test reads the full fetch's span out of soccer_managers.py and
requires the partial to be at least as wide, rather than hard-coding
either number.

Mutation-checked: reverting the horizon, re-hardcoding the window in
_get_weeks_data, and narrowing the back-window are all caught.

Harness clean; soccer's other tests pass.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Udr6MfaFLUPhX5Fgo67Jf5
@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Important

Review available on request

  • 🔍 Trigger review

Reviews should be triggered manually for repositories with fewer than 10 stars. Select Trigger review above or comment @coderabbitai review to review the latest changes. For a full review, comment @coderabbitai full review.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9a38841f-2353-4f32-afe8-9c7fec824980


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 25 complexity

Metric Results
Complexity 25

View in Codacy

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants