refactor(api): collapse dead v1/_v2 DI provider tiers#1113
Merged
Conversation
The DI layer carried three providers per service, threading three project-resolution strategies: by name (v1), by integer id (_v2), and by external UUID (_v2_external). The v1 routers are long gone and every live v2 router consumes only the _v2_external tier, so the v1 and _v2 tiers were dead weight - most of it marked '# pragma: no cover'. Delete the v1 and _v2 provider tiers across deps/projects.py, deps/repositories.py, deps/services.py, and deps/importers.py, along with the name-based and integer-id project resolution they existed to thread. One provider per service remains. Test updates: test_deps.py now exercises the live validate_project_external_id resolver; the mcp/cli/test-int conftests drop their vestigial get_project_config overrides (no route resolves it anymore); the embedding-provider reuse test calls the surviving search repository provider. Part of #1109 (ConfigManager injection is the remaining half) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: phernandez <paul@basicmachines.co>
This was referenced Jul 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First half of #1109 (2026-07 architecture review). The DI layer carried a
get_X/get_X_v2/get_X_v2_externaltriple for eight services (parser, markdown, file, search, link-resolver, entity, context, directory) plus matching repository and importer tiers — ~3x the DI surface. The tiers differed only in project resolution (name / integer id / external UUID); every service body was identical.Verified before deleting: the v1 routers were already removed,
api/v2/routers/consumes only the_v2_externaltier, and every v1/_v2provider had zero production callers (most were# pragma: no cover). Now there is one provider per service.Deleted:
deps/projects.py: name-based resolution (get_project_id,get_project_config,ProjectPathDep) and integer-id resolution (validate_project_id,get_project_config_v2)deps/repositories.py,deps/services.py,deps/importers.py: all v1 and_v2providers and theirDepaliasesdeps/__init__.py: corresponding re-exports (110 → 72 exported names)Test updates:
tests/test_deps.pynow tests the livevalidate_project_external_idresolver (the old file only exercised deleted v1/_v2functions)get_project_configoverrides — no route resolves that dependency anymoretest-int/semantic/test_embedding_provider_reuse.pycalls the survivingget_search_repository_v2_externalNot in this PR (remaining half of #1109): building config injection from the composition roots so
deps/config.py/fallback paths stop constructingConfigManager()below the root. That needs new wiring (aRequest-awareget_app_configmirroringget_engine_factory), not just deletion — separate PR.Follow-up candidate: rename the surviving
*_v2_externalproviders to clean base names once the in-flight arch-review PRs land (avoids conflicts with #1111's router changes).Test plan
uv run pytest tests/test_deps.py tests/index/test_project_index_surface.py tests/api/v2— 237 passeduv run pytest tests/mcp tests/cli— 1354 passed, 8 skippeduv run pytest test-int/semantic/test_embedding_provider_reuse.py— 3 passedjust typecheck— clean (9 pre-existing uvloop deprecation warnings only)Part of #1109
🤖 Generated with Claude Code