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: refuse to render a performance shot whose selected clip is not a lip-sync take (#8977)
[._.]/ Adam Eivy0d49283214ce
diff --git a/server/services/musicVideo/performanceShot.js b/server/services/musicVideo/performanceShot.jsindex 6de95b04ad..c3128a8988 100644--- a/server/services/musicVideo/performanceShot.js+++ b/server/services/musicVideo/performanceShot.js@@ -83,18 +83,25 @@ const refuse = (message, code, status = 400) => new ServerError(message, { statuconst SAME_TIME_SEC = 0.001;/**- * Performance scenes whose SELECTED take was generated against a different song- * interval (the scene was re-timed) or a different recording (the song was- * replaced). Returns `[{ sceneId, reason: 'retimed' | 'audio-changed' }]`;+ * Performance scenes whose SELECTED clip cannot be rendered as a lip-synced+ * shot: a take with no performance instruction (a cutaway render or an import+ * made before the scene became a performance), or one generated against a+ * different song interval (the scene was re-timed) or a different recording+ * (the song was replaced). Returns+ * `[{ sceneId, reason: 'not-lip-synced' | 'retimed' | 'audio-changed' }]`;* the master is hashed only when there is a performance take to check.*/export async function findStalePerformanceTakes(project, masterPath) {- const selected = (Array.isArray(project?.scenes) ? project.scenes : [])- .map((scene) => ({ scene, instruction: selectedPerformanceInstruction(scene) }))- .filter(({ instruction }) => instruction);- if (selected.length === 0) return [];- const sha256 = await hashFile(masterPath);const stale = [];+ const selected = [];+ for (const scene of Array.isArray(project?.scenes) ? project.scenes : []) {+ if (!isPerformanceScene(scene) || !scene.videoHistoryId) continue;+ const instruction = selectedPerformanceInstruction(scene);+ if (instruction) selected.push({ scene, instruction });+ else stale.push({ sceneId: scene.sceneId, reason: 'not-lip-synced' });+ }+ if (selected.length === 0) return stale;+ const sha256 = await hashFile(masterPath);for (const { scene, instruction } of selected) {const interval = instruction.songInterval || {};if (instruction.audio?.sha256 !== sha256) stale.push({ sceneId: scene.sceneId, reason: 'audio-changed' });diff --git a/server/services/musicVideo/performanceShot.test.js b/server/services/musicVideo/performanceShot.test.jsindex a4df9dd398..4490b222ab 100644--- a/server/services/musicVideo/performanceShot.test.js+++ b/server/services/musicVideo/performanceShot.test.js@@ -184,6 +184,9 @@ describe.skipIf(!ffmpeg)('music-video performance shot through the fal lip-syncawait writeFile(songPath, replaced);expect(await findStalePerformanceTakes({ scenes: [withTake] }, songPath)).toEqual([{ sceneId: 'mvs-1', reason: 'audio-changed' }]);+ // A performance scene whose selected clip is not a lip-sync take is refused too.+ expect(await findStalePerformanceTakes({ scenes: [{ ...withTake, takes: [] }] }, songPath))+ .toEqual([{ sceneId: 'mvs-1', reason: 'not-lip-synced' }]);// Switched back to a cutaway, the old take is an ordinary clip again.expect(await findStalePerformanceTakes({ scenes: [{ ...withTake, shotMode: 'cutaway' }] }, songPath)).toEqual([]);const [asCutaway] = await resolveSceneClips({ scenes: [{ ...withTake, shotMode: 'cutaway' }] });diff --git a/server/services/musicVideo/render.js b/server/services/musicVideo/render.jsindex c7157bede2..5bf128a23f 100644--- a/server/services/musicVideo/render.js+++ b/server/services/musicVideo/render.js@@ -473,7 +473,7 @@ export async function renderMusicVideo(projectId) {const stale = await findStalePerformanceTakes(project, audioPath);if (stale.length > 0) {throw new ServerError(- `${stale.length} performance shot${stale.length === 1 ? ' was' : 's were'} generated against a different song interval or recording — regenerate ${stale.length === 1 ? 'it' : 'them'}, or switch to Cutaway, before rendering`,+ `${stale.length} performance shot${stale.length === 1 ? ' has' : 's have'} no lip-synced take of the current song interval and recording — regenerate ${stale.length === 1 ? 'it' : 'them'}, or switch to Cutaway, before rendering`,{ status: 422, code: 'STALE_PERFORMANCE_TAKES', context: { stale } },);}