From 488254527cf6358d6c78c25fff3fc38a7412a3ac Mon Sep 17 00:00:00 2001 From: Ed_ Date: Mon, 15 Jun 2026 16:06:17 -0400 Subject: [PATCH] test(conductor_tech_lead): mock send_result not send (Phase 2.12, fixes Phase 1.1 regression) Phase 1.1 migrated src/conductor_tech_lead.py:68 from ai_client.send() to ai_client.send_result(). The 3 tests in TestConductorTechLead mocked src.ai_client.send which is no longer called by the production code, causing "send was called 0 times" failures. Changes: - Replace patch("src.ai_client.send") with patch("src.ai_client.send_result") - Wrap mock return_value with Result(data=...) and mock side_effect with Result(data=...) values - Add "from src.result_types import Result" import All 9 tests in tests/test_conductor_tech_lead.py pass (3 migrated + 6 unaffected topological sort tests). --- tests/test_conductor_tech_lead.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/test_conductor_tech_lead.py b/tests/test_conductor_tech_lead.py index 4012f84a..c8155ef6 100644 --- a/tests/test_conductor_tech_lead.py +++ b/tests/test_conductor_tech_lead.py @@ -1,27 +1,28 @@ import unittest from unittest.mock import patch from src import conductor_tech_lead +from src.result_types import Result import pytest class TestConductorTechLead(unittest.TestCase): def test_generate_tickets_retry_failure(self) -> None: - with patch('src.ai_client.send') as mock_send: - mock_send.return_value = "invalid json" + with patch('src.ai_client.send_result') as mock_send_result: + mock_send_result.return_value = Result(data="invalid json") # conductor_tech_lead.generate_tickets now raises RuntimeError on error after 3 attempts with pytest.raises(RuntimeError): conductor_tech_lead.generate_tickets("brief", "skeletons") - assert mock_send.call_count == 3 + assert mock_send_result.call_count == 3 def test_generate_tickets_retry_success(self) -> None: - with patch('src.ai_client.send') as mock_send: - mock_send.side_effect = ["invalid json", '[{"Task": "Test"}]'] + with patch('src.ai_client.send_result') as mock_send_result: + mock_send_result.side_effect = [Result(data="invalid json"), Result(data='[{"Task": "Test"}]')] tickets = conductor_tech_lead.generate_tickets("brief", "skeletons") assert tickets == [{"Task": "Test"}] - assert mock_send.call_count == 2 + assert mock_send_result.call_count == 2 def test_generate_tickets_success(self) -> None: - with patch('src.ai_client.send') as mock_send: - mock_send.return_value = '[{"id": "T1", "description": "desc", "depends_on": []}]' + with patch('src.ai_client.send_result') as mock_send_result: + mock_send_result.return_value = Result(data='[{"id": "T1", "description": "desc", "depends_on": []}]') tickets = conductor_tech_lead.generate_tickets("brief", "skeletons") self.assertEqual(len(tickets), 1) self.assertEqual(tickets[0]['id'], "T1")