@@ -500,6 +500,40 @@ describe("scripts/pr wrappers", () => {
500500 }
501501 } ) ;
502502
503+ itPosix ( "executes extracted helpers through a symlinked temporary root" , ( ) => {
504+ const fixture = makeMismatchedWrapperRepo ( { realModules : true } ) ;
505+ try {
506+ // Exercise the wrapper's own helper path, not a physical path reconstructed by the test.
507+ writeFileSync (
508+ join ( fixture . canonical , "scripts/pr-lib/gates.sh" ) ,
509+ `ci_dispatch() { node "$(review_artifacts_helper_path)" template "$1" "${ REVIEWED_HEAD } "; }\n` ,
510+ ) ;
511+ fixture . git ( fixture . canonical , [ "add" , "scripts/pr-lib/gates.sh" ] ) ;
512+ fixture . git ( fixture . canonical , [ "commit" , "-m" , "test: real anchor helper dispatch" ] ) ;
513+ fixture . git ( fixture . canonical , [ "push" , "origin" , "main" ] ) ;
514+ parkCanonicalOffAnchor ( fixture ) ;
515+ const temporaryAlias = join ( fixture . root , "temporary-alias" ) ;
516+ symlinkSync ( fixture . root , temporaryAlias , "dir" ) ;
517+ const result = spawnSync (
518+ join ( fixture . linked , "scripts/pr" ) ,
519+ [ "ci-dispatch" , String ( REVIEWED_PR ) ] ,
520+ {
521+ cwd : fixture . linked ,
522+ encoding : "utf8" ,
523+ env : { ...fixture . env , TMPDIR : temporaryAlias } ,
524+ } ,
525+ ) ;
526+ expect ( result . status , `${ result . stdout } \n${ result . stderr } ` ) . toBe ( 0 ) ;
527+ expect ( result . stderr ) . toContain ( "running wrapper code materialized from" ) ;
528+ expect ( result . stdout , "the extracted helper must not silently skip its entrypoint" ) . toContain (
529+ REVIEWED_HEAD ,
530+ ) ;
531+ expect ( JSON . parse ( result . stdout ) . pr ) . toEqual ( { number : REVIEWED_PR , headSha : REVIEWED_HEAD } ) ;
532+ } finally {
533+ fixture . cleanup ( ) ;
534+ }
535+ } ) ;
536+
503537 itPosix ( "executes review artifacts from the extracted anchor dependency closure" , ( ) => {
504538 const fixture = makeMismatchedWrapperRepo ( { realModules : true } ) ;
505539 try {
0 commit comments