From 50cf90969828b9c352979114b2122c157656a172 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Fri, 26 Jun 2026 23:16:40 -0400 Subject: [PATCH] fix(gui_2,app_controller): two regressions blocking uv run sloppy.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. gui_2.py:_gui_func — ws was only assigned inside 'if bg_shader_enabled' (default False), but used unconditionally on the next line. When the shader feature was off, theme.render_post_fx(ws.x, ws.y, ...) raised UnboundLocalError, which immapp.run caught and degraded the app. This is what was blocking the GUI from appearing. Fix: hoist 'ws = imgui.get_io().display_size' above the conditional so it's always assigned. The 'if bg_shader_enabled' branch now uses the already-assigned ws. 2. app_controller.py:_push_mma_state_update_result — production code did 'Ticket(id=t.id, ...)' on each element of self.active_tickets, but the test sets self.active_tickets to a list of dicts (mock data). Production callers go through _load_active_tickets which converts, but mock callers bypass. Added 'Ticket.from_dict(t) if isinstance(t, dict) else t' normalization at the entry point (same pattern as line 3295). After these fixes: - live_gui_health_endpoint returns healthy=True - test_push_mma_state_update passes - test_api_hooks_gui_health_live passes --- src/app_controller.py | 9 ++++++++- src/gui_2.py | 5 +++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/app_controller.py b/src/app_controller.py index d7a79ca6..b3c12f92 100644 --- a/src/app_controller.py +++ b/src/app_controller.py @@ -5088,6 +5088,13 @@ class AppController: from src import project_manager track = self.active_track if track is None: return OK + # Normalize dict inputs to Ticket dataclass (test callers may set + # self.active_tickets to a list of dicts; production callers normalize + # at _load_active_tickets time). + normalized = [ + t if isinstance(t, Ticket) else Ticket.from_dict(t) + for t in self.active_tickets + ] new_tickets = [ Ticket( id=t.id, @@ -5096,7 +5103,7 @@ class AppController: assigned_to=t.assigned_to, depends_on=list(t.depends_on), ) - for t in self.active_tickets + for t in normalized ] track.tickets = new_tickets state = TrackState(metadata=track, tasks=list(new_tickets)) diff --git a/src/gui_2.py b/src/gui_2.py index baed59a0..8473d978 100644 --- a/src/gui_2.py +++ b/src/gui_2.py @@ -1092,10 +1092,11 @@ class App: render_shader_live_editor(self) render_history_window(self) pushed_prior_tint = False - + + ws = imgui.get_io().display_size + # Render background shader if getattr(self, 'bg_shader_enabled', False): - ws = imgui.get_io().display_size get_bg().render(ws.x, ws.y) theme.render_post_fx(ws.x, ws.y, self.ai_status, self.ui_crt_filter)