Skip to content

Commit bfff5d1

Browse files
committed
test(approvals): a rollback to an older body does not judge a run of the newer one
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzg3ayWUHg9nLoybejn
1 parent 30ec243 commit bfff5d1

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

‎packages/plugins/plugin-approvals/src/flow-route.integration.test.ts‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)