@@ -467,6 +467,27 @@ describe('[#26668] the approvals get serves the route a request takes, not the f
467467 expect ( ( await get ( next ) ) . flow_route . outcome ) . toEqual ( { status : 'approved' , ended : true } ) ;
468468 } ) ;
469469
470+ it ( '[#35863] a rollback re-arms an older body: a run of the newer one is not judged by it' , async ( ) => {
471+ const name = 'contract_rolled_back' ;
472+ const { nodes, edges } = REVIEWED_THEN_LEGAL ;
473+ // Version 1 has no subflow; version 2, the one the run runs, adds legal in a child run.
474+ automation . registerFlow ( name , {
475+ ...REVIEWED_THEN_LEGAL , name, version : 1 ,
476+ nodes : nodes . filter ( ( n ) => n . id !== 'legal' ) ,
477+ edges : [ ...edges . filter ( ( e ) => e . source !== 'legal' && e . target !== 'legal' ) , { id : 'r5' , source : 'manager_review' , target : 'done' , label : 'approve' } ] ,
478+ } as any ) ;
479+ automation . registerFlow ( name , { ...REVIEWED_THEN_LEGAL , name, version : 2 } as any ) ;
480+ await new Promise ( ( r ) => setTimeout ( r , 5 ) ) ;
481+ const manager = await submit ( name , { } ) ;
482+ const legal = await approve ( manager , 'u_mgr' ) ;
483+ await reject ( legal , 'u_legal' ) ;
484+ expect ( ( await automation . getRun ( manager . flow_run_id ) ) ?. status , 'the root run has ended' ) . toBe ( 'completed' ) ;
485+
486+ // Version 1 armed again: a body with no subflow, registered before the run started, but not the body it ran.
487+ automation . rollbackFlow ( name , 1 ) ;
488+ expect ( 'outcome' in ( await get ( manager ) ) . flow_route ) . toBe ( false ) ;
489+ } ) ;
490+
470491 it ( '[#35863] a request whose snapshot does not say its run is a root run is never served "ended"' , async ( ) => {
471492 const manager = await submit ( LINEAR . name , { } ) ;
472493 const director = await approve ( manager , 'u_mgr' ) ;
0 commit comments