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

Bound lyric spans at zero and persist derived shots on storyboard approval

Claudeeeed3d0e6a51
diff --git a/server/services/musicVideo/productionReview.js b/server/services/musicVideo/productionReview.js
index f655094c5f..757d575974 100644
--- a/server/services/musicVideo/productionReview.js
+++ b/server/services/musicVideo/productionReview.js
@@ -279,7 +279,7 @@ export function productionReadiness(project) {
// A line is judged on the span its words give it (lyricCueSpan), the span the renderer shows:
// forced-aligned words may run a little past a line window taken from the song's line timestamps.
if (cues.some(c => !c.words?.length || c.words.some(w => !(Number.isFinite(w.startSec) && w.endSec > w.startSec))
- || !(lyricCueSpan(c)?.endSec <= duration))) {
+ || !(lyricCueSpan(c)?.startSec >= 0 && lyricCueSpan(c).endSec <= duration))) {
boardProblems.push('Every lyric line needs bounded, positive-duration word timings; repair zero-length or missing words.');
}
}
@@ -410,7 +410,7 @@ export function assertProductionApproval(project, stage = 'proof') {
* claims human playback; rendering alone is not a review. */
export function approveProductionStage(project, { stage, basis, proofReview, approvedBy, reviewer }) {
const readiness = productionReadiness(project);
- const expected = stage === 'proof'
+ let expected = stage === 'proof'
? hash({ basis: readiness.basis.proof, excerptId: project.productionReview?.proof?.excerptId,
filename: project.excerpts?.find(e => e.id === project.productionReview?.proof?.excerptId)?.filename })
: readiness.basis[stage];
@@ -425,6 +425,13 @@ export function approveProductionStage(project, { stage, basis, proofReview, app
throw new ServerError('The rendered proof changed. Play and review the new excerpt before approving.', { status: 409, code: 'MUSIC_VIDEO_REVIEW_STALE' });
}
}
+ // Approving a Board storyboard writes the derived rows it was judged on (boardStoryboard) into the
+ // draft, so code, renders and the making-of read the approved shots. The approval binds to that revision.
+ if (stage === 'storyboard' && project.productionReview?.draft?.storyboardSource !== 'document' && (project.scenes || []).length) {
+ project = { ...project, productionReview: { ...project.productionReview,
+ draft: { ...project.productionReview?.draft, storyboard: boardStoryboard(project) } } };
+ expected = productionReviewBasis(project).storyboard;
+ }
const decision = { stage, basis: expected, inputs: productionApprovalInputs(project)[stage], values: productionApprovalValues(project, stage), approvedAt: new Date().toISOString(),
...(approvedBy ? { approvedBy } : {}), ...(reviewer ? { reviewer: structuredClone(reviewer) } : {}),
...(stage === 'proof' ? { proofReview: structuredClone(proofReview) } : {}) };
diff --git a/server/services/musicVideo/productionReview.storyboard.test.js b/server/services/musicVideo/productionReview.storyboard.test.js
index ffe4eba047..1486b68c6a 100644
--- a/server/services/musicVideo/productionReview.storyboard.test.js
+++ b/server/services/musicVideo/productionReview.storyboard.test.js
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
-import { productionReadiness, productionAlignmentBasis } from './productionReview.js';
+import { productionReadiness, productionAlignmentBasis, approveProductionStage } from './productionReview.js';
const WORD_PROBLEM = /bounded, positive-duration word timings/;
const SHOT_PROBLEM = /^Complete timing, action, staging, camera and transition/;
@@ -50,3 +50,19 @@ describe('storyboard readiness after verified lyric timing', () => {
expect(storyboard.problems).toContain('Complete timing, action, staging, camera and transition for Verse.');
});
});
+
+describe('approving a Board storyboard of derived shots', () => {
+ it('writes the derived rows into the draft and stays approved on that revision', () => {
+ const planned = project();
+ const draft = { ...planned.productionReview.draft, cast: 'The director', environments: 'Edit room', visualLanguage: 'Analog grain',
+ motionLanguage: 'Slow push-ins', guideArtifactId: 'g1' };
+ const ready = { ...planned, devArtifacts: [{ id: 'g1', mimeType: 'image/png', file: 'guide.png', version: 1 }],
+ productionReview: { ...planned.productionReview, draft } };
+ const art = approveProductionStage(ready, { stage: 'art', basis: productionReadiness(ready).basis.art });
+ const before = productionReadiness(art);
+ expect(before.storyboard.problems).toEqual([]);
+ const approved = approveProductionStage(art, { stage: 'storyboard', basis: before.basis.storyboard });
+ expect(approved.productionReview.draft.storyboard).toEqual(before.storyboard.shots);
+ expect(productionReadiness(approved).storyboard.approved).toBe(true);
+ });
+});