@@ -77,9 +77,10 @@ interface PromoteTxApplied {
7777 blocked : null
7878 promoteRunId : string
7979 deployTargetIds : string [ ]
80- willUpdate : number
81- willCreate : number
82- willArchive : number
80+ /** Actual written/archived counts (post-skip), not the pre-copy plan totals. */
81+ updated : number
82+ created : number
83+ archived : number
8384 drift : boolean
8485}
8586
@@ -275,13 +276,23 @@ export async function promoteFork(params: PromoteForkParams): Promise<PromoteFor
275276 } ,
276277 } )
277278
279+ // A source whose active deployment vanished between plan and copy is skipped
280+ // above, so report what was actually written - the plan totals would overstate.
281+ const skipped = plan . items . length - writtenItems . length
282+ if ( skipped > 0 ) {
283+ logger . warn (
284+ `[${ requestId } ] Promote skipped ${ skipped } source workflow(s) whose deployment disappeared between plan and apply` ,
285+ { sourceWorkspaceId, targetWorkspaceId, skipped }
286+ )
287+ }
288+
278289 return {
279290 blocked : null ,
280291 promoteRunId,
281292 deployTargetIds : writtenItems . map ( ( item ) => item . targetWorkflowId ) ,
282- willUpdate : plan . willUpdate ,
283- willCreate : plan . willCreate ,
284- willArchive : plan . willArchive ,
293+ updated : updatedSnapshots . length ,
294+ created : createdTargetIds . length ,
295+ archived : archivedSnapshots . length ,
285296 drift : plan . drift ,
286297 }
287298 } )
@@ -322,17 +333,17 @@ export async function promoteFork(params: PromoteForkParams): Promise<PromoteFor
322333 }
323334
324335 logger . info ( `[${ requestId } ] Promoted ${ sourceWorkspaceId } -> ${ targetWorkspaceId } ` , {
325- updated : txResult . willUpdate ,
326- created : txResult . willCreate ,
327- archived : txResult . willArchive ,
336+ updated : txResult . updated ,
337+ created : txResult . created ,
338+ archived : txResult . archived ,
328339 redeployed,
329340 } )
330341
331342 return {
332343 promoteRunId : txResult . promoteRunId ,
333- updated : txResult . willUpdate ,
334- created : txResult . willCreate ,
335- archived : txResult . willArchive ,
344+ updated : txResult . updated ,
345+ created : txResult . created ,
346+ archived : txResult . archived ,
336347 redeployed,
337348 unmappedRequired : [ ] ,
338349 drift : txResult . drift ,
0 commit comments