Skip to content

Fix NCAA baseball scorebug missing count/outs data#34

Merged
ChuckBuilds merged 3 commits intomainfrom
fix/baseball-scoreboard-ncaa
Feb 17, 2026
Merged

Fix NCAA baseball scorebug missing count/outs data#34
ChuckBuilds merged 3 commits intomainfrom
fix/baseball-scoreboard-ncaa

Conversation

@ChuckBuilds
Copy link
Copy Markdown
Owner

@ChuckBuilds ChuckBuilds commented Feb 17, 2026

Summary

  • Detect when ESPN NCAA API lacks count/outs data (has_count_data flag)
  • Hide outs circles and balls-strikes count for NCAA games (data unavailable from ESPN)
  • Bases diamond always renders (ESPN provides onFirst/onSecond/onThird)
  • Reduce live scorebug logo offset from 10px to 2px

Test plan

  • Verify NCAA baseball live scorebugs render without outs/count display
  • Verify MLB live scorebugs still show full count/outs as before
  • Verify bases diamond renders correctly for both NCAA and MLB

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Improvements

    • Scoreboard now detects when pitch count and outs are available and only shows outs, balls, and strikes when present.
    • UI hides count-related visuals and reflows layout dynamically when data is missing for cleaner display.
    • Non-live/default events now initialize without count data to reflect feed availability.
    • Minor layout tweaks for logos and scorebug positioning.
  • Chores

    • Plugin version and manifest updated.

- Detect when ESPN NCAA API lacks count/outs data (has_count_data flag)
- Hide outs circles and balls-strikes count for NCAA games (data unavailable)
- Bases diamond always renders (ESPN provides onFirst/onSecond/onThird)
- Reduce live scorebug logo offset from 10px to 2px

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 17, 2026

📝 Walkthrough

Walkthrough

Introduces a boolean flag has_count_data propagated from league/manager into extracted game details and used by the live scorebug renderer to conditionally skip rendering outs/count visuals and adjust positioning; non-live/default paths set has_count_data = False.

Changes

Cohort / File(s) Summary
Core game extraction
plugins/baseball-scoreboard/baseball.py
Add has_count_data detection (based on league) and include it in _extract_game_details for live and non-live paths; add debug logging for has_count_data and final count values.
Rendering logic
plugins/baseball-scoreboard/game_renderer.py
Gate outs and balls/strikes visuals behind has_count_data; compute outs column/positions only when count data exists; minor logo/placement tweaks.
NCAA manager sample data
plugins/baseball-scoreboard/ncaa_baseball_managers.py
Set sample current_game["has_count_data"] = False in NCAABaseballLiveManager initialization.
Manifests / metadata
plugins.json, plugins/baseball-scoreboard/manifest.json
Bump plugin version to 1.3.1 and update last_updated/versions metadata.

Sequence Diagram(s)

sequenceDiagram
    participant Manager as LiveManager
    participant Extractor as Baseball._extract_game_details
    participant Renderer as GameRenderer
    participant Display as ScorebugDisplay

    Manager->>Extractor: provide live event payload
    Extractor-->>Manager: return game_details (includes has_count_data)
    Manager->>Renderer: render_live_game(game_details)
    alt has_count_data == true
        Renderer->>Display: draw outs indicators and count (balls/strikes)
        Renderer->>Display: draw bases visuals
    else has_count_data == false
        Renderer->>Display: skip outs/count visuals (adjust layout)
    end
    Renderer->>Display: draw common scorebug elements (logos, score, teams)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix NCAA baseball scorebug missing count/outs data' is fully related to the main change. The PR introduces a has_count_data flag to detect when ESPN NCAA API lacks count/outs data and conditionally hides these elements in the scorebug rendering, which directly matches the title.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/baseball-scoreboard-ncaa

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.

@ChuckBuilds
Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 17, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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.

🧹 Nitpick comments (1)
plugins/baseball-scoreboard/baseball.py (1)

228-234: Detection heuristic is reasonable but fragile if ESPN API evolves.

The check "outs" in situation or "count" in situation or "balls" in situation correctly uses key presence to distinguish NCAA games (which lack these keys) from MLB games. This works for the current API shape and properly handles null or 0 values. However, if ESPN ever adds these keys to NCAA responses—even with null values—the flag would incorrectly flip to True and display stale/zero count data for NCAA games.

A more robust approach would detect based on league identifier (e.g., checking for a league property propagated through the method), which would be deterministic rather than heuristic. However, league information is not currently available in the _extract_game_details context and would require refactoring to pass through the call chain. For now, the implementation works correctly but relies on ESPN's API structure remaining stable.

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

In `@plugins/baseball-scoreboard/baseball.py` around lines 228 - 234, Refactor
_extract_game_details to accept an optional league identifier and use it to set
has_count_data deterministically (e.g., if league indicates MLB then True, if
NCAA then False); if adding the league param isn't possible immediately, make
the heuristic more conservative by changing the has_count_data check to require
the keys exist in situation and their values are not None (e.g., check "outs" in
situation and situation["outs"] is not None, same for "count"/"balls") so you
won't treat null keys as real count data; update references to has_count_data
and keep the debug logs (is_favorite_game, situation) unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@plugins/baseball-scoreboard/baseball.py`:
- Around line 228-234: Refactor _extract_game_details to accept an optional
league identifier and use it to set has_count_data deterministically (e.g., if
league indicates MLB then True, if NCAA then False); if adding the league param
isn't possible immediately, make the heuristic more conservative by changing the
has_count_data check to require the keys exist in situation and their values are
not None (e.g., check "outs" in situation and situation["outs"] is not None,
same for "count"/"balls") so you won't treat null keys as real count data;
update references to has_count_data and keep the debug logs (is_favorite_game,
situation) unchanged.

Replace key-presence heuristic with deterministic self.league check
to avoid false positives if ESPN ever adds null count keys to NCAA
responses.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
plugins/baseball-scoreboard/baseball.py (1)

632-663: Monkey-patching display_manager.draw is fragile but guarded.

Temporarily swapping self.display_manager.draw to render onto the overlay is a code smell — if _draw_bdf_text were ever called concurrently or if the method signature changes, this would silently break. The try/finally guard is good, but consider passing the draw target directly to the BDF text method in a future refactor to avoid shared mutable state manipulation.

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@plugins/baseball-scoreboard/baseball.py`:
- Around line 228-234: Update the plugin manifest.json version from 1.3.0 to the
correct PATCH bump 1.2.1 for this bug fix (this plugin's manifest in the
baseball-scoreboard package), ensuring the version string follows semantic
versioning "1.2.1" and commit the change; no code changes are needed in
baseball.py (the detection logic using self.league is correct).

Comment on lines +228 to +234
# NCAA baseball API doesn't provide count/outs data (only onFirst/onSecond/onThird)
# Use league identifier for deterministic detection instead of key-presence heuristic
has_count_data = self.league != "college-baseball"

if is_favorite_game:
self.logger.debug(f"Full situation data: {situation}")
self.logger.debug(f"has_count_data: {has_count_data}")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify self.league is set in a parent class (SportsCore or similar)
echo "=== Searching for 'self.league' assignments ==="
rg -n --type=py 'self\.league\s*=' -C 3

echo ""
echo "=== Searching for 'college-baseball' string usage ==="
rg -n --type=py 'college-baseball' -C 2

echo ""
echo "=== Searching for class definition and inheritance ==="
rg -n --type=py 'class Baseball' -C 5

echo ""
echo "=== Searching for SportsCore class ==="
rg -n --type=py 'class SportsCore' -C 5

Repository: ChuckBuilds/ledmatrix-plugins

Length of output: 33978


🏁 Script executed:

#!/bin/bash
# Check for version information in baseball-scoreboard plugin
echo "=== Looking for version files in baseball-scoreboard plugin ==="
find plugins/baseball-scoreboard -type f -name "*version*" -o -name "setup.py" -o -name "pyproject.toml" -o -name "__init__.py" | head -20

echo ""
echo "=== Checking for __version__ string in baseball-scoreboard plugin files ==="
rg -n --type=py '__version__' plugins/baseball-scoreboard/

echo ""
echo "=== Checking the main plugin manager file for version info ==="
head -50 plugins/baseball-scoreboard/manager.py | grep -i version

Repository: ChuckBuilds/ledmatrix-plugins

Length of output: 277


🏁 Script executed:

#!/bin/bash
# Check for version management at repository and plugin root level
echo "=== Checking repository root for version files ==="
ls -la | grep -i version || echo "No version files in root"

echo ""
echo "=== Checking plugins directory for version.py or similar ==="
find plugins -maxdepth 2 -name "*version*" -type f

echo ""
echo "=== Check if version is in baseball plugin __init__.py ==="
if [ -f "plugins/baseball-scoreboard/__init__.py" ]; then
  cat plugins/baseball-scoreboard/__init__.py
else
  echo "No __init__.py in baseball-scoreboard"
fi

echo ""
echo "=== Check parent of plugins directory ==="
ls -la plugins/ | head -20

echo ""
echo "=== Search for version pattern in any config files ==="
rg -n '"version":|version\s*=' plugins/baseball-scoreboard/ | head -10

Repository: ChuckBuilds/ledmatrix-plugins

Length of output: 2269


🏁 Script executed:

#!/bin/bash
# Get the full manifest.json to see version history and changelog
echo "=== Full manifest.json content ==="
cat plugins/baseball-scoreboard/manifest.json

Repository: ChuckBuilds/ledmatrix-plugins

Length of output: 1786


Correct the version bump to 1.2.1 per coding guidelines for bug fixes.

The version was bumped to 1.3.0 (a MINOR version increment), but the coding guideline for **/plugins/**/*.py requires PATCH version bumps (1.2.x) for bug fixes. Since this PR fixes the NCAA baseball scorebug missing count/outs data, the version should be 1.2.1, not 1.3.0. Update manifest.json to reflect this.

(Note: The self.league attribute is properly defined in SportsCore.__init__ and correctly set to "college-baseball" by the NCAA Baseball manager, so the detection logic is sound.)

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

In `@plugins/baseball-scoreboard/baseball.py` around lines 228 - 234, Update the
plugin manifest.json version from 1.3.0 to the correct PATCH bump 1.2.1 for this
bug fix (this plugin's manifest in the baseball-scoreboard package), ensuring
the version string follows semantic versioning "1.2.1" and commit the change; no
code changes are needed in baseball.py (the detection logic using self.league is
correct).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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/baseball-scoreboard/manifest.json (1)

74-74: ⚠️ Potential issue | 🟡 Minor

last_updated in manifest is stale — still shows 2026-02-14.

The new release is dated 2026-02-17 (per the versions array entry on Line 34 and plugins.json Line 299), but last_updated on Line 74 was not updated to match.

Proposed fix
-  "last_updated": "2026-02-14",
+  "last_updated": "2026-02-17",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/baseball-scoreboard/manifest.json` at line 74, The manifest.json
"last_updated" field is stale (currently "2026-02-14") and must match the
release date used elsewhere (the new release date "2026-02-17" referenced in the
versions array and plugins.json); update the "last_updated" value in
manifest.json to "2026-02-17" so it aligns with the versions array entry and
plugins.json, ensuring consistent release metadata for the plugin.
🤖 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/baseball-scoreboard/manifest.json`:
- Line 74: The manifest.json "last_updated" field is stale (currently
"2026-02-14") and must match the release date used elsewhere (the new release
date "2026-02-17" referenced in the versions array and plugins.json); update the
"last_updated" value in manifest.json to "2026-02-17" so it aligns with the
versions array entry and plugins.json, ensuring consistent release metadata for
the plugin.

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