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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: Music Video boot recovery leaves a peer's in-flight render alone and deletes full-render partials (#9010)
[._.]/ Adam Eivy118865a3fab6
diff --git a/server/routes/musicVideoRevision.test.js b/server/routes/musicVideoRevision.test.jsindex a9c7cded1f..a5a37fd5a7 100644--- a/server/routes/musicVideoRevision.test.js+++ b/server/routes/musicVideoRevision.test.js@@ -40,6 +40,8 @@ const h = vi.hoisted(() => {vi.mock('../lib/childProcess.js', async (importOriginal) => ({ ...(await importOriginal()), spawn: h.spawn }));vi.mock('../lib/sseUtils.js', () => ({ broadcastSse: vi.fn(), attachSseClient: vi.fn(() => true), closeJobAfterDelay: vi.fn() }));+// The draft render stamps this install's id on its in-flight mark (#9010).+vi.mock('../services/instanceIdentity.js', () => ({ ensureInstanceId: vi.fn(async () => 'inst-test') }));vi.mock('../lib/killWithEscalation.js', () => ({ killWithEscalation: vi.fn((proc) => proc.emit('close', null, 'SIGTERM')) }));vi.mock('../services/htmlComposition/encode.js', () => ({ encodeFileContactSheetAtTimes: vi.fn(async () => {}) }));vi.mock('../services/mediaJobQueue/index.js', () => ({diff --git a/server/services/musicVideo/excerpt.js b/server/services/musicVideo/excerpt.jsindex 082c1c6677..e0cc937112 100644--- a/server/services/musicVideo/excerpt.js+++ b/server/services/musicVideo/excerpt.js@@ -53,7 +53,7 @@ function findExcerpt(project, excerptId) {* project; the render job fills in `filename`/`contactSheetFilename` (or* `error`) once the encode finishes.*/-export function startExcerptOnProject(project, { startSec, endSec, sections = null, partialFilename = null }, now = new Date().toISOString()) {+export function startExcerptOnProject(project, { startSec, endSec, sections = null, partialFilename = null, renderingOn = null }, now = new Date().toISOString()) {if (!(startSec >= 0) || !(endSec > startSec) || endSec > MAX_EXCERPT_SEC) {throw excerptError(422, 'INVALID_EXCERPT_RANGE', 'endSec must be greater than startSec, and both within range');}@@ -70,6 +70,9 @@ export function startExcerptOnProject(project, { startSec, endSec, sections = nu// can delete a partial file a restart left behind (cleared on every// terminal patch).partialFilename,+ // #9010: the instance running the encode — a synced peer's boot recovery+ // leaves a mark it doesn't own alone (cleared on every terminal patch).+ renderingOn,// #8987: the sections the draft cuts, in ABSOLUTE song time — what a// flagged note maps onto when the director asks for a selective revision.sections: Array.isArray(sections) ? sections : null,diff --git a/server/services/musicVideo/excerptRender.js b/server/services/musicVideo/excerptRender.jsindex a62bc67548..3652c85fc3 100644--- a/server/services/musicVideo/excerptRender.js+++ b/server/services/musicVideo/excerptRender.js@@ -29,11 +29,12 @@ import { killWithEscalation } from '../../lib/killWithEscalation.js';import { safeUnder } from '../../lib/ffmpeg.js';import { encodeFileContactSheetAtTimes } from '../htmlComposition/encode.js';import { getProject, listProjects, mutateProjectRecord } from './projects.js';-import { planMusicVideoRender, buildMusicVideoFfmpegArgs, excerptBoundaryTimes } from './render.js';+import { planMusicVideoRender, buildMusicVideoFfmpegArgs, excerptBoundaryTimes, isLocalRenderMark } from './render.js';import { renderableCues, sectionCardCues } from './composition.js';import { renderTypographyOverlays, removeCompositionScratch } from './compositionRender.js';import { startExcerptOnProject, applyExcerptPatch } from './excerpt.js';import { markRevisionRendering, settleRevisionRender } from './revision.js';+import { ensureInstanceId } from '../instanceIdentity.js';const jobs = new Map();const projectExcerptRenders = new Map();@@ -114,9 +115,12 @@ export async function startExcerptRender(projectId, { startSec, endSec }, { revi// Persist the new `status: 'rendering'` excerpt against the FRESHEST// record (not the `project` snapshot planning read above), so a// concurrent note/edit on another excerpt can't be clobbered. The output- // filename is recorded now so a restart mid-encode can delete the partial.+ // filename is recorded now so a restart mid-encode can delete the partial,+ // and the mark names this instance so a synced peer's boot recovery can't+ // demote it (#9010).+ const renderingOn = await ensureInstanceId();const { excerpt } = await mutateProjectRecord(projectId, (current) => {- const started = startExcerptOnProject(current, { startSec, endSec: endClamped, sections, partialFilename: filename });+ const started = startExcerptOnProject(current, { startSec, endSec: endClamped, sections, partialFilename: filename, renderingOn });return revisionId ? { ...started, project: markRevisionRendering(started.project, revisionId, started.excerpt.id) } : started;});const excerptId = excerpt.id;@@ -149,7 +153,7 @@ export async function startExcerptRender(projectId, { startSec, endSec }, { reviconst finalize = async (patch) => {projectExcerptRenders.delete(projectId);const persisted = await mutateProjectRecord(projectId, (current) => ({- project: settleRevisionRender(applyExcerptPatch(current, excerptId, { ...patch, partialFilename: null }), excerptId, patch),+ project: settleRevisionRender(applyExcerptPatch(current, excerptId, { ...patch, partialFilename: null, renderingOn: null }), excerptId, patch),})).then(() => true, (err) => {console.error(`❌ Music-video excerpt render [${jobId.slice(4, 12)}] project ${projectId.slice(0, 8)} status→${patch.status} write failed: ${err.message}`);@@ -308,17 +312,21 @@ export async function startExcerptRender(projectId, { startSec, endSec }, { revi// on that project). #8987: delete the partial video/contact sheet the// interrupted encode was writing, and return a selective revision that was// rendering that draft to `open` — resumable from its checkpoint, re-rendering-// without generating anything its sections already hold.+// without generating anything its sections already hold. #9010: an excerpt+// whose `renderingOn` names another instance is that peer's live render, not+// ours to demote.export async function recoverStuckMusicVideoExcerpts() {+ const instanceId = await ensureInstanceId();const projects = await listProjects();let recovered = 0;for (const project of projects) {- const stuck = (project.excerpts || []).filter((e) => e.status === 'rendering' && !projectExcerptRenders.has(project.id));+ const stuck = (project.excerpts || []).filter((e) => e.status === 'rendering'+ && !projectExcerptRenders.has(project.id) && isLocalRenderMark(e.renderingOn, instanceId));if (stuck.length === 0) continue;const ok = await mutateProjectRecord(project.id, (current) => {let next = current;for (const excerpt of stuck) {- next = { ...next, excerpts: (next.excerpts || []).map((e) => (e.id === excerpt.id ? { ...e, status: 'error', error: 'Interrupted by a server restart', jobId: null, partialFilename: null } : e)) };+ next = { ...next, excerpts: (next.excerpts || []).map((e) => (e.id === excerpt.id ? { ...e, status: 'error', error: 'Interrupted by a server restart', jobId: null, partialFilename: null, renderingOn: null } : e)) };next = settleRevisionRender(next, excerpt.id, { status: 'error', error: 'The draft render was interrupted by a server restart' });}return { project: next };diff --git a/server/services/musicVideo/projectsLogic.js b/server/services/musicVideo/projectsLogic.jsindex e4d026c29f..ba0b9a9c02 100644--- a/server/services/musicVideo/projectsLogic.js+++ b/server/services/musicVideo/projectsLogic.js@@ -213,6 +213,9 @@ export function cloneProjectRecord(source, {// starts with none (its carried-over notes can open a fresh one).revisions: [],renderHistoryId: null,+ // #9010: the source's in-flight render mark is not the clone's.+ renderingOn: null,+ renderPartialFilename: null,deleted: false,deletedAt: null,};diff --git a/server/services/musicVideo/render.js b/server/services/musicVideo/render.jsindex 71f36ab5e5..a69b2bda61 100644--- a/server/services/musicVideo/render.js+++ b/server/services/musicVideo/render.js@@ -40,6 +40,7 @@ import { renderableCues, sectionCardCues } from './composition.js';import { renderTypographyOverlays, removeCompositionScratch, sweepCompositionScratch } from './compositionRender.js';import { selectedPerformanceInstruction } from '../../lib/musicVideoShotTiming.js';import { findStalePerformanceTakes } from './performanceShot.js';+import { ensureInstanceId } from '../instanceIdentity.js';// Per-project render mutex (keyed by projectId so two projects can render in// parallel; same-project re-entry returns 409 with the live jobId for re-attach).@@ -63,6 +64,18 @@ const PENDING = Symbol('mv-render-pending');const appendToVideoHistory = (meta) =>mutateVideoHistory((history) => { history.unshift(meta); return history; });+// #9010: an in-flight render mark (`status: 'rendering'` on a project, or on+// one of its draft excerpts) names the instance running it in `renderingOn`.+// Project records federate between a user's machines, so a booting machine+// must only treat ITS OWN marks as crashed jobs — a peer's mark describes a+// render that may still be running there. A legacy mark with no stamp predates+// the field and is recovered as before.+export const isLocalRenderMark = (renderingOn, instanceId) => !renderingOn || renderingOn === instanceId;++// Every terminal project write clears the in-flight mark's stamp and the+// partial-output pointer alongside the status.+const settledRender = (status, extra = {}) => ({ status, ...extra, renderingOn: null, renderPartialFilename: null });+export const attachRenderSseClient = (jobId, res) => attachSse(jobs, jobId, res);// #8964 loop semantics. A scene saved before shot planning existed has no@@ -563,6 +576,8 @@ export async function renderMusicVideo(projectId) {await ensureDir(PATHS.videos);await ensureDir(PATHS.videoThumbnails);+ // Resolved before the job hand-off so a failure here releases the slot.+ const renderingOn = await ensureInstanceId();const jobId = randomUUID();const filename = `music-video-${projectId.slice(0, 8)}-${Date.now()}.mp4`;const outputPath = join(PATHS.videos, filename);@@ -585,7 +600,10 @@ export async function renderMusicVideo(projectId) {const priorStatus = project.status && project.status !== 'rendering' ? project.status : 'ready';// Mark the project rendering so the board reflects an in-flight render even// on a client that didn't initiate it (federates via emitRecordUpdated).- await updateProject(projectId, { status: 'rendering' }).catch((err) => {+ // #9010: stamp this instance on the mark so a peer's boot recovery leaves+ // it alone, and record the output file so OUR boot recovery can delete the+ // partial a restart mid-encode leaves behind.+ await updateProject(projectId, { status: 'rendering', renderingOn, renderPartialFilename: filename }).catch((err) => {console.error(`❌ Music-video render [${jobId.slice(0, 8)}] project ${projectId.slice(0, 8)} status→rendering write failed: ${err.message}`);});@@ -646,7 +664,7 @@ export async function renderMusicVideo(projectId) {console.error(`❌ Music-video render spawn error [${jobId.slice(0, 8)}]: ${reason}`);broadcastSse(job, { type: 'error', error: reason });projectRenders.delete(projectId);- await updateProject(projectId, { status: 'failed' }).catch((updateErr) => {+ await updateProject(projectId, settledRender('failed')).catch((updateErr) => {console.error(`❌ Music-video render [${jobId.slice(0, 8)}] project ${projectId.slice(0, 8)} status→failed write failed: ${updateErr.message}`);});await releaseScratch();@@ -668,7 +686,7 @@ export async function renderMusicVideo(projectId) {// A cancel restores the pre-render status (so a cancelled re-render of a// 'complete' project stays 'complete'); a real failure marks it 'failed'.const targetStatus = canceled ? priorStatus : 'failed';- await updateProject(projectId, { status: targetStatus }).catch((updateErr) => {+ await updateProject(projectId, settledRender(targetStatus)).catch((updateErr) => {console.error(`❌ Music-video render [${jobId.slice(0, 8)}] project ${projectId.slice(0, 8)} status→${targetStatus} write failed: ${updateErr.message}`);});await releaseScratch();@@ -705,7 +723,7 @@ export async function renderMusicVideo(projectId) {musicVideoProjectId: projectId,};await appendToVideoHistory(meta);- await updateProject(projectId, { renderHistoryId: jobId, status: 'complete' }).catch((updateErr) => {+ await updateProject(projectId, settledRender('complete', { renderHistoryId: jobId })).catch((updateErr) => {console.error(`❌ Music-video render [${jobId.slice(0, 8)}] project ${projectId.slice(0, 8)} status→complete write failed: ${updateErr.message}`);});console.log(`✅ Music video rendered [${jobId.slice(0, 8)}]: ${filename}`);@@ -715,7 +733,7 @@ export async function renderMusicVideo(projectId) {job.lastError = `Finalize failed: ${err.message}`;console.error(`❌ Music-video render finalize failed [${jobId.slice(0, 8)}]: ${err.message}`);broadcastSse(job, { type: 'error', error: 'Render finalize failed' });- await updateProject(projectId, { status: 'failed' }).catch((updateErr) => {+ await updateProject(projectId, settledRender('failed')).catch((updateErr) => {console.error(`❌ Music-video render [${jobId.slice(0, 8)}] project ${projectId.slice(0, 8)} status→failed write failed: ${updateErr.message}`);});} finally {@@ -757,7 +775,7 @@ export async function renderMusicVideo(projectId) {broadcastSse(job, { type: canceled ? 'canceled' : 'error', error: reason });projectRenders.delete(projectId);const targetStatus = canceled ? priorStatus : 'failed';- await updateProject(projectId, { status: targetStatus }).catch((updateErr) => {+ await updateProject(projectId, settledRender(targetStatus)).catch((updateErr) => {console.error(`❌ Music-video render [${jobId.slice(0, 8)}] project ${projectId.slice(0, 8)} status→${targetStatus} write failed: ${updateErr.message}`);});await releaseScratch();@@ -774,23 +792,38 @@ export async function renderMusicVideo(projectId) {// Boot recovery: a render job cannot survive a restart, so a persisted// 'rendering' status with no live job is stale. Demote it to 'complete' when a-// finished render is already recorded, otherwise to 'ready'. A list failure-// propagates to the bootstrap caller's logBootstrapFailure rather than-// reporting zero recovered.+// finished render is already recorded, otherwise to 'ready', then delete the+// partial output the interrupted encode was writing (#9010). A mark another+// instance stamped is left alone — that render may still be running on the+// peer this record synced from. A list failure propagates to the bootstrap+// caller's logBootstrapFailure rather than reporting zero recovered.export async function recoverStuckMusicVideoRenders() {// No overlay capture survives a restart either; drop any scratch it left.await sweepCompositionScratch().catch((err) => {console.warn(`⚠️ Music Video recovery: could not remove stale overlay scratch: ${err.message}`);});- const stuck = (await listProjects()).filter((p) => p?.status === 'rendering' && !projectRenders.has(p.id));+ const instanceId = await ensureInstanceId();+ const stuck = (await listProjects()).filter((p) => p?.status === 'rendering'+ && !projectRenders.has(p.id) && isLocalRenderMark(p.renderingOn, instanceId));+ // A render whose history append landed but whose 'complete' write failed+ // still names its (finished) file — that file is the gallery's, not a partial.+ const finished = stuck.some((p) => p.renderPartialFilename)+ ? new Set((await loadHistory()).map((entry) => entry?.filename))+ : new Set();let recovered = 0;for (const project of stuck) {const targetStatus = project.renderHistoryId ? 'complete' : 'ready';- const ok = await updateProject(project.id, { status: targetStatus }).then(() => true, (err) => {+ const ok = await updateProject(project.id, settledRender(targetStatus)).then(() => true, (err) => {console.error(`❌ Music Video recovery: project ${project.id.slice(0, 8)} status→${targetStatus} write failed: ${err.message}`);return false;});- if (ok) recovered++;+ if (!ok) continue;+ recovered++;+ // Only once the record no longer points at it. The filename came off a+ // (possibly peer-synced) record, so it is only resolved inside videos/.+ const partial = project.renderPartialFilename;+ const partialPath = typeof partial === 'string' && !finished.has(partial) ? safeUnder(PATHS.videos, partial) : null;+ if (partialPath) await unlink(partialPath).catch(() => {});}if (stuck.length > 0) console.log(`🎬 Music Video boot recovery: demoted ${recovered}/${stuck.length} stuck render(s)`);}diff --git a/server/services/musicVideo/render.terminal.test.js b/server/services/musicVideo/render.terminal.test.jsindex ff715b222d..ae6ffcae2d 100644--- a/server/services/musicVideo/render.terminal.test.js+++ b/server/services/musicVideo/render.terminal.test.js@@ -72,17 +72,21 @@ vi.mock('./compositionRender.js', () => ({removeCompositionScratch: vi.fn(async () => {}),sweepCompositionScratch: vi.fn(async () => {}),}));-vi.mock('./projects.js', () => ({ getProject: vi.fn(), listProjects: vi.fn(async () => []), updateProject: vi.fn(async () => ({})) }));+vi.mock('./projects.js', () => ({ getProject: vi.fn(), listProjects: vi.fn(async () => []), updateProject: vi.fn(async () => ({})), mutateProjectRecord: vi.fn() }));+vi.mock('../instanceIdentity.js', () => ({ ensureInstanceId: vi.fn(async () => 'inst-self') }));import { renderMusicVideo, getRenderJobStatus, cancelRender } from './render.js';import { removeCompositionScratch } from './compositionRender.js';import { findFfmpeg, generateThumbnail } from '../../lib/ffmpeg.js';import { loadHistory } from '../videoGen/local.js';import { getTrack } from '../tracks/index.js';-import { getProject, listProjects, updateProject } from './projects.js';+import { getProject, listProjects, updateProject, mutateProjectRecord } from './projects.js';+import { unlink } from 'fs/promises';const tick = () => new Promise((r) => setTimeout(r, 0));const lastProc = () => h.procs[h.procs.length - 1];+// A terminal project write: the status plus the cleared in-flight mark (#9010).+const settled = (status, extra = {}) => ({ status, ...extra, renderingOn: null, renderPartialFilename: null });const prime = (projectId) => {getProject.mockResolvedValue({@@ -113,7 +117,7 @@ describe('renderMusicVideo terminal handling (#2386)', () => {expect(getRenderJobStatus(jobId).status).toBe('error');expect(getRenderJobStatus(jobId).error).toMatch(/Failed to spawn ffmpeg/);- expect(updateProject).toHaveBeenCalledWith(pid, { status: 'failed' });+ expect(updateProject).toHaveBeenCalledWith(pid, settled('failed'));// Slot released — a re-render reaches spawn again instead of 409ing.const again = await renderMusicVideo(pid);@@ -133,7 +137,7 @@ describe('renderMusicVideo terminal handling (#2386)', () => {// NOT finalized: status stays running, project not marked failed, slot held.expect(getRenderJobStatus(jobId).status).toBe('running');- expect(updateProject).not.toHaveBeenCalledWith(pid, { status: 'failed' });+ expect(updateProject).not.toHaveBeenCalledWith(pid, settled('failed'));await expect(renderMusicVideo(pid)).rejects.toMatchObject({status: 409, code: 'RENDER_IN_PROGRESS', context: { jobId },});@@ -142,7 +146,7 @@ describe('renderMusicVideo terminal handling (#2386)', () => {proc.emit('close', 1, null);await tick();expect(getRenderJobStatus(jobId).status).toBe('error');- expect(updateProject).toHaveBeenCalledWith(pid, { status: 'failed' });+ expect(updateProject).toHaveBeenCalledWith(pid, settled('failed'));// Slot now released.const again = await renderMusicVideo(pid);@@ -229,13 +233,66 @@ describe('recoverStuckMusicVideoRenders (#8430)', () => {await recoverStuckMusicVideoRenders();expect(updateProject.mock.calls).toEqual([- ['done-1', { status: 'complete' }],- ['fresh-1', { status: 'ready' }],+ ['done-1', settled('complete')],+ ['fresh-1', settled('ready')],]);expect(logSpy.mock.calls.some(([line]) => line.includes('demoted 2/2'))).toBe(true);logSpy.mockRestore();});+ it('stamps the in-flight mark with this instance and the output file it is writing (#9010)', async () => {+ prime('stamp-1');+ await renderMusicVideo('stamp-1');+ expect(updateProject).toHaveBeenCalledWith('stamp-1', {+ status: 'rendering', renderingOn: 'inst-self', renderPartialFilename: expect.stringMatching(/^music-video-stamp-1-\d+\.mp4$/),+ });+ });++ it('leaves a peer-owned render alone, and deletes only its own partial output (#9010)', async () => {+ const { recoverStuckMusicVideoRenders } = await import('./render.js');+ const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});+ loadHistory.mockResolvedValue([{ id: 'r-done', filename: 'music-video-finished.mp4' }]);+ listProjects.mockResolvedValueOnce([+ { id: 'mine-1', status: 'rendering', renderingOn: 'inst-self', renderPartialFilename: 'music-video-mine.mp4' },+ { id: 'peer-1', status: 'rendering', renderingOn: 'inst-peer', renderPartialFilename: 'music-video-peer.mp4' },+ { id: 'legacy-1', status: 'rendering' },+ // Its history append landed but the 'complete' write did not: the file is a finished render.+ { id: 'late-1', status: 'rendering', renderingOn: 'inst-self', renderPartialFilename: 'music-video-finished.mp4' },+ ]);++ await recoverStuckMusicVideoRenders();++ expect(updateProject.mock.calls).toEqual([+ ['mine-1', settled('ready')],+ ['legacy-1', settled('ready')],+ ['late-1', settled('ready')],+ ]);+ expect(unlink.mock.calls).toEqual([['/data/videos/music-video-mine.mp4']]);+ logSpy.mockRestore();+ });++ it('excerpt recovery demotes its own and legacy drafts but not a peer\'s (#9010)', async () => {+ const { recoverStuckMusicVideoExcerpts } = await import('./excerptRender.js');+ const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});+ const draft = (id, extra) => ({ id, status: 'rendering', jobId: id, partialFilename: `${id}.mp4`, notes: [], ...extra });+ let record = {+ id: 'mv-x', status: 'complete', revisions: [],+ excerpts: [draft('mve-mine', { renderingOn: 'inst-self' }), draft('mve-peer', { renderingOn: 'inst-peer' }), draft('mve-legacy')],+ };+ listProjects.mockResolvedValueOnce([record]);+ mutateProjectRecord.mockImplementation(async (_id, transform) => { record = transform(record).project; return {}; });++ await recoverStuckMusicVideoExcerpts();++ const byId = Object.fromEntries(record.excerpts.map((e) => [e.id, e]));+ expect(byId['mve-mine']).toMatchObject({ status: 'error', renderingOn: null, partialFilename: null });+ expect(byId['mve-legacy']).toMatchObject({ status: 'error', partialFilename: null });+ expect(byId['mve-peer']).toMatchObject({ status: 'rendering', renderingOn: 'inst-peer', partialFilename: 'mve-peer.mp4' });+ expect(unlink.mock.calls.map(([p]) => p)).not.toContain('/data/videos/mve-peer.mp4');+ expect(unlink.mock.calls.map(([p]) => p)).toContain('/data/videos/mve-mine.mp4');+ logSpy.mockRestore();+ });+it('propagates a list failure instead of reporting zero recovered', async () => {const { recoverStuckMusicVideoRenders } = await import('./render.js');listProjects.mockRejectedValueOnce(new Error('DB unavailable'));@@ -255,7 +312,7 @@ describe('recoverStuckMusicVideoRenders (#8430)', () => {await recoverStuckMusicVideoRenders();- expect(updateProject).toHaveBeenCalledWith('good-1', { status: 'ready' });+ expect(updateProject).toHaveBeenCalledWith('good-1', settled('ready'));expect(errorSpy.mock.calls.some(([line]) => line.includes('bad-1'))).toBe(true);expect(logSpy.mock.calls.some(([line]) => line.includes('demoted 1/2'))).toBe(true);errorSpy.mockRestore();@@ -365,7 +422,7 @@ describe('composed render lifecycle (#8984)', () => {await tick();expect(getRenderJobStatus(jobId).status).toBe('canceled');expect(h.procs).toHaveLength(0);- expect(updateProject).toHaveBeenLastCalledWith('cancel-1', { status: 'complete' });+ expect(updateProject).toHaveBeenLastCalledWith('cancel-1', settled('complete'));expect(removeCompositionScratch).toHaveBeenCalledWith(jobId);expect(cancelRender(jobId)).toBe(false);const again = await renderMusicVideo('cancel-1');