Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

refactor(strategies): remove dead _handle_search_error/_handle_analysis_error (#5042)

LearningCircuite18064ef48f1
diff --git a/src/local_deep_research/advanced_search_system/strategies/base_strategy.py b/src/local_deep_research/advanced_search_system/strategies/base_strategy.py
index 490f3bd677..8f7a5d45c0 100644
--- a/src/local_deep_research/advanced_search_system/strategies/base_strategy.py
+++ b/src/local_deep_research/advanced_search_system/strategies/base_strategy.py
@@ -156,48 +156,6 @@ class BaseSearchStrategy(ABC):
return False
return True
- def _handle_search_error(
- self, error: Exception, question: str, progress_base: int
- ) -> list:
- """
- Handle errors during search execution.
-
- Args:
- error: The exception that occurred
- question: The question being searched
- progress_base: The current progress percentage
-
- Returns:
- List: Empty list to continue processing
- """
- error_msg = f"Error during search: {error!s}"
- logger.error(f"SEARCH ERROR: {error_msg}")
- self._update_progress(
- error_msg,
- progress_base + 2,
- {"phase": "search_error", "error": str(error)},
- )
- return []
-
- def _handle_analysis_error(
- self, error: Exception, question: str, progress_base: int
- ) -> None:
- """
- Handle errors during result analysis.
-
- Args:
- error: The exception that occurred
- question: The question being analyzed
- progress_base: The current progress percentage
- """
- error_msg = f"Error analyzing results: {error!s}"
- logger.info(f"ANALYSIS ERROR: {error_msg}")
- self._update_progress(
- error_msg,
- progress_base + 10,
- {"phase": "analysis_error", "error": str(error)},
- )
-
def _emit_question_generation_progress(
self,
iteration: int,
@@ -244,10 +202,11 @@ class BaseSearchStrategy(ABC):
def _create_error_response(self, error: str) -> dict[str, Any]:
"""Build a standardized error result.
- Shared by ``mcp_strategy`` and ``focused_iteration_strategy``.
- Both ``questions`` and ``questions_by_iteration`` keys are
- included because the two consumers read different keys
- historically — keeping both avoids breaking either caller.
+ Used by ``focused_iteration_strategy`` (the other historical
+ consumer, ``mcp_strategy``, has been removed). Both ``questions``
+ and ``questions_by_iteration`` keys are included because the two
+ consumers read different keys historically — keeping both avoids
+ breaking downstream readers of either key.
"""
return {
"findings": [],
@@ -264,8 +223,9 @@ class BaseSearchStrategy(ABC):
) -> str:
"""Append a Markdown ``## Sources`` bibliography to ``content``.
- Shared by ``mcp_strategy`` (uses ``self.all_search_results``)
- and ``langgraph_agent_strategy`` (uses ``self.collector.results``).
+ Used by ``langgraph_agent_strategy`` (passes
+ ``self.collector.results``); the other historical consumer,
+ ``mcp_strategy``, has been removed.
Returns ``content`` unchanged when no links can be extracted.
"""
if not search_results:
diff --git a/tests/advanced_search_system/strategies/test_base_strategy.py b/tests/advanced_search_system/strategies/test_base_strategy.py
index 2e857eac1d..a92f3744c9 100644
--- a/tests/advanced_search_system/strategies/test_base_strategy.py
+++ b/tests/advanced_search_system/strategies/test_base_strategy.py
@@ -242,55 +242,6 @@ class TestValidateSearchEngine:
assert result is False
-class TestHandleSearchError:
- """Tests for _handle_search_error method."""
-
- def test_handle_search_error_updates_progress(self):
- """Handle search error updates progress."""
- strategy = ConcreteStrategy()
- callback = Mock()
- strategy.set_progress_callback(callback)
-
- error = ValueError("Connection failed")
- result = strategy._handle_search_error(error, "test question", 50)
-
- assert result == []
- callback.assert_called_once()
- call_args = callback.call_args
- assert "Connection failed" in call_args[0][0]
- assert call_args[0][1] == 52 # progress_base + 2
- assert call_args[0][2]["phase"] == "search_error"
-
- def test_handle_search_error_returns_empty_list(self):
- """Handle search error always returns empty list."""
- strategy = ConcreteStrategy()
-
- result = strategy._handle_search_error(
- Exception("Error"), "question", 0
- )
-
- assert result == []
-
-
-class TestHandleAnalysisError:
- """Tests for _handle_analysis_error method."""
-
- def test_handle_analysis_error_updates_progress(self):
- """Handle analysis error updates progress."""
- strategy = ConcreteStrategy()
- callback = Mock()
- strategy.set_progress_callback(callback)
-
- error = ValueError("Analysis failed")
- strategy._handle_analysis_error(error, "test question", 50)
-
- callback.assert_called_once()
- call_args = callback.call_args
- assert "Analysis failed" in call_args[0][0]
- assert call_args[0][1] == 60 # progress_base + 10
- assert call_args[0][2]["phase"] == "analysis_error"
-
-
class TestEmitQuestionGenerationProgress:
"""Tests for _emit_question_generation_progress method."""