* fix(fonts): resolve asset paths against the install root, not the cwd
FontManager built its catalog from cwd-relative paths ('assets/fonts'),
so any process started outside the install root — the plugin safety
harness on CI being the recurring case — found no fonts and silently
degraded every plugin to PIL's default face. Several plugins grew
per-plugin workarounds for exactly this (countdown, text-display,
tide-display in the plugins monorepo).
Catalog population now falls back to the install root derived from this
module's location when the cwd-relative path is missing; behavior when
running from the install root is unchanged. Verified: resolve_font
returns the real FreeType face from a foreign cwd, and the full unit
suites (266 tests) pass.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FgbA8SMutQQpXkMG8LMmC4
* docs: seed CHANGELOG.md with the module-availability release discipline
The plugins monorepo's sunset rule ('delete a bundled fallback copy only
when the manifest floors on the first core release shipping the module')
needs core module additions recorded against version numbers. Seeds the
changelog at 3.1.0 and documents the discipline.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FgbA8SMutQQpXkMG8LMmC4
* ci: enroll the core unit suites in a dedicated job
The existing workflow ran only the three plugin-harness suites; the
skin-system, font-manager, data-source, extractor, scroll-helper,
adaptive-layout, and loader-compat suites (266 tests) existed but never
ran in CI, so a refactor of src/base_classes or src/common could regress
them silently. Also enrolls the new sports characterization and
element-style suites landing in this branch.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FgbA8SMutQQpXkMG8LMmC4
* feat: ship src/element_style — the per-element style resolver plugins already expect
Three plugins (of-the-day, ledmatrix-music, football-scoreboard) import
src.element_style behind guarded try/except with classic fallbacks, but
the module never existed in core, so the richer per-element styling UI
those code paths implement has been dormant. This lands it:
- ElementStyleResolver.style() resolves per-element font/size/color with
the key semantic the consumers encode: a config value counts as
user-forced only when it differs from the schema default (the web UI
bakes defaults into config.json on save), and untouched configs
resolve to exactly the caller's classic values — byte-identical
rendering, proven by of-the-day's committed goldens passing unchanged.
- defaults_from_schema_file parses both declaration forms (the compact
x-style-elements map and hand-written customization blocks).
- expand_style_elements() expands x-style-elements into full config
blocks; schema_manager.load_schema() applies it (guarded, no-op for
schemas without the declaration) so the config form and defaults
merging see the expanded UI.
- Fonts resolve cwd-independently with (path, size) caching; .bdf loads
via freetype like FontManager; nothing in the module raises out of
style().
Verified: 31 new unit tests; of-the-day's previously-skipped 9-test
spec suite now runs and passes; football's resolver tests pass (27);
music's 38 plugin tests pass; schema-manager suites pass (43).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FgbA8SMutQQpXkMG8LMmC4
* test: characterization suite for src/base_classes/sports.py ahead of unification
Pins current behavior before the planned merge of the nine drifted
plugin copies back into this ancestor: the _extract_game_details_common
key contract per sport (reusing GUARANTEED_KEYS from the skin tests),
update() flows for upcoming/recent/live against cache-seeded fixtures
under frozen time, rendering smoke per mode class, and guard rails on
the skin-system seam.
Five surprising behaviors are pinned AS-IS and flagged in comments so
the merge changes them knowingly or not at all: is_upcoming also
matching status.type.name; hockey dropping events whose competitors
lack 'statistics'; baseball reading the event-level status for innings;
no past-date filter in upcoming; and favorites-only mode with an empty
favorites list showing nothing.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FgbA8SMutQQpXkMG8LMmC4
* ci: restrict the test workflow's GITHUB_TOKEN to contents:read
CodeQL flagged the new unit-tests job for running with the default
unrestricted token; the pre-existing job had the same exposure. Both
jobs only check out the repo and run pytest, so a workflow-level
contents:read is sufficient.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FgbA8SMutQQpXkMG8LMmC4
* Address CodeRabbit review: font-name traversal + offline test guard
Two Minor findings from CodeRabbit's first review of this PR.
- resolve_font_path: reject relative font names carrying path components.
font_name comes from plugin config, which the web UI writes; a value like
"../../config/config.json" escaped assets/fonts/ after os.path.join and let
a config probe arbitrary paths for existence (disclosure unlikely, since
Pillow/freetype reject non-font files, but the probe is real). Relative
names must now be bare filenames (os.path.basename(name) == name); absolute
paths keep their existing isfile() gate. Test confirms the traversal
resolved the real config.json before the guard.
- build_manager fixture: patch requests.Session.get BEFORE constructing the
manager. Construction creates both SportsCore.session and the
ESPNDataSource.session; the old code only replaced manager.session after
the fact, leaving data_source.session real and able to reach the network on
an accidental fetch. Patching the class makes every session built in the
fixture offline.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KEZK1P1Q1fu5pcuVrkrCFZ
---------
Co-authored-by: Claude <noreply@anthropic.com>
7.2 KiB
Changelog
Notable changes to the LEDMatrix core. The version below is the value of
src.__version__, which the plugin loader reports to compatibility checks and
which plugin manifests reference via ledmatrix_min_version.
Why this file exists: the plugin monorepo bundles fallback copies of several
core modules (see docs/plugin-development/08-shared-sports-code.md in
ledmatrix-plugins). A plugin
may delete its bundled copy only when its manifest floors on the first core
release that ships the module — which requires module additions to be recorded
here, against a version number. When you add a module plugins will import via
src.*, note it in the Unreleased section and bump src/__init__.py in the
release that ships it.
Use ledmatrix_min_version in manifests, not ledmatrix_min. The loader
accepts both, but the store flags the old spelling as deprecated
(store_manager.py) and only the new one is in schema/manifest_schema.json.
3.2.0
The first release shipping the unified sports library. This is the version
a sports plugin floors ledmatrix_min_version at before deleting its bundled
copy of sports.py, scroll_display.py, data_sources.py or
base_odds_manager.py — the sunset rule in
docs/plugin-development/08-shared-sports-code.md keys on exactly this number.
Adoption is deliberately staged: the modules below ship here, plugins adopt them behind guarded imports, and only then do the bundled copies go away. Nothing in this release changes what an existing plugin loads.
Added
-
src/element_style.py— per-element style resolver backing thex-style-elementsconfig-schema extension. Already consumed (behind guarded imports with classic fallbacks) by theof-the-day,ledmatrix-music, andfootball-scoreboardplugins. -
Core unit-test CI job enrolling the previously unenrolled suites (skin system, data sources, API extractors, scroll helper, adaptive layout, loader compatibility warning) plus new characterization tests for
src/base_classes/sports.pyahead of the shared sports-code unification. -
src/base_classes/sports/—sports.pyis now a package (core.py+modes.py). The import path is unchanged:from src.base_classes.sports import SportsCorestill works. -
Nine methods promoted onto the sports base classes from the plugins' bundled copies, plus the override points
_favorite_key,_config_schema_pathand_font_rootand the class attributesFINAL_PERIOD/CLOCK_COUNTS_DOWN. Seedocs/SPORTS_UNIFICATION.md. A plugin may start calling these once its manifest floorsledmatrix_min_versionat the release that ships them. -
src/base_classes/sports/capabilities/— opt-in capabilities for the sports scoreboards, composed by inheritance rather than gated by config branches inside the base classes:CelebrationMixin— the score/win takeover, merging the goal and score dialects behind thescore_phrase()/win_phrase()hooks, theCOALESCE_SCORING_SEQUENCEclass attribute and the_favorite_keyseam. Reads both thecelebrate_opponent_goalsandcelebrate_opponent_scoresconfig spellings. Sports that do not mix it in have none of this code in their MRO.RotationStrategy+ a name registry (swrr,weighted,simple, plusregister_rotation_strategyfor plugin-supplied orderings). Each built-in is verified against a verbatim transcription of the plugin implementation it replaces. An unknown name degrades tosimple.
-
src/common/sports_scroll.py—SportsScrollDisplayandSportsScrollDisplayManager, the shared scroll orchestration layer for the sports scoreboards, plus native support forglobal_config['target_fps'](the bundled plugin copies hardcode ~100 FPS viascroll_delayand never consult the global target). Content building (prepare_scroll_content,_load_separator_icons) is per-sport and stays an override point — seedocs/SPORTS_UNIFICATION.mdfor where the line falls and why.
Changed
src/__init__.pybumped to 3.2.0 — the number the sunset rule keys on.- Live games are no longer dropped when the feed omits a game clock.
SportsLive._is_game_really_overpreviously (in the baseball and UFC plugin lineages) coerced a missing or non-string clock to the literal"0:00"and then treated the game as finished onceperiod >= 4. Baseball has no game clock andperiodis the inning, so live MLB games disappeared from the scoreboard from the 5th inning onward; UFC was affected the same way. The clock check is now skipped when the clock is unusable, and the period threshold is the per-sportFINAL_PERIOD(hockey ends in P3). Sports whose clocks count up — soccer, AFL, NRL — setCLOCK_COUNTS_DOWN = Falseand never run the check at all, since0:00there means kickoff rather than expiry.
Fixed
FontManagerresolvesassets/fontsagainst the core install root instead of the process working directory, so font loading works when the process starts elsewhere (e.g. the plugin safety harness on CI).- Hockey events whose competitors carry no
statisticsarray are no longer discarded. The extractor readcompetitor["statistics"]unguarded, so aKeyErrorinside the generator dropped the entire event despite valid scores and status; shot counts now fall back to0. - Live baseball events that populate status only at the competition level are
no longer discarded. The extractor read the event top-level
game_event["status"]for the inning; real ESPN events duplicate it, but MiLB events synthesized from the MLB Stats API do not, so the lookup raised a bareKeyError. It now reads the already-validated competition-level status. SportsLive._is_game_really_overno longer crashes the live-update pass when a feed sends an explicit nullperiod.None >= FINAL_PERIODraisedTypeError, and the only caller (_detect_stale_games) has notry/except— the same failure shape as the already-fixed nullperiod_text.- An expired clock spelled
"00:00"now ends the game. The check compared the colon-stripped clock against a hand-listed set of literals, which"0000"is not a member of, so a finished game with a two-digit-minute clock stayed on the scoreboard indefinitely. The comparison is now numeric. SportsCore._load_fontsresolvesassets/fontsthrough the_font_root()seam instead of the process working directory. Started outside the install root, every scoreboard font silently degraded to PIL's default bitmap face.SportsCore._should_logno longer raisesAttributeErroron the first warning of a run;_last_warning_timeis initialized in__init__rather than lazily by an unrelated method.SportsCore._resolve_project_pathresolved relative logo directories against<root>/srcinstead of the repo root aftersports.pybecame a package — the class bodies moved byte-identically but__file__gained a directory. Both it and_font_rootnow derive from one_INSTALL_ROOTconstant.
3.1.0
Baseline for this changelog. Highlights already shipped at this version: skin system for sports scoreboards (#419), Vegas continuous-scroll overhaul (#423), plugin update surfacing (#421).