Skip to content

[cuegui] Fix blank Redirect page when default show is missing#2443

Open
ramonfigueiredo wants to merge 3 commits into
AcademySoftwareFoundation:masterfrom
ramonfigueiredo:fix-cuegui-redirect-blank-missing-default-show
Open

[cuegui] Fix blank Redirect page when default show is missing#2443
ramonfigueiredo wants to merge 3 commits into
AcademySoftwareFoundation:masterfrom
ramonfigueiredo:fix-cuegui-redirect-blank-missing-default-show

Conversation

@ramonfigueiredo

@ramonfigueiredo ramonfigueiredo commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Related Issues

Summarize your change.

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.

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

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
@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6a4c1179-f0a0-4ae4-839d-bc4a5c7748d4

📥 Commits

Reviewing files that changed from the base of the PR and between b5f12d7 and e576b53.

📒 Files selected for processing (1)
  • cuegui/cuegui/Redirect.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • cuegui/cuegui/Redirect.py

📝 Walkthrough

Walkthrough

Redirect.py gains a new __getDefaultShow() static method that resolves the current show via the SHOW environment variable with an alphabetical fallback to the first active show, returning None when none exist. Guards are added to GroupFilter.__populate_menu, RedirectControls.__init__, and showChanged to handle missing shows without raising. Two new tests cover widget construction under these failure modes.

Changes

Safer Show Resolution in RedirectControls

Layer / File(s) Summary
Default show resolution and initialization
cuegui/cuegui/Redirect.py
Adds __getDefaultShow() with env-variable lookup (defaulting to "pipe"), CueException-catching fallback to first active show alphabetically, and None return when no shows exist. Updates __init__ to obtain and use the default show name (empty string if absent) for ShowCombo construction.
Defensive guards preventing crashes on missing shows
cuegui/cuegui/Redirect.py
Adds early-return to __populate_menu when self.__show is falsy. Tightens showChanged with empty-text guard and try/except around findShow to warn on CueException. Guards update with current-show check before querying procs; removes redundant show reassignment.
Test coverage for missing and absent shows
cuegui/tests/test_redirect.py
Adds imports for opencue.exception and opencue.wrappers.show; adds test_builds_when_default_show_missing and test_builds_when_no_active_shows, both mocking findShow to raise EntityNotFoundException and asserting RedirectWidget() is non-None.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 Hop hop, no show today?
No crash shall block my way!
I'll check the env, then peek the list,
Return a None if shows are missed.
Safe widget built, the warren cheers — ✨
No more AttributeError tears!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main fix: addressing the blank Redirect page when the default show is missing.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@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)
cuegui/tests/test_redirect.py (1)

60-81: ⚡ Quick win

Strengthen regression checks to validate fallback behavior, not only construction.

These tests pass even if fallback selection regresses, because both only assert non-None widget creation. Add assertions for the selected show state (fallback in 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

📥 Commits

Reviewing files that changed from the base of the PR and between ca5f70f and b5f12d7.

📒 Files selected for processing (2)
  • cuegui/cuegui/Redirect.py
  • cuegui/tests/test_redirect.py

Comment thread cuegui/cuegui/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant