fix(log): Refresh Registry button now calls load_registry() on the live instance
ROOT CAUSE: gui_2.py:1675 re-instantiated LogRegistry() which opens the TOML but never called .load_registry() so the table stayed empty. FIX: in-place load_registry() on the existing instance — preserves in-memory state (any pending update_session_metadata call) and matches the user's intent of 'refresh from disk'.
This commit is contained in:
+2
-1
@@ -1672,7 +1672,8 @@ def render_log_management(app: App) -> None:
|
||||
if exp:
|
||||
if app._log_registry is None: app._log_registry = log_registry.LogRegistry(str(paths.get_logs_dir() / "log_registry.toml"))
|
||||
else:
|
||||
if imgui.button("Refresh Registry"): app._log_registry = log_registry.LogRegistry(str(paths.get_logs_dir() / "log_registry.toml"))
|
||||
if imgui.button("Refresh Registry"):
|
||||
if app._log_registry is not None: app._log_registry.load_registry()
|
||||
imgui.same_line()
|
||||
if imgui.button("Load Log"): app.cb_load_prior_log()
|
||||
imgui.same_line()
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import inspect
|
||||
from src import gui_2
|
||||
|
||||
def test_refresh_registry_button_calls_load_registry():
|
||||
src = inspect.getsource(gui_2)
|
||||
marker = "Refresh Registry"
|
||||
idx = src.find(marker)
|
||||
assert idx != -1, "Could not find Refresh Registry button in gui_2.py"
|
||||
snippet = src[idx:idx + 400]
|
||||
assert "load_registry" in snippet, (
|
||||
"Refresh Registry button must invoke load_registry(); "
|
||||
"currently it only re-instantiates LogRegistry which leaves .data empty."
|
||||
)
|
||||
assert snippet.count("log_registry.LogRegistry(") <= 1, (
|
||||
"Refresh Registry button should not re-instantiate LogRegistry. "
|
||||
"Prefer in-place load_registry() on the live instance."
|
||||
)
|
||||
Reference in New Issue
Block a user