From 16c6705b8013613325bf6b8c26e9c2494ec6c998 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Mon, 15 Jun 2026 16:24:05 -0400 Subject: [PATCH] test(spawn_interception_v2): mock send_result not send (Phase 2.18, pre-empts Phase 1.3 regression) Phase 1.3 migrated run_worker_lifecycle to send_result(). The mock_ai_client fixture in test_spawn_interception_v2.py mocked src.ai_client.send and returned a string. The test_run_worker_lifecycle_approved test asserts on the call_args (user_message + md_content), which still works with the new mock name. Changes: - Replace patch(src.ai_client.send) with patch(src.ai_client.send_result) - Rename mock_send to mock_send_result - Wrap mock return_value with Result(data="Task completed") - Add "from src.result_types import Result" import All 3 tests in test_spawn_interception_v2.py pass. --- tests/test_spawn_interception_v2.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_spawn_interception_v2.py b/tests/test_spawn_interception_v2.py index 324e6f4d..aa8c70dd 100644 --- a/tests/test_spawn_interception_v2.py +++ b/tests/test_spawn_interception_v2.py @@ -3,6 +3,7 @@ from unittest.mock import MagicMock, patch from src import multi_agent_conductor from src.models import Ticket, WorkerContext from src import events +from src.result_types import Result import threading from typing import Generator @@ -19,9 +20,9 @@ class MockDialog: @pytest.fixture def mock_ai_client() -> Generator[MagicMock, None, None]: - with patch("src.ai_client.send") as mock_send: - mock_send.return_value = "Task completed" - yield mock_send + with patch("src.ai_client.send_result") as mock_send_result: + mock_send_result.return_value = Result(data="Task completed") + yield mock_send_result def test_confirm_spawn_pushed_to_queue() -> None: event_queue = events.SyncEventQueue()