From bb3b3056b4f4e46606a26ecb169c2b40d34e8c17 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Mon, 15 Jun 2026 15:50:56 -0400 Subject: [PATCH] conductor(plan): add 7 production-affected test mock files to Phase 2 The original Phase 2 covered 12 test files that *call* ai_client.send(...). Phase 1.1 implementation revealed 7 additional test files that *mock* ai_client.send (via patch()) for tests of the production code paths. When production migrates to send_result(), these mocks receive 0 calls and the tests fail with 'send was called 0 times'. Adding Phase 2.12-2.18 to cover: - test_conductor_tech_lead.py (3 mocks; breaks after Phase 1.1) - test_orchestration_logic.py (1 mock; breaks after Phase 1.1) - test_orchestrator_pm.py (3 mocks; pre-empt Phase 1.2) - test_orchestrator_pm_history.py (1 mock; pre-empt Phase 1.2) - test_phase6_engine.py (1 mock; pre-empt Phase 1.3) - test_run_worker_lifecycle_abort.py (1 mock; pre-empt Phase 1.3) - test_spawn_interception_v2.py (1 mock; pre-empt Phase 1.3) test_rag_integration.py mock migration deferred to RAG track (OOS1). Also adds state.toml for the track (7 phases, 28 tasks, audit fields). --- .../plan.md | 63 ++++++++++++++- .../state.toml | 80 +++++++++++++++++++ 2 files changed, 140 insertions(+), 3 deletions(-) create mode 100644 conductor/tracks/public_api_migration_and_ui_polish_20260615/state.toml diff --git a/conductor/tracks/public_api_migration_and_ui_polish_20260615/plan.md b/conductor/tracks/public_api_migration_and_ui_polish_20260615/plan.md index 5fa9600f..d1fb9df2 100644 --- a/conductor/tracks/public_api_migration_and_ui_polish_20260615/plan.md +++ b/conductor/tracks/public_api_migration_and_ui_polish_20260615/plan.md @@ -194,12 +194,69 @@ assert result.ok and result.data == "x" - **VERIFY:** `uv run pytest tests/test_tier4_interceptor.py -v` passes - **COMMIT:** `test(tier4_interceptor): migrate to send_result() (Phase 2.11)` -### Task 2.12: Phase 2 verification +### 2G: Test mock migrations for production-affected tests (added 2026-06-15 during Phase 1) -- [ ] **Task 2.12**: Full Phase 2 verification +**CRITICAL DISCOVERY during Phase 1.1:** The original Phase 2 list of 12 test files covered files that *call* `ai_client.send(...)`. However, several test files use `patch('src.ai_client.send')` to *mock* the deprecated function for tests of the production code paths. When the production code is migrated to `send_result()` (Phases 1.1-1.3), the mocks receive 0 calls and the tests fail with `'send' was called 0 times`. + +**Affected test files (8 discovered; the plan/spec missed them):** +- `tests/test_conductor_tech_lead.py` (3 mocks; breaks after Phase 1.1) - was the regression I hit +- `tests/test_orchestration_logic.py` (1 mock; breaks after Phase 1.1) - was the regression I hit +- `tests/test_orchestrator_pm.py` (3 mocks; breaks after Phase 1.2) +- `tests/test_orchestrator_pm_history.py` (1 mock; breaks after Phase 1.2) +- `tests/test_phase6_engine.py` (1 mock; breaks after Phase 1.3 if migration touches worker_comms_callback path) +- `tests/test_run_worker_lifecycle_abort.py` (1 mock; breaks after Phase 1.3) +- `tests/test_spawn_interception_v2.py` (1 mock; breaks after Phase 1.3) +- `tests/test_rag_integration.py` (1 mock; already pre-existing failure; deferred to RAG track per spec ยง7.1 OOS1) + +**Migration pattern for mocks:** +```python +# Before: +with patch('src.ai_client.send') as mock_send: + mock_send.return_value = '[{"id": "T1"}]' + ... + +# After: +with patch('src.ai_client.send_result') as mock_send_result: + mock_send_result.return_value = Result(data='[{"id": "T1"}]') + ... +``` + +Must also add `from src.result_types import Result` to imports if not already present. + +- [ ] **Task 2.12**: Migrate test_conductor_tech_lead.py (3 mocks) + - **VERIFY:** `uv run pytest tests/test_conductor_tech_lead.py -v` passes + - **COMMIT:** `test(conductor_tech_lead): mock send_result not send (Phase 2.12, fixes Phase 1.1 regression)` + +- [ ] **Task 2.13**: Migrate test_orchestration_logic.py (1 mock) + - **VERIFY:** `uv run pytest tests/test_orchestration_logic.py -v` passes + - **COMMIT:** `test(orchestration_logic): mock send_result not send (Phase 2.13, fixes Phase 1.1 regression)` + +- [ ] **Task 2.14**: Migrate test_orchestrator_pm.py (3 mocks; pre-empt Phase 1.2 regression) + - **VERIFY:** `uv run pytest tests/test_orchestrator_pm.py -v` passes + - **COMMIT:** `test(orchestrator_pm): mock send_result not send (Phase 2.14, pre-empts Phase 1.2 regression)` + +- [ ] **Task 2.15**: Migrate test_orchestrator_pm_history.py (1 mock; pre-empt Phase 1.2 regression) + - **VERIFY:** `uv run pytest tests/test_orchestrator_pm_history.py -v` passes + - **COMMIT:** `test(orchestrator_pm_history): mock send_result not send (Phase 2.15, pre-empts Phase 1.2 regression)` + +- [ ] **Task 2.16**: Migrate test_phase6_engine.py (1 mock; pre-empt Phase 1.3 regression) + - **VERIFY:** `uv run pytest tests/test_phase6_engine.py -v` passes + - **COMMIT:** `test(phase6_engine): mock send_result not send (Phase 2.16, pre-empts Phase 1.3 regression)` + +- [ ] **Task 2.17**: Migrate test_run_worker_lifecycle_abort.py (1 mock; pre-empt Phase 1.3 regression) + - **VERIFY:** `uv run pytest tests/test_run_worker_lifecycle_abort.py -v` passes + - **COMMIT:** `test(run_worker_lifecycle_abort): mock send_result not send (Phase 2.17, pre-empts Phase 1.3 regression)` + +- [ ] **Task 2.18**: Migrate test_spawn_interception_v2.py (1 mock; pre-empt Phase 1.3 regression) + - **VERIFY:** `uv run pytest tests/test_spawn_interception_v2.py -v` passes + - **COMMIT:** `test(spawn_interception_v2): mock send_result not send (Phase 2.18, pre-empts Phase 1.3 regression)` + +### Task 2.19: Phase 2 verification + +- [ ] **Task 2.19**: Full Phase 2 verification - **Command:** `uv run rg "ai_client\.send\(" tests/ | grep -v test_ai_client_result.py` (should be 0 hits after Phase 2) - **EXPECTED:** 0 hits outside `test_ai_client_result.py` (which is handled in Task 2.7) - - **COMMIT:** `conductor(checkpoint): Phase 2 complete - 11 test files migrated to send_result()` + - **COMMIT:** `conductor(checkpoint): Phase 2 complete - 18 test files migrated to send_result()` (11 call-site + 7 mock) --- diff --git a/conductor/tracks/public_api_migration_and_ui_polish_20260615/state.toml b/conductor/tracks/public_api_migration_and_ui_polish_20260615/state.toml new file mode 100644 index 00000000..cd20a491 --- /dev/null +++ b/conductor/tracks/public_api_migration_and_ui_polish_20260615/state.toml @@ -0,0 +1,80 @@ +# Track state for public_api_migration_and_ui_polish_20260615 +# Updated by Tier 2 Tech Lead as tasks complete + +[meta] +track_id = "public_api_migration_and_ui_polish_20260615" +name = "Public API Migration + UI Polish Test Cleanup" +status = "active" +current_phase = 0 +last_updated = "2026-06-15" + +[blocked_by] +# No external blockers + +[blocks] +data_structure_strengthening_20260606 = "planned in this track" +mcp_architecture_refactor_20260606 = "transitively" + +[phases] +phase_1 = { status = "pending", checkpointsha = "", name = "Production call site migration" } +phase_2 = { status = "pending", checkpointsha = "", name = "Test file migration" } +phase_3 = { status = "pending", checkpointsha = "", name = "Qwen test fix" } +phase_4 = { status = "pending", checkpointsha = "", name = "Symbol parsing test fix" } +phase_5 = { status = "pending", checkpointsha = "", name = "UI Polish test fixes" } +phase_6 = { status = "pending", checkpointsha = "", name = "Deprecation removal" } +phase_7 = { status = "pending", checkpointsha = "", name = "Docs + housekeep" } + +[tasks] +# Phase 1 +t1_1 = { status = "pending", commit_sha = "", description = "Migrate src/conductor_tech_lead.py:68 to send_result()" } +t1_2 = { status = "pending", commit_sha = "", description = "Migrate src/orchestrator_pm.py:86 to send_result()" } +t1_3 = { status = "pending", commit_sha = "", description = "Migrate src/multi_agent_conductor.py:591 to send_result()" } +t1_4 = { status = "pending", commit_sha = "", description = "Phase 1 checkpoint" } + +# Phase 2 +t2_1 = { status = "pending", commit_sha = "", description = "Migrate test_ai_client_cli.py" } +t2_2 = { status = "pending", commit_sha = "", description = "Migrate test_ai_cache_tracking.py" } +t2_3 = { status = "pending", commit_sha = "", description = "Migrate test_gemini_cli_edge_cases.py" } +t2_4 = { status = "pending", commit_sha = "", description = "Migrate test_gemini_cli_parity_regression.py" } +t2_5 = { status = "pending", commit_sha = "", description = "Migrate test_gui2_mcp.py" } +t2_6 = { status = "pending", commit_sha = "", description = "Migrate test_token_usage.py" } +t2_7 = { status = "pending", commit_sha = "", description = "Migrate test_ai_client_result.py" } +t2_8 = { status = "pending", commit_sha = "", description = "Migrate test_api_events.py" } +t2_9 = { status = "pending", commit_sha = "", description = "Migrate test_deepseek_provider.py" } +t2_10 = { status = "pending", commit_sha = "", description = "Migrate test_gemini_cli_integration.py" } +t2_11 = { status = "pending", commit_sha = "", description = "Migrate test_tier4_interceptor.py" } +t2_12 = { status = "pending", commit_sha = "", description = "Phase 2 checkpoint" } + +# Phase 3 +t3_1 = { status = "pending", commit_sha = "", description = "Fix test_qwen_provider.py (2 tests)" } +t3_2 = { status = "pending", commit_sha = "", description = "Verify no regression" } + +# Phase 4 +t4_1 = { status = "pending", commit_sha = "", description = "Fix test_symbol_parsing.py (2 tests)" } +t4_2 = { status = "pending", commit_sha = "", description = "Verify no regression" } + +# Phase 5 +t5_1 = { status = "pending", commit_sha = "", description = "Fix test_discussion_truncate_layout.py" } +t5_2 = { status = "pending", commit_sha = "", description = "Fix test_log_management_refresh.py" } +t5_3 = { status = "pending", commit_sha = "", description = "Verify no regression" } + +# Phase 6 +t6_1 = { status = "pending", commit_sha = "", description = "Remove send() function from src/ai_client.py" } +t6_2 = { status = "pending", commit_sha = "", description = "Delete test_deprecation_warnings.py" } +t6_3 = { status = "pending", commit_sha = "", description = "Remove filterwarnings from pyproject.toml" } +t6_4 = { status = "pending", commit_sha = "", description = "Phase 6 checkpoint" } + +# Phase 7 +t7_1 = { status = "pending", commit_sha = "", description = "Update docs/guide_ai_client.md" } +t7_2 = { status = "pending", commit_sha = "", description = "Update conductor/product-guidelines.md" } +t7_3 = { status = "pending", commit_sha = "", description = "Run full test suite" } +t7_4 = { status = "pending", commit_sha = "", description = "Update metadata.json" } + +[verification] +phase_1_production_migration_complete = false +phase_2_test_migration_complete = false +phase_3_qwen_tests_pass = false +phase_4_symbol_parsing_tests_pass = false +phase_5_ui_polish_tests_pass = false +phase_6_deprecation_removed = false +phase_7_docs_complete = false