Skip to content

Commit 2a801c9

Browse files
jopemachineclaude
andcommitted
refactor(BA-5982): finish typed-ID propagation in deployment domain
Three sites in the deployment repository / db_source that still declared collection-shaped IDs as plain ``uuid.UUID`` were missed by the prior sed sweep (which only matched bare ``: uuid.UUID``): - ``DeploymentRepository.update_endpoint_lifecycle_bulk`` and the paired ``DeploymentDBSource.update_endpoint_lifecycle_bulk``: ``endpoint_ids: list[uuid.UUID]`` → ``list[DeploymentID]``. - ``DeploymentDBSource._get_last_deployment_histories_by_category``: ``deployment_ids: Sequence[uuid.UUID]`` → ``Sequence[DeploymentID]``, return ``dict[uuid.UUID, ...]`` → ``dict[DeploymentID, ...]``. The internal comprehension wraps ``row.deployment_id`` (still a plain ``uuid.UUID`` on ``DeploymentHistoryRow``) into ``DeploymentID`` at the row→dict boundary so the public dict key matches the typed contract. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 7f41f2b commit 2a801c9

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ async def update_endpoint_with_spec(
684684

685685
async def update_endpoint_lifecycle_bulk(
686686
self,
687-
endpoint_ids: list[uuid.UUID],
687+
endpoint_ids: list[DeploymentID],
688688
prevoius_statuses: list[EndpointLifecycle],
689689
new_status: EndpointLifecycle,
690690
) -> None:
@@ -757,10 +757,10 @@ async def update_endpoint_lifecycle_bulk_with_history(
757757
async def _get_last_deployment_histories_by_category(
758758
self,
759759
db_sess: SASession,
760-
deployment_ids: Sequence[uuid.UUID],
760+
deployment_ids: Sequence[DeploymentID],
761761
*,
762762
category: DeploymentHandlerCategory,
763-
) -> dict[uuid.UUID, DeploymentHistoryRow]:
763+
) -> dict[DeploymentID, DeploymentHistoryRow]:
764764
"""Return the most recent history row in ``category`` for each
765765
deployment id."""
766766
if not deployment_ids:
@@ -780,7 +780,7 @@ async def _get_last_deployment_histories_by_category(
780780
)
781781
result = await db_sess.execute(query)
782782
rows = result.scalars().all()
783-
return {row.deployment_id: row for row in rows}
783+
return {DeploymentID(row.deployment_id): row for row in rows}
784784

785785
async def get_db_now(self) -> datetime:
786786
"""Get current database server time."""

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ async def update_endpoint_with_spec(
242242
@deployment_repository_resilience.apply()
243243
async def update_endpoint_lifecycle_bulk(
244244
self,
245-
endpoint_ids: list[uuid.UUID],
245+
endpoint_ids: list[DeploymentID],
246246
prevoius_status: list[EndpointLifecycle],
247247
new_status: EndpointLifecycle,
248248
) -> None:

0 commit comments

Comments
 (0)