From 3d87f8e7ed42e044e514952d6a4f4ad4a9f06458 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Mon, 29 Jun 2026 16:35:20 -0400 Subject: [PATCH] fix(gui): wire _install_default_layout_if_empty_result into App._post_init App._post_init now resolves src = paths.get_layouts_dir()/default.ini and dst = Path.cwd()/manualslop_layout.ini, then calls the drain-plane helper before the warmup-complete registration block. Errors drain to self._startup_timeline_errors per the data-oriented convention, so a missing bundled layout (e.g. partial wheel install) does not crash the GUI: panels just stay invisible until the user drops a real INI in. Test fix: test_default_layout_install._GUI_SCRIPT was a relative path, but the subprocess Popen runs with cwd = temp_workspace where sloppy.py does not exist. Switched to an absolute path via _PROJECT_ROOT, the same pattern conftest.py:648 uses for the live_gui fixture. --- src/gui_2.py | 6 ++++++ tests/test_default_layout_install.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gui_2.py b/src/gui_2.py index 1f239f2a..71afa53b 100644 --- a/src/gui_2.py +++ b/src/gui_2.py @@ -574,6 +574,12 @@ class App: # _io_pool thread; it only sets primitive state on the App, which # is safe. The render_warmup_status_indicator() function reads # the timestamp to show a brief "ready" tag for 3 seconds. + src_layout_path: Path = paths.get_layouts_dir() / "default.ini" + dst_layout_path: Path = Path.cwd() / "manualslop_layout.ini" + install_result: Result[bool] = _install_default_layout_if_empty_result(self, src_layout_path, dst_layout_path) + if not install_result.ok: + if not hasattr(self, "_startup_timeline_errors"): self._startup_timeline_errors = [] + self._startup_timeline_errors.append(("_install_default_layout", install_result.errors[0])) if hasattr(self.controller, "on_warmup_complete"): cb_result = _post_init_callback_result(self) if not cb_result.ok: diff --git a/tests/test_default_layout_install.py b/tests/test_default_layout_install.py index 1650e9db..88b6a17e 100644 --- a/tests/test_default_layout_install.py +++ b/tests/test_default_layout_install.py @@ -13,7 +13,7 @@ import pytest _PROJECT_ROOT: Path = Path(os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) _SCRIPTS_DIR: Path = _PROJECT_ROOT / "tests" / "artifacts" / "tier2_state" / "default_layout_install_20260629" -_GUI_SCRIPT: str = "sloppy.py" +_GUI_SCRIPT: str = str(_PROJECT_ROOT / "sloppy.py") _INI_FILENAME: str = "manualslop_layout.ini"