From 4228cf5d0013025705e90fa59839147e0ee5b1d7 Mon Sep 17 00:00:00 2001 From: ciregenz Date: Tue, 28 Jul 2026 11:06:41 -0700 Subject: [PATCH] [eric] backend: unused imports and dead helpers swept --- backend/apps/agents/manager/predict_prompts.py | 2 +- backend/apps/agents/ui_request_bridge.py | 5 ----- backend/apps/help/bundle.py | 2 +- backend/tests/test_app_export_no_stale_files.py | 1 - backend/tests/test_router_watchdog.py | 2 -- backend/tests/test_spawn_agent.py | 2 +- backend/tests/test_subscription_health.py | 2 +- backend/tests/test_tool_manifest.py | 1 - backend/tests/test_ws_efficiency.py | 1 - 9 files changed, 4 insertions(+), 14 deletions(-) diff --git a/backend/apps/agents/manager/predict_prompts.py b/backend/apps/agents/manager/predict_prompts.py index 5eb73da6..dc478ceb 100644 --- a/backend/apps/agents/manager/predict_prompts.py +++ b/backend/apps/agents/manager/predict_prompts.py @@ -34,7 +34,7 @@ def p_recent_topics(limit: int = MAX_TOPICS) -> List[str]: ) topics: List[str] = [] seen = set() - for _sid, d in data: + for _, d in data: name = (d.get("name") or "").strip() low = name.lower() if low in P_SKIP_NAMES or low in seen: diff --git a/backend/apps/agents/ui_request_bridge.py b/backend/apps/agents/ui_request_bridge.py index 4f14722c..faa78b08 100644 --- a/backend/apps/agents/ui_request_bridge.py +++ b/backend/apps/agents/ui_request_bridge.py @@ -49,8 +49,3 @@ def respond_to_ui_request(session_id: str, component_id: str, response: Dict[str pending.response = response pending.event.set() return True - - -@typechecked -def has_pending_ui_request(session_id: str, component_id: str) -> bool: - return (session_id, component_id) in p_pending diff --git a/backend/apps/help/bundle.py b/backend/apps/help/bundle.py index 4c3d4747..f4f4ee99 100644 --- a/backend/apps/help/bundle.py +++ b/backend/apps/help/bundle.py @@ -13,7 +13,7 @@ import re import sys import time from contextlib import asynccontextmanager -from typing import AsyncIterator, List, Optional +from typing import AsyncIterator, List from pydantic import BaseModel, ConfigDict, Field from typeguard import typechecked diff --git a/backend/tests/test_app_export_no_stale_files.py b/backend/tests/test_app_export_no_stale_files.py index 221b5841..00aeb247 100644 --- a/backend/tests/test_app_export_no_stale_files.py +++ b/backend/tests/test_app_export_no_stale_files.py @@ -4,7 +4,6 @@ exists. output.files is frozen at creation (v1); the agent edits land on disk imported app reverted every edited file (new files survived since they were never in the snapshot). With a workspace, disk is the single source of truth; only true flat apps (no workspace) still carry the inline copy.""" -import os import uuid import pytest diff --git a/backend/tests/test_router_watchdog.py b/backend/tests/test_router_watchdog.py index 68ce21eb..4bbb4964 100644 --- a/backend/tests/test_router_watchdog.py +++ b/backend/tests/test_router_watchdog.py @@ -4,10 +4,8 @@ evidence so a zero-config user never boots a router with nothing to route.""" import asyncio import json -import os from unittest.mock import patch -import pytest import backend.apps.nine_router.process as proc from backend.apps.settings.models import AppSettings diff --git a/backend/tests/test_spawn_agent.py b/backend/tests/test_spawn_agent.py index 54550eed..61aa5f14 100644 --- a/backend/tests/test_spawn_agent.py +++ b/backend/tests/test_spawn_agent.py @@ -6,7 +6,7 @@ import asyncio import json import subprocess import sys -from typing import Dict, List, Optional +from typing import Dict, List from pytest import MonkeyPatch, raises diff --git a/backend/tests/test_subscription_health.py b/backend/tests/test_subscription_health.py index 806fcefc..2a3126bd 100644 --- a/backend/tests/test_subscription_health.py +++ b/backend/tests/test_subscription_health.py @@ -4,7 +4,7 @@ subscription lanes, and results are cached so a double boot-fetch can't double-s import asyncio import json -from typing import Dict, List, Optional +from typing import Dict, List import backend.apps.nine_router.subscription_health as sh diff --git a/backend/tests/test_tool_manifest.py b/backend/tests/test_tool_manifest.py index 67c0ce39..75e08dfc 100644 --- a/backend/tests/test_tool_manifest.py +++ b/backend/tests/test_tool_manifest.py @@ -3,7 +3,6 @@ FULL_TOOLS list that prunes dead preset built-ins WITHOUT dropping anything Open manifest MUST keep every built-in in effective_allowed's source set + ToolSearch (so deferred MCP loading survives); MCP tools ride mcp_servers, not this list.""" -import os from backend.apps.agents.manager.prompt.tool_catalog import ( FULL_TOOLS, diff --git a/backend/tests/test_ws_efficiency.py b/backend/tests/test_ws_efficiency.py index 2e1b749f..8f0b239c 100644 --- a/backend/tests/test_ws_efficiency.py +++ b/backend/tests/test_ws_efficiency.py @@ -6,7 +6,6 @@ clients backwards, and an open session in the history map had its terminal frame import asyncio -import pytest from fastapi.testclient import TestClient from backend.apps.agents.core.ws_manager import ws_manager, slim_status_data