@@ -72,6 +72,7 @@ async function createFixture({
7272 remoteCheckpoint = true ,
7373 removeLocalRun = false ,
7474 terminalFinalization = false ,
75+ isolatedWorktree = true ,
7576} = { } ) {
7677 const parent = await mkdtemp ( path . join ( os . tmpdir ( ) , 'echo-ui-identity-routing-' ) )
7778 const loopRoot = path . join ( parent , 'issue-dev-loop' )
@@ -626,6 +627,18 @@ if [ "$1 $2" = "rev-parse HEAD" ]; then
626627 echo "${ 'b' . repeat ( 40 ) } "
627628 exit 0
628629fi
630+ if [ "$1 $2 $3" = "rev-parse --path-format=absolute --git-dir" ]; then
631+ echo ${ JSON . stringify (
632+ isolatedWorktree
633+ ? path . join ( parent , '.git' , 'worktrees' , 'issue-123' )
634+ : path . join ( parent , '.git' ) ,
635+ ) }
636+ exit 0
637+ fi
638+ if [ "$1 $2 $3" = "rev-parse --path-format=absolute --git-common-dir" ]; then
639+ echo ${ JSON . stringify ( path . join ( parent , '.git' ) ) }
640+ exit 0
641+ fi
629642if [ "$1 $2 $3" = "status --porcelain=v1 --untracked-files=all" ]; then
630643 if [ -f ${ JSON . stringify ( path . join ( parent , 'dirty-git' ) ) } ]; then
631644 echo " M src/unsafe.ts"
@@ -927,6 +940,32 @@ test('wrapped activation allows an exact durable target ahead of its committed l
927940 } )
928941} )
929942
943+ test ( 'wrapped activation rejects an exact durable target in the primary checkout' , async ( ) => {
944+ const fixture = await createFixture ( {
945+ historicalActivation : true ,
946+ isolatedWorktree : false ,
947+ } )
948+ await assert . rejects (
949+ execFileAsync (
950+ routerLauncherPath ,
951+ [
952+ '--loop-root' ,
953+ fixture . loopRoot ,
954+ 'automation' ,
955+ '--' ,
956+ process . execPath ,
957+ fixture . loopctlPath ,
958+ 'validate' ,
959+ '--activation' ,
960+ '--loop-root' ,
961+ fixture . loopRoot ,
962+ ] ,
963+ { env : fixture . env } ,
964+ ) ,
965+ / h i s t o r i c a l t a r g e t v a l i d a t i o n r e q u i r e s a n i s o l a t e d l i n k e d G i t w o r k t r e e / ,
966+ )
967+ } )
968+
930969test ( 'wrapped activation rejects historical validation without a remote durable checkpoint' , async ( ) => {
931970 const fixture = await createFixture ( {
932971 historicalActivation : true ,
0 commit comments