@@ -12,9 +12,16 @@ vi.mock('@/lib/core/async-jobs', () => ({
1212 getJobQueue : vi . fn ( ) . mockResolvedValue ( { getJob : mockGetJob } ) ,
1313} ) )
1414
15- vi . mock ( '@/lib/workflows/executor/enqueue-execution' , ( ) => ( {
16- RESUME_EXECUTION_JOB_ID_PREFIX : 'resume-execution:' ,
17- WORKFLOW_EXECUTION_JOB_ID_PREFIX : 'workflow-execution:' ,
15+ vi . mock ( '@/lib/logs/execution/functional-outputs' , ( ) => ( {
16+ collectFunctionalBlockOutputs : vi . fn ( ) . mockReturnValue ( new Map ( ) ) ,
17+ } ) )
18+
19+ vi . mock ( '@/lib/logs/execution/trace-store' , ( ) => ( {
20+ materializeExecutionData : vi . fn ( ) ,
21+ } ) )
22+
23+ vi . mock ( '@/lib/workflows/executor/paused-execution-metadata' , ( ) => ( {
24+ getAutomaticResumeWaitingMetadata : vi . fn ( ) . mockReturnValue ( null ) ,
1825} ) )
1926
2027import { getWorkflowExecutionStatus } from '@/lib/workflows/executor/execution-status'
@@ -56,6 +63,25 @@ describe('getWorkflowExecutionStatus queue projection', () => {
5663 expect ( mockGetJob ) . toHaveBeenCalledWith ( 'workflow-execution:execution-1' )
5764 } )
5865
66+ it ( 'preserves queue cancellation as a cancelled execution resource' , async ( ) => {
67+ mockGetJob . mockResolvedValue ( {
68+ status : 'cancelled' ,
69+ createdAt : new Date ( '2026-08-05T12:00:00.000Z' ) ,
70+ completedAt : new Date ( '2026-08-05T12:00:01.000Z' ) ,
71+ metadata : { workflowId : 'workflow-1' } ,
72+ } )
73+
74+ const status = await getWorkflowExecutionStatus ( input )
75+
76+ expect ( status ) . toMatchObject ( {
77+ executionId : 'execution-1' ,
78+ status : 'cancelled' ,
79+ level : 'info' ,
80+ endedAt : '2026-08-05T12:00:01.000Z' ,
81+ error : null ,
82+ } )
83+ } )
84+
5985 it ( 'uses the resume entry ID when the queued work is a resume attempt' , async ( ) => {
6086 queueTableRows ( schemaMock . resumeQueue , [ { id : 'resume-entry-1' , status : 'claimed' } ] )
6187 mockGetJob . mockResolvedValueOnce ( {
0 commit comments