Skip to content

fix(ledmatrix-flights): give the Vegas map the same features as the rotation - #231

Open
ChuckBuilds wants to merge 2 commits into
mainfrom
fix/flights-vegas-map-parity
Open

fix(ledmatrix-flights): give the Vegas map the same features as the rotation#231
ChuckBuilds wants to merge 2 commits into
mainfrom
fix/flights-vegas-map-parity

Conversation

@ChuckBuilds

@ChuckBuilds ChuckBuilds commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Problem

Aircraft trails never appeared on the map in Vegas scroll mode, even with show_trails enabled.

get_vegas_content() reimplemented a cut-down version of the map view rather than sharing it. Its copy drew two things; _display_map drew five. Missing from the ticker:

  • aircraft trails, with their fading effect
  • the white centre-position marker — the map's only reference point, so without it the aircraft positions are much harder to read
  • the aircraft count and airplane icon

The trail data was always being collected: aircraft_trails is populated in update() regardless of which display path runs. This was purely a rendering gap.

It's duplication drift rather than a deliberate simplification — _display_map accumulated features over time and the Vegas copy didn't track them.

Fix

Extracted _render_map_image() as the single source of truth, called by both _display_map and get_vegas_content.

I deliberately did not just add the three missing pieces to the copy: that leaves the identical trap for the next feature added to the map view. There is now one renderer and one call site for _get_map_background.

Sizing needs no extra plumbing

Worth noting for review, since it looks like it should: display_width/display_height are properties over matrix, and the core narrows the display manager while requesting Vegas content, so _latlon_to_pixel already scales its projection to whatever width the ticker asked for. Verified from 64×32 up to 512×64, including an explicit 64px-wide render.

On the test rig flights renders at 256px (it has vegas_width_pct: 50), and the log confirms the shared path producing 256x64.

Testing

test_vegas_map_parity.py (17 cases). The load-bearing one asserts the Vegas image is byte-identical to what the rotation pushes to the display — that's what stops the two drifting again, rather than testing for the three features individually and missing the fourth next time. Plus direct coverage of trails on/off, the centre marker, the untracked-trail skip, and rendering at every panel size.

  • Safety harness: all sizes PASS.
  • check_module_collisions.py: OK across 41 plugins.
  • On hardware: renders through the shared path with no errors, 107–113 aircraft flowing from SkyAware.

Also drops two locals in get_vegas_content that the refactor left unused.

Context

Part of a set of Vegas scroll mode changes; the core-side companion is ChuckBuilds/LEDMatrix#423.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KEZK1P1Q1fu5pcuVrkrCFZ

Summary by CodeRabbit

  • Bug Fixes

    • Fixed the Vegas scroll map so trails, the center marker, aircraft, and aircraft count display correctly.
    • Ensured Vegas map visuals match the standard rotating map display across screen sizes.
  • Release

    • Updated the ledmatrix-flights plugin to version 1.12.6, including the latest release notes.

…otation

get_vegas_content() reimplemented a cut-down version of the map view rather
than sharing it. Its copy drew only the map background and the aircraft dots,
so three things were silently missing from the ticker:

- aircraft trails, even with show_trails enabled
- the white centre-position marker, which is the map's only reference point
- the aircraft count and airplane icon

The trail data was always there — aircraft_trails is populated in update()
regardless of which display path runs — so this was purely a rendering gap.
It is duplication drift rather than a deliberate simplification: _display_map
gained features over time and the Vegas copy did not track them.

Extracted _render_map_image() as the single source of truth, called by both
_display_map and get_vegas_content. Fixing the copy in place would have left
the same trap for the next feature added to the map view.

Sizing needs no extra plumbing: display_width/display_height are properties
over matrix, and Vegas narrows the display manager while requesting content, so
_latlon_to_pixel already scales its projection to whatever width the ticker
asked for. Verified at 64x32 through 512x64, including a 64px-wide render.

test_vegas_map_parity.py asserts the Vegas image is byte-identical to what the
rotation pushes to the display, so the two cannot diverge again, plus direct
coverage of the trails, the centre marker and the untracked-trail skip.

Also drops two now-unused locals from get_vegas_content.

Safety harness: all sizes PASS. Module collisions: OK.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KEZK1P1Q1fu5pcuVrkrCFZ
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@ChuckBuilds, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 54 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5b879eb6-94d6-4568-9893-fe5b114abf3f

📥 Commits

Reviewing files that changed from the base of the PR and between 154c858 and eea66e6.

📒 Files selected for processing (1)
  • plugins/ledmatrix-flights/test_vegas_map_parity.py
📝 Walkthrough

Walkthrough

The Vegas map renderer is centralized in _render_map_image(), reused by ticker and rotation paths, and covered by pixel-level regression tests. Plugin metadata and release documentation are updated to version 1.12.6.

Changes

Vegas map parity

Layer / File(s) Summary
Shared Vegas map rendering
plugins/ledmatrix-flights/manager.py
get_vegas_content() and _display_map() now use _render_map_image(), which renders backgrounds, center markers, trails, aircraft, counts, and icons at the display dimensions.
Renderer regression coverage
plugins/ledmatrix-flights/test_vegas_map_parity.py
Adds deterministic tests for map elements, trail behavior, Vegas-to-rotation pixel parity, display updates, and narrowed dimensions.
Version 1.12.6 release metadata
plugins.json, plugins/ledmatrix-flights/manifest.json, plugins/ledmatrix-flights/CHANGELOG.md
Updates registry and manifest versions to 1.12.6 and documents the Vegas map rendering fix dated 2026-07-29.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: Vegas map rendering now matches the rotation view’s features.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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/flights-vegas-map-parity

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.

@codacy-production

codacy-production Bot commented Jul 29, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 38 complexity

Metric Results
Complexity 38

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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/ledmatrix-flights/test_vegas_map_parity.py (1)

221-225: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover every supported panel size.

This omits required 128×64 and 256×32 coverage while testing unsupported 256×64 and 512×64 dimensions.

Proposed test matrix
-    `@pytest.mark.parametrize`("width,height", [(64, 32), (128, 32), (256, 64), (512, 64)])
+    `@pytest.mark.parametrize`(
+        "width,height",
+        [(64, 32), (128, 32), (128, 64), (256, 32)],
+    )

As per coding guidelines, “Every plugin must render correctly on all supported matrix sizes: 64×32, 128×32, 128×64, and 256×32.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/ledmatrix-flights/test_vegas_map_parity.py` around lines 221 - 225,
Update the width,height parameter matrix in
test_renders_without_error_at_any_size to cover exactly the supported sizes
64×32, 128×32, 128×64, and 256×32; remove the unsupported 256×64 and 512×64
cases while preserving the existing render and image-size assertions.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@plugins/ledmatrix-flights/manager.py`:
- Around line 2902-2903: Move map background retrieval out of the render path:
update() should refresh tile/background data through self.cache_manager, while
display() and get_vegas_content() should only read the cached background and
retain the existing black fallback when unavailable. Ensure
_get_map_background() is no longer invoked synchronously by either render
method.

---

Nitpick comments:
In `@plugins/ledmatrix-flights/test_vegas_map_parity.py`:
- Around line 221-225: Update the width,height parameter matrix in
test_renders_without_error_at_any_size to cover exactly the supported sizes
64×32, 128×32, 128×64, and 256×32; remove the unsupported 256×64 and 512×64
cases while preserving the existing render and image-size assertions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 05a8f722-73c6-4dd4-bda7-ee98ff7ff369

📥 Commits

Reviewing files that changed from the base of the PR and between 3f7c90e and 154c858.

📒 Files selected for processing (5)
  • plugins.json
  • plugins/ledmatrix-flights/CHANGELOG.md
  • plugins/ledmatrix-flights/manager.py
  • plugins/ledmatrix-flights/manifest.json
  • plugins/ledmatrix-flights/test_vegas_map_parity.py

Comment on lines 2902 to 2903
# Get map background if enabled
map_bg = self._get_map_background(self.center_lat, self.center_lon)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

Move tile fetching out of the render path.

_get_map_background() can synchronously fetch map tiles on cache misses, and this helper runs from both display() and get_vegas_content(). A cold cache can therefore stall a rotation/Vegas frame. Refresh tile/background data in update() through self.cache_manager; render from cached data or use the existing black fallback.

As per coding guidelines, “Fetch or refresh network data in update(), never in display(), and use the shared self.cache_manager for network-fetched data.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/ledmatrix-flights/manager.py` around lines 2902 - 2903, Move map
background retrieval out of the render path: update() should refresh
tile/background data through self.cache_manager, while display() and
get_vegas_content() should only read the cached background and retain the
existing black fallback when unavailable. Ensure _get_map_background() is no
longer invoked synchronously by either render method.

Source: Coding guidelines

Drops an unused ImageDraw import, and replaces Cls.__new__(Cls) with a
no-op-__init__ subclass for building the test shell. The __new__ form is valid
Python but Codacy's Pylint reports it as a missing-cls call; the subclass reads
better anyway and states the intent — bypass the real __init__, which builds
fetchers, threads and caches the map renderer does not need.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KEZK1P1Q1fu5pcuVrkrCFZ
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.

2 participants