fix: a Vegas static pause survives a non-numeric display duration; aliased store installs ask for a restart - #753
Open
ChuckBuilds wants to merge 2 commits into
Open
ChuckBuilds wants to merge 2 commits into
ChuckBuilds wants to merge 2 commits into
Conversation
… a static pause The Vegas static pause compared plugin.get_display_duration() with the clock. clock-simple, calendar and countdown return their display_duration setting straight from config.json, so a value saved as "20" or null reached that comparison as a string or None. The TypeError went to the pause's broad except, which ended the pause: the plugin flashed up and the scroll went straight on, at every one of its turns. inf held the pause until something interrupted it, and NaN, False, 0 or a negative number ended it at once. The pause now reads the duration the way the rotation has since #739, with the same helper, then the rotation's fallbacks: 30 s for anything that is not a number or a get_display_duration() that raises, 15 s for a number at or below zero. Logged once per plugin. test_vegas_static_mode.py's pauses used 0 to mean "no wait"; they now use 0.01. The helper moves from display_controller (_finite_seconds) to base_plugin (finite_seconds), unchanged: the coordinator cannot import from display_controller, which imports src.vegas_mode at module level, and a new src module would turn ledmatrix-plugins' min-core table check red until it was listed. base_plugin is already loaded whenever either one is. Tests: test/test_vegas_static_pause_duration.py, on a fake clock, including TestSameAsTheRotation, which runs every value through both the pause and the rotation's _get_display_duration/_resolve_durations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
POST /plugins/install decides restart_required from whether config.json already enables the plugin: the display loads a plugin when its enabled flag changes, so one already enabled (a reinstall, or a config carried over) keeps running the copy it loaded until a restart. The route read that flag under the registry id. Weather, Music, Stocks and Leaderboard install under the id their manifests declare (weather -> ledmatrix-weather), which is the config section's id, so reinstalling an enabled one never reported that a restart was needed. Both the queued and the direct path now look up the installed id once (#746's _installed_plugin_id) and use it for the plugin_id they answer with and for the enabled check. Tests: test/test_api_v3_install_restart_installed_id.py, through the Flask test client, both paths. 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 49 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (8)
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 | 17 |
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.
Two small follow-ups to #739 and #746, one commit each.
1. A Vegas static pause reads the display duration the way the rotation does
VegasModeCoordinator._handle_static_pausecomparedplugin.get_display_duration()with the clock. clock-simple, calendar and countdown returndisplay_durationas it is in config.json, so a value saved as"20",nullor"twenty"raised aTypeErrorthere. It didn't crash, because the pause's broadexceptcaught it, but that ended the pause: the plugin flashed up and the scroll went straight on, at every one of its turns. Other values went wrong too:infheld the pause until something interrupted it, and NaN,False, 0 or a negative number ended it at once._static_pause_duration()reads the duration with fix(display): a non-numeric plugin duration no longer stops the display; narrow scroll strips no longer raise #739's helper and then applies the rotation's fallbacks. Anything that isn't a finite number, or aget_display_duration()that raises, gets 30 s. A number at or below zero gets 15 s. Each plugin is warned about once.display_controller._finite_seconds→base_plugin.finite_seconds, and the rotation now imports it.base_pluginwas chosen because:display_controller, which importssrc.vegas_modeat module level;srcmodule would turn the plugins repo's min-core table check red until it was listed;base_pluginis already loaded whenever either caller is.test_vegas_static_mode.pyused0to mean "no wait" and now uses0.01.2. A store install checks
restart_requiredunder the installed idPOST /api/v3/plugins/installdecidedrestart_requiredby looking for the plugin'senabledflag under the registry id. An aliased entry installs under a different id:weatherinstalls with manifest idledmatrix-weather, and its config section isledmatrix-weather. So reinstalling an enabled Weather, Music, Stocks or Leaderboard never reported that a restart was needed, and the display kept running the copy it had loaded. Both the queued and the direct path now call #746's_installed_plugin_id()once and use the result for theplugin_idthey return and for the enabled check.Tests (written first)
test/test_vegas_static_pause_duration.pyruns on a fake clock. It covers:get_display_duration();finite_secondstable;TestSameAsTheRotation, which runs every value through both the pause and the rotation's_get_display_duration→_resolve_durationsand checks they agree.test/test_api_v3_install_restart_installed_id.pyuses the Flask test client on the direct and queued paths. It checks:2236ff30: 61 fail and 7 pass. The 7 are guards for values that already worked. On this branch: all 68 pass.test_display_duration_not_a_number.pywith the helper moved, the Vegas tests and the store tests: 1047 passed.display_controller.pyare the same 8 that main has.Merge notes
Based on origin/main
2236ff30, after #738–#747 landed. The CHANGELOG bullets go at the end of Unreleased → Fixes.git merge-treeagainst the open PRs:🤖 Generated with Claude Code