From c8e6a9585d6dbda1d3d75767ae73dba61255f07c Mon Sep 17 00:00:00 2001 From: Ed_ Date: Thu, 14 May 2026 20:08:14 -0400 Subject: [PATCH] test(gui): Fix test_discussion_tabs_rendered mock assertion The test was incorrectly asserting against mock_imgui.begin_tab_item instead of the newly refactored mock_imscope.tab_item context manager pattern. --- src/ai_client.py | 40 +++++++++++++++---------------- tests/test_gui_discussion_tabs.py | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/ai_client.py b/src/ai_client.py index 0b8493f..b24fb49 100644 --- a/src/ai_client.py +++ b/src/ai_client.py @@ -151,26 +151,6 @@ def set_current_tier(tier: Optional[str]) -> None: """ _local_storage.current_tier = tier -def get_comms_log_callback() -> Optional[Callable[[dict[str, Any]], None]]: - """ - - Returns the comms log callback (thread-local with global fallback). - [C: src/multi_agent_conductor.py:run_worker_lifecycle] - """ - tl_cb = getattr(_local_storage, "comms_log_callback", None) - if tl_cb: return tl_cb - return comms_log_callback - -def set_comms_log_callback(cb: Optional[Callable[[dict[str, Any]], None]]) -> None: - """ - - Sets the comms log callback (both global and thread-local). - [C: src/app_controller.py:AppController._init_ai_and_hooks, src/multi_agent_conductor.py:run_worker_lifecycle] - """ - global comms_log_callback - comms_log_callback = cb - _local_storage.comms_log_callback = cb - # Increased to allow thorough code exploration before forcing a summary MAX_TOOL_ROUNDS: int = 10 @@ -270,6 +250,26 @@ COMMS_CLAMP_CHARS: int = 300 #region: Comms Log +def get_comms_log_callback() -> Optional[Callable[[dict[str, Any]], None]]: + """ + + Returns the comms log callback (thread-local with global fallback). + [C: src/multi_agent_conductor.py:run_worker_lifecycle] + """ + tl_cb = getattr(_local_storage, "comms_log_callback", None) + if tl_cb: return tl_cb + return comms_log_callback + +def set_comms_log_callback(cb: Optional[Callable[[dict[str, Any]], None]]) -> None: + """ + + Sets the comms log callback (both global and thread-local). + [C: src/app_controller.py:AppController._init_ai_and_hooks, src/multi_agent_conductor.py:run_worker_lifecycle] + """ + global comms_log_callback + comms_log_callback = cb + _local_storage.comms_log_callback = cb + def _append_comms(direction: str, kind: str, payload: dict[str, Any]) -> None: """ [C: tests/test_ai_client_concurrency.py:run_t1, tests/test_ai_client_concurrency.py:run_t2, tests/test_mma_agent_focus_phase1.py:test_append_comms_has_source_tier_key, tests/test_mma_agent_focus_phase1.py:test_append_comms_source_tier_none_when_unset, tests/test_mma_agent_focus_phase1.py:test_append_comms_source_tier_set_when_current_tier_set, tests/test_mma_agent_focus_phase1.py:test_append_comms_source_tier_tier2] diff --git a/tests/test_gui_discussion_tabs.py b/tests/test_gui_discussion_tabs.py index a9a5ffc..f290128 100644 --- a/tests/test_gui_discussion_tabs.py +++ b/tests/test_gui_discussion_tabs.py @@ -58,7 +58,7 @@ def test_discussion_tabs_rendered(mock_gui): mock_imgui.begin_combo.assert_called_once_with("##disc_sel", 'main') mock_imgui.begin_tab_bar.assert_called_once_with('discussion_takes_tabs') - calls = [c[0][0] for c in mock_imgui.begin_tab_item.call_args_list] + calls = [c[0][0] for c in mock_imscope.tab_item.call_args_list] assert 'Original###main' in calls assert 'Take 1###main_take_1' in calls assert 'Synthesis###Synthesis' in calls