From 1fb6ebc4d042566cc038424fbf43f23f39fe1227 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Fri, 6 Mar 2026 12:48:02 -0500 Subject: [PATCH] idk why these weren't committed --- src/api_hook_client.py | 3 +-- src/app_controller.py | 7 +------ src/gui_2.py | 20 ++------------------ tests/conftest.py | 1 - tests/test_arch_boundary_phase1.py | 1 - tests/test_arch_boundary_phase2.py | 4 ---- tests/test_arch_boundary_phase3.py | 9 ++++----- tests/test_ast_parser.py | 1 - tests/test_auto_whitelist.py | 2 -- tests/test_conductor_api_hook_integration.py | 4 +--- tests/test_deepseek_provider.py | 2 -- tests/test_execution_engine.py | 1 - tests/test_gemini_cli_adapter.py | 1 - tests/test_gemini_cli_adapter_parity.py | 1 - tests/test_gemini_cli_edge_cases.py | 3 --- tests/test_gemini_cli_integration.py | 3 +-- tests/test_gemini_cli_parity_regression.py | 1 - tests/test_gui2_events.py | 2 +- tests/test_headless_verification.py | 1 - tests/test_hooks.py | 2 -- tests/test_live_gui_integration_v2.py | 3 +-- tests/test_log_pruner.py | 3 +-- tests/test_mma_agent_focus_phase1.py | 4 ---- tests/test_mma_dashboard_refresh.py | 2 +- tests/test_mma_orchestration_gui.py | 1 - tests/test_mma_ticket_actions.py | 1 - tests/test_negative_flows.py | 1 - tests/test_orchestration_logic.py | 2 -- tests/test_phase6_engine.py | 1 - tests/test_process_pending_gui_tasks.py | 2 +- tests/test_spawn_interception_v2.py | 3 +-- tests/test_sync_hooks.py | 3 +-- tests/test_tier4_interceptor.py | 3 --- tests/test_token_usage.py | 2 -- tests/test_token_viz.py | 2 -- 35 files changed, 17 insertions(+), 85 deletions(-) diff --git a/src/api_hook_client.py b/src/api_hook_client.py index aaca8e2..f70b86b 100644 --- a/src/api_hook_client.py +++ b/src/api_hook_client.py @@ -1,6 +1,5 @@ from __future__ import annotations import requests # type: ignore[import-untyped] -import json import time from typing import Any @@ -27,7 +26,7 @@ class ApiHookClient: if response.status_code == 200: return response.json() return None - except Exception as e: + except Exception: # Silently ignore connection errors unless we are in a wait loop return None diff --git a/src/app_controller.py b/src/app_controller.py index 53c8cb4..6f11b6b 100644 --- a/src/app_controller.py +++ b/src/app_controller.py @@ -1,9 +1,8 @@ -import queue import threading import time import sys import os -from typing import Any, List, Dict, Optional, Tuple, Callable, Union, cast +from typing import Any, List, Dict, Optional, Callable from pathlib import Path import json import uuid @@ -22,8 +21,6 @@ from src import session_logger from src import project_manager from src import performance_monitor from src import models -from src.log_registry import LogRegistry -from src.log_pruner import LogPruner from src.file_cache import ASTParser from src import ai_client from src import shell_runner @@ -31,10 +28,8 @@ from src import mcp_client from src import aggregate from src import orchestrator_pm from src import conductor_tech_lead -from src import cost_tracker from src import multi_agent_conductor from src import theme -from src.ai_client import ProviderError def save_config(config: dict[str, Any]) -> None: with open(models.CONFIG_PATH, "wb") as f: diff --git a/src/gui_2.py b/src/gui_2.py index f5015d9..4917de9 100644 --- a/src/gui_2.py +++ b/src/gui_2.py @@ -1,41 +1,26 @@ # gui_2.py from __future__ import annotations import tomli_w -import threading import time import math import json import sys import os -import uuid -import requests # type: ignore[import-untyped] from pathlib import Path from tkinter import filedialog, Tk -from typing import Optional, Callable, Any -from src import aggregate +from typing import Optional, Any from src import ai_client from src import cost_tracker -from src import shell_runner from src import session_logger from src import project_manager from src import theme_2 as theme -import tomllib -from src import events -import numpy as np from src import api_hooks -from src import mcp_client -from src import orchestrator_pm -from src import performance_monitor +import numpy as np from src import log_registry from src import log_pruner -from src import conductor_tech_lead -from src import multi_agent_conductor from src import models from src import app_controller -from src import file_cache -from fastapi import FastAPI, Depends, HTTPException -from fastapi.security.api_key import APIKeyHeader from pydantic import BaseModel from imgui_bundle import imgui, hello_imgui, immapp @@ -171,7 +156,6 @@ class App: def _test_callback_func_write_to_file(self, data: str) -> None: """A dummy function that a custom_callback would execute for testing.""" - import os # Ensure the directory exists if running from a different cwd os.makedirs("tests/artifacts", exist_ok=True) with open("tests/artifacts/temp_callback_output.txt", "w") as f: diff --git a/tests/conftest.py b/tests/conftest.py index 2729e70..a187639 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,5 +1,4 @@ import pytest -import asyncio import subprocess import time import requests diff --git a/tests/test_arch_boundary_phase1.py b/tests/test_arch_boundary_phase1.py index ae77c9e..086eb32 100644 --- a/tests/test_arch_boundary_phase1.py +++ b/tests/test_arch_boundary_phase1.py @@ -1,7 +1,6 @@ import os import sys import unittest -from unittest.mock import patch, MagicMock # Ensure project root is in path sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) diff --git a/tests/test_arch_boundary_phase2.py b/tests/test_arch_boundary_phase2.py index 152dffd..b102c35 100644 --- a/tests/test_arch_boundary_phase2.py +++ b/tests/test_arch_boundary_phase2.py @@ -2,12 +2,10 @@ import os import sys import unittest from unittest.mock import patch, MagicMock -from pathlib import Path # Ensure project root is in path sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) -from src.project_manager import default_project class TestArchBoundaryPhase2(unittest.TestCase): def setUp(self) -> None: @@ -15,7 +13,6 @@ class TestArchBoundaryPhase2(unittest.TestCase): def test_toml_exposes_all_dispatch_tools(self) -> None: """manual_slop.toml [agent.tools] must list every tool in mcp_client.dispatch().""" - from src import mcp_client from src import models # We check the tool names in the source of mcp_client.dispatch @@ -44,7 +41,6 @@ class TestArchBoundaryPhase2(unittest.TestCase): def test_mutating_tool_triggers_callback(self) -> None: """All mutating tools must trigger the pre_tool_callback.""" - from src import ai_client from src.app_controller import AppController # Use a real AppController to test its _confirm_and_run diff --git a/tests/test_arch_boundary_phase3.py b/tests/test_arch_boundary_phase3.py index 9e0ffd7..4dfea2d 100644 --- a/tests/test_arch_boundary_phase3.py +++ b/tests/test_arch_boundary_phase3.py @@ -1,7 +1,6 @@ import os import sys import unittest -from unittest.mock import patch, MagicMock # Ensure project root is in path sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) @@ -29,7 +28,7 @@ class TestArchBoundaryPhase3(unittest.TestCase): def test_cascade_blocks_multi_hop(self) -> None: """Test that blocking cascades through multiple dependencies.""" - from src.models import Ticket, Track + from src.models import Ticket from src.dag_engine import TrackDAG, ExecutionEngine t1 = Ticket(id="T1", description="d1", status="blocked", assigned_to="worker1") @@ -45,7 +44,7 @@ class TestArchBoundaryPhase3(unittest.TestCase): def test_manual_unblock_restores_todo(self) -> None: """Test that unblocking a task manually works if dependencies are met.""" - from src.models import Ticket, Track + from src.models import Ticket from src.dag_engine import TrackDAG, ExecutionEngine t1 = Ticket(id="T1", description="d1", status="completed", assigned_to="worker1") @@ -64,7 +63,7 @@ class TestArchBoundaryPhase3(unittest.TestCase): def test_in_progress_not_blocked(self) -> None: """Test that in_progress tasks are not blocked automatically (only todo).""" - from src.models import Ticket, Track + from src.models import Ticket from src.dag_engine import TrackDAG, ExecutionEngine t1 = Ticket(id="T1", description="d1", status="blocked", assigned_to="worker1") @@ -79,7 +78,7 @@ class TestArchBoundaryPhase3(unittest.TestCase): def test_execution_engine_tick_cascades_blocks(self) -> None: """Test that ExecutionEngine.tick() triggers the cascading blocks.""" - from src.models import Ticket, Track + from src.models import Ticket from src.dag_engine import TrackDAG, ExecutionEngine t1 = Ticket(id="T1", description="d1", status="blocked", assigned_to="worker1") diff --git a/tests/test_ast_parser.py b/tests/test_ast_parser.py index b9b27a9..bd3cf2b 100644 --- a/tests/test_ast_parser.py +++ b/tests/test_ast_parser.py @@ -1,4 +1,3 @@ -import pytest from src.file_cache import ASTParser def test_ast_parser_initialization() -> None: diff --git a/tests/test_auto_whitelist.py b/tests/test_auto_whitelist.py index a9e2ac1..5ad2c77 100644 --- a/tests/test_auto_whitelist.py +++ b/tests/test_auto_whitelist.py @@ -1,7 +1,5 @@ import pytest from src.log_registry import LogRegistry -from src import project_manager -import time from pathlib import Path from datetime import datetime diff --git a/tests/test_conductor_api_hook_integration.py b/tests/test_conductor_api_hook_integration.py index 434b57f..f9c3e3d 100644 --- a/tests/test_conductor_api_hook_integration.py +++ b/tests/test_conductor_api_hook_integration.py @@ -1,6 +1,4 @@ -import pytest -from unittest.mock import patch, MagicMock -import time +from unittest.mock import patch from src.api_hook_client import ApiHookClient def simulate_conductor_phase_completion(client: ApiHookClient, track_id: str, phase_name: str) -> bool: diff --git a/tests/test_deepseek_provider.py b/tests/test_deepseek_provider.py index 4089a25..41b4ab8 100644 --- a/tests/test_deepseek_provider.py +++ b/tests/test_deepseek_provider.py @@ -1,7 +1,5 @@ from unittest.mock import patch, MagicMock from src import ai_client -import json -import pytest def test_deepseek_model_selection() -> None: """ diff --git a/tests/test_execution_engine.py b/tests/test_execution_engine.py index c0386a9..4dce77d 100644 --- a/tests/test_execution_engine.py +++ b/tests/test_execution_engine.py @@ -1,4 +1,3 @@ -import pytest from src.models import Ticket from src.dag_engine import TrackDAG, ExecutionEngine diff --git a/tests/test_gemini_cli_adapter.py b/tests/test_gemini_cli_adapter.py index 07b7f73..2b09e0f 100644 --- a/tests/test_gemini_cli_adapter.py +++ b/tests/test_gemini_cli_adapter.py @@ -1,5 +1,4 @@ import json -import subprocess from unittest.mock import patch, MagicMock from src.gemini_cli_adapter import GeminiCliAdapter diff --git a/tests/test_gemini_cli_adapter_parity.py b/tests/test_gemini_cli_adapter_parity.py index b77fc78..d9feaa2 100644 --- a/tests/test_gemini_cli_adapter_parity.py +++ b/tests/test_gemini_cli_adapter_parity.py @@ -1,6 +1,5 @@ import unittest import json -import subprocess from unittest.mock import patch, MagicMock from src.gemini_cli_adapter import GeminiCliAdapter diff --git a/tests/test_gemini_cli_edge_cases.py b/tests/test_gemini_cli_edge_cases.py index 6814fa1..253ccde 100644 --- a/tests/test_gemini_cli_edge_cases.py +++ b/tests/test_gemini_cli_edge_cases.py @@ -1,5 +1,3 @@ -import json -import subprocess from unittest.mock import patch, MagicMock from src.gemini_cli_adapter import GeminiCliAdapter from src import mcp_client @@ -21,7 +19,6 @@ def test_gemini_cli_context_bleed_prevention() -> None: assert result["text"] == "Model response" def test_gemini_cli_parameter_resilience() -> None: - from src import mcp_client with patch('src.mcp_client.read_file', return_value="content") as mock_read: mcp_client.dispatch("read_file", {"file_path": "aliased.txt"}) mock_read.assert_called_once_with("aliased.txt") diff --git a/tests/test_gemini_cli_integration.py b/tests/test_gemini_cli_integration.py index 696fb0f..1eadd38 100644 --- a/tests/test_gemini_cli_integration.py +++ b/tests/test_gemini_cli_integration.py @@ -1,5 +1,4 @@ -import json -from unittest.mock import patch, MagicMock +from unittest.mock import MagicMock from src import ai_client diff --git a/tests/test_gemini_cli_parity_regression.py b/tests/test_gemini_cli_parity_regression.py index 0f2e10a..4c27c78 100644 --- a/tests/test_gemini_cli_parity_regression.py +++ b/tests/test_gemini_cli_parity_regression.py @@ -1,4 +1,3 @@ -from typing import Any from unittest.mock import patch, MagicMock def test_send_invokes_adapter_send() -> None: diff --git a/tests/test_gui2_events.py b/tests/test_gui2_events.py index 77e08a4..fffa33e 100644 --- a/tests/test_gui2_events.py +++ b/tests/test_gui2_events.py @@ -1,5 +1,5 @@ import pytest -from unittest.mock import patch, MagicMock +from unittest.mock import patch from src.gui_2 import App from src import ai_client diff --git a/tests/test_headless_verification.py b/tests/test_headless_verification.py index b331089..68a728e 100644 --- a/tests/test_headless_verification.py +++ b/tests/test_headless_verification.py @@ -4,7 +4,6 @@ from unittest.mock import MagicMock, patch from src.models import Ticket, Track from src import multi_agent_conductor from src.multi_agent_conductor import ConductorEngine -from src import events from src import ai_client @pytest.mark.asyncio diff --git a/tests/test_hooks.py b/tests/test_hooks.py index 4a14499..2321f7c 100644 --- a/tests/test_hooks.py +++ b/tests/test_hooks.py @@ -1,6 +1,4 @@ import pytest -import requests -import time import sys import os diff --git a/tests/test_live_gui_integration_v2.py b/tests/test_live_gui_integration_v2.py index 6aee0cd..ce08864 100644 --- a/tests/test_live_gui_integration_v2.py +++ b/tests/test_live_gui_integration_v2.py @@ -1,7 +1,6 @@ import pytest -from unittest.mock import patch, ANY +from unittest.mock import patch import time -import sys from src.gui_2 import App from src.events import UserRequestEvent from src.api_hook_client import ApiHookClient diff --git a/tests/test_log_pruner.py b/tests/test_log_pruner.py index d0ee0a4..5ab8e32 100644 --- a/tests/test_log_pruner.py +++ b/tests/test_log_pruner.py @@ -2,8 +2,7 @@ import pytest from src.log_pruner import LogPruner from src.log_registry import LogRegistry from pathlib import Path -from unittest.mock import MagicMock, patch -import time +from unittest.mock import patch from datetime import datetime, timedelta @pytest.fixture diff --git a/tests/test_mma_agent_focus_phase1.py b/tests/test_mma_agent_focus_phase1.py index dbe2667..cb2f2eb 100644 --- a/tests/test_mma_agent_focus_phase1.py +++ b/tests/test_mma_agent_focus_phase1.py @@ -5,10 +5,6 @@ state when logging comms and tools. """ from src import ai_client -from src import session_logger -from src import project_manager -from unittest.mock import patch, MagicMock -import time def reset_tier(): ai_client.current_tier = None diff --git a/tests/test_mma_dashboard_refresh.py b/tests/test_mma_dashboard_refresh.py index 4657d3e..fae37b8 100644 --- a/tests/test_mma_dashboard_refresh.py +++ b/tests/test_mma_dashboard_refresh.py @@ -1,5 +1,5 @@ import pytest -from unittest.mock import patch, MagicMock +from unittest.mock import patch from typing import Any from src.gui_2 import App diff --git a/tests/test_mma_orchestration_gui.py b/tests/test_mma_orchestration_gui.py index 215d290..f76ec78 100644 --- a/tests/test_mma_orchestration_gui.py +++ b/tests/test_mma_orchestration_gui.py @@ -1,4 +1,3 @@ -import json from unittest.mock import patch import time from src.gui_2 import App diff --git a/tests/test_mma_ticket_actions.py b/tests/test_mma_ticket_actions.py index e4bef52..81a6430 100644 --- a/tests/test_mma_ticket_actions.py +++ b/tests/test_mma_ticket_actions.py @@ -1,4 +1,3 @@ -from unittest.mock import patch from src.gui_2 import App def test_cb_ticket_retry(app_instance: App) -> None: diff --git a/tests/test_negative_flows.py b/tests/test_negative_flows.py index 4802ab5..c61298d 100644 --- a/tests/test_negative_flows.py +++ b/tests/test_negative_flows.py @@ -1,4 +1,3 @@ -import os import sys import time from pathlib import Path diff --git a/tests/test_orchestration_logic.py b/tests/test_orchestration_logic.py index 9860590..a92e71d 100644 --- a/tests/test_orchestration_logic.py +++ b/tests/test_orchestration_logic.py @@ -1,7 +1,5 @@ import pytest from unittest.mock import patch -import json -from typing import Any from src import orchestrator_pm from src import multi_agent_conductor from src import conductor_tech_lead diff --git a/tests/test_phase6_engine.py b/tests/test_phase6_engine.py index 1337316..d9ea169 100644 --- a/tests/test_phase6_engine.py +++ b/tests/test_phase6_engine.py @@ -1,4 +1,3 @@ -import pytest from unittest.mock import MagicMock, patch from src.multi_agent_conductor import ConductorEngine, run_worker_lifecycle from src.models import Ticket, Track, WorkerContext diff --git a/tests/test_process_pending_gui_tasks.py b/tests/test_process_pending_gui_tasks.py index 5963b34..bf7cde5 100644 --- a/tests/test_process_pending_gui_tasks.py +++ b/tests/test_process_pending_gui_tasks.py @@ -1,6 +1,6 @@ from typing import Generator import pytest -from unittest.mock import patch, MagicMock +from unittest.mock import patch from src import ai_client from src.gui_2 import App diff --git a/tests/test_spawn_interception_v2.py b/tests/test_spawn_interception_v2.py index 2e59cab..324e6f4 100644 --- a/tests/test_spawn_interception_v2.py +++ b/tests/test_spawn_interception_v2.py @@ -3,9 +3,8 @@ from unittest.mock import MagicMock, patch from src import multi_agent_conductor from src.models import Ticket, WorkerContext from src import events -import time import threading -from typing import Generator, Any +from typing import Generator class MockDialog: def __init__(self, approved: bool, final_payload: dict | None = None) -> None: diff --git a/tests/test_sync_hooks.py b/tests/test_sync_hooks.py index b195dd3..beb87fa 100644 --- a/tests/test_sync_hooks.py +++ b/tests/test_sync_hooks.py @@ -1,5 +1,4 @@ -import pytest -from unittest.mock import patch, MagicMock +from unittest.mock import patch from src.api_hook_client import ApiHookClient def test_api_ask_client_method() -> None: diff --git a/tests/test_tier4_interceptor.py b/tests/test_tier4_interceptor.py index e8198a1..e81ebec 100644 --- a/tests/test_tier4_interceptor.py +++ b/tests/test_tier4_interceptor.py @@ -1,7 +1,6 @@ from unittest.mock import MagicMock, patch from src.shell_runner import run_powershell from src import ai_client -from typing import Any, Optional, Callable def test_run_powershell_qa_callback_on_failure(vlogger) -> None: """Test that qa_callback is called when a powershell command fails (non-zero exit code).""" @@ -75,7 +74,6 @@ def test_end_to_end_tier4_integration(vlogger) -> None: def test_ai_client_passes_qa_callback() -> None: """Verifies that ai_client.send passes the qa_callback down to the provider function.""" - from src import ai_client qa_callback = lambda x: "analysis" with patch("src.ai_client._send_gemini") as mock_send: @@ -89,7 +87,6 @@ def test_ai_client_passes_qa_callback() -> None: def test_gemini_provider_passes_qa_callback_to_run_script() -> None: """Verifies that _send_gemini passes the qa_callback to _run_script.""" - from src import ai_client qa_callback = MagicMock() # Mock the tool loop behavior diff --git a/tests/test_token_usage.py b/tests/test_token_usage.py index 14619cc..24c3371 100644 --- a/tests/test_token_usage.py +++ b/tests/test_token_usage.py @@ -1,9 +1,7 @@ import sys import os -import hashlib from unittest.mock import patch, MagicMock from types import SimpleNamespace -from pathlib import Path sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) diff --git a/tests/test_token_viz.py b/tests/test_token_viz.py index 6063633..babd313 100644 --- a/tests/test_token_viz.py +++ b/tests/test_token_viz.py @@ -2,8 +2,6 @@ from src import ai_client from typing import Any -import pytest -from unittest.mock import MagicMock, patch def test_add_bleed_derived_aliases() -> None: """_add_bleed_derived must inject 'estimated_prompt_tokens' alias."""