mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-10-04 14:25:08 +00:00
* fix(sports): rebuild un-shared faces through the pinned layout engine unshare_element_fonts re-instantiates a duplicate font face so two elements can be told apart by id(). It did so through bare ImageFont.truetype, which takes PIL's default layout engine rather than the one src/common/font_layout.py pins. Raqm and Basic disagree on fractional advances -- that disagreement is the reason the pin exists, having broken golden images across machines -- so a rebuilt face could measure differently from the shared face it replaced, on any host where Raqm is installed. These were the only two call sites in src/ bypassing the pin. The guard asserts that the rebuild goes through the pinned loader rather than comparing engine values: where Raqm is absent, bare truetype returns BASIC anyway, so an engine comparison passes whether or not the pin is honoured. The first draft of this test did exactly that and passed with the bug reintroduced. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * refactor(web): drop the two dead client-side config-form renderers generateConfigForm and generateSimpleConfigForm (580 lines) were defined on the Alpine component and never called: server-side Jinja replaced them, as pages_v3.py:641 records. Nothing in any template invokes them -- there is no x-html in the templates and no bracket access on the component. They carried their own x-widget dispatch, which made them an active trap: the next person adding a widget would reasonably think both renderers needed updating. plugins/config_manager.js (PluginConfigManager, 133 lines) goes for the same reason -- loaded on every page from base.html, referenced only by itself and by an archived doc. Kept, having checked them: widgets/example-color-picker.js is the worked example docs/widget-guide.md points plugin authors at, and widgets/plugin-loader.js is the client half of a documented feature (manifest-declared plugin widgets) whose server route is missing -- soccer-scoreboard already ships a widgets/custom-leagues.js that this loader is meant to fetch. That is an unfinished feature to complete, not dead code to delete. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * feat(web): serve plugin-declared widgets, and actually ask for them LEDMatrixWidgets.loadPluginWidget has always fetched /static/plugin-widgets/<plugin>/<widget>.js, and docs/widget-guide.md has always documented that path, but nothing served it. soccer-scoreboard has shipped a 17KB widgets/custom-leagues.js since August that could never load. Both halves were missing, not just the route: - serve_plugin_widget serves the script from the plugin's widgets/ directory as text/javascript. The manifest is the allowlist -- only a widget the plugin declares is reachable -- so installing a plugin does not publish everything it ships. Path handling mirrors the sibling serve_plugin_web_ui: allowlist regexes, os.path.basename, resolve() + relative_to() containment, and the ledmatrix- prefix fallback. The declared script name is guarded too, since it comes from the plugin rather than the request. - The config form never requested one. Its x-widget dispatch is a hardcoded list of core widget names, so a plugin's own widget fell through to a plain text input. An unrecognised x-widget on a string field now asks ensureWidget() for it. The text input stays as the fallback and is removed only once the widget has actually rendered, so a missing or broken widget costs the user an editor rather than their configured value on the next save. - manifest_schema.json gains "widgets", so the declaration is validated rather than merely tolerated by additionalProperties. Verified in a browser against the real partial: a declared widget loads, registers and renders, and its field posts exactly one value; a field whose widget 404s keeps its text input and still posts its value. Not addressed: loadPluginWidgetsFromManifest still has no caller. The per-field ensureWidget path is lazier and is what the form now uses, so that bulk helper is dead weight -- worth removing, but left alone here rather than inventing a call site for it. Known limitation, documented: only string-typed fields take this path. object/array/boolean/number fields and enums are dispatched by the template's own branches, which still only know core widgets. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(element-style): a wrong-size BDF now keeps its font, not its size BDF fonts are fixed-size bitmap strikes: FreeType accepts only the pixel size baked into the file and raises for anything else. 32 of the 35 shipped fonts are BDF, so a size picked in the web UI usually is not a valid strike -- and load_font caught that failure with its generic "unloadable font" handler, which substitutes PressStart2P. Asking for 5x7.bdf at size 10 therefore rendered a completely different typeface, silently. It now falls back to the file's own native size instead, which is what SportsCore._load_custom_font_from_element_config has always done. The native size is read via FontManager._read_bdf_native_size rather than a fourth copy of that parser, matching how core.py already delegates. Also here, because they are the same code path: - native_bdf_size() is exposed for the web UI, which needs to know when a size field can take effect at all. None means "free choice". - ElementStyle.font_size now reports the size actually realised rather than the one requested. Callers lay out from it, and reserving space for a size nothing was drawn at is how this surfaces. - The module font cache is a bounded LRU (256) instead of an unbounded dict. The display process runs for weeks and every config save can add a (font, size) pair; every other hot cache in the codebase is bounded this way. Untouched configs are unaffected: the shipped classic fonts are the three TTFs, so nothing was hitting the substitution path by default. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * feat(element-style): per-mode style and offset overrides Lets one element be styled differently per situation -- a scoreboard's live / upcoming / recent cards, weather's current / hourly / daily screens -- under customization.modes.<mode>. The mode is bound at construction rather than passed per call. That is what makes this cheap to adopt: SportsUpcoming and SportsRecent are already separate instances with distinct SKIN_MODE values, so binding once makes every existing style()/offset_value() call site mode-aware without editing any of them. A per-call mode argument exists for the rare host that renders more than one mode. The two layers answer different questions, deliberately: - The base layer keeps the existing "differs from the schema default" rule, because the save flow writes the full default object into config.json whether or not the user touched it. - A mode layer is pure override -- its fields default to None, so presence is intent. Nothing writes into it unasked, so there is nothing for the stricter rule to protect against. None therefore means inherit, and has to stay distinct from 0: a mode y_offset of 0 means "sit at the base position", not "no preference". This is the same distinction scroll_card.switch_* draws with "inherit". A malformed mode value falls back to the resolved base value rather than to the caller's default -- caught by the degradation tests, which is what they are for: resolving the mode first let one bad string in a mode block silently discard a good base offset. With no modes block, and for every existing caller, resolution is unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * feat(element-style): declare per-mode overrides in config_schema.json A plugin adds "x-style-modes": ["live", "upcoming", "recent"] alongside its x-style-elements declaration and gets a customization.modes.<mode> group per mode, with every field of every declared element repeated as an override. Those override fields are typed nullable and default to null, which is the whole trick. The save flow writes schema defaults into config.json wholesale, so giving a mode field the base element's default would make every mode a frozen copy of the base the first time a user pressed Save, and the base would stop reaching them. Null means inherit. The mutation test for this is explicit: with concrete defaults, a base font_size of 14 resolves as 10 with user_forced set. min/max from the declaration carry into the mode blocks, so an out-of-range override is rejected by validation rather than clamped silently at render time. Also: the emitted font field now carries "x-widget": "font-selector". The widget already shipped and the config form already allowlisted it -- the hint was simply never emitted, so the field rendered as a bare text box that the user had to type a font filename into. Verified through the real SchemaManager path -- load_schema, defaults extraction, merge_with_defaults, validation, then resolution -- rather than against a hand-built dict, since the thing at risk is what that pipeline does to a null. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(web): render the config form from the schema the save route validates The form read config_schema.json with a raw json.load while api_v3.save_plugin_config went through SchemaManager. Those are not the same schema: SchemaManager applies expand_style_elements, which turns a compact customization.x-style-elements declaration into the per-element blocks the form knows how to render. Without it, that customization object has an x-style-elements key and no "properties", so the template's object branch matched nothing and the section rendered as empty space -- while saving still validated against the expanded shape. of-the-day ships the compact form, so its customization section has been invisible in the web UI. pages_v3 gains a schema_manager the way it already has config_manager and plugin_manager. use_cache=False matches the save route, so an edited schema is not served stale during plugin development. The raw read stays as a fallback for callers that register this blueprint without one. Checked before making the change: load_schema does nothing here except read, validate and expand -- inject_skin_selector is a separate method it does not call -- so this is not a behaviour change for schemas without the declaration. The test pair renders the same compact schema with and without a SchemaManager, so it documents exactly what was broken as well as what is fixed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * feat(web): style-editor widget -- a row per element instead of 65 accordions Rendered element by element, a realistic scoreboard's customization block is 65 nested sections, and reaching one per-mode font size takes five levels of expanding. The widget collapses that to one compact row per element -- font, size, colour, X, Y -- with a tab per declared mode. It emits ordinary inputs under the same dotted names the generic renderer would produce, so the save/validate/merge pipeline is untouched: no hidden JSON blob and no new server-side parsing. It is driven entirely by the schema block it is handed, so fields added to the schema later appear without editing the widget. If it fails to load or throws, the generic nested rendering it replaces is left in place. Fixing two things the save path got wrong for nullable fields, found by posting what the widget actually emits: - The indexed-array recombiner (text_color.0/.1/.2 -> one list) compared the declared type to the string 'array', so a per-mode colour, typed ["array", "null"], was never reassembled and failed validation on save. _parse_form_value_with_schema had the same comparison. - A blank nullable field became [] rather than None, which then failed the minItems the colour array declares. Null is the inherit sentinel, so it has to survive. And two things the widget itself got wrong, found by looking at it: - An unset base control fell back to the select's first option, so an untouched scoreboard claimed every element used 10x20.bdf -- and the size box then locked itself to that bitmap font's fixed size. Base controls now show the schema default; mode controls stay blank, because blank there means inherit. - Elements arrived alphabetised (Detail and Odds above Score). Flask's JSON provider sorts keys, so declaration order has to be stated explicitly; expand_style_elements now emits x-propertyOrder, which the generic renderer already honoured too. Size is disabled and shown as fixed for a bitmap font, using the scalable/native_size the font catalog now reports. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * feat(element-style): visibility, alignment and scale per element Completes the customization vocabulary: hide an element, align it, and resize a logo, alongside the font/size/colour/offset that already existed. All three per mode. They resolve to "change nothing" until the user asks for something -- True, None and 1.0 -- rather than to whatever the schema declares. That is the same invariant the font fields keep: a caller that honours them still renders an untouched config exactly as it did before they existed. A schema default therefore does not count as a choice, which matters because the save flow writes that default into config either way. scale sits in the layout block with the offsets rather than in the element block, because it is geometry: a logo has a scale and no font. The widget's columns come from the schema, so a logo row shows visibility, offsets and scale and no empty font cell. Two bugs found by the tests rather than by reading: - A nullable enum needs null in its enum list, not just in its type. The mode copy of `align` defaulted to null and then failed its own schema, so a plugin declaring any enum field with modes could not save at all. Six tests failed on this before any of them reached what they were testing. - defaults_from_schema only ever extracted font/font_size/text_color, so the schema defaults for the new fields were invisible to the resolver and a declared default read as a user choice. Widget: the table scrolls horizontally and pins the element-name column. Nine columns do not fit the config panel, and clipping them hid the offsets entirely while scrolling them made every row anonymous. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * feat(element-style): resolve elements under the names plugins actually use Two naming conventions collided as the scoreboards grew. Counted across the published schemas: the style block names elements with a _text suffix (score_text, status_text, detail_text), while the layout block mostly uses the bare noun (score, date, time, odds) -- except status_text, which kept the suffix in seven plugins and lost it in two. records vs record splits seven to two the same way. A lookup now tries the exact name first and then the spellings that mean the same thing. Exact-first is what makes this inert for any config that already matches; the aliases only decide cases that resolved to nothing before. This is also what makes migrating to the compact declaration form safe. That form uses one key for both blocks, so a scoreboard adopting it asks for layout.score_text while its users have layout.score saved -- without the aliases, every offset they had dialled in would silently become 0. Applies to the style block, the layout block, the schema defaults and the per-mode overrides, since the drift shows up in all four. Not attempting to canonicalise on write: renaming keys in config.json would break the plugins still reading the old spelling from their own bundled code, and the drift costs a dict miss rather than correctness. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * feat(plugins): BasePlugin.styles -- per-element styling every plugin inherits Adopting the element-style system meant repeating three things in every plugin: a guarded import, finding its own config_schema.json, and rebuilding the resolver when on_config_change swapped the config dict. This is those three things once, on the class all 45 plugins already inherit from. title = self.styles.style('title_text', classic_font='PressStart2P-Regular.ttf', classic_size=8, classic_color=(255, 255, 255)) The classic_* arguments are the adoption contract: with nothing configured they come back verbatim, so a plugin that switches to this renders exactly as before until a user changes something. A plugin with one instance per display mode sets STYLE_MODE on the class and every existing lookup becomes mode-aware without a call site changing -- which is the point of binding the mode to the resolver rather than passing it per call. styles_for() covers a plugin that renders several modes from one instance. Schema discovery reads the concrete class's own module rather than this file, because this file lives in src/plugin_system where no plugin schema exists -- the same trap SportsCore._config_schema_path documents. The first mutation test for that passed anyway: an installed plugin's module directory and its entry under plugins_dir are the same path, so the test could not tell the two apart. The case where they diverge is a plugin symlinked in for development, and the test now forces that shape. Getting discovery wrong is silent rather than loud: with no schema the resolver has no defaults to compare against, so every configured value reads as a deliberate override and the plugin quietly stops honouring its own shipped styling. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * feat(element-style): adopt hand-written customization blocks, and widen the font list Nineteen plugins spell their style elements out longhand instead of declaring them -- football's block is 701 lines for seven elements -- and predate this system entirely. Core now recognises that shape, so they pick up the row-per-element editor and the real font picker on a core update rather than on a plugin release. Checked against every published schema: 21 plugins adopt, and the defaults of each still validate against the schema generated for it. Detection requires *every* field in a block to be one this system understands. A looser "has at least one style field" rule sweeps in baseball's `count`, which carries a text_color beside geometry that means nothing here. That distinction took three attempts to test: the first two assertions passed under both rules, because an over-eager rule leaves a fontless block looking untouched and only surfaces as an extra row in the editor. The hardcoded font enum is replaced rather than extended. Football lists five of the thirty-five installed fonts, which is why a font a user uploads can never appear in one. It is not a curated safe set -- it omits some twenty other faces that fit the declared size cap just as well -- it is the fonts that happened to exist when it was written. Widening it does need a guard, though, and not the one the schema already has: a bitmap font ignores font_size and renders at its size baked into the file, so `maximum: 16` cannot stop a 27px face. The picker now filters out fixed-size fonts taller than the element's own declared ceiling, which drops exactly the four that would overflow a 32px panel and keeps the other thirty. Per-mode overrides stay opt-in: core cannot invent a plugin's display modes, so `x-style-modes` remains the one line that unlocks them. Their layout half covers every positionable element rather than only those with a style block -- the two namespaces do not line up in a hand-written schema, and football positions six things (logos, timeouts, possession) that have no style block at all. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * refactor(web): remove the two Fonts-tab panels that reported invented data "Element Font Overrides" let a user configure an override, showed a success toast, and changed nothing. All three endpoints behind it were stubs -- GET returned a hardcoded {}, POST and DELETE returned success without calling anything -- each marked "This would integrate with the actual font system". Wiring them to FontManager would not have fixed it. The machinery there is real (_load_overrides/_save_overrides persist config/font_overrides.json, resolve_font applies them, and the countdown plugin genuinely consumes it), but the panel's element dropdown offered eleven invented keys -- nfl.live.score, clock.time, weather.current -- that no plugin has ever read. An override saved against one of those would have persisted correctly and still done nothing. "Detected Manager Fonts" goes for the same reason. It claimed to show "fonts currently in use by managers (auto-detected)"; its own comment said "we'll simulate this", and it listed every font in the catalog with a hardcoded usage_count of 1 -- the panel beside it, with fabricated numbers attached. Per-element font choice now lives in each plugin's own config editor, against the elements that plugin actually has, and covers size, colour, offsets, visibility, alignment and scale rather than family and size. Kept: the font library (upload, preview, delete), which works, and /fonts/tokens, which is a stub but genuinely feeds the preview's size dropdown. FontManager's override methods are untouched -- countdown uses them. Verified in a browser with the tab's JS running: no console errors, 35 fonts listed, upload and preview intact. Removing the panel meant unwiring it from populateFontSelects too, which would otherwise have bailed out early on the missing select and left the preview dropdown empty. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * refactor(sports): one reader for element colours and layout offsets There were two copies of the per-element colour read and three of the layout-offset read. They had already drifted -- the scroll-card renderer carries a comment about having ignored offsets its own schema advertised -- and each new capability had to be added to all of them or silently work in some places and not others. All of them now go through src.element_style, which is what carries the alias handling and the per-mode lookup. That lands immediately for the nine plugins importing these modules: a scoreboard asking for `score_text` offsets finds the `layout.score` its users configured, and a Live instance resolves its own colours through SKIN_MODE without any call site passing a mode. _normalize_color learned "#RRGGBB" in the process. The scoreboards' own readers have always accepted it, so the shared one had to, or consolidating would have quietly dropped a form users' configs may hold. _coerce_offset picked up the non-finite guard the scroll-card reader had and the other two did not. _get_layout_offset is promoted onto SportsCoreSharedMixin. Each plugin still carries its own copy in its bundled sports.py, which wins by MRO -- so adopting this is a deletion in the plugin, and until that deletion nothing changes for it. Note for whoever runs the suite next: test_display_dirty_tracking.py is order-dependent. Fifteen of its tests failed in one full run and passed in the next with no change in between, and pass in isolation. Pre-existing, unrelated to this, but it makes a full-run diff untrustworthy until it is fixed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(changelog): record the element-style work under Unreleased This file's own preamble asks for it: a plugin may delete its bundled fallback copy of a core module only when its manifest floors on the first release that shipped that module, which requires the additions to be recorded here against a version. Names a plugin can now import and floor on -- the stateless layout_offset and element_color readers, alias_keys, native_bdf_size, the resolver's mode binding, BasePlugin.styles, and the promoted SportsCoreSharedMixin._get_layout_offset -- plus the schema and web-UI changes, the four fixes and the three removals. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(fonts): log the BDF native-size read failure instead of swallowing it The bdf-native-size lookup in get_fonts_catalog() caught any exception and silently discarded it. Every other guarded read added in this PR (the manifest parse in _declared_widget_script, the SchemaManager fallback in _load_plugin_config_partial) logs before falling through to the same degraded behavior. This one didn't, which is the shape a silent-exception-swallow lint rule flags. Behavior is unchanged -- native_size still comes back None -- but a corrupt or unreadable BDF file now leaves a trace. Verified: font-related tests (140) and the full suite still pass, with only the 2 pre-existing Europe/Kiev/Asia/Calcutta tzdata-alias failures already present on origin/main. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix: address CodeRabbit findings on the style-editor/font-selector PR - Fix _load_font_sized double-wrapping the (font, size) tuple on the missing-font path, which handed callers a tuple instead of a font. - Fix _set_nested_value skipping an explicit None when the key already existed, which silently kept stale overrides when a user cleared a nullable per-mode field or blanked all channels of an indexed color. - Preserve BDF scalable/native_size metadata through fetchFontCatalog's catalog-format mapping so maxFixedSize filtering actually applies. - Stop caching an empty array on a failed font-catalog fetch so a later call can retry instead of being stuck with the failed result. - Keep a saved font selected in the style editor even when it no longer fits a newly declared maxFixedSize, instead of silently deselecting it. - Don't drop in-progress user edits to fallback fields when a plugin widget finishes loading asynchronously and takes over the form. - Tighten the removed font-override endpoint test to assert 405, not just != 200. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(web): a partial save no longer switches off checkboxes it never showed An HTML checkbox posts nothing when unchecked, so the save route walked the schema and forced every boolean missing from the form to False. That is right for the rendered form and wrong for every other caller: a script, the MQTT bridge or a curl against the documented endpoint never rendered a checkbox, and reading its silence as "all off" turns a one-field save into a mass disable. Found on hardware. Posting four customization.* keys to a live device switched off nfl.enabled, ncaa_fb.enabled and every display-mode toggle in one request. The form now reports the top-level sections it drew (__rendered_section), and inside those an absent checkbox still means unchecked -- including a section whose only fields are checkboxes that are all off, which no heuristic could recover. A post with no marker only touches objects it actually posted a field from. Meta fields are dropped before form keys are treated as config paths, because unknown keys are otherwise written straight into config.json. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * feat(sports): resolve element colour by name, and honour visible/align/scale Two of the three gaps this framework shipped with. Colour by name. A draw resolved its colour by comparing the *identity* of the font object it was handed, which cannot tell two elements apart when they share a face -- so those draws went out white. Every bitmap font is in that case, because a freetype.Face cannot be re-instantiated to un-share it, which is how an element rendered in any of the 32 shipped BDF fonts silently lost a colour its picker had offered all along. _draw_text_with_outline now takes element="score_text" and reads the colour by name; the identity path remains for un-annotated callers, but narrows before giving up -- one configured colour among the sharers is the only thing the user can have meant. Visible, align and scale. The resolver has understood these since the framework landed and nothing consumed them: an element could be marked hidden in the web UI and still render. Adds the stateless readers, the mixin accessors, and a scale parameter on the one shared logo-sizing seam (keyed into the cache, so two elements scaled differently cannot be served each other's image). Naming an element in a draw also honours its visibility. Untouched configs are unaffected: every new parameter defaults to today's behaviour, and all ten affected plugins render pixel-identically to main across every harness size. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(plugins): how to declare styleable elements; harden the widget's lookups The plugin-author guide for the compact x-style-elements declaration -- what each key does, how to read values back without breaking the "user-forced only when it differs from the default" rule, and why a hand-written block needs no changes to be adopted. Also clears the static-analysis findings on style-editor.js. Every lookup in that file is keyed by something out of a schema or a saved config, so a key of __proto__ or constructor would walk the prototype chain and hand back a function instead of a schema; reads now go through an own-property helper. The panel registry became a list, and the flagged vars moved to their function roots. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(web): clear the remaining static-analysis findings Five, all on lines this branch touched. The Python one is not a new defect: _set_missing_booleans_to_false's first parameter was always named `config`, which shadows the `config` submodule imported for its side effects at the bottom of this module. Editing the signature simply put the existing warning on a changed line. The parameter is the plugin's config dict, so `plugin_config` is what it should have been called anyway; callers pass it positionally and are unaffected. The JavaScript ones are the object-injection rule firing on reads keyed by data. own() now goes through a property descriptor, so the one unavoidable data-keyed read is no longer a computed member access; at() consumes its path instead of indexing it; and the column set is a Map, which has no prototype to pollute and needs no guarded reads at all. Verified the widget still renders identically against football's real schema: 29 element rows, all four mode tabs, values populated, no console errors. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(web): drop the hasOwnProperty alias the descriptor read made redundant own() now reads through Object.getOwnPropertyDescriptor, so the alias it used to call has no remaining reference. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
342 lines
20 KiB
Markdown
342 lines
20 KiB
Markdown
# 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](https://github.com/ChuckBuilds/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`.
|
|
|
|
## Unreleased
|
|
|
|
**Per-element display customization, and the last mile of it into the web UI.**
|
|
A user can set the font, size, colour, position, visibility and alignment of
|
|
individual display elements per plugin -- and, where a plugin has display
|
|
modes, separately per mode.
|
|
|
|
New public API a plugin may import via `src.*` (floor on the release that
|
|
ships this):
|
|
|
|
- `src.element_style.layout_offset(config, element, axis, default, mode)` and
|
|
`element_color(config, element, default, mode)` — the stateless reads the
|
|
scoreboard helpers share. There were three copies of the offset read and two
|
|
of the colour read; these are the one implementation, and they carry the
|
|
element-name aliasing and the per-mode lookup.
|
|
- `src.element_style.alias_keys(element)` — the names one element may be stored
|
|
under. The style block names elements `score_text` while the layout block
|
|
says `score`, and `records`/`record` and `status_text`/`status` split seven
|
|
to two across the published schemas. A lookup tries the exact name first, so
|
|
this is inert for a config that already matches.
|
|
- `src.element_style.element_visible(config, element, default, mode)`,
|
|
`element_align(...)` and `element_scale(...)` — the stateless reads for the
|
|
three knobs the resolver already understood but no draw path consumed, so an
|
|
element could be marked hidden in the web UI and still render.
|
|
- `SportsCoreSharedMixin._draw_text_with_outline(..., element="score_text")` —
|
|
naming the element resolves its colour by name and honours its visibility
|
|
toggle. Without a name the colour is inferred from font-object identity,
|
|
which cannot separate two elements sharing a face; that is the case every
|
|
bitmap font is in, because a `freetype.Face` cannot be re-instantiated, and
|
|
it is how a BDF-rendered element silently lost a configured colour. Shared
|
|
faces now resolve when exactly one sharer has a colour set.
|
|
- `LogoHelper.load_logo(..., scale=)` — applies a user's image scale, and keys
|
|
the cache on the scaled box so two elements scaled differently cannot be
|
|
served each other's image.
|
|
- `src.element_style.native_bdf_size(font)` — the one pixel size a bitmap font
|
|
can render at, or None for a scalable one. The web UI needs this to know
|
|
whether a size control can take effect at all.
|
|
- `ElementStyleResolver(config, defaults, mode=...)` plus `visible`, `align`
|
|
and `scale` on `ElementStyle`. The mode binds to the resolver rather than
|
|
being passed per call, so a plugin with one instance per mode makes every
|
|
existing lookup mode-aware by setting one class attribute.
|
|
- `BasePlugin.styles` / `styles_for(mode)` / `STYLE_MODE` — the accessor every
|
|
plugin inherits, so adopting this is no longer a guarded import plus schema
|
|
discovery plus resolver invalidation in each plugin.
|
|
- `SportsCoreSharedMixin._get_layout_offset` — promoted from the plugins'
|
|
bundled copies. Each still carries its own, which wins by MRO, so adopting
|
|
it is a deletion.
|
|
|
|
Schema and web UI:
|
|
|
|
- A `customization` block is now rendered by a composite style editor: one row
|
|
per element rather than nested accordions, with a tab per declared mode.
|
|
Plugins that hand-wrote their style blocks get it without a plugin release;
|
|
`x-style-elements` and `x-style-modes` declare it compactly.
|
|
- Font fields become a real picker rather than a hardcoded `enum`, so a font
|
|
the user uploads is selectable. Bitmap fonts taller than the element's
|
|
declared size ceiling are filtered out, because a bitmap font ignores
|
|
`font_size` and renders at its own size.
|
|
- `/static/plugin-widgets/<plugin>/<widget>.js` serves a plugin's own web-UI
|
|
widgets. The client half and the docs already existed; nothing served them.
|
|
|
|
Fixed:
|
|
|
|
- A bitmap font asked for a size it has no strike for fell back to
|
|
*PressStart2P* — a different typeface — rather than to its own native size.
|
|
32 of the 35 shipped fonts are bitmap, so this was reachable for most font
|
|
choices.
|
|
- The plugin config form read `config_schema.json` directly while the save
|
|
route read it through `SchemaManager`. Only the latter expands a compact
|
|
`x-style-elements` declaration, so a plugin using that form had a
|
|
customization section that rendered as empty space.
|
|
- `unshare_element_fonts` rebuilt faces through bare `ImageFont.truetype`,
|
|
bypassing the layout engine `src/common/font_layout.py` pins. These were the
|
|
only two call sites in `src/` doing so.
|
|
- The form parser compared a schema type to a bare string, so a nullable field
|
|
(`["array", "null"]`) never had its indexed colour inputs recombined, and a
|
|
blank one became `[]` rather than null.
|
|
|
|
Removed:
|
|
|
|
- The Fonts tab's "Element Font Overrides" panel and its three endpoints. They
|
|
reported success and saved nothing, and the element keys the panel offered
|
|
(`nfl.live.score`, `clock.time`) are read by no plugin, so wiring them to the
|
|
real `FontManager` methods would still have changed nothing on the panel.
|
|
Per-element font choice now lives in each plugin's own config editor.
|
|
- "Detected Manager Fonts", which listed every installed font with a hardcoded
|
|
usage count.
|
|
- Two dead client-side config-form renderers in `app-shell.js` (~580 lines) and
|
|
the legacy `plugins/config_manager.js`, superseded by server-side rendering.
|
|
|
|
## 3.3.0
|
|
|
|
**The release the sports scoreboards floor on to delete their bundled copies.**
|
|
3.2.0 shipped the unified sports library and made `ledmatrix_min_version`
|
|
enforceable; this ships the last three shared modules and completes the store
|
|
gate, so a scoreboard can now floor here and carry no fallback at all.
|
|
|
|
New modules a plugin may import via `src.*` and floor on 3.3.0 for:
|
|
|
|
- `src/common/sports_card.py` — settings, colour, font and date helpers for a
|
|
scoreboard's `game_renderer.py`. Free functions taking `config`/`fonts`
|
|
explicitly, so nothing about the caller's class is assumed.
|
|
- `src/common/sports_game_renderer.py` — `SportsGameRendererMixin`: scroll/Vegas
|
|
card geometry (centre gap, logo slot and cache key, layout offsets, the
|
|
upcoming-card date and time layout). No `__init__` and no state, so adoption
|
|
is one line on the class statement.
|
|
- `src/common/sports_shared.py` — `SportsCoreSharedMixin`,
|
|
`SportsLiveSharedMixin`, `SportsRecentSharedMixin`: the `sports.py` bodies
|
|
byte-identical in all eight lineage-sharing scoreboards.
|
|
|
|
All three sit under `src/common/` rather than `src/base_classes/sports/`,
|
|
deliberately: importing that package pulls `core.py` → `DisplayManager` →
|
|
`rgbmatrix`, and these are pure logic. Plugins importing them must not acquire a
|
|
hardware dependency.
|
|
|
|
Three notes for anyone adopting `sports_shared`:
|
|
|
|
- `SportsRecentSharedMixin` defines `__init__`. Its bare `super()` binds to the
|
|
mixin, so it reaches the host only when the mixin is listed **first** in the
|
|
bases. Reversing that order silently skips the host constructor.
|
|
- Methods that resolve the plugin's `config_schema.json` use `_plugin_dir()`,
|
|
which walks the MRO rather than reading `__file__` — `__file__` is now
|
|
`src/common/`. It walks because `SportsCore` is an ABC: a subclass built with
|
|
`type(name, bases, ns)` reports `__module__` as `"abc"`.
|
|
- `_get_timezone`, `_extract_game_details` and `_fetch_data` are byte-identical
|
|
across the eight but stay in the plugins. The first binds a per-plugin
|
|
timezone module whose contents differ; the other two are the abstract stubs
|
|
that define the sport.
|
|
|
|
**The store's compatibility gate is now on every registry-managed route.** 3.2.0
|
|
gated `install_plugin`. This release gates the git-pull update path and
|
|
`install_from_url`, so a plugin whose floor the core cannot meet is refused
|
|
after download with no partial directory left behind.
|
|
|
|
### Fixed
|
|
|
|
- **ESPN 403s.** `site.api` began rejecting the User-Agent strings this repo
|
|
sent on 2026-08-04; every shared-data-source scoreboard returned
|
|
`403 Forbidden`. Requests now send an identifying token with a project URL —
|
|
browser-style strings and bare custom tokens are both refused.
|
|
- **Low-memory boards becoming unreachable under load** while still answering
|
|
pings and serving the web UI. Fetched payloads are released after delivery
|
|
rather than pinned on the completed request for up to an hour, malloc arenas
|
|
are capped, and log volume and SD writes are reduced. Available memory is now
|
|
reported in Tools diagnostics.
|
|
- **A failed logo download pinning a team to a grey box**: the placeholder was
|
|
written under the real logo's filename, so later attempts found a file and
|
|
reported success without retrying.
|
|
- **A plugin enabled but never loaded is retried** rather than staying absent
|
|
with `error = null`.
|
|
- `ttl` now controls cache expiry; abandoned cache writes no longer leave temp
|
|
files; one cache-cleanup thread per directory rather than per manager.
|
|
- Odds are fetched for the games displayed, not the whole schedule window, and a
|
|
stalled ESPN no longer stalls the whole plugin update.
|
|
- Array-item secrets are no longer wiped or logged.
|
|
- A restored backup matches the device it was taken from.
|
|
- The web UI reports the real error instead of "unknown", rejects non-finite
|
|
JSON numbers, and stops checkbox groups posting back hidden options.
|
|
|
|
### Added
|
|
|
|
- `display.hardware.orientation` for panels mounted upside down.
|
|
- Vegas keeps live content in the ticker rather than being preempted by it.
|
|
- Schemas can label enum dropdown options.
|
|
|
|
## 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.
|
|
|
|
**This is also the first release that *enforces* `ledmatrix_min_version`.**
|
|
Before it, the floor was advisory — the loader logged a warning and continued,
|
|
and the plugin store never compared the core version at all, so an update could
|
|
deliver a plugin that could not run. From 3.2.0 the store refuses such an
|
|
install. That matters for the sunset rule: a plugin may only delete its bundled
|
|
fallback once the cores in the field actually enforce the floor, which means
|
|
waiting for 3.2.0 to be widely installed rather than merely released. See
|
|
`docs/SPORTS_UNIFICATION.md`, phase B6.
|
|
|
|
One deliberate exception: a core reporting a version below `2.0.0` is treated as
|
|
*unknown* rather than old and is never blocked. The v3.1.0 release ships
|
|
`__version__ = "1.0.0"` (the tag was cut before the string was bumped), and
|
|
nearly every published manifest floors at `2.0.0` — so blocking on that number
|
|
would lock those users out of the plugin store entirely.
|
|
|
|
### Added
|
|
- `src/element_style.py` — per-element style resolver backing the
|
|
`x-style-elements` config-schema extension. Already consumed (behind guarded
|
|
imports with classic fallbacks) by the `of-the-day`, `ledmatrix-music`, and
|
|
`football-scoreboard` plugins.
|
|
- 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.py` ahead of the shared sports-code unification.
|
|
- `src/base_classes/sports/` — `sports.py` is now a package (`core.py` +
|
|
`modes.py`). The import path is unchanged: `from src.base_classes.sports
|
|
import SportsCore` still works.
|
|
- Nine methods promoted onto the sports base classes from the plugins'
|
|
bundled copies, plus the override points `_favorite_key`,
|
|
`_config_schema_path` and `_font_root` and the class attributes
|
|
`FINAL_PERIOD` / `CLOCK_COUNTS_DOWN`. See `docs/SPORTS_UNIFICATION.md`.
|
|
A plugin may start calling these once its manifest floors
|
|
`ledmatrix_min_version` at 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 the `score_phrase()` / `win_phrase()` hooks, the
|
|
`COALESCE_SCORING_SEQUENCE` class attribute and the `_favorite_key` seam.
|
|
Reads both the `celebrate_opponent_goals` and `celebrate_opponent_scores`
|
|
config spellings. Sports that do not mix it in have none of this code in
|
|
their MRO.
|
|
- `RotationStrategy` + a name registry (`swrr`, `weighted`, `simple`,
|
|
plus `register_rotation_strategy` for plugin-supplied orderings). Each
|
|
built-in is verified against a verbatim transcription of the plugin
|
|
implementation it replaces. An unknown name degrades to `simple`.
|
|
|
|
- `src/common/sports_scroll.py` — `SportsScrollDisplay` and
|
|
`SportsScrollDisplayManager`, the shared scroll **orchestration** layer for
|
|
the sports scoreboards, plus native support for
|
|
`global_config['target_fps']` (the bundled plugin copies hardcode ~100 FPS
|
|
via `scroll_delay` and never consult the global target). Content building
|
|
(`prepare_scroll_content`, `_load_separator_icons`) is per-sport and stays an
|
|
override point — see `docs/SPORTS_UNIFICATION.md` for where the line falls
|
|
and why.
|
|
|
|
- `src/plugin_system/compatibility.py` — the single place that answers "can this
|
|
plugin run on this core?", shared by the loader (advisory, at load time) and
|
|
the store (blocking, at install/update time) so the two cannot drift. Reads
|
|
every spelling published manifests use, including the deprecated
|
|
`versions[].ledmatrix_min`. It does **not** yet evaluate `compatible_versions`,
|
|
which is the schema-required field and can express upper bounds; closing that
|
|
is tracked in `docs/SPORTS_UNIFICATION.md` before B6.
|
|
- `scripts/check_release_version.py` and a `Release version check` workflow —
|
|
assert that a tag, the newest CHANGELOG heading and `src.__version__` agree,
|
|
on pushed `v*` tags and published releases. Runnable via `workflow_dispatch`
|
|
to check a tag *before* creating it. Added because `v3.1.0` was tagged six
|
|
weeks before `src/__init__.py` was bumped to match, which is why devices
|
|
installed from that release report `1.0.0`.
|
|
|
|
### Changed
|
|
- `src/__init__.py` bumped to **3.2.0** — the number the sunset rule keys on.
|
|
- **The plugin store refuses an incompatible install.**
|
|
`StoreManager.install_plugin` now checks the downloaded manifest's declared
|
|
floor against `src.__version__` and refuses when the plugin needs a newer
|
|
core. The check sits in `install_plugin` because `_reinstall_with_rollback`
|
|
calls it, so a refused *update* restores the version the user already had.
|
|
Refusal requires evidence: an undeclared floor, an unparseable version on
|
|
either side, or an untrustworthy core version all allow the install.
|
|
- **A failed install no longer destroys the plugin it replaced.**
|
|
`install_plugin` previously deleted the existing plugin directory before
|
|
downloading, so any later failure — a dropped connection, a malformed
|
|
manifest, or the new compatibility refusal — left the user with nothing. The
|
|
existing copy is now set aside and restored if the install fails, matching
|
|
the protection `_reinstall_with_rollback` already gave the update path.
|
|
- `web_interface.__version__` re-exports `src.__version__` instead of carrying
|
|
its own hardcoded `"3.0.0"`, which had drifted two majors from the core.
|
|
- **Live games are no longer dropped when the feed omits a game clock.**
|
|
`SportsLive._is_game_really_over` previously (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 once `period >= 4`. Baseball
|
|
has no game clock and `period` is 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-sport `FINAL_PERIOD` (hockey ends in P3).
|
|
Sports whose clocks count up — soccer, AFL, NRL — set
|
|
`CLOCK_COUNTS_DOWN = False` and never run the check at all, since `0:00`
|
|
there means kickoff rather than expiry.
|
|
|
|
### Fixed
|
|
- **Plugin updates could hang the web request thread.** The per-plugin reinstall
|
|
locks were non-reentrant, and `_reinstall_with_rollback` holds one across its
|
|
call to `install_plugin` — which now takes the same lock to protect the
|
|
set-aside/restore above. That nesting deadlocked
|
|
`update_plugin → _reinstall_with_rollback → install_plugin`, the standard
|
|
path for every monorepo plugin update. The locks are now `RLock`s.
|
|
- `FontManager` resolves `assets/fonts` against 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 `statistics` array are no longer
|
|
discarded. The extractor read `competitor["statistics"]` unguarded, so a
|
|
`KeyError` inside the generator dropped the entire event despite valid
|
|
scores and status; shot counts now fall back to `0`.
|
|
- 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 bare `KeyError`. It now reads the already-validated competition-level
|
|
status.
|
|
- `SportsLive._is_game_really_over` no longer crashes the live-update pass when
|
|
a feed sends an explicit null `period`. `None >= FINAL_PERIOD` raised
|
|
`TypeError`, and the only caller (`_detect_stale_games`) has no `try/except`
|
|
— the same failure shape as the already-fixed null `period_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_fonts` resolves `assets/fonts` through 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_log` no longer raises `AttributeError` on the first
|
|
warning of a run; `_last_warning_time` is initialized in `__init__` rather
|
|
than lazily by an unrelated method.
|
|
- `SportsCore._resolve_project_path` resolved relative logo directories
|
|
against `<root>/src` instead of the repo root after `sports.py` became a
|
|
package — the class bodies moved byte-identically but `__file__` gained a
|
|
directory. Both it and `_font_root` now derive from one `_INSTALL_ROOT`
|
|
constant.
|
|
|
|
## 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).
|