@@ -2519,38 +2519,22 @@ async def search_deployment_policies(
25192519
25202520 async def apply_strategy_mutations (
25212521 self ,
2522- assignments : Mapping [uuid .UUID , DeploymentSubStep ],
25232522 rollout : Sequence [RBACEntityCreator [RoutingRow ]],
25242523 drain : BatchUpdater [RoutingRow ] | None ,
25252524 completed_ids : set [uuid .UUID ],
2526- rolled_back_ids : set [uuid .UUID ],
25272525 ) -> int :
2528- """Apply all DB mutations from a strategy evaluation cycle in a single transaction.
2526+ """Apply route mutations from a strategy evaluation cycle in a single transaction.
2527+
2528+ Sub-step transitions are handled exclusively by the coordinator
2529+ via ``EndpointLifecycleBatchUpdaterSpec``.
25292530
25302531 Returns:
25312532 Number of deployments whose revision was swapped.
25322533 """
25332534 async with self ._begin_session_read_committed () as db_sess :
2534- await self ._update_sub_steps (db_sess , assignments )
25352535 await self ._create_routes (db_sess , rollout )
25362536 await self ._drain_routes (db_sess , drain )
2537- swapped = await self ._complete_deployment_revision_swap (db_sess , completed_ids )
2538- await self ._clear_deploying_revision (db_sess , rolled_back_ids )
2539- return swapped
2540-
2541- @staticmethod
2542- async def _update_sub_steps (
2543- db_sess : SASession ,
2544- assignments : Mapping [uuid .UUID , DeploymentSubStep ],
2545- ) -> None :
2546- """Update deployment sub-step assignments."""
2547- for endpoint_id , sub_step in assignments .items ():
2548- query = (
2549- sa .update (EndpointRow )
2550- .where (EndpointRow .id == endpoint_id )
2551- .values (sub_step = sub_step )
2552- )
2553- await db_sess .execute (query )
2537+ return await self ._complete_deployment_revision_swap (db_sess , completed_ids )
25542538
25552539 @staticmethod
25562540 async def _create_routes (
@@ -2593,20 +2577,24 @@ async def _complete_deployment_revision_swap(
25932577 result = await db_sess .execute (query )
25942578 return cast (CursorResult [Any ], result ).rowcount
25952579
2596- @staticmethod
2597- async def _clear_deploying_revision (
2598- db_sess : SASession ,
2599- rolled_back_ids : set [uuid .UUID ],
2580+ async def clear_deploying_revision (
2581+ self ,
2582+ deployment_ids : set [uuid .UUID ],
26002583 ) -> None :
2601- """Clear deploying_revision for rolled-back deployments."""
2602- if not rolled_back_ids :
2584+ """Clear deploying_revision and sub_step for rolled-back deployments.
2585+
2586+ This is called explicitly by ``DeployingRollingBackHandler`` after
2587+ rollback completes, NOT automatically by apply_strategy_mutations.
2588+ """
2589+ if not deployment_ids :
26032590 return
2604- query = (
2605- sa .update (EndpointRow )
2606- .where (EndpointRow .id .in_ (rolled_back_ids ))
2607- .values (
2608- deploying_revision = None ,
2609- sub_step = None ,
2591+ async with self ._begin_session_read_committed () as db_sess :
2592+ query = (
2593+ sa .update (EndpointRow )
2594+ .where (EndpointRow .id .in_ (deployment_ids ))
2595+ .values (
2596+ deploying_revision = None ,
2597+ sub_step = None ,
2598+ )
26102599 )
2611- )
2612- await db_sess .execute (query )
2600+ await db_sess .execute (query )
0 commit comments