Skip to content

fix(tui): use the is_running property for app guards that never fired (#894) - #939

Open
aniketshukla1 wants to merge 1 commit into
usestrix:mainfrom
aniketshukla1:fix/894-tui-is-running-guards
Open

fix(tui): use the is_running property for app guards that never fired (#894)#939
aniketshukla1 wants to merge 1 commit into
usestrix:mainfrom
aniketshukla1:fix/894-tui-is-running-guards

Conversation

@aniketshukla1

Copy link
Copy Markdown

Summary

textual's App.is_mounted is a method taking a widget, not a property — so a bare self.is_mounted is an always-truthy bound method, and every if not self.is_mounted: return guard in the TUI was dead. Worst case, the dead guard let query_one run against a missing screen, raise, get caught by the surrounding except, and re-schedule via call_after_refresh — looping instead of returning.

Closes #894.

Changes

Switch the 13 app-level guards in strix/interface/tui/app.py to App.is_running (the bool property these guards actually want). The one correct widget.is_mounted (a Widget property) is left unchanged.

This resolves the mypy "Function 'is_mounted' could always be true in boolean context" and pyright reportUnnecessaryComparison findings from the issue. Confirmed by introspection that App.is_running is a property and App.is_mounted is a function, so not self.is_running is now a real check.

…usestrix#894)

textual's App.is_mounted is a method taking a widget, not a property, so a bare self.is_mounted is an always-truthy bound method and every 'if not self.is_mounted: return' guard was dead. Worst case, the dead guard let query_one run against a missing screen, raise, get caught, and re-schedule via call_after_refresh — looping instead of returning.

Switch the 13 app-level guards to App.is_running (the bool property these guards want). The one correct widget.is_mounted (a Widget property) is left unchanged. Resolves the mypy 'could always be true' / pyright reportUnnecessaryComparison findings in the issue.
@greptile-apps

greptile-apps Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Corrects TUI lifecycle guards by checking whether the Textual app is running instead of treating the App.is_mounted method as a boolean.

  • Updates 13 app-level guards in strix/interface/tui/app.py.
  • Leaves the widget-level widget.is_mounted property check unchanged.

Confidence Score: 5/5

The PR appears safe to merge, with the corrected guards preventing TUI operations after the app stops running.

The changes consistently replace always-truthy app method references with the intended boolean lifecycle property, and no reachable blocking or non-blocking defect remains.

Important Files Changed

Filename Overview
strix/interface/tui/app.py Replaces ineffective app-level is_mounted method checks with boolean is_running lifecycle checks; no actionable regression was identified.

Reviews (1): Last reviewed commit: "fix(tui): use the is_running property fo..." | Re-trigger Greptile

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.

[BUG] App-level is_mounted guards in the TUI are dead code (always truthy)

1 participant