Skip to content

refactor(api): collapse dead v1/_v2 DI provider tiers#1113

Merged
phernandez merged 1 commit into
mainfrom
refactor/1109-collapse-di-tiers
Jul 20, 2026
Merged

refactor(api): collapse dead v1/_v2 DI provider tiers#1113
phernandez merged 1 commit into
mainfrom
refactor/1109-collapse-di-tiers

Conversation

@phernandez

Copy link
Copy Markdown
Member

Summary

First half of #1109 (2026-07 architecture review). The DI layer carried a get_X / get_X_v2 / get_X_v2_external triple 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_external tier, and every v1/_v2 provider 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 _v2 providers and their Dep aliases
  • deps/__init__.py: corresponding re-exports (110 → 72 exported names)

Test updates:

  • tests/test_deps.py now tests the live validate_project_external_id resolver (the old file only exercised deleted v1/_v2 functions)
  • mcp/cli/test-int conftests drop their vestigial get_project_config overrides — no route resolves that dependency anymore
  • test-int/semantic/test_embedding_provider_reuse.py calls the surviving get_search_repository_v2_external

Not in this PR (remaining half of #1109): building config injection from the composition roots so deps/config.py/fallback paths stop constructing ConfigManager() below the root. That needs new wiring (a Request-aware get_app_config mirroring get_engine_factory), not just deletion — separate PR.

Follow-up candidate: rename the surviving *_v2_external providers 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 passed
  • uv run pytest tests/mcp tests/cli — 1354 passed, 8 skipped
  • uv run pytest test-int/semantic/test_embedding_provider_reuse.py — 3 passed
  • just typecheck — clean (9 pre-existing uvloop deprecation warnings only)

Part of #1109

🤖 Generated with Claude Code

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>
@phernandez
phernandez merged commit 8ffc9b8 into main Jul 20, 2026
22 checks passed
@phernandez
phernandez deleted the refactor/1109-collapse-di-tiers branch July 20, 2026 13:22
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.

1 participant