@@ -144,6 +144,47 @@ describe('workflow application contexts', () => {
144144 } )
145145 } )
146146
147+ it ( 'resolves the canonical workflow from an execution ID without a workflow assertion' , async ( ) => {
148+ queueCanonicalBindings ( { log : 'workflow-1' } )
149+ queueTableRows ( schemaMock . workflow , [
150+ {
151+ workflowId : 'workflow-1' ,
152+ workflow : { id : 'workflow-1' , name : 'Canonical workflow' } ,
153+ workspaceId : 'workspace-1' ,
154+ } ,
155+ ] )
156+
157+ await expect (
158+ resolveActiveWorkflowRunApplicationContext ( {
159+ runId : 'run-1' ,
160+ assertedWorkspaceId : 'workspace-1' ,
161+ } )
162+ ) . resolves . toMatchObject ( {
163+ runId : 'run-1' ,
164+ workflowId : 'workflow-1' ,
165+ workspaceId : 'workspace-1' ,
166+ } )
167+ } )
168+
169+ it ( 'conceals a workspace mismatch for an execution-only lookup' , async ( ) => {
170+ queueCanonicalBindings ( { log : 'workflow-1' } )
171+ queueTableRows ( schemaMock . workflow , [
172+ {
173+ workflowId : 'workflow-1' ,
174+ workflow : { id : 'workflow-1' , name : 'Canonical workflow' } ,
175+ workspaceId : 'workspace-1' ,
176+ } ,
177+ ] )
178+
179+ await expect (
180+ resolveActiveWorkflowRunApplicationContext ( {
181+ runId : 'run-1' ,
182+ assertedWorkspaceId : 'workspace-2' ,
183+ } )
184+ ) . rejects . toMatchObject ( { code : 'not_found' , message : 'Workflow not found' } )
185+ expect ( mocks . loadWorkspace ) . not . toHaveBeenCalled ( )
186+ } )
187+
147188 it ( 'binds live execution authority to the deployment version stored on its durable log' , async ( ) => {
148189 queueTableRows ( schemaMock . workflowExecutionLogs , [
149190 {
0 commit comments