Skip to content

fix(sports): scroll and Vegas cards name the printed date's own weekday - #747

Merged
ChuckBuilds merged 1 commit into
mainfrom
fix/sports-card-weekday
Oct 4, 2026
Merged

ChuckBuilds merged 1 commit into
mainfrom
fix/sports-card-weekday

Conversation

@ChuckBuilds

Copy link
Copy Markdown
Owner

Summary

Scroll and Vegas game cards showed the wrong weekday for evening games in the Americas.

  • Symptom: with scroll_card.date_format = "weekday", a Friday 8:00 PM ET game (00:00 UTC Saturday) rendered as "Sat Oct 2".
  • Cause:
    • The plugin prints "M/D" in its resolved timezone: its own setting, else the global one, else the system zone.
    • The card cannot see that zone. It gets the plugin's raw config, whose timezone ships as "", so card_tzinfo falls back to UTC.
    • The full-screen scorebug was right; only the cards were wrong.

Fix

  • Why the date can be pinned down: every zone is within a day of UTC, so the printed date is the start's UTC date or one of its neighbours.
  • What the card does now: it picks whichever of those three days has the printed month and day, and shows that day's weekday. This is exact whichever zone printed the date, with no plugin changes. The global LEDMatrix timezone, which the card has no handle on, is covered too.
  • When the start time can't place the date (no offset, unparseable, or more than a day away), the card keeps the old zone-based weekday.
  • The switch-mode scorebug passes the game in too, so the two formatters agree.
  • Pinned test: test_sports_twins.py::TestPinnedDivergence::test_weekday_zone_source changes as a deliberate decision. What a card draws now matches.
  • Plugins: all eight renderers go through sports_card.format_game_date or the mixin, so no plugin release is needed.

Tests

  • New: TestWeekdayMatchesThePrintedDate (18). The cases cover:
    • New York Friday evening;
    • the US DST end (both sides);
    • New Year's Eve in Los Angeles;
    • Pago Pago (UTC−11), Auckland on its DST start day, Kiritimati (UTC+14), London;
    • ISO strings, naive starts, and no usable start.
  • 10 of these fail on main.
  • test/test_*sports*.py: 849 passed. scripts/check_types.py: no issues.

Part of a bug sweep

This is one of 10 independent fix PRs from one sweep, all based on main ef69201.

  • Merge order: any. 45 pairwise test merges gave 0 conflicts, and each PR also merges cleanly with fix(ipc): ticks carry the volatile timestamps, so current-status stays known over the socket #737.
  • CHANGELOG: each PR adds its bullet at a different place in Unreleased → Fixes, so squash-merging them one after another needs no conflict fixing.
  • Full suite (Windows), all 10 merged together vs plain main: the same 62 failures and 6 errors on both. These are the known Windows path and file-locking tests. 191 more tests pass.
    • One extra failure in that run, test_backup_manager.py::test_create_backup_contents (os.replace → WinError 5 on a temp zip), was a Windows file-lock flake. It passes on rerun, and nothing here touches create_backup.
  • ledpi: all 10 together ran on ledpi (Pi 4) on top of main, with a clean start and no errors or render stalls in the journal. ledpi is back on plain main.

🤖 Generated with Claude Code

With scroll_card.date_format "weekday", a Friday 8 PM ET game read
"Sat Oct 2" on the scroll and Vegas cards.

Cause: the extractor prints the "M/D" in the plugin's resolved zone (its
own setting, then the global one, then the system zone), but the card is
handed only the plugin's config. Its timezone ships as "", so
card_tzinfo fell back to UTC and the weekday belonged to the UTC date:
the next day for evening games in the Americas, the previous day for
morning games east of UTC (Auckland, Kiritimati).

Fix: every zone is within a day of UTC, so the printed date is the
start's UTC date or a neighbour of it. _format_date_as now takes the game
and names the weekday of whichever of those days has the printed month
and day, falling back to the zone-based weekday only when the start
cannot place the date (no offset, unparseable, or more than a day away).
The switch-mode scorebug shares the formatter and passes the game too, so
the twins stay identical; it already used the resolved zone and draws
what it drew before. Public signatures are unchanged.

Tests cover US DST end, New Year's Eve, both sides of the date line, NZ
DST start and UTC+14. The twins test's weekday pin is updated: the drawn
date now agrees, and only the bare weekday helpers still differ.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 28 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3650da77-f448-400e-977c-98143cfd840b
📥 Commits

Reviewing files that changed from the base of the PR and between ef69201 and a5a125b.

📒 Files selected for processing (5)
  • CHANGELOG.md
  • src/common/sports_card.py
  • src/common/sports_shared.py
  • test/test_sports_card.py
  • test/test_sports_twins.py
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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 12 complexity

Metric Results
Complexity 12

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.

@ChuckBuilds
ChuckBuilds merged commit 07abd87 into main Oct 4, 2026
15 checks passed
@ChuckBuilds
ChuckBuilds deleted the fix/sports-card-weekday branch October 4, 2026 02:19
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.

1 participant