Skip to content

Commit 6f84f80

Browse files
jopemachineclaude
andcommitted
refactor: prefix the unscoped deployment search with admin_ at every layer
Rename ``DeploymentDBSource.search_deployments`` and ``DeploymentAdminRepository.search_deployments`` to ``admin_search_deployments`` so the unscoped intent shows up on every call site (db_source → repository → service → processor), not just on the class that happens to host the method. ``DeploymentDBSource`` is a shared namespace that also carries the scoped ``search_user_deployments`` / ``search_project_deployments`` variants, so the bare ``search_deployments`` name was ambiguous about which scope semantics it carries. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 752f6a2 commit 6f84f80

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

src/ai/backend/manager/repositories/deployment/admin_repository.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,18 @@ def __init__(
6565
self._db_source = DeploymentDBSource(db)
6666

6767
@deployment_admin_repository_resilience.apply()
68-
async def search_deployments(
68+
async def admin_search_deployments(
6969
self,
7070
querier: BatchQuerier,
7171
) -> ModelDeploymentDataSearchResult:
7272
"""Search every deployment without a scope filter.
7373
7474
Callers may still pass arbitrary ``conditions`` through the
7575
querier — the absence of a scope filter on the repository method
76-
itself is what makes this admin-only.
76+
itself is what makes this admin-only. The ``admin_`` prefix is
77+
kept at every layer of the stack (db_source → repository →
78+
service → processor) so the unscoped intent is obvious at every
79+
call site, even when the class name (``DeploymentAdminRepository``)
80+
already telegraphs it.
7781
"""
78-
return await self._db_source.search_deployments(querier)
82+
return await self._db_source.admin_search_deployments(querier)

src/ai/backend/manager/repositories/deployment/db_source/db_source.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,14 +1156,16 @@ async def get_route(
11561156
return None
11571157
return row.to_route_info()
11581158

1159-
async def search_deployments(
1159+
async def admin_search_deployments(
11601160
self,
11611161
querier: BatchQuerier,
11621162
) -> ModelDeploymentDataSearchResult:
1163-
"""Search endpoints and project each row directly to ``ModelDeploymentData``.
1163+
"""Search every endpoint without a scope filter, projecting each row
1164+
directly to ``ModelDeploymentData``.
11641165
1165-
Mirrors ``search_endpoints`` but skips the ``DeploymentInfo`` step
1166-
so the API path consumes the row's authoritative projection.
1166+
Backs ``DeploymentAdminRepository.admin_search_deployments`` — the
1167+
admin label makes the unscoped intent explicit at every layer of
1168+
the stack (db_source → repository → service).
11671169
"""
11681170
async with self._begin_readonly_session_read_committed() as db_sess:
11691171
query = sa.select(EndpointRow).options(

src/ai/backend/manager/services/deployment/admin_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ async def admin_search_deployments(
2828
self, action: AdminSearchDeploymentsAction
2929
) -> AdminSearchDeploymentsActionResult:
3030
"""Search every deployment without a scope filter."""
31-
result = await self._admin_repository.search_deployments(action.querier)
31+
result = await self._admin_repository.admin_search_deployments(action.querier)
3232
return AdminSearchDeploymentsActionResult(
3333
data=result.items,
3434
total_count=result.total_count,

0 commit comments

Comments
 (0)