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

fix: re-time an instrumental song revision instead of failing it

Claude686f8717c13d
diff --git a/server/routes/musicVideoSongRevision.test.js b/server/routes/musicVideoSongRevision.test.js
index 4ec1948955..7413982d20 100644
--- a/server/routes/musicVideoSongRevision.test.js
+++ b/server/routes/musicVideoSongRevision.test.js
@@ -206,4 +206,24 @@ describe('revise the song from an imported track', () => {
expect(created.body.project.lyricCues.map((c) => c.id)).toEqual(['cue-a', 'cue-x', 'cue-b', 'cue-y']);
expect(created.body.project.songRevision.lyricDiff).toEqual({ kept: 4, changed: 0, added: 0, removed: 0 });
});
+
+ it('re-times an instrumental revision through the song length alone', async () => {
+ const { fork } = await fixture();
+ const draft = await post(fork.id, '', { ...fields, lyrics: '', instrumental: true });
+ const revisionId = draft.body.project.songRevision.id;
+ setDeps({ generate: async (_fields, opts) => {
+ if (!opts.songIds) await opts.onSubmitted(['take-i']);
+ return { songId: 'take-i', filename: 'take-i.m4a' };
+ } });
+ await post(fork.id, 'generate', { revisionId }); await service.__testing.settle();
+ expect((await post(fork.id, 'select', { revisionId, songId: 'take-i' })).status).toBe(200);
+ expect(startRetime).toHaveBeenCalledWith(fork.id);
+ const align = vi.fn();
+ const retimed = await service.retimeRevisedSong(fork.id, { align,
+ analyze: (id) => store.mutateProjectRecord(id, (p) => ({ project: { ...p, audioAnalysis: { durationSec: 40 } } })) });
+ expect(align).not.toHaveBeenCalled();
+ expect(retimed.songRevision.retime.status).toBe('done');
+ expect(retimed.scenes[0]).toMatchObject({ startSec: 0, endSec: 40 });
+ expect(Object.values(retimed.songRevision.sceneReview).map((e) => e.status)).toEqual(['removed']);
+ });
});
diff --git a/server/services/musicVideo/songRevision.js b/server/services/musicVideo/songRevision.js
index 444c14e415..30d47c3afd 100644
--- a/server/services/musicVideo/songRevision.js
+++ b/server/services/musicVideo/songRevision.js
@@ -211,7 +211,9 @@ async function remapSongRevisionBoard(projectId) {
const out = await mutate(projectId, (project) => {
const revision = project.songRevision;
if (!reviewable(revision)) fail('This song revision is no longer current');
- if (!(project.lyricCues || []).some((c) => typeof c.startSec === 'number')) fail('Align the new lyrics before re-timing the shots', 'SONG_REVISION_NOT_ALIGNED');
+ // An instrumental song has no lines to align; its board moves through the song's length alone.
+ const cues = project.lyricCues || [];
+ if (cues.length && !cues.some((c) => typeof c.startSec === 'number')) fail('Align the new lyrics before re-timing the shots', 'SONG_REVISION_NOT_ALIGNED');
const remap = remapSongTimeline(project, revision);
const added = addScenes({ ...project, scenes: remap.scenes }, remap.newScenes);
const sceneReview = { ...remap.sceneReview };