[cuegui] Fix blank Redirect page when default show is missing#2443
Conversation
Issue:
- The CueCommander Redirect page rendered blank on setups without a show named "pipe" (the hardcoded default).
- RedirectControls.__init__ called opencue.api.findShow(os.getenv("SHOW", "pipe")), which raised EntityNotFoundException when that show did not exist.
- The plugin loader (Plugins.launchPlugin) swallows construction errors, so the dock was added but its content never built, leaving an empty page.
Summary of changes:
- Add RedirectControls.__getDefaultShow(), which falls back to the first active show when the configured/default show is not found, and returns None (logging a warning) when no active shows exist
- Guard the None/empty-show paths in ShowCombo selection, showChanged, and GroupFilter.__populate_menu so the widget always builds
- Add regression tests covering the missing-default-show and no-active-shows cases
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
ChangesSafer Show Resolution in RedirectControls
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
cuegui/tests/test_redirect.py (1)
60-81: ⚡ Quick winStrengthen regression checks to validate fallback behavior, not only construction.
These tests pass even if fallback selection regresses, because both only assert non-
Nonewidget creation. Add assertions for the selected show state (fallbackin the first case, empty/no-show in the second).✅ Suggested assertion upgrade
def test_builds_when_default_show_missing(self, findShowMock, getActiveShowsMock): @@ widget = cuegui.Redirect.RedirectWidget() self.assertIsNotNone(widget) + show_combo = widget.findChild(cuegui.Redirect.ShowCombo) + self.assertEqual(str(show_combo.currentText()), 'fallback') @@ def test_builds_when_no_active_shows(self, findShowMock, getActiveShowsMock): @@ widget = cuegui.Redirect.RedirectWidget() self.assertIsNotNone(widget) + show_combo = widget.findChild(cuegui.Redirect.ShowCombo) + self.assertEqual(str(show_combo.currentText()), '')🤖 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 `@cuegui/tests/test_redirect.py` around lines 60 - 81, The tests test_builds_when_default_show_missing and test_builds_when_no_active_shows only verify that the RedirectWidget is successfully constructed by asserting it is not None, but they do not validate that the correct fallback show was actually selected. In test_builds_when_default_show_missing, add an assertion to verify that the widget has selected the fallback_show (the show returned by getActiveShowsMock). In test_builds_when_no_active_shows, add an assertion to verify that the widget correctly handles the case where there are no active shows available (check that it has an appropriate empty or no-show state). This will ensure the fallback selection logic is actually working as expected, not just that widget construction succeeds.
🤖 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 `@cuegui/cuegui/Redirect.py`:
- Around line 217-220: The RedirectWidget.update() method dereferences
self.__controls.getShow().data.name without null-safety checks, but
self.__current_show can now be None (from self.__getDefaultShow()). Add a
null-check in the update() method to verify that the result of
self.__controls.getShow() is not None before accessing its .data.name property.
In the scenario where no active show exists, handle this gracefully by using an
empty string or default value instead of allowing the AttributeError to
propagate and break the search flow.
---
Nitpick comments:
In `@cuegui/tests/test_redirect.py`:
- Around line 60-81: The tests test_builds_when_default_show_missing and
test_builds_when_no_active_shows only verify that the RedirectWidget is
successfully constructed by asserting it is not None, but they do not validate
that the correct fallback show was actually selected. In
test_builds_when_default_show_missing, add an assertion to verify that the
widget has selected the fallback_show (the show returned by getActiveShowsMock).
In test_builds_when_no_active_shows, add an assertion to verify that the widget
correctly handles the case where there are no active shows available (check that
it has an appropriate empty or no-show state). This will ensure the fallback
selection logic is actually working as expected, not just that widget
construction succeeds.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: eb799f04-8dd9-4c3f-808d-75328aa103e1
📒 Files selected for processing (2)
cuegui/cuegui/Redirect.pycuegui/tests/test_redirect.py
- Move getShow() to top of RedirectWidget.update() - Warn and return when no active show is available - Prevents AttributeError on show.data.name when getShow() is None
Related Issues
Summarize your change.
Issue:
Changes: