Fix NCAA baseball scorebug missing count/outs data#34
Conversation
- 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>
📝 WalkthroughWalkthroughIntroduces a boolean flag Changes
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)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
🧹 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 situationcorrectly uses key presence to distinguish NCAA games (which lack these keys) from MLB games. This works for the current API shape and properly handlesnullor0values. However, if ESPN ever adds these keys to NCAA responses—even withnullvalues—the flag would incorrectly flip toTrueand 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_detailscontext 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>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
plugins/baseball-scoreboard/baseball.py (1)
632-663: Monkey-patchingdisplay_manager.drawis fragile but guarded.Temporarily swapping
self.display_manager.drawto render onto the overlay is a code smell — if_draw_bdf_textwere ever called concurrently or if the method signature changes, this would silently break. Thetry/finallyguard 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).
| # 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}") |
There was a problem hiding this comment.
🧩 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 5Repository: 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 versionRepository: 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 -10Repository: 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.jsonRepository: 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>
There was a problem hiding this comment.
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_updatedin manifest is stale — still shows2026-02-14.The new release is dated
2026-02-17(per the versions array entry on Line 34 andplugins.jsonLine 299), butlast_updatedon 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.
Summary
has_count_dataflag)Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit
Improvements
Chores