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): keep active excerpt ownership out of project clones
[._.]/ Adam Eivybaec98037d74
diff --git a/server/routes/musicVideoAutoReview.test.js b/server/routes/musicVideoAutoReview.test.jsindex c1e88dddd8..41d3ec1227 100644--- a/server/routes/musicVideoAutoReview.test.js+++ b/server/routes/musicVideoAutoReview.test.js@@ -10,7 +10,7 @@import { describe, it, expect, vi, beforeEach, afterAll } from 'vitest';import express from 'express';-import { mkdirSync, rmSync, writeFileSync } from 'fs';+import { existsSync, mkdirSync, rmSync, writeFileSync } from 'fs';import { dirname, join } from 'path';import { promisify } from 'util';import { request } from '../lib/testHelper.js';@@ -344,3 +344,34 @@ describe('opt-in automatic review/retries (#8988)', () => {expect(review.findings).toEqual([expect.objectContaining({ atSec: 6, check: 'motion', source: 'analysis' })]);});});+++it('cloning an active draft cannot give recovery ownership of the source render', async () => {+ const { startExcerptRender, recoverStuckMusicVideoExcerpts } = await import('../services/musicVideo/excerptRender.js');+ const p = await project();+ await startExcerptRender(p.id, { startSec: 5, endSec: 25 });+ await finishDraft(p.id, 1);+ const completed = (await projects.getProject(p.id)).excerpts[0];++ await startExcerptRender(p.id, { startSec: 5, endSec: 25 });+ const proc = h.procs[1];+ const outputPath = proc.args[proc.args.length - 1];+ writeFileSync(outputPath, 'partial-mp4');+ try {+ const response = await request(app).post(`${base(p.id)}/clone`).send({});+ expect(response.status).toBe(201);+ await recoverStuckMusicVideoExcerpts();+ // The source still owns the running encoder; recovery on its clone must+ // never remove the output that encoder is writing.+ expect(existsSync(outputPath)).toBe(true);+ const cloned = await projects.getProject(response.body.id);+ expect(cloned.excerpts).toHaveLength(1);+ expect(cloned.excerpts[0]).toMatchObject({+ id: completed.id, status: 'complete', filename: completed.filename,+ contactSheetFilename: completed.contactSheetFilename, notes: completed.notes,+ });+ expect((await projects.getProject(p.id)).excerpts[1].status).toBe('rendering');+ } finally {+ await finishDraft(p.id, 2);+ }+});diff --git a/server/services/musicVideo/projectsLogic.js b/server/services/musicVideo/projectsLogic.jsindex d949f2f227..d3fc31b682 100644--- a/server/services/musicVideo/projectsLogic.js+++ b/server/services/musicVideo/projectsLogic.js@@ -206,7 +206,9 @@ export function cloneProjectRecord(source, {// #8987 — a draft's section map follows the scenes to their new ids, so a// clone can still revise from the review notes it carried over (#8986)....(Array.isArray(source.excerpts) ? {- excerpts: source.excerpts.map((excerpt) => (Array.isArray(excerpt?.sections)+ // A running encoder belongs only to the source project. Copying its+ // partial-file ownership would let clone recovery delete that output.+ excerpts: source.excerpts.filter((excerpt) => excerpt?.status !== 'rendering').map((excerpt) => (Array.isArray(excerpt?.sections)? { ...excerpt, sections: excerpt.sections.map((s) => ({ ...s, sceneId: sceneIdMap.get(s.sceneId) ?? s.sceneId })) }: excerpt)),} : {}),