Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

test: preserve production receipts on accepted cancellation (#7169)

[._.]/ Adam Eivy0faa237b47af
diff --git a/server/services/mediaJobQueue/index.test.js b/server/services/mediaJobQueue/index.test.js
index 20f9a1bc7d..a8f879fa55 100644
--- a/server/services/mediaJobQueue/index.test.js
+++ b/server/services/mediaJobQueue/index.test.js
@@ -732,14 +732,17 @@ describe('mediaJobQueue', () => {
});
it.each([true, undefined])('preserves accepted or legacy cancellation results (%s)', async (accepted) => {
- const job = mediaJobQueue.enqueueJob({ kind: 'video', params: { prompt: 'cancel render' } });
- await waitFor(() => stubs.generateVideo.mock.calls.length === 1);
+ const job = mediaJobQueue.enqueueJob({ kind: 'video', params: { mode: 'grok', prompt: 'cancel render', videoProduction: { projectId: 'example-project', attemptId: 'example-attempt' } } });
+ await waitFor(() => stubs.generateVideoGrok.mock.calls.length === 1);
stubs.cancelVideo.mockImplementationOnce(() => {
videoGenEvents.emit('failed', { generationId: job.jobId, error: 'Stopped' });
return accepted;
});
await expect(mediaJobQueue.cancelJob(job.jobId)).resolves.toMatchObject({ ok: true, status: 'canceling' });
await waitFor(() => mediaJobQueue.getJob(job.jobId).status === 'canceled');
+ const { settleVideoAttempt } = await import('../creativeDirector/videoExecution.js');
+ await waitFor(() => settleVideoAttempt.mock.calls.length === 1);
+ expect(settleVideoAttempt).toHaveBeenCalledWith('example-project', 'example-attempt', { jobId: job.jobId, status: 'uncertain' });
});
it('cancel during the terminal drain window is refused, not "canceling"', async () => {