@@ -1886,7 +1886,7 @@ describe('workflow executor metadata delegation', () => {
18861886 vi . unstubAllGlobals ( )
18871887 } )
18881888
1889- it ( 'binds workflow metadata reads to the target workflow and trusted execution subject ' , async ( ) => {
1889+ it ( 'binds cross- workflow metadata reads to the target without attaching the parent run ' , async ( ) => {
18901890 const fetchMock = vi
18911891 . fn ( )
18921892 . mockResolvedValue (
@@ -1914,7 +1914,6 @@ describe('workflow executor metadata delegation', () => {
19141914 expect ( workflowMetadataMocks . buildExecutorDelegationHeaders ) . toHaveBeenCalledWith ( {
19151915 subjectUserId : 'user-1' ,
19161916 workflowId : 'child-workflow' ,
1917- executionId : 'execution-1' ,
19181917 } )
19191918 expect ( fetchMock ) . toHaveBeenCalledWith ( 'https://sim.local/api/workflows/child-workflow' , {
19201919 headers : {
@@ -1929,6 +1928,38 @@ describe('workflow executor metadata delegation', () => {
19291928 } )
19301929 } )
19311930
1931+ it ( 'includes the run binding when the metadata target is the executing workflow' , async ( ) => {
1932+ vi . stubGlobal (
1933+ 'fetch' ,
1934+ vi . fn ( ) . mockResolvedValue (
1935+ new Response ( JSON . stringify ( { data : { name : 'Current Workflow' , description : null } } ) , {
1936+ status : 200 ,
1937+ headers : { 'Content-Type' : 'application/json' } ,
1938+ } )
1939+ )
1940+ )
1941+
1942+ await transformBlockTool (
1943+ { type : 'workflow' , params : { workflowId : 'current-workflow' } } ,
1944+ {
1945+ getAllBlocks : ( ) => [ workflowBlock ] ,
1946+ getTool : ( ) => workflowTool ,
1947+ enrichmentContext : {
1948+ workflowId : 'current-workflow' ,
1949+ workspaceId : 'workspace-1' ,
1950+ executionId : 'execution-1' ,
1951+ userId : 'user-1' ,
1952+ } ,
1953+ }
1954+ )
1955+
1956+ expect ( workflowMetadataMocks . buildExecutorDelegationHeaders ) . toHaveBeenCalledWith ( {
1957+ subjectUserId : 'user-1' ,
1958+ workflowId : 'current-workflow' ,
1959+ executionId : 'execution-1' ,
1960+ } )
1961+ } )
1962+
19321963 it ( 'does not issue an actorless fallback token without a trusted execution subject' , async ( ) => {
19331964 const fetchMock = vi . fn ( )
19341965 vi . stubGlobal ( 'fetch' , fetchMock )
0 commit comments