镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

scoreboards: require core 3.7.0; use its celebration, fetch and card-wrapper mixins (stage 3) - #574

Merged
ChuckBuilds merged 4 commits into
mainfrom
claude/sports-stage3-adopt
Sep 29, 2026
Merged

ChuckBuilds merged 4 commits into
mainfrom
claude/sports-stage3-adopt

Conversation

@ChuckBuilds

Copy link
Copy Markdown
Owner

The last step of sports consolidation stage 3. Core v3.7.0 (LEDMatrix#672) ships SportsCelebrationMixin, SportsFetchMixin and SportsCardWrappersMixin. The scoreboards now require 3.7.0, inherit these mixins and delete their identical copies. Nothing on the display changes.

Changes

  • SportsFetchMixin: all nine SportsCore classes inherit it.
  • SportsCelebrationMixin: the SportsLive classes in afl, football, hockey, nrl and soccer inherit it. Hockey adopts the shared drawing but keeps its own triggers, as the owner decided. Every plugin still decides when to celebrate and what to say.
  • SportsCardWrappersMixin: all eight GameRenderer classes inherit it. Football keeps its own _format_game_date and _upcoming_center_mode, which follow its switch-mode settings.
  • Imports: plain imports, with no fallback.
  • Tests: three celebration tests now patch time.time instead of sports.time, and football's palette tests import the colour helpers from core.
  • Versions: minor bumps with versions[] entries (minimum core 3.7.0), compatible_versions ≥3.7.0, a CHANGELOG entry per plugin, and plugins.json. New versions: afl 1.34.0, baseball 1.53.0, basketball 1.40.0, football 3.17.0, hockey 1.39.0, lacrosse 1.35.0, nrl 1.33.0, soccer 2.38.0, ufc 1.18.0.
  • New guard, scripts/test_stage3_mixin_copies.py:
    • It fails if an adopting plugin defines a moved name again, except football's two kept methods.
    • It also fails if the core import is wrapped in a try, if the mixin base is missing, or if the name lists drift from core v3.7.0.
    • Seven planted faults were all caught.
  • Drift baseline: it loses exactly the two entries that no longer diverge.
  • Docs: doc 08 now says hockey celebrates, and has a new "Converged at 3.7.0" section. CLAUDE.md feat: add hockey-scoreboard plugin (Phase 2 start) #7 is updated.

Net: 43 files, +625 / −5,187.

Verification

Compared against origin/main, both on core v3.7.0.

  • Rendering: all 192 harness PNGs are byte-identical.
  • Goldens and checks: the 135 celebration frames, 72 card frames and 235 method checks pass on both. On this branch the celebrations are drawn by core's mixin.
  • Plugin tests: run_plugin_tests.py gives the same result per test, 320 passed. The 2 failures happen on main too: test_odds_placement, and the interactive test_football_plugin.
  • Repo scripts: all 44 scripts/test_*.py and 13 check scripts pass. That includes check_version_bump naming all nine ids, update_registry --check and the drift check.
  • Attribute and MRO proof: every moved name resolves to core, and football's overrides still take precedence. No attribute is lost or gained, and the constants and built objects are identical.
  • Core parity: core's test_sports_stage3_parity.py passes with LEDMATRIX_PLUGINS pointed at this branch.
  • On ledpi (Pi 4, core v3.7.0):
    • Baseball, football, hockey and soccer from this branch loaded, recognised the favourites and cycled through 13 mode switches with no errors.
    • The only error logged was football's first update() timing out at startup. That's a known startup-time limit: all plugins share one short budget at boot, and it isn't a code error.
    • The MRO on the Pi shows the celebration, fetch and card methods coming from src.common.*.

🤖 Generated with Claude Code

ChuckBuilds and others added 4 commits September 29, 2026 13:01
…xins; drop the copies (stage 3)

Core 3.7.0 ships three modules holding code the scoreboards carried as
identical copies. Each plugin now inherits the mixin and deletes its copy;
imports are plain (the next commit floors every plugin on 3.7.0).

- sports.py, all nine: SportsCore inherits SportsFetchMixin
  (src.common.sports_fetch) and loses _fetch_season_directly,
  _background_fetches_espn_ranges, _needs_previous_day, _wants_live_odds,
  _LOOKBACK_CUTOFF_HOUR and _LIVE_ODDS_LOOKAHEAD.
- sports.py, afl/football/hockey/nrl/soccer: SportsLive inherits
  SportsCelebrationMixin (src.common.sports_celebration) and loses the
  celebration drawing (_draw_celebration_layout, _celebration_palette,
  _celebration_backdrop, _draw_celebration_motif, _celebration_confetti,
  _draw_celebration_confetti, _celebration_crests, _fit_font and four class
  constants); the module loses the colour helpers and _PALETTE_* constants
  and the colorsys/math/random imports only they used. Arming a celebration
  (_start_celebration, _check_for_goal/_check_for_score, _check_for_win) and
  display() stay per plugin; hockey adopts the drawing too.
- game_renderer.py, all eight: GameRenderer inherits
  SportsCardWrappersMixin (src.common.sports_card_wrappers) and loses its 17
  sports_card delegations. football keeps _format_game_date and
  _upcoming_center_mode (they follow the switch-mode settings), which
  override the mixin's.

Tests: the three celebration tests patched `sports.time`, which the drawing
no longer reads; they patch time.time on the time module instead, and
football's palette tests take the helpers from src.common.sports_celebration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
afl 1.34.0, baseball 1.53.0, basketball 1.40.0, football 3.17.0,
hockey 1.39.0, lacrosse 1.35.0, nrl 1.33.0, soccer 2.38.0, ufc 1.18.0.

versions[0].ledmatrix_min_version and compatible_versions rise to 3.7.0,
the first release that ships src.common.sports_fetch,
src.common.sports_celebration and src.common.sports_card_wrappers, which
the previous commit imports plainly. A floor raise is a minor bump, as for
the 3.2.0-3.6.1 raises before it. The versions[] notes and CHANGELOG
entries name what each plugin dropped. plugins.json regenerated with
update_registry.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…o entries

scripts/test_stage3_mixin_copies.py, in the shape of test_espn_dates_copies.py
and the timezone guard: for every plugin adopting src.common.sports_fetch
(all nine), src.common.sports_celebration (afl, football, hockey, nrl,
soccer) or src.common.sports_card_wrappers (the eight with a game renderer),
no runtime file may define a moved name again -- a module-level helper or
constant, or a method or class constant on any class -- except football's
own _format_game_date and _upcoming_center_mode (KEEP). The mixin must be
imported plainly and be a base of SportsCore / SportsLive / GameRenderer.
With a core checkout the lists are compared with what core's modules
define, both ways. A self-check plants a copy, a guarded import and a
missing base.

Mutation-checked: a helper restored in soccer's sports.py, a wrapper in
hockey's renderer, a class constant on nrl's SportsLive, a method on
soccer's SoccerLiveManager, afl's import wrapped in try, ufc's base dropped
and a name dropped from the list each fail it.

sports_drift_baseline.json: _format_game_date and _upcoming_center_mode in
game_renderer.py were recorded as divergent because football's differ;
football is now the only plugin defining them, so check_sports_drift
reports them back in sync. Only those two removals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ons from core 3.7.0

docs 08: the sports.py and game_renderer.py rows say which parts are now
core's; hockey is no longer described as having no celebration code (it has
goal and win celebrations, drawn by core's mixin like the other four); the
convergence list gains "Converged at 3.7.0" naming the three modules, what
each plugin inherits, football's kept overrides, the guard script, and the
identical methods deliberately left in the plugins. CLAUDE.md
non-negotiable #7: floor 3.7.0 and the three modules.

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

coderabbitai Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 14a1e59f-4365-43d1-a225-9a35779b0766


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

Metric Results
Complexity -44

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 858ad75 into main Sep 29, 2026
5 checks passed
@ChuckBuilds
ChuckBuilds deleted the claude/sports-stage3-adopt branch September 29, 2026 17:28
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