Skip to content

fix: resolve SERP provider abstract method issues and namespace collision#786

Open
claude[bot] wants to merge 1 commit intomainfrom
assistant/improve-20260319-032605
Open

fix: resolve SERP provider abstract method issues and namespace collision#786
claude[bot] wants to merge 1 commit intomainfrom
assistant/improve-20260319-032605

Conversation

@claude
Copy link
Contributor

@claude claude bot commented Mar 19, 2026

Summary

This PR fixes critical code quality issues in the nodetool-core codebase:

Issue 1: Missing Abstract Method Implementation

  • ApifyProvider and DataForSEOProvider were missing the search_raw abstract method from SerpProvider
  • This caused test failures: TypeError: Can't instantiate abstract class without an implementation for abstract method 'search_raw'
  • Fix: Added search_raw method that returns an appropriate error message indicating the method is not supported by these providers

Issue 2: Namespace Collision

  • Two separate tools modules existed:
    • src/nodetool/agents/tools - Agent tools (BrowserTool, NodeTool, etc.)
    • src/nodetool/tools - MCP server tools (WorkflowTools, AssetTools, etc.)
  • This caused mypy error: error: Duplicate module named "tools"
  • Fix: Renamed src/nodetool/tools to src/nodetool/server_tools and updated all imports

Changes

  1. Added search_raw method to ApifyProvider (src/nodetool/agents/serp_providers/apify_provider.py)

    • Returns error indicating Apify uses actor-based scraping instead of SerpAPI engines
  2. Added search_raw method to DataForSEOProvider (src/nodetool/agents/serp_providers/data_for_seo_provider.py)

    • Returns error indicating DataForSEO uses its own API structure instead of SerpAPI engines
  3. Renamed src/nodetool/tools to src/nodetool/server_tools

    • Eliminates namespace collision with src/nodetool/agents/tools
    • Updated ~96 imports across source and test files
    • Updated patch statements in test files

Test Plan

✅ All ApifyProvider tests pass (13 tests)
✅ DataForSEOProvider instantiation test passes
✅ Full test suite passes (3200+ tests)
✅ Ruff linting passes
⚠️ Pre-existing mypy error for _remove_base64_images.py (unrelated to this change)

Verification

# Run SERP provider tests
pytest tests/agents/serp_providers/test_apify_provider.py -v
pytest tests/agents/tools/test_serp_provider_selection.py::test_serp_provider_explicit_dataforseo -v

# Run linting
ruff check src/

# Run full test suite
pytest tests/ -x

🤖 Generated with Claude Code

…sion

Fixes:
- Add missing `search_raw` method to ApifyProvider
- Add missing `search_raw` method to DataForSEOProvider
- Rename `src/nodetool/tools` to `src/nodetool/server_tools` to fix namespace collision with `src/nodetool/agents/tools`
- Update all imports from `nodetool.tools` to `nodetool.server_tools` in source and test files
- Update patch statements in tests to use new module path

This resolves test failures where SERP providers could not be instantiated
due to missing abstract method implementations, and fixes mypy errors
caused by duplicate "tools" module names.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants