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
feat: Music Video checklists list every readiness problem with a jump link; Setup tracks lyrics and timing (#10142)
Adam Eivy2a2f51652298
diff --git a/client/src/components/musicVideo/LyricsPanel.jsx b/client/src/components/musicVideo/LyricsPanel.jsxindex 122ed00f53..e0feee5411 100644--- a/client/src/components/musicVideo/LyricsPanel.jsx+++ b/client/src/components/musicVideo/LyricsPanel.jsx@@ -1,5 +1,6 @@import { useRef, useState } from 'react';import { ListMusic, Plus, Trash2, Upload } from 'lucide-react';+import { lyricSetupState } from '../../lib/musicVideoStages.js';// Client-minted ids keep a freshly added row addressable across saves without// waiting for the server (crypto.randomUUID is unavailable on the plain-HTTP@@ -288,6 +289,12 @@ export default function LyricsPanel({ project, onEditLocal, onSave, onImport, im<section className="space-y-1 min-w-0"><div className="flex items-center justify-between"><h4 className="font-medium text-port-text">Lyric lines</h4>+ {cues.length > 0 && !lyricSetupState(project).instrumental && (+ <span className={`text-xs ${lyricSetupState(project).verified ? 'text-port-success' : 'text-port-warning'}`}+ title="Verify the word timing in Production approvals once you have listened to it">+ Lyric timing: {lyricSetupState(project).verified ? 'verified' : 'provisional'}+ </span>+ )}<span className="flex items-center gap-2">{onAlign && (<button type="button" onClick={() => runAlign()} disabled={aligning || cues.length === 0 || !hasAudio}diff --git a/client/src/components/musicVideo/StageChecklist.jsx b/client/src/components/musicVideo/StageChecklist.jsxindex 37bf2a7b1b..85827ebb7f 100644--- a/client/src/components/musicVideo/StageChecklist.jsx+++ b/client/src/components/musicVideo/StageChecklist.jsx@@ -26,6 +26,11 @@ export default function StageChecklist({ items, onAction, headerAnchor = null })<div className="min-w-0 flex-1"><span className={item.done ? 'text-port-text-muted' : ''}>{item.label}</span>{!item.done && item.detail && <p className="break-words text-xs text-port-text-muted">{item.detail}</p>}+ {!item.done && item.details?.length > 0 && (+ <ul className="list-disc space-y-0.5 pl-4 text-xs text-port-text-muted">+ {item.details.map((text) => <li key={text} className="break-words">{text}</li>)}+ </ul>+ )}</div>{!item.done && item.action && onAction && item.action.anchor !== headerAnchor && (<buttondiff --git a/client/src/components/musicVideo/stages/PublishStage.jsx b/client/src/components/musicVideo/stages/PublishStage.jsxindex ea1433d794..6a692cbb90 100644--- a/client/src/components/musicVideo/stages/PublishStage.jsx+++ b/client/src/components/musicVideo/stages/PublishStage.jsx@@ -11,7 +11,7 @@ import PublishPlatformsPanel from '../PublishPlatformsPanel.jsx';export default function PublishStage({ board }) {const { project, locked, publishKit, publishing } = board;return (- <fieldset disabled={locked} className="min-w-0 space-y-3">+ <fieldset id="mv-publish-kit" disabled={locked} className="min-w-0 space-y-3">{publishing && <PublishPlatformsPanel publishing={publishing} />}<PublishKitPanel project={project} publishKit={publishKit} enabledTargets={publishing?.enabledTargets} />{publishing && <PublishPostingPanel project={project} publishing={publishing} />}diff --git a/client/src/components/musicVideo/stages/SetupStage.jsx b/client/src/components/musicVideo/stages/SetupStage.jsxindex f28a527bc4..4d70e58fe9 100644--- a/client/src/components/musicVideo/stages/SetupStage.jsx+++ b/client/src/components/musicVideo/stages/SetupStage.jsx@@ -14,15 +14,20 @@ import { AnalyzeAction, MidiAction } from '../ProjectActionGroups.jsx';import StageSection from '../StageSection.jsx';import ProjectOptionsPanel, { projectOptionsSummary } from '../ProjectOptionsPanel.jsx';import { Check } from 'lucide-react';-import { projectHasAudio } from '../../../lib/musicVideoStages.js';+import { lyricSetupState, projectHasAudio } from '../../../lib/musicVideoStages.js';import { formatCount } from '../../../utils/formatters.js';const songSummary = (project, trackLabel) => {const lines = (project.lyricCues || []).length;+ const aligned = lines > 0 && project.lyricCues.every((cue) => cue.words?.length);+ const lyrics = lyricSetupState(project);+ const lyricText = lines+ ? [`${formatCount(lines)} lyric ${lines === 1 ? 'line' : 'lines'}`, aligned ? 'aligned' : null, lyrics.verified ? 'verified' : null].filter(Boolean).join(' · ')+ : lyrics.instrumental ? 'Instrumental' : 'No lyrics';return [projectHasAudio(project) ? trackLabel || 'Track attached' : 'No track yet',project.audioAnalysis ? 'Analyzed' : 'Not analyzed',- lines ? `${formatCount(lines)} lyric ${lines === 1 ? 'line' : 'lines'}` : 'No lyrics',+ lyricText,].join(' · ');};@@ -86,7 +91,7 @@ export default function SetupStage({ board }) {conceptDraft, styleDraft, importingLyrics, aligningLyrics, treatment,autopilotRun, autonomous, runStage, onSelectStage,} = board;- const songOpen = !projectHasAudio(project) || !project.audioAnalysis;+ const songOpen = !projectHasAudio(project) || !project.audioAnalysis || !lyricSetupState(project).ok;const cues = project.lyricCues || [];const aligned = cues.length > 0 && cues.every((cue) => cue.words?.length);const trackLabel = project.trackId ? trackName(project.trackId) : audioFilename;diff --git a/client/src/lib/musicVideoStages.js b/client/src/lib/musicVideoStages.jsindex 2129b1a045..f6837ff160 100644--- a/client/src/lib/musicVideoStages.js+++ b/client/src/lib/musicVideoStages.js@@ -262,6 +262,22 @@ const composeDone = (project, mode) => {* `todo` — plus `current`, the first stage that is not done. A live production* run owns the project, so it pins `current` to Produce.*/+/**+ * Lyric half of Setup: storyboard approval needs lyrics imported and their word+ * timings verified (or an explicit instrumental exception). `readiness.alignment`+ * is the server's verdict; the draft is the fallback before readiness loads.+ * `ok` also holds once the storyboard is approved, which implies both.+ */+export function lyricSetupState(project, readiness = project?.productionReadiness) {+ const draft = project?.productionReview?.draft || {};+ const instrumental = draft.lyricsMode === 'instrumental';+ const lines = (project?.lyricCues || []).filter((cue) => isNonBlankStr(cue.text)).length;+ const alignment = readiness?.alignment?.status || (instrumental ? 'instrumental' : draft.timingStatus === 'verified' ? 'verified' : 'provisional');+ const imported = instrumental || lines > 0;+ const verified = alignment === 'verified' || alignment === 'instrumental';+ return { instrumental, lines, alignment, imported, verified, ok: !!readiness?.storyboard?.approved || (imported && verified) };+}+export function deriveStages(project, readiness = project?.productionReadiness, publish = {}) {const scenes = project?.scenes || [];const mode = project?.composition?.mode || 'concat';@@ -277,7 +293,7 @@ export function deriveStages(project, readiness = project?.productionReadiness,const produceDone = planned && (footageOptional || scenes.every((scene) => sceneRenderReady(scene, { layered })));const done = {- setup: projectHasAudio(project) && !!project?.audioAnalysis,+ setup: projectHasAudio(project) && !!project?.audioAnalysis && lyricSetupState(project, readiness).ok,'cast-sets': castDone,board: planned,produce: produceDone && !!readiness?.proof.approved,@@ -422,6 +438,28 @@ export function deriveNextAction(project, {// The editable art-direction fields Production approvals needs before art can be approved.const ART_DIRECTION_FIELDS = [['cast', 'cast'], ['environments', 'sets'], ['visualLanguage', 'visual language'], ['motionLanguage', 'motion']];const APPROVAL_ANCHORS = { art: 'mv-review-art', storyboard: 'mv-review-storyboard', proof: 'mv-review-proof' };+const PUBLISH_ANCHOR = 'mv-publish-kit';++// Storyboard readiness problems, grouped by what the user has to go fix. The+// server returns plain sentences; the first matching rule picks the group.+const STORYBOARD_PROBLEM_GROUPS = [+ { id: 'art', label: 'Art direction', test: /art direction|art feedback/i, action: { label: 'Review art direction', anchor: APPROVAL_ANCHORS.art } },+ { id: 'lyrics', label: 'Lyrics', test: /lyrics|instrumental/i, action: { label: 'Import lyrics', anchor: 'mv-lyrics-import' } },+ { id: 'timing', label: 'Lyric timing', test: /alignment|timing|vocal|master song/i, action: { label: 'Verify timing', anchor: APPROVAL_ANCHORS.storyboard } },+ { id: 'coverage', label: 'Shot coverage', test: /cover the master|gaps or overlaps|create a timed/i, action: { label: 'Open the treatment', anchor: 'mv-board-treatment' } },+ { id: 'shots', label: 'Shot details', test: /./, action: { label: 'Edit the storyboard', anchor: APPROVAL_ANCHORS.storyboard } },+];++/** One open checklist item per group of storyboard readiness problems, listing every problem in it. */+function storyboardProblemItems(readiness) {+ const problems = readiness?.storyboard?.problems || [];+ if (readiness?.storyboard?.approved || !problems.length) return [];+ return STORYBOARD_PROBLEM_GROUPS.flatMap((group, index) => {+ const earlier = STORYBOARD_PROBLEM_GROUPS.slice(0, index);+ const mine = problems.filter((text) => group.test.test(text) && !earlier.some((g) => g.test.test(text)));+ return mine.length ? [{ id: `board-${group.id}`, label: group.label, done: false, details: mine, action: group.action }] : [];+ });+}/*** What one stage tab needs before it counts as done, as a short checklist the@@ -452,26 +490,40 @@ export function stageChecklist(stageId, project, readiness = project?.production// An autonomous run that is still going writes the song itself.const autoSong = !!project.autonomousRun && !['completed', 'canceled', 'failed'].includes(project.autonomousRun.status);const hasAudio = projectHasAudio(project);+ const lyrics = lyricSetupState(project, readiness);return [{ id: 'track', label: 'Track attached', done: hasAudio, detail: !hasAudio && autoSong ? 'The autonomous run is making the song.' : null,action: hasAudio || autoSong ? null : { label: 'Attach a track', anchor: 'mv-track' } },- { id: 'analysis', label: 'Song analyzed', done: !!project.audioAnalysis, detail: project.audioAnalysis ? null : 'Analyze the song from the header or Song & lyrics.' },+ { id: 'analysis', label: 'Song analyzed', done: !!project.audioAnalysis, detail: project.audioAnalysis ? null : 'Analyze the song from the header or Song & lyrics.',+ action: project.audioAnalysis ? null : { label: 'Open Song & lyrics', anchor: 'mv-setup-song' } },+ { id: 'lyrics', label: lyrics.instrumental ? 'Instrumental — no lyrics needed' : 'Lyrics imported', done: lyrics.imported || lyrics.ok,+ detail: 'Import the lyrics, or mark the song instrumental in Production approvals.',+ action: autoSong ? null : { label: 'Import lyrics', anchor: 'mv-lyrics-import' } },+ { id: 'timing', label: lyrics.instrumental ? 'Instrumental exception confirmed' : 'Lyric timing verified', done: lyrics.verified || lyrics.ok,+ detail: lyrics.alignment === 'stale' ? 'Word timings or the master changed since you verified them; verify again.'+ : lyrics.instrumental ? 'Explain the instrumental exception in Production approvals.'+ : 'Align the words, listen to them against the vocal, then verify the timing in Production approvals.',+ action: autoSong ? null : { label: 'Verify timing', anchor: APPROVAL_ANCHORS.storyboard } },];}case 'cast-sets': {const missing = ART_DIRECTION_FIELDS.filter(([key]) => !isNonBlankStr(draft[key])).map(([, label]) => label);const guide = (project.devArtifacts || []).find((a) => a.id === draft.guideArtifactId && !a.deleted) || null;return [- { id: 'direction', label: 'Art direction written', done: missing.length === 0, detail: missing.length ? `Still missing: ${missing.join(', ')}.` : null },+ { id: 'direction', label: 'Art direction written', done: missing.length === 0, detail: missing.length ? `Still missing: ${missing.join(', ')}.` : null,+ action: missing.length ? { label: 'Write art direction', anchor: APPROVAL_ANCHORS.art } : null },{ id: 'guide', label: guide ? `Visual guide chosen: ${guide.title || guide.filename || 'sheet'}` : 'Visual guide chosen', done: !!guide,- detail: guide ? null : 'Pick a Cast & Sets sheet as the visual guide in Production approvals.' },+ detail: guide ? null : 'Pick a Cast & Sets sheet as the visual guide in Production approvals.',+ action: guide ? null : { label: 'Choose a guide', anchor: APPROVAL_ANCHORS.art } },approval('art', 'Art direction', 'Ready for your review. Approving a sheet file does not approve the art direction; approve it in Production approvals.'),];}case 'board': {const planned = scenes.length > 0 || (draft.storyboard || []).length > 0;return [- { id: 'shots', label: 'Shots planned', done: planned, detail: planned ? null : 'Plan the shots from the header, or add scenes by hand.' },+ { id: 'shots', label: 'Shots planned', done: planned, detail: planned ? null : 'Plan the shots from the header, or add scenes by hand.',+ action: planned ? null : { label: 'Open the treatment', anchor: 'mv-board-treatment' } },+ ...storyboardProblemItems(readiness),approval('storyboard', 'Timed storyboard', 'Ready for your review in Production approvals.'),];}@@ -480,16 +532,19 @@ export function stageChecklist(stageId, project, readiness = project?.productionif (!FOOTAGE_OPTIONAL_MODES.has(mode)) {const layered = isLayeredComposition(project);const ready = scenes.filter((scene) => sceneRenderReady(scene, { layered })).length;- items.push({ id: 'footage', label: `Footage for every shot (${formatCount(ready)} of ${formatCount(scenes.length)})`, done: scenes.length > 0 && ready === scenes.length });+ const footageDone = scenes.length > 0 && ready === scenes.length;+ items.push({ id: 'footage', label: `Footage for every shot (${formatCount(ready)} of ${formatCount(scenes.length)})`, done: footageDone,+ action: footageDone ? null : { label: 'Set up production', anchor: 'mv-production-start' } });}items.push(approval('proof', 'Animated proof', 'Render the proof, watch it with sound, then approve it in Production approvals.'));return items;}case 'compose': {// Compose counts as done only behind an approved proof (see deriveStages).- const proof = { id: 'proof', label: 'Animated proof approved (Produce)', done: !!readiness?.proof?.approved };- if (mode === 'composed') return [proof, { id: 'composition', label: 'Timed typography added', done: (project.composition?.textCues || []).length > 0 }];- if (mode === 'document') return [proof, { id: 'composition', label: 'Composition document attached', done: !!project.composition?.document }];+ const proof = { id: 'proof', label: 'Animated proof approved (Produce)', done: !!readiness?.proof?.approved,+ action: readiness?.proof?.approved ? null : { label: 'Review animated proof', anchor: APPROVAL_ANCHORS.proof } };+ if (mode === 'composed') return [proof, { id: 'composition', label: 'Timed typography added', done: (project.composition?.textCues || []).length > 0, action: { label: 'Add typography', anchor: 'mv-typo-font' } }];+ if (mode === 'document') return [proof, { id: 'composition', label: 'Composition document attached', done: !!project.composition?.document, action: { label: 'Attach a document', anchor: 'mv-doc-folder' } }];if (mode === 'eidoverse') {const saved = !!project.composition?.eidoverseScene?.inlineScript;return [proof, { id: 'composition', label: 'Save the Eidoverse scene', done: saved, action: saved ? null : { label: 'Save the scene', anchor: 'mv-eidoverse-scene' } }];@@ -497,7 +552,8 @@ export function stageChecklist(stageId, project, readiness = project?.productionif (mode === 'code') {const generated = !!project.composition?.codeVideo?.generatedAt;return [proof, { id: 'composition', label: generated ? 'Code video generated' : 'Code video sections ready', done: codeComposed(project),- detail: codeComposed(project) ? null : 'Generate the code video from the Code Video panel.' }];+ detail: codeComposed(project) ? null : 'Generate the code video from the Code Video panel.',+ action: codeComposed(project) ? null : { label: 'Open Code Video', anchor: 'mv-code-section' } }];}return [proof, { id: 'composition', label: 'Nothing to compose for this render style', done: true }];}@@ -505,7 +561,7 @@ export function stageChecklist(stageId, project, readiness = project?.productionreturn [{id: 'final', label: 'Final video rendered', done: !!project.renderHistoryId && !isFinalRenderStale(project),detail: isFinalRenderStale(project) ? `${STALE_RENDER_MESSAGE}.` : null,- action: isFinalRenderStale(project) ? { label: 'Re-render', anchor: 'mv-final-video' } : null,+ action: project.renderHistoryId && !isFinalRenderStale(project) ? null : { label: project.renderHistoryId ? 'Re-render' : 'Render', anchor: 'mv-final-video' },}];case 'publish': {const kit = project.publishKit || {};@@ -513,13 +569,14 @@ export function stageChecklist(stageId, project, readiness = project?.productionconst progress = publishPlatformProgress(project, publish);const items = [{ id: 'kit', label: 'Kit built from the current render', done: kitCurrent,- detail: kit.builtAt && !kitCurrent ? 'The final render changed since the kit was built; rebuild it.' : null },- { id: 'copy', label: 'Copy drafted', done: !!(kit.copyDraftedAt || kit.copy) },+ detail: kit.builtAt && !kitCurrent ? 'The final render changed since the kit was built; rebuild it.' : null,+ action: kitCurrent ? null : { label: 'Build the kit', anchor: PUBLISH_ANCHOR } },+ { id: 'copy', label: 'Copy drafted', done: !!(kit.copyDraftedAt || kit.copy), action: kit.copyDraftedAt || kit.copy ? null : { label: 'Draft the copy', anchor: PUBLISH_ANCHOR } },];- if (!progress.rows.length) return [...items, { id: 'posted', label: 'Posted to a platform', done: progress.done }];- items.push({ id: 'posted', label: `Posted to every enabled platform (${formatCount(progress.posted)} of ${formatCount(progress.total)})`, done: progress.done });+ if (!progress.rows.length) return [...items, { id: 'posted', label: 'Posted to a platform', done: progress.done, action: progress.done ? null : { label: 'Open publishing', anchor: PUBLISH_ANCHOR } }];+ items.push({ id: 'posted', label: `Posted to every enabled platform (${formatCount(progress.posted)} of ${formatCount(progress.total)})`, done: progress.done, action: progress.done ? null : { label: 'Open publishing', anchor: PUBLISH_ANCHOR } });const STATE_LABELS = { posted: 'posted', draft: 'draft filled', none: 'not started' };- for (const row of progress.rows) items.push({ id: `post-${row.target}`, label: `${row.label}: ${STATE_LABELS[row.state]}`, done: row.state === 'posted' });+ for (const row of progress.rows) items.push({ id: `post-${row.target}`, label: `${row.label}: ${STATE_LABELS[row.state]}`, done: row.state === 'posted', action: row.state === 'posted' ? null : { label: 'Open publishing', anchor: PUBLISH_ANCHOR } });return items;}default:diff --git a/client/src/lib/musicVideoStages.test.js b/client/src/lib/musicVideoStages.test.jsindex 829b82f7bd..800abd300b 100644--- a/client/src/lib/musicVideoStages.test.js+++ b/client/src/lib/musicVideoStages.test.js@@ -5,6 +5,8 @@ import {const APPROVED = { art: { approved: true }, storyboard: { approved: true }, proof: { approved: true }, readyForProduction: true };const ANALYSIS = { bpm: 120, durationSec: 30, sections: [] };+// Setup is done only once lyrics are in and their timing is verified (or the song is instrumental).+const LYRICS = { lyricCues: [{ id: 'l1', text: 'la la' }], productionReview: { draft: { timingStatus: 'verified' } } };const scene = (over = {}) => ({ sceneId: 's1', order: 0, prompt: 'a', referenceImageId: 'img', videoHistoryId: 'vid', ...over });const run = (over = {}) => ({id: 'run-1', status: 'running', interrupted: false, limits: { maxGenerations: 12, spendCapUsd: 20 }, usage: { generations: 3, spentUsd: 4.5 }, ...over,@@ -40,7 +42,7 @@ describe('deriveStages / deriveNextAction', () => {});it('a project waiting on Cast & Sets approval offers the approval, a stopped check-in offers to resume, and no check-in offers to start', () => {- const waiting = { id: 'p', trackId: 't1', audioAnalysis: ANALYSIS, automation: {}, castAndSets: { status: 'review' }, scenes: [] };+ const waiting = { id: 'p', trackId: 't1', audioAnalysis: ANALYSIS, ...LYRICS, automation: {}, castAndSets: { status: 'review' }, scenes: [] };expect(deriveStages(waiting).current).toBe('cast-sets');expect(stateOf(waiting)).toMatchObject({ setup: 'done', 'cast-sets': 'active', board: 'todo' });expect(deriveNextAction(waiting)).toMatchObject({ id: 'approve-cast-sets', kind: 'run' });@@ -162,12 +164,12 @@ describe('deriveStages / deriveNextAction', () => {});it('requires art review for hands-on projects too', () => {- expect(stateOf({ id: 'p', trackId: 't1', audioAnalysis: ANALYSIS, scenes: [] })['cast-sets']).toBe('active');+ expect(stateOf({ id: 'p', trackId: 't1', audioAnalysis: ANALYSIS, ...LYRICS, scenes: [] })['cast-sets']).toBe('active');});});it('never promotes placeholder scenes or imported schematic documents to final production', () => {- const project = { id: 'example', trackId: 'song', audioAnalysis: ANALYSIS, scenes: [scene()], composition: { mode: 'document', document: { directory: 'draft' } } };+ const project = { id: 'example', trackId: 'song', audioAnalysis: ANALYSIS, ...LYRICS, scenes: [scene()], composition: { mode: 'document', document: { directory: 'draft' } } };expect(stateOf(project)).toMatchObject({ 'cast-sets': 'active', board: 'todo', produce: 'todo', compose: 'todo' });expect(deriveNextAction(project)).toMatchObject({ id: 'review-production', stage: 'cast-sets' });const planned = { ...project, productionReadiness: { ...APPROVED, proof: { approved: false }, readyForProduction: false } };@@ -308,9 +310,9 @@ describe('stageChecklist', () => {proof: { approved: false, problems: [] }, readyForProduction: false,};const castProject = (over = {}) => ({- id: 'p', trackId: 't1', audioAnalysis: ANALYSIS, scenes: [],+ id: 'p', trackId: 't1', audioAnalysis: ANALYSIS, scenes: [], lyricCues: LYRICS.lyricCues,devArtifacts: [{ id: 'sheet', title: 'Cast sheet', mimeType: 'text/html' }, { id: 'gone', title: 'Rejected sheet', deleted: true }],- productionReview: { draft: { cast: 'c', environments: 'e', visualLanguage: 'v', motionLanguage: 'm', guideArtifactId: 'sheet' } },+ productionReview: { draft: { cast: 'c', environments: 'e', visualLanguage: 'v', motionLanguage: 'm', guideArtifactId: 'sheet', timingStatus: 'verified' } },...over,});@@ -337,18 +339,59 @@ describe('stageChecklist', () => {});it('covers Setup, Board, Produce and Compose with the same done answers deriveStages uses', () => {- expect(stageChecklist('setup', { id: 'p' }).map((i) => i.done)).toEqual([false, false]);+ expect(stageChecklist('setup', { id: 'p' }).map((i) => i.done)).toEqual([false, false, false, false]);expect(stageChecklist('setup', { id: 'p' })[0].action).toEqual({ label: 'Attach a track', anchor: 'mv-track' });// A running autonomous run writes the song itself, so there is nothing to attach.expect(stageChecklist('setup', { id: 'p', autonomousRun: { status: 'running' } })[0]).toMatchObject({ action: null, detail: 'The autonomous run is making the song.' });expect(stageChecklist('board', castProject({ scenes: [scene()] }), NOT_APPROVED).map((i) => [i.id, i.done]))- .toEqual([['shots', true], ['approve-storyboard', false]]);+ .toEqual([['shots', true], ['board-art', false], ['approve-storyboard', false]]);expect(stageChecklist('produce', castProject({ scenes: [scene(), scene({ sceneId: 's2', videoHistoryId: null })] }), APPROVED)[0]).toMatchObject({ id: 'footage', label: 'Footage for every shot (1 of 2)', done: false });// A code render draws its own picture: no footage item.expect(stageChecklist('produce', castProject({ composition: { mode: 'code' } }), APPROVED).map((i) => i.id)).toEqual(['approve-proof']);expect(stageChecklist('compose', castProject({ composition: { mode: 'composed', textCues: [] } }), APPROVED).map((i) => i.done)).toEqual([true, false]);});+ it('keeps Setup open until lyrics are imported and their timing verified, unless the song is instrumental', () => {+ const base = { id: 'p', trackId: 't1', audioAnalysis: ANALYSIS };+ const setup = (project, readiness) => deriveStages(project, readiness).stages.find((st) => st.id === 'setup').state;+ expect(setup(base)).not.toBe('done');+ expect(stageChecklist('setup', base).filter((i) => !i.done).map((i) => i.id)).toEqual(['lyrics', 'timing']);+ const imported = { ...base, lyricCues: [{ id: 'l1', text: 'la' }] };+ expect(stageChecklist('setup', imported).find((i) => i.id === 'timing')).toMatchObject({ done: false, action: { anchor: 'mv-review-storyboard' } });+ expect(setup(imported)).not.toBe('done');+ // The server's verdict wins over a stale draft: previously verified, timings changed since.+ const verified = { ...imported, ...LYRICS };+ expect(setup(verified)).toBe('done');+ expect(stageChecklist('setup', verified, { alignment: { status: 'stale' } }).find((i) => i.id === 'timing').detail).toMatch(/verify again/);+ expect(setup({ ...base, productionReview: { draft: { lyricsMode: 'instrumental' } } })).toBe('done');+ });++ it('lists every storyboard readiness problem on Board, grouped, each with a jump target', () => {+ const readiness = { ...NOT_APPROVED, storyboard: { approved: false, problems: [+ 'Import lyrics and align them to the current vocal; missing lyrics are not an instrumental.',+ 'Lyric alignment is provisional or changed. Listen and verify the current word timings.',+ 'Storyboard shots must cover the master without unintended gaps or overlaps.',+ 'Complete timing, action, staging, camera and transition for Shot 1.',+ 'Review lyric anchors for Shot 1.',+ ] } };+ const items = stageChecklist('board', castProject({ scenes: [scene()] }), readiness).filter((i) => i.details);+ expect(items.map((i) => i.id)).toEqual(['board-lyrics', 'board-timing', 'board-coverage', 'board-shots']);+ expect(items.flatMap((i) => i.details)).toHaveLength(5);+ expect(items.every((i) => i.action?.anchor)).toBe(true);+ });++ it('gives every open checklist item an action so none is a dead end', () => {+ const stages = ['setup', 'cast-sets', 'board', 'produce', 'compose', 'review', 'publish'];+ const modes = [undefined, 'composed', 'document', 'eidoverse', 'code'];+ for (const mode of modes) {+ const project = castProject({ composition: mode ? { mode } : undefined, lyricCues: [] });+ for (const stage of stages) {+ const open = stageChecklist(stage, project, NOT_APPROVED).filter((i) => !i.done && !i.action);+ expect(open.map((i) => `${mode}/${stage}/${i.id}`)).toEqual([]);+ }+ }+ });+});describe('compareMusicVideoProjectsNewestFirst', () => {