Repository navigation
fix(sports): honour every pending kickoff in the idle back-off, not just the first - #772
Conversation
…ust the first _note_scheduled_start_candidate kept one kickoff. While it was inside its 15-minute grace every later kickoff was refused, and by the time the grace ended the later one had passed and was refused again as already past. So of two favourites kicking off within 15 minutes of each other, the second lost its own grace: if the first game was not live by then (a rain delay, a postponement, ESPN slow to flip it) and ESPN had not flipped the second either, the back-off went straight back to its ceiling and the second game was noticed up to that late. Later kickoffs now wait in a short queue (_later_scheduled_starts, the earliest 8). When the current kickoff's grace ends, the earliest queued one still inside its own grace takes over -- including one that has already passed. A kickoff still holds the live cadence for at most its own grace, so a postponed game costs the same quarter of an hour as before, and _next_scheduled_start_ts keeps its meaning for anything that reads or sets it. The promotion is a module function, so the mixin's method set is unchanged. Table tests replay the idle loop on a fake clock over kickoff schedules; mutation-checked (the old code fails 10 of the new tests). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe sports live manager now queues up to eight scheduled kickoffs. When a kickoff’s grace period expires, the manager can promote the earliest queued kickoff that remains within its grace period. Regression tests cover queue selection, polling cadence, and live-game detection. ChangesSports kickoff queue
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The kickoff queue has no identified merge-blocking issue; merge after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change retains overlapping kickoffs without increasing polling speed or allowing unlimited queued state. No introduced security failure was established. Deployed plugin integration and concurrent access remain unverified, limiting confidence in the complete runtime assessment. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 41.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 2 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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 | 11 |
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.
What
_note_scheduled_start_candidate()kept a single kickoff. While that kickoff was inside its 15-minute grace, every later kickoff was refused (candidate < currentis false). Once the grace ended, the later kickoff had already passed, so it was refused again as "already past". The result: when two favourites kick off within 15 minutes of each other, the second one gets no grace of its own. If the first game isn't live by then (a rain delay, a postponement, or ESPN slow to flip it) and ESPN hasn't flipped the second game either, the back-off returns to its ceiling. The second game can then be noticed up to 15 minutes late.Fix
_later_scheduled_starts, which keeps the earliest 8._current_scheduled_start) promotes the earliest queued kickoff that is still inside its own grace. That can be one that has already passed. Queued kickoffs past their own grace are dropped._next_scheduled_start_tskeeps its meaning: it is the kickoff honoured now. Code that reads it or sets it by hand behaves as before. ufc'stest_idle_league_backoff.pydoes this, and it still passes against this branch, as do all nine plugins'test_idle_league_backoff.pyand football'stest_kickoff_wakes_the_idle_poll.py.test_stage3_mixin_copies.pyMOVED table needs no entry. There is no newsrc/module, socheck_min_core_version.pyneeds no entry either.Tests
TestLiveMixinintest/test_sports_shared.pygains these:test_every_pending_kickoff_gets_its_grace, a table of 8 schedules. Each one replays the idle loop on a fake clock: every look offers each game not yet live, then sleeps for whatever_idle_live_interval()returns. Every game must be seen live within one 30 s poll of going live. The rows cover:Mutation check:
Full suite on Windows, branch vs an origin/main worktree: the FAILED/ERROR id lists are identical (74 ids each, all pre-existing Windows failures). The branch has 12 more passes, which are the new tests. mypy 1.20.2:
scripts/check_types.pyreports only the pre-existingfetch_service.pyunused-ignore, which also fails on main locally.sports_shared.py(not on the ratchet) has the same error count as main.Related
Plugins PR (draft, stacked on #620) applies football 3.18.7's rule to the other eight scoreboards: a board offers only the kickoffs of games it would show. That PR and this one are independent; neither needs the other.
🤖 Generated with Claude Code
Summary by CodeRabbit