[search] Cross-feature coupling: routes import private functions from services.search internals #776

Closed
opened 2026-06-03 00:28:51 +02:00 by sleepy · 0 comments
Owner

Problem

routes/search_routes.py imports private (underscore-prefixed) functions directly from module internals:

from services.search.core import _call_provider
from services.search.providers import _get_provider_key, _get_search_instance

And src/deep_research.py does the same from the other copy:

from src.search.providers import _get_search_settings
from src.search.core import _call_provider, _build_provider_chain

AGENTS.md violation

Features communicate through narrow, typed interfaces. Never import another feature's internals directly.

Fix

  1. Expose public functions in services/search/__init__.py (or a service.py facade)
  2. Remove all private imports from routes and other features
  3. The existing services/search/service.py (95 lines) may already be intended for this but is not used
## Problem `routes/search_routes.py` imports private (underscore-prefixed) functions directly from module internals: ``` from services.search.core import _call_provider from services.search.providers import _get_provider_key, _get_search_instance ``` And `src/deep_research.py` does the same from the other copy: ``` from src.search.providers import _get_search_settings from src.search.core import _call_provider, _build_provider_chain ``` ## AGENTS.md violation > Features communicate through narrow, typed interfaces. Never import another feature's internals directly. ## Fix 1. Expose public functions in `services/search/__init__.py` (or a `service.py` facade) 2. Remove all private imports from routes and other features 3. The existing `services/search/service.py` (95 lines) may already be intended for this but is not used
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sleepy/odysseus#776
No description provided.