fix(display): a non-numeric plugin duration no longer stops the display; narrow scroll strips no longer raise - #739
Merged
Merged
Conversation
…the display DisplayController._get_display_duration returned whatever the plugin's get_display_duration() gave back. clock-simple, calendar and countdown return their display_duration setting straight from config.json, so a value saved as "20" or null reached _resolve_durations as a string or None, and its `<= 0` check raised a TypeError. Nothing in the loop caught it: run()'s outer handler logged "Unexpected error in display controller" and cleanup() ended the service when that plugin's screen came up, and systemd restarted it into the same crash. The plugin's answer is now read as seconds: a finite number or a numeric string is used (as BasePlugin.get_display_duration already accepts), a number at or below zero still goes to _resolve_durations' 15 s rule, and anything else -- None, a non-numeric string, a bool, NaN, infinity, or a get_display_duration() that raises -- gets the 30 s a mode without a plugin gets. The warning is logged once per plugin, not at every screen. Tests: test/test_display_duration_not_a_number.py, including the real run() on the run-loop harness, which returned at t=30 before the fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y frame ScrollHelper._get_visible_portion_integer handled a frame that runs off the end of the strip by copying the strip's tail and then the rest of the frame from its head, which assumed the head was at least that wide. For a strip narrower than the panel that raised "could not broadcast input array" at every position, so get_visible_portion() never returned a frame and the caller logged a traceback each frame. Vegas composes such a strip (lead_in_width defaults to 0) when its content is narrower than the chain. A wrapping frame is now taken column by column modulo the strip's width (np.take, mode='wrap', into the reused frame buffer): the tail then the head, as before, and a narrow strip repeated across the panel. The same path takes a position before the start of the strip, whose [-n:m] slice was empty and made frombytes raise; the integer and sub-pixel fast paths now leave a negative start to it. A zero-width strip is still a black frame. Tests: test/test_scroll_helper_narrow_strip.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 29 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (5)
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 |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 4 |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two crashes in the render path.
1. A plugin duration that isn't a number stopped the display
Several plugins return
display_durationstraight from config.json: clock-simple, calendar and countdown. A value saved as"20"ornull(from the raw Config Editor or a hand edit) reached_resolve_durations. There,max_duration <= 0raisedTypeError, which no handler in the loop catches, sorun()exited.Reproduced on ledpi (plain main ef69201): I set clock-simple's
display_durationto"20"and started it on demand.The panel went dark and the service restarted 10 s later. The same build with this fix kept running with the same PID and showed the clock.
Fix:
_get_display_durationruns the plugin'sget_display_duration()in a try block and takes its value through_finite_seconds.BasePlugin.None, other strings, bools, NaN, inf, or a raise get the 30 s fallback, with one warning per plugin.0or a negative number still goes to_resolve_durations' existing 15 s rule.2.
ScrollHelperraised on every frame for a strip narrower than the panelCause: the wrap branch copied the strip's tail and then "the rest" of the frame from its head, assuming the head was panel-wide. A narrower strip raised
could not broadcast ...at every position. Vegas composes such a strip, with no lead-in, when its content is narrower than the chain.Fix: a frame that runs off the strip takes columns with
np.take(..., mode='wrap', out=frame_buffer). Frame column j is strip column (start + j) mod width. A wide strip still shows tail then head as before; a narrow one repeats across the panel.start_x >= 0.Tests
test_display_duration_not_a_number.py(25, including the realrun()loop via the run-loop harness, which returned at t=30 on main) andtest_scroll_helper_narrow_strip.py(24). On main, 22 of the first and 12 of the second fail.Part of a bug sweep
This is one of 10 independent fix PRs from one sweep, all based on
mainef69201.main: the same 62 failures and 6 errors on both. These are the known Windows path and file-locking tests. 191 more tests pass.test_backup_manager.py::test_create_backup_contents(os.replace→WinError 5on a temp zip), was a Windows file-lock flake. It passes on rerun, and nothing here touchescreate_backup.main, with a clean start and no errors or render stalls in the journal. ledpi is back on plainmain.🤖 Generated with Claude Code