Skip to content

fix: post-audit follow-ups (lacrosse rename + dead v2 imports)#93

Merged
ChuckBuilds merged 1 commit intomainfrom
fix/post-audit-followups
Apr 8, 2026
Merged

fix: post-audit follow-ups (lacrosse rename + dead v2 imports)#93
ChuckBuilds merged 1 commit intomainfrom
fix/post-audit-followups

Conversation

@ChuckBuilds
Copy link
Copy Markdown
Owner

@ChuckBuilds ChuckBuilds commented Apr 8, 2026

Summary

Companion to ChuckBuilds/LEDMatrix#307. Fixes the two code bugs
the docs refresh audit on #92 surfaced that belong in this repo.

Bug 6: lacrosse-scoreboard display-mode collision (BREAKING)

`lacrosse-scoreboard` shipped six display modes
(`ncaa_mens_recent` / `upcoming` / `live` and
`ncaa_womens_*`) that collided with the same six names used by
`hockey-scoreboard`. LEDMatrix's display controller stores modes
in a flat dict keyed by mode name, so whichever plugin loaded
second silently overrode the first — no log warning, no crash,
just silent data loss.

All six lacrosse modes gained a `lax_` prefix:

Old New
`ncaa_mens_recent` `lax_ncaa_mens_recent`
`ncaa_mens_upcoming` `lax_ncaa_mens_upcoming`
`ncaa_mens_live` `lax_ncaa_mens_live`
`ncaa_womens_recent` `lax_ncaa_womens_recent`
`ncaa_womens_upcoming` `lax_ncaa_womens_upcoming`
`ncaa_womens_live` `lax_ncaa_womens_live`

Updated the manifest, the default-mode fallback in `manager.py`,
the dispatch in `_get_current_manager`, the mode-string parser
(`record_dynamic_progress`, `get_cycle_duration`, and the
granular parser in `display_plugin_mode`), and the
`live_modes.append(...)` literals in `get_live_modes`. The old
`current_mode.split('
', 2)[2]` parser assumed two underscores
before the mode-type segment; the new four-segment strings
(`lax_ncaa_mens_recent`) have three, so the parser now uses
`rsplit('
', 1)[1]` which is correct regardless of prefix depth.

Version bumped 1.0.3 → 1.1.0 (minor bump per semver for a
breaking config change). README's old "Known conflict" warning
is replaced with a breaking-change notice; full migration table
and instructions live in the new
`CHANGELOG.md`.

No backward-compat aliases — the old mode names are no
longer recognized by the dispatch logic. Anyone with the old
names in `display_durations`, `rotation_order`, or any other
config key needs to migrate per the CHANGELOG.

Bug 5: dead `web_interface_v2` import pattern

14 plugin files carried a `try/except` block importing
`web_interface_v2.increment_api_counter` with a no-op fallback:

```python
try:
from web_interface_v2 import increment_api_counter
except ImportError:
def increment_api_counter(kind: str, count: int = 1):
pass
```

The `web_interface_v2` module doesn't exist anywhere in the v3
codebase — the counter has been silently a no-op for every
plugin, and no API-metrics dashboard reads it. Deleted the
import block, every direct call site, one
`self.increment_api_counter` `hasattr`-guarded call in
`odds-ticker/data_fetcher.py`, and the orphan
`# Increment API counter` comments left behind.

Touched plugins (14 files):

  • `baseball-scoreboard/base_odds_manager.py`
  • `basketball-scoreboard/base_odds_manager.py`
  • `football-scoreboard/base_odds_manager.py`
  • `hockey-scoreboard/base_odds_manager.py`
  • `lacrosse-scoreboard/base_odds_manager.py`
  • `soccer-scoreboard/base_odds_manager.py`
  • `ufc-scoreboard/base_odds_manager.py`
  • `ledmatrix-leaderboard/data_fetcher.py`
  • `ledmatrix-music/manager.py`
  • `ledmatrix-stocks/data_fetcher.py`
  • `ledmatrix-weather/manager.py`
  • `odds-ticker/manager.py`
  • `odds-ticker/data_fetcher.py`
  • `youtube-stats/manager.py`

Verification done locally

  • `ast.parse` on every `.py` file under `plugins/` — 0 syntax errors
  • `py_compile` on all 14 touched files + `lacrosse-scoreboard/manager.py`
  • No `web_interface_v2` or `increment_api_counter` references
    remain anywhere under `plugins/` (except an unrelated
    `src.api_counter` mock in
    `lacrosse-scoreboard/test_lacrosse_plugin.py`)
  • Lacrosse `lax_` prefix applied consistently across the
    manifest, default mode fallback, dispatch logic, and
    mode-string parser
  • Pre-commit hook auto-synced `plugins.json` to the new
    `1.1.0` version

Test plan

  • Install both `lacrosse-scoreboard` and `hockey-scoreboard`
    side-by-side and confirm both plugins' NCAA modes appear in
    the rotation (no silent override).
  • Restart the display service and confirm no
    `ImportError: web_interface_v2` warnings in
    `journalctl -u ledmatrix`.
  • Enable the odds flow via `odds-ticker` or any of the
    scoreboards and confirm odds still render correctly after
    the counter-call removal.
  • For any user with `ncaa_mens_` or `ncaa_womens_`
    keys in `config.json` under a lacrosse-specific section,
    follow the migration steps in the new
    `lacrosse-scoreboard/CHANGELOG.md`.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Breaking Changes

    • Lacrosse plugin v1.1.0 requires configuration migration: add lax_ prefix to all NCAA mode identifiers (e.g., ncaa_mens_recentlax_ncaa_mens_recent). Update any references in display settings.
  • Chores

    • Removed API counter tracking integration across multiple plugins.

The docs refresh audit on #92 flagged two code bugs affecting the
plugins repo. Neither could be fixed in a docs-only PR, so they
were deferred to this follow-up. The companion LEDMatrix PR
(ChuckBuilds/LEDMatrix#307) handles the six bugs that belong in
the app repo.

Bug 6: lacrosse-scoreboard display-mode collision (BREAKING)
  lacrosse-scoreboard shipped six display modes (ncaa_mens_recent /
  upcoming / live and ncaa_womens_recent / upcoming / live) that
  collide with the same six modes exposed by hockey-scoreboard.
  LEDMatrix's display controller stores modes in a flat dict keyed
  by mode name (src/display_controller.py), so whichever plugin
  loaded second silently overrode the first — with no warning in
  the logs. Renamed all six modes with a plugin-specific lax_
  prefix:

    ncaa_mens_recent      -> lax_ncaa_mens_recent
    ncaa_mens_upcoming    -> lax_ncaa_mens_upcoming
    ncaa_mens_live        -> lax_ncaa_mens_live
    ncaa_womens_recent    -> lax_ncaa_womens_recent
    ncaa_womens_upcoming  -> lax_ncaa_womens_upcoming
    ncaa_womens_live      -> lax_ncaa_womens_live

  Manifest, dispatch logic in manager.py (_get_current_manager,
  _record_dynamic_progress, get_cycle_duration, and the granular
  mode-parser that walks the league registry) all updated to use
  the new names. The split('_', 2)[2] parser has been replaced
  with rsplit('_', 1)[1] where the new four-segment mode strings
  (lax_ncaa_mens_recent) need the last segment. README
  "Known conflict" warning replaced with a breaking-change note
  pointing at the new CHANGELOG.md, which spells out the rename
  table and migration steps for anyone with the old mode names
  hardcoded in their config.json (display_durations, rotation_order,
  etc.). Version bumped 1.0.3 -> 1.1.0 (minor bump per semver —
  breaking config change). No backward-compat aliases.

Bug 5: dead web_interface_v2 import pattern (plugins half)
  Every plugin that used to talk to the v2 API-counter helper
  carried a try/except block importing web_interface_v2 and
  falling back to a no-op stub. The web_interface_v2 module
  doesn't exist anywhere in the v3 codebase — the counter was
  silently a no-op for every plugin, and no API-metrics dashboard
  reads the counter. Deleted the import block, all direct calls,
  one self.increment_api_counter hasattr-guarded call site in
  odds-ticker/data_fetcher.py, and the orphan "# Increment API
  counter" comment lines left behind.

  Touched plugins (14 files):
    - baseball-scoreboard/base_odds_manager.py
    - basketball-scoreboard/base_odds_manager.py
    - football-scoreboard/base_odds_manager.py
    - hockey-scoreboard/base_odds_manager.py
    - lacrosse-scoreboard/base_odds_manager.py
    - soccer-scoreboard/base_odds_manager.py
    - ufc-scoreboard/base_odds_manager.py
    - ledmatrix-leaderboard/data_fetcher.py
    - ledmatrix-music/manager.py
    - ledmatrix-stocks/data_fetcher.py
    - ledmatrix-weather/manager.py
    - odds-ticker/manager.py
    - odds-ticker/data_fetcher.py
    - youtube-stats/manager.py

Verification done locally:
  - ast.parse on all plugin .py files (0 syntax errors)
  - py_compile on every touched file
  - No web_interface_v2 or increment_api_counter references
    remain anywhere under plugins/ (except the unrelated
    src.api_counter mock in lacrosse-scoreboard/test_lacrosse_plugin.py)
  - Lacrosse lax_ prefix applied consistently across manifest,
    default mode fallback, dispatch logic, and mode-string parser

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 8, 2026

📝 Walkthrough

Walkthrough

This PR removes increment_api_counter calls across multiple sports and utility plugins, eliminating external API usage tracking. Concurrently, it updates the lacrosse-scoreboard plugin with a version bump to 1.1.0, renames display mode identifiers with a lax_ prefix to resolve naming collisions, and documents breaking changes in the changelog and README.

Changes

Cohort / File(s) Summary
Scoreboard plugins - API counter removal
plugins/baseball-scoreboard/base_odds_manager.py, plugins/basketball-scoreboard/base_odds_manager.py, plugins/football-scoreboard/base_odds_manager.py, plugins/hockey-scoreboard/base_odds_manager.py, plugins/soccer-scoreboard/base_odds_manager.py, plugins/ufc-scoreboard/base_odds_manager.py, plugins/lacrosse-scoreboard/base_odds_manager.py
Removed conditional increment_api_counter import from web_interface_v2 and eliminated API counter increments after ESPN odds fetch operations; all odds retrieval, caching, and error handling remain unchanged.
Data fetcher plugins - API counter removal
plugins/ledmatrix-leaderboard/data_fetcher.py, plugins/ledmatrix-music/manager.py, plugins/ledmatrix-stocks/data_fetcher.py, plugins/ledmatrix-weather/manager.py, plugins/youtube-stats/manager.py
Removed increment_api_counter import and eliminated API counter increments across ESPN ranking fetches, geocoding/weather requests, and channel data retrieval; request/parse/cache logic unchanged.
Odds-ticker plugin
plugins/odds-ticker/data_fetcher.py, plugins/odds-ticker/manager.py
Removed increment_api_counter import and deleted all API counter calls in sports/odds fetch methods; request and data handling logic preserved.
Lacrosse-scoreboard display mode refactoring
plugins/lacrosse-scoreboard/manager.py
Updated granular display-mode naming to emit and recognize lax_{league\_id}_{mode\_type} prefix; mode parsing, cycling, and duration tracking updated to strip/recognize lax_ prefix; docstring whitespace adjustments included.
Lacrosse-scoreboard metadata & version
plugins/lacrosse-scoreboard/manifest.json, plugins/lacrosse-scoreboard/CHANGELOG.md, plugins/lacrosse-scoreboard/README.md, plugins.json
Updated lacrosse-scoreboard version to 1.1.0 with last_updated to 2026-04-07; renamed all six display mode identifiers by adding lax_ prefix (e.g., ncaa_mens_recentlax_ncaa_mens_recent); documented breaking change and required migration path in CHANGELOG and README.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the two main changes: lacrosse display mode renaming with a lax_ prefix and removal of dead web_interface_v2 imports across multiple plugins.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/post-audit-followups

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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
plugins/lacrosse-scoreboard/manager.py (1)

1439-1468: ⚠️ Potential issue | 🔴 Critical

_get_manager_for_mode will return None for modes with the lax_ prefix.

The method expects unprefixed mode names (e.g., ncaa_mens_recent), but callers at lines 1750, 1793, and 1833 pass mode names extracted from self.modes which include the lax_ prefix (e.g., lax_ncaa_mens_recent). Since the method only checks startswith("ncaa_mens_") and startswith("ncaa_womens_"), these prefixed modes will not match and the method will return None, breaking the dynamic cycle completion logic.

Strip the lax_ prefix from mode_name at the beginning of _get_manager_for_mode, or adjust the caller to remove the prefix before passing it.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/lacrosse-scoreboard/manager.py` around lines 1439 - 1468, The
_get_manager_for_mode method fails to match mode names that include the "lax_"
prefix (e.g., "lax_ncaa_mens_recent") because it only checks
startswith("ncaa_mens_") and startswith("ncaa_womens_"); update
_get_manager_for_mode to normalize the incoming mode_name by stripping a leading
"lax_" prefix (if present) before the existing startswith checks so callers that
pass modes from self.modes (like "lax_ncaa_mens_recent") will resolve to the
correct manager (ncaa_mens_live, ncaa_mens_recent, ncaa_mens_upcoming, etc.).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@plugins/lacrosse-scoreboard/manager.py`:
- Around line 1439-1468: The _get_manager_for_mode method fails to match mode
names that include the "lax_" prefix (e.g., "lax_ncaa_mens_recent") because it
only checks startswith("ncaa_mens_") and startswith("ncaa_womens_"); update
_get_manager_for_mode to normalize the incoming mode_name by stripping a leading
"lax_" prefix (if present) before the existing startswith checks so callers that
pass modes from self.modes (like "lax_ncaa_mens_recent") will resolve to the
correct manager (ncaa_mens_live, ncaa_mens_recent, ncaa_mens_upcoming, etc.).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4708a2c5-725f-4e93-8b8c-06b2586034cd

📥 Commits

Reviewing files that changed from the base of the PR and between 9a27aba and e9febd7.

📒 Files selected for processing (19)
  • plugins.json
  • plugins/baseball-scoreboard/base_odds_manager.py
  • plugins/basketball-scoreboard/base_odds_manager.py
  • plugins/football-scoreboard/base_odds_manager.py
  • plugins/hockey-scoreboard/base_odds_manager.py
  • plugins/lacrosse-scoreboard/CHANGELOG.md
  • plugins/lacrosse-scoreboard/README.md
  • plugins/lacrosse-scoreboard/base_odds_manager.py
  • plugins/lacrosse-scoreboard/manager.py
  • plugins/lacrosse-scoreboard/manifest.json
  • plugins/ledmatrix-leaderboard/data_fetcher.py
  • plugins/ledmatrix-music/manager.py
  • plugins/ledmatrix-stocks/data_fetcher.py
  • plugins/ledmatrix-weather/manager.py
  • plugins/odds-ticker/data_fetcher.py
  • plugins/odds-ticker/manager.py
  • plugins/soccer-scoreboard/base_odds_manager.py
  • plugins/ufc-scoreboard/base_odds_manager.py
  • plugins/youtube-stats/manager.py
💤 Files with no reviewable changes (12)
  • plugins/hockey-scoreboard/base_odds_manager.py
  • plugins/youtube-stats/manager.py
  • plugins/lacrosse-scoreboard/base_odds_manager.py
  • plugins/football-scoreboard/base_odds_manager.py
  • plugins/soccer-scoreboard/base_odds_manager.py
  • plugins/ledmatrix-stocks/data_fetcher.py
  • plugins/ledmatrix-leaderboard/data_fetcher.py
  • plugins/ledmatrix-weather/manager.py
  • plugins/basketball-scoreboard/base_odds_manager.py
  • plugins/baseball-scoreboard/base_odds_manager.py
  • plugins/odds-ticker/manager.py
  • plugins/ufc-scoreboard/base_odds_manager.py

@ChuckBuilds ChuckBuilds merged commit 50e2b7b into main Apr 8, 2026
1 check passed
@ChuckBuilds ChuckBuilds deleted the fix/post-audit-followups branch April 8, 2026 13:02
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