@@ -59,6 +59,7 @@ export interface TableWorkflowDeploymentSummary {
5959 deployed : number
6060 alreadyDeployed : number
6161 skippedLocked : number
62+ skippedUndeployable : number
6263}
6364
6465interface TableWorkflowDeploymentBackfillOptions {
@@ -194,9 +195,9 @@ function validateCandidatePage(
194195 return lastWorkflowId
195196}
196197
197- async function assertOnlyLockedCandidatesRemain (
198+ async function assertOnlySkippedCandidatesRemain (
198199 store : TableWorkflowDeploymentStore ,
199- lockedWorkflowIds : ReadonlySet < string >
200+ skippedWorkflowIds : ReadonlySet < string >
200201) : Promise < void > {
201202 let afterWorkflowId = ''
202203 for ( ; ; ) {
@@ -205,7 +206,7 @@ async function assertOnlyLockedCandidatesRemain(
205206 if ( ! lastWorkflowId ) return
206207
207208 const unexpectedCandidate = candidates . find (
208- ( candidate ) => ! lockedWorkflowIds . has ( candidate . workflowId )
209+ ( candidate ) => ! skippedWorkflowIds . has ( candidate . workflowId )
209210 )
210211 if ( unexpectedCandidate ) {
211212 throw new Error (
@@ -420,8 +421,9 @@ export async function backfillTableWorkflowDeployments(
420421 deployed : 0 ,
421422 alreadyDeployed : 0 ,
422423 skippedLocked : 0 ,
424+ skippedUndeployable : 0 ,
423425 }
424- const lockedWorkflowIds = new Set < string > ( )
426+ const skippedWorkflowIds = new Set < string > ( )
425427 let afterWorkflowId = ''
426428
427429 for ( ; ; ) {
@@ -441,7 +443,7 @@ export async function backfillTableWorkflowDeployments(
441443 const result = await deploy ( candidate )
442444 if ( ! result . success ) {
443445 if ( result . errorCode === 'locked' ) {
444- lockedWorkflowIds . add ( candidate . workflowId )
446+ skippedWorkflowIds . add ( candidate . workflowId )
445447 summary . skippedLocked += 1
446448 logger . warn ( 'Skipping locked workflow referenced by a table workflow group' , {
447449 workflowId : candidate . workflowId ,
@@ -450,6 +452,16 @@ export async function backfillTableWorkflowDeployments(
450452 } )
451453 continue
452454 }
455+ if ( result . errorCode === 'validation' ) {
456+ skippedWorkflowIds . add ( candidate . workflowId )
457+ summary . skippedUndeployable += 1
458+ logger . warn ( 'Skipping undeployable workflow referenced by a table workflow group' , {
459+ workflowId : candidate . workflowId ,
460+ workspaceId : candidate . workspaceId ,
461+ reason : result . error ?? 'Workflow deployment validation failed' ,
462+ } )
463+ continue
464+ }
453465 throw new Error (
454466 `Failed to deploy table workflow ${ candidate . workflowId } : ${ result . error ?? 'deployment returned no error' } `
455467 )
@@ -472,7 +484,7 @@ export async function backfillTableWorkflowDeployments(
472484 }
473485
474486 await store . assertIntegrity ( )
475- await assertOnlyLockedCandidatesRemain ( store , lockedWorkflowIds )
487+ await assertOnlySkippedCandidatesRemain ( store , skippedWorkflowIds )
476488
477489 return summary
478490}
0 commit comments