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

scoreboards: use core's favorite_team_check and sports_timezone when available (sports consolidation stage 2) - #565

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

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

Conversation

@ChuckBuilds

Copy link
Copy Markdown
Owner

Stage 2 of the sports-code consolidation, plugin side. Depends on ChuckBuilds/LEDMatrix#665: plugins CI checks out core main, and the new check_min_core_version table entries need that PR's modules. Merge #665 first.

Each scoreboard now uses core's src.common.favorite_team_check and src.common.sports_timezone when the running core has them. On older cores, including 3.5.0, it falls back to its own copy. The bundled copies stay until core 3.6.0 is released. After that, a follow-up raises the minimum core version and deletes them (about 4,100 lines).

Changes

  • Favourite check (afl, baseball, basketball, football, hockey, lacrosse, nrl): manager.py imports FavoriteTeamCheck from core. The import has the usual exact-name ModuleNotFoundError guard and falls back to <sport>_favorite_check.py, which is unchanged.
  • Timezone (the same seven plus soccer and ufc): a guarded shim is appended to each <sport>_timezone.py. The code above it is byte-unchanged and serves as the fallback.
    • When core has the module, the shim points the public functions at core's, passing the plugin's label and write-back values.
    • When no log is given, it passes the plugin module's logger, so log records keep their logger name.
    • Call sites don't change, and the later cleanup only has to delete the code above the shim.
  • Tests: each test_timezone_resolution.py now stubs the system-timezone lookup on whichever module actually resolves it. Otherwise the tests would check the wrong code on the core path.
  • New guard, scripts/test_timezone_and_favorite_check_copies.py:
    • The favourite-check copies must be byte-identical to each other and equal to core's module.
    • Each timezone copy's helpers must be AST-equal to core's.
    • Each bundled resolver must match core's answers and log records across 1,152 cases.
    • Every plugin must use the exact-name guard.
    • On the core path, each plugin must behave the same as its fallback.
    • All 16 mutations tried were caught.
  • Versions: patch bumps for all 9 (versions[] entries, CHANGELOGs, plugins.json). The minimum core version stays at 3.5.0.
  • Table and docs: check_min_core_version.py gets entries for both modules as unreleased (None), and doc 08 is updated.

Verification

Compared against origin/main plugins on core v3.5.0, on both paths: this PR on core #665 (core path) and on core v3.5.0 (fallback).

  • Rendering: all 192 harness PNGs are byte-identical on both paths.
  • Plugin tests: run_plugin_tests.py gives 322 passed on all three configurations. The same 2 failures happen on main: baseball test_odds_placement and football's interactive test_football_plugin.
  • Repo scripts: every scripts/test_*.py and check script matches main. The one exception is test_check_min_core_version, whose new entries need fix(football): a two-point conversion is not a safety (3.28.1) #665's modules. check_version_bump passes naming all 9 ids, and so do update_registry --check, the helpers parity check and the drift check.
  • Import check: on the core path, every adopted name resolves to src.common.*. On v3.5.0 each resolves to the bundled module.
  • On ledpi (Pi 4, core fix(football): a two-point conversion is not a safety (3.28.1) #665):
    • Baseball, football, hockey and soccer from this branch loaded and ran with no errors.
    • FavoriteTeamCheck resolves to core.
    • An A/B against the 1.51.0 bundled copy gave identical favourite-check log output.

Not changed (owner decisions)

  • f1: its timezone copy fits the core module exactly (the guard checks it with label "F1 scoreboard"), but f1 isn't touched here.
  • Soccer and ufc: they don't get the favourite-team check, because adding it would be a new feature.

🤖 Generated with Claude Code

ChuckBuilds and others added 3 commits September 29, 2026 08:35
…the core ships them (sports consolidation stage 2)

Core promotes two files the scoreboards carry as copies (LEDMatrix
claude/sports-stage2-core): src.common.favorite_team_check and
src.common.sports_timezone. Adopt them B5-style, keeping the copies as the
fallback so the floors stay at 3.5.0:

- afl, baseball, basketball, football, hockey, lacrosse, nrl: manager.py
  imports FavoriteTeamCheck from core under the usual guard (exc.name names
  the exact module), falling back to <sport>_favorite_check.py, which is
  unchanged.
- The same seven plus soccer and ufc: <sport>_timezone.py ends in a guarded
  shim. On a core with the module it rebinds resolve_timezone_name,
  resolve_timezone and system_timezone_name to core's, passing this plugin's
  label and write-back values and its own logger; otherwise the code above
  it, byte-for-byte unchanged, is what runs. Call sites are untouched.
- test_timezone_resolution.py stubs system_timezone_name on whichever module
  the resolver reads it from, so it tests the path in use.

Patch bumps with versions[] entries (2026-09-29), CHANGELOGs, registry.
f1-scoreboard's f1_timezone.py fits core's module (it differs only in label)
but is left alone: whether it adopts is an owner decision. soccer and ufc
still have no favourite-team check (adding one is a feature change).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…; table entries for the two modules

- scripts/test_timezone_and_favorite_check_copies.py: the favourite-check
  copies must be byte-identical and equal core's module as an AST
  (annotations aside); every timezone copy's helpers must equal core's, and
  its resolver must return the same zone and log the same records as core's
  given its values, across 1,000+ scenarios; each adopter must import core's
  modules through the exact-name guard, and on a core that has them resolve
  through core with the same results as its own fallback. The core
  comparisons skip without a core that ships both modules.
- check_min_core_version.py: src.common.favorite_team_check and
  src.common.sports_timezone as None (on core main, in no tagged release).
- docs 08: the two copy families and how they converge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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: d46cec41-122b-43c8-8b73-99e415bae4ab


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

codacy-production Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 148 complexity

Metric Results
Complexity 148

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 marked this pull request as ready for review September 29, 2026 13:05
…flakes and pylint

Comment-only; the AST of every file is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ChuckBuilds
ChuckBuilds merged commit 7c97d3e into main Sep 29, 2026
5 checks passed
@ChuckBuilds
ChuckBuilds deleted the claude/sports-stage2-adopt branch September 29, 2026 13:20
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