@@ -295,21 +295,26 @@ function tasklessIngressState() {
295295 return value
296296}
297297
298- function mutationStateV2Ephemeral ( operationIdOverride = 'ephemeral-mutation-v2' , targetCount = 1 ) {
298+ function mutationStateV2Ephemeral ( operationIdOverride = 'ephemeral-mutation-v2' , targetCount = 1 , fixtureOptions = { } ) {
299299 const value = state ( '00000000-0000-4000-8000-000000000099' , 'implementation' )
300300 value . taskRecoveryBinding = null
301301 const operationId = operationIdOverride
302- const targetPaths = targetCount === 1
303- ? [ path . join ( tempRoot , 'src' , 'ephemeral-source.js' ) ]
304- : Array . from ( { length : targetCount } , ( _ , index ) =>
305- path . join ( tempRoot , 'src' , `ephemeral-source-${ String ( index ) . padStart ( 3 , '0' ) } .js` ) )
302+ const targetPaths = Array . isArray ( fixtureOptions . targetPaths )
303+ ? fixtureOptions . targetPaths
304+ : ( targetCount === 1
305+ ? [ path . join ( tempRoot , 'src' , 'ephemeral-source.js' ) ]
306+ : Array . from ( { length : targetCount } , ( _ , index ) =>
307+ path . join ( tempRoot , 'src' , `ephemeral-source-${ String ( index ) . padStart ( 3 , '0' ) } .js` ) ) )
308+ const decisionTargetPaths = Array . isArray ( fixtureOptions . decisionTargetPaths )
309+ ? fixtureOptions . decisionTargetPaths
310+ : targetPaths
306311 const targetPath = targetPaths [ 0 ]
307312 const decisionDigest = 'a' . repeat ( 64 )
308313 const footprintDigest = 'b' . repeat ( 64 )
309314 const plannedSetDigest = 'c' . repeat ( 64 )
310315 const adapterDigest = 'd' . repeat ( 64 )
311316 const registryDigest = 'e' . repeat ( 64 )
312- const operationTargetSetDigest = taskOperationTargetSetDigest ( targetPaths )
317+ const operationTargetSetDigest = taskOperationTargetSetDigest ( decisionTargetPaths )
313318 value . stickyProject = {
314319 schemaVersion : 'ProjectTargetLeaseV2' ,
315320 targetDigest : '0' . repeat ( 64 ) ,
@@ -421,6 +426,8 @@ function mutationStateV2Ephemeral(operationIdOverride = 'ephemeral-mutation-v2',
421426 taskRecoveryKey : null ,
422427 contextEpoch : 'ctx-test' ,
423428 operation : 'create-or-update' ,
429+ sourceTargets : [ ] ,
430+ targetTargets : decisionTargetPaths ,
424431 targetSetDigest : operationTargetSetDigest ,
425432 footprintDigest,
426433 adapterDigest,
@@ -501,7 +508,7 @@ function mutationStateV2Ephemeral(operationIdOverride = 'ephemeral-mutation-v2',
501508 writerGeneration : 0 ,
502509 expectedStateSequence : 0 ,
503510 kind : 'create-or-update' ,
504- exactTargets : targetPaths ,
511+ exactTargets : decisionTargetPaths ,
505512 targetSetDigest : value . turnLiveness . inFlightOperation . artifactDecision . targetSetDigest ,
506513 beforeDigest : value . turnLiveness . inFlightOperation . mutationPreObservation . snapshotDigest
507514 } , baseOptions )
@@ -1586,6 +1593,31 @@ try {
15861593 taskOperationTargetSetDigest ( recoveredExactTargets )
15871594 )
15881595
1596+ const lexicalAliasMeta = path . join ( tempRoot , 'ephemeral-preflight-lexical-alias-hooks' )
1597+ const lexicalAliasTarget = `${ path . join ( tempRoot , 'src' , 'alias-segment' ) } ${ path . sep } ..${ path . sep } ephemeral-alias.js`
1598+ const canonicalAliasTarget = path . join ( tempRoot , 'src' , 'ephemeral-alias.js' )
1599+ const lexicalAliasState = mutationStateV2Ephemeral (
1600+ 'ephemeral-lexical-alias' ,
1601+ 1 ,
1602+ { targetPaths : [ lexicalAliasTarget ] , decisionTargetPaths : [ canonicalAliasTarget ] }
1603+ )
1604+ const lexicalAliasPreflight = commitTaskRecoveryState ( {
1605+ metaDir : lexicalAliasMeta ,
1606+ identity : { activeRoot, project : 'devcodex' } ,
1607+ sessionKey : 'ephemeral-lexical-alias-session' ,
1608+ state : lexicalAliasState
1609+ } , { ...baseOptions , reason : 'mutation-preflight' , force : true } )
1610+ assert . strictEqual ( lexicalAliasPreflight . status , 'ephemeral-stub' , JSON . stringify ( lexicalAliasPreflight ) )
1611+ const lexicalAliasRead = readTaskRecoveryState ( {
1612+ metaDir : lexicalAliasMeta ,
1613+ sessionKey : 'ephemeral-lexical-alias-session'
1614+ } )
1615+ assert . deepStrictEqual (
1616+ lexicalAliasRead . state . turnLiveness . taskOperationSet . unresolved . exactTargets ,
1617+ [ canonicalAliasTarget ] ,
1618+ 'recovery must persist the canonical decision target instead of a lexical footprint alias'
1619+ )
1620+
15891621 const secondUseMeta = path . join ( tempRoot , 'ephemeral-preflight-second-use-hooks' )
15901622 const priorOperationId = `simple-prior-${ 'p' . repeat ( 80 ) } `
15911623 const currentOperationId = `simple-current-${ 'c' . repeat ( 80 ) } `
0 commit comments