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
Music Video: review Storyboard, Make and Final render with a large player beside the approval (#10311)
[._.]/40ffe5b48376
diff --git a/client/src/components/musicVideo/CompositionPreviewPlayer.jsx b/client/src/components/musicVideo/CompositionPreviewPlayer.jsxindex 8aebf1f07a..7744682bee 100644--- a/client/src/components/musicVideo/CompositionPreviewPlayer.jsx+++ b/client/src/components/musicVideo/CompositionPreviewPlayer.jsx@@ -130,9 +130,10 @@ export default function CompositionPreviewPlayer({ project, audioUrl, seekRequesuseEffect(() => {if (!seekRequest || duration <= 0 || appliedSeek.current === seekRequest.n) return;appliedSeek.current = seekRequest.n;- audioRef.current?.pause?.();- setPlaying(false);seek(seekRequest.t);+ // A storyboard row asks to play from the shot (`play`); a scene card only cues it.+ if (seekRequest.play && audioRef.current) { audioRef.current.play?.()?.catch?.(() => {}); setPlaying(true); }+ else { audioRef.current?.pause?.(); setPlaying(false); }}, [seekRequest, duration, seek]);useEffect(() => {diff --git a/client/src/components/musicVideo/MusicVideoLayout.jsx b/client/src/components/musicVideo/MusicVideoLayout.jsxindex d741a47363..b893fb25e0 100644--- a/client/src/components/musicVideo/MusicVideoLayout.jsx+++ b/client/src/components/musicVideo/MusicVideoLayout.jsx@@ -100,14 +100,20 @@ const DOCK_CLASSES = 'min-w-0 max-xl:order-first max-xl:col-span-full xl:sticky* `autopilotStatus(…)` (`{ label, short, tone }`) for the header's Autopilot* button (or null to hide it);* `onOpenSettings(tab)` opens Project settings. `dock` is the `PreviewDock`.+ * `lead` (the step checklist) opens the step; `review` is the step's approval.+ * With `playerFirst` the player and the approval sit together at the top of the+ * step; otherwise the player docks at the side and the approval closes the step.*/export default function MusicVideoLayout({project, trackLabel, stage, onStageChange, progress, nextAction, onNextAction, spend, status = null,- attention = null, dock = null, notes = null, autopilot = null, onOpenSettings = null, children,+ attention = null, dock = null, notes = null, autopilot = null, onOpenSettings = null,+ playerFirst = false, lead = null, review = null, children,}) {const headerRef = useRef(null);const rootRef = useRef(null);- const dockVisible = !!dock;+ // On a step reviewed by watching (Storyboard, Make, Final render) the player is the main+ // element: full width at the top of the step with the approval beside it, not a side column.+ const sideDock = !!dock && !playerFirst;// The dock sticks just under the header, whose height depends on wrapping.useEffect(() => {@@ -242,7 +248,7 @@ export default function MusicVideoLayout({</header>{/* One column on a phone, capped at the screen width so a wide control can't push the step off screen. */}- <div className={`grid grid-cols-[minmax(0,1fr)] items-start gap-4 md:grid-cols-[13rem_minmax(0,1fr)] ${dockVisible ? 'xl:grid-cols-[13rem_minmax(0,1fr)_minmax(20rem,24rem)]' : ''}`}>+ <div className={`grid grid-cols-[minmax(0,1fr)] items-start gap-4 md:grid-cols-[13rem_minmax(0,1fr)] ${sideDock ? 'xl:grid-cols-[13rem_minmax(0,1fr)_minmax(20rem,24rem)]' : ''}`}><div className="hidden md:block md:sticky md:top-[calc(var(--mv-header-h,9rem)-0.75rem)]"><StepRail stages={progress.stages} stage={stage} onStageChange={onStageChange} needsYouStage={needsYouStage} notes={notes} /></div>@@ -257,9 +263,17 @@ export default function MusicVideoLayout({<h3 id={`mv-step-title-${stage}`} className="text-xl font-semibold">{stageEntry?.title || stageEntry?.label}</h3>{stageEntry?.doneWhen && <p className="text-sm text-port-text-muted">{stageEntry.doneWhen}</p>}</div>+ {lead}+ {playerFirst && (dock || review) && (+ <div className={`grid min-w-0 items-start gap-3 ${dock && review ? 'xl:grid-cols-[minmax(0,3fr)_minmax(20rem,2fr)]' : ''}`}>+ {dock && <div className="min-w-0">{dock}</div>}+ {review}+ </div>+ )}{children}+ {!playerFirst && review}</div>- {dockVisible ? <div className={DOCK_CLASSES}>{dock}</div> : null}+ {sideDock ? <div className={DOCK_CLASSES}>{dock}</div> : null}</div></div>);diff --git a/client/src/components/musicVideo/MusicVideoLayout.test.jsx b/client/src/components/musicVideo/MusicVideoLayout.test.jsxindex 9e13b65490..f900a0a4fb 100644--- a/client/src/components/musicVideo/MusicVideoLayout.test.jsx+++ b/client/src/components/musicVideo/MusicVideoLayout.test.jsx@@ -110,6 +110,30 @@ describe('phone layout', () => {});});+describe('player-first steps', () => {+ const renderStep = (playerFirst) => render(<MusicVideoLayout project={{ id: 'example-project', name: 'Example Project' }} stage="board"+ onStageChange={() => {}} progress={progressFor('board')} spend={{ spentUsd: 0 }} playerFirst={playerFirst}+ lead={<section aria-label="Checklist">checklist</section>}+ review={<section aria-label="Approval">approve</section>}+ dock={<aside aria-label="Preview">preview</aside>}>+ <section aria-label="Work">work</section>+ </MusicVideoLayout>);++ it('puts the player and the approval side by side at the top of a step reviewed by watching', () => {+ renderStep(true);+ const panel = screen.getByRole('tabpanel');+ const order = ['Checklist', 'Preview', 'Approval', 'Work'].map((name) => within(panel).getByRole(name === 'Preview' ? 'complementary' : 'region', { name }));+ for (let i = 1; i < order.length; i += 1) expect(order[i - 1].compareDocumentPosition(order[i]) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();+ });++ it('docks the player at the side and closes the step with the approval otherwise', () => {+ renderStep(false);+ const panel = screen.getByRole('tabpanel');+ expect(within(panel).queryByRole('complementary', { name: 'Preview' })).toBeNull();+ expect(panel.lastElementChild).toHaveAccessibleName('Approval');+ });+});+describe('stepState', () => {it('uses one word per state, flagging a changed approval and the step that waits on the director', () => {const at = (entry, needsYouStage = null) => stepState({ id: 'board', ...entry }, { needsYouStage }).word;diff --git a/client/src/components/musicVideo/PreviewDock.jsx b/client/src/components/musicVideo/PreviewDock.jsxindex 86241c62bf..7e685f3858 100644--- a/client/src/components/musicVideo/PreviewDock.jsx+++ b/client/src/components/musicVideo/PreviewDock.jsx@@ -11,17 +11,18 @@ function VideoPreview({ source, seekRequest, collapsed }) {const videoRef = useRef(null);const pending = useRef(null);const applied = useRef(null);- const seekTo = (t) => {+ const seekTo = (t, play = false) => {const video = videoRef.current;if (!video) return;if (video.readyState >= 1) video.currentTime = Math.min(t, video.duration || t);else pending.current = t;+ if (play) video.play?.()?.catch?.(() => {});};useEffect(() => {if (!seekRequest || applied.current === seekRequest.n) return;applied.current = seekRequest.n;const t = seekRequest.t - source.startSec;- if (t >= 0 && (source.endSec == null || t <= source.endSec - source.startSec)) seekTo(t);+ if (t >= 0 && (source.endSec == null || t <= source.endSec - source.startSec)) seekTo(t, !!seekRequest.play);}, [seekRequest, source.startSec, source.endSec]);return (<videodiff --git a/client/src/components/musicVideo/ProductionReviewContext.jsx b/client/src/components/musicVideo/ProductionReviewContext.jsxindex 6e8ea53786..144a81e740 100644--- a/client/src/components/musicVideo/ProductionReviewContext.jsx+++ b/client/src/components/musicVideo/ProductionReviewContext.jsx@@ -1,8 +1,18 @@+import { ChevronRight, Play } from 'lucide-react';import DevArtifactPreview from './DevArtifactPreview.jsx';import { formatTimecode, formatCount } from '../../utils/formatters.js';-/** The saved evidence immediately preceding a revision-bound decision. */-export default function ProductionReviewContext({ stage, project, basis, approved, onOpenArtifact, onArtReady }) {+const FOLD = 'min-h-[44px] cursor-pointer py-2 text-sm';++/**+ * The saved evidence immediately preceding a revision-bound decision. People+ * review visually — the visual guide for art, the player for the storyboard —+ * so the written recipe (art direction text, each shot's action, staging,+ * camera, transition and lyric anchors) is a deep dive behind a fold, one shot+ * at a time, never a wall of text above the Approve button. `onSeek(startSec)`+ * plays the docked preview from a shot.+ */+export default function ProductionReviewContext({ stage, project, basis, approved, onOpenArtifact, onArtReady, onSeek = null }) {const draft = project.productionReview?.draft || {};const guide = project.devArtifacts?.find(a => a.id === draft.guideArtifactId && !a.deleted);const document = draft.storyboardSource === 'document';@@ -16,24 +26,45 @@ export default function ProductionReviewContext({ stage, project, basis, approve<DevArtifactPreview key={`${guide.id}:${guide.version}`} projectId={project.id} artifact={guide} onReady={onArtReady} /><button type="button" className="min-h-[44px] text-sm text-port-accent" onClick={() => onOpenArtifact(guide.id)}>Open guide and version history</button></figure> : <p role="status">No current visual guide selected. Choose a Development file in the planning editor below.</p>}- <dl className="space-y-2 text-sm">{[['Cast', draft.cast], ['Environments', draft.environments], ['Visual language', draft.visualLanguage], ['Motion and energy', draft.motionLanguage]].map(([label, value]) => <div key={label}><dt className="font-medium">{label}</dt><dd className="whitespace-pre-wrap break-words">{value || 'Missing — complete this in the planning editor.'}</dd></div>)}</dl>+ <details>+ <summary className={FOLD}>Written art direction</summary>+ <dl className="space-y-2 text-sm">{[['Cast', draft.cast], ['Environments', draft.environments], ['Visual language', draft.visualLanguage], ['Motion and energy', draft.motionLanguage]].map(([label, value]) => <div key={label}><dt className="font-medium">{label}</dt><dd className="whitespace-pre-wrap break-words">{value || 'Missing — complete this in the planning editor.'}</dd></div>)}</dl>+ </details></> : <>- <p className="text-sm font-medium">{formatCount(shots.length)} {document ? 'document shots' : 'storyboard shots'} · {document ? `Document ${project.composition?.document?.directory?.split('/').at(-1) || 'not selected'}` : 'Current Board timing'}</p>+ <p className="text-sm">+ Watch the storyboard in the player, then approve. {formatCount(shots.length)} {document ? 'document shots' : 'storyboard shots'}+ {document ? ` · document ${project.composition?.document?.directory?.split('/').at(-1) || 'not selected'}` : ' · current Board timing'}.+ </p>{!shots.length && <p role="status">No storyboard shots to review. Import the current document’s shot manifest or prepare Board scenes below.</p>}- <ol className="max-h-[60vh] overflow-y-auto space-y-3 rounded border border-port-border p-2" aria-label="Current storyboard shots" tabIndex={0}>+ {shots.length > 0 && <ol className="max-h-[45vh] divide-y divide-port-border overflow-y-auto rounded border border-port-border" aria-label="Current storyboard shots" tabIndex={0}>{shots.map((shot, index) => {const scene = document ? shot : project.scenes?.find(s => s.sceneId === shot.sceneId);- return <li key={shot.id || shot.sceneId || index} className="border-b border-port-border pb-3 text-sm">- <p className="font-medium">{index + 1}. {scene?.label || shot.label || 'Shot'} · {Number.isFinite(scene?.startSec) ? `${formatTimecode(scene.startSec)}–${formatTimecode(scene.endSec)}` : 'Timing missing'}</p>- <p className="whitespace-pre-wrap break-words">{shot.action || 'Action missing'}</p>- <dl className="text-xs text-port-text-muted space-y-1">{['staging', 'camera', 'transition'].map(key => <div key={key}><dt className="capitalize font-medium">{key}</dt><dd className="whitespace-pre-wrap break-words">{shot[key] || 'Missing'}</dd></div>)}</dl>- <p className="text-xs">Lyric anchors: {(shot.lyricCueIds || []).map(id => project.lyricCues?.find(c => c.id === id)?.text || id).join(' · ') || (draft.lyricsMode === 'instrumental' ? 'Instrumental' : 'None selected')}</p>+ const timed = Number.isFinite(scene?.startSec);+ return <li key={shot.id || shot.sceneId || index} className="flex min-w-0 items-start gap-1 px-2 text-sm">+ {onSeek && timed+ ? <button type="button" onClick={() => onSeek(scene.startSec)} aria-label={`Play shot ${index + 1} in the preview`}+ className="mt-1.5 flex h-8 w-8 shrink-0 items-center justify-center rounded text-port-accent hover:bg-port-border/40"><Play size={14} aria-hidden="true" /></button>+ : <span className="w-8 shrink-0" />}+ <details className="group min-w-0 flex-1">+ {/* A flex summary drops the native marker, so the row draws its own chevron. */}+ <summary className={`${FOLD} flex items-center gap-2 marker:content-none [&::-webkit-details-marker]:hidden`}>+ <ChevronRight size={14} aria-hidden="true" className="shrink-0 text-port-text-muted transition-transform group-open:rotate-90" />+ <span className="w-12 shrink-0 font-mono text-xs text-port-text-muted">{timed ? formatTimecode(scene.startSec).replace(/\.\d+$/, '') : '—'}</span>+ <span className="min-w-0 truncate">{scene?.label || shot.label || shot.id || `Shot ${index + 1}`}</span>+ </summary>+ <div className="space-y-1 pb-2">+ <p className="whitespace-pre-wrap break-words">{shot.action || 'Action missing'}</p>+ <dl className="text-xs text-port-text-muted space-y-1">{['staging', 'camera', 'transition'].map(key => <div key={key}><dt className="capitalize font-medium">{key}</dt><dd className="whitespace-pre-wrap break-words">{shot[key] || 'Missing'}</dd></div>)}</dl>+ <p className="text-xs">Lyric anchors: {(shot.lyricCueIds || []).map(id => project.lyricCues?.find(c => c.id === id)?.text || id).join(' · ') || (draft.lyricsMode === 'instrumental' ? 'Instrumental' : 'None selected')}</p>+ {timed && <p className="text-xs text-port-text-muted">{formatTimecode(scene.startSec)}–{formatTimecode(scene.endSec)}</p>}+ </div>+ </details></li>;})}- </ol>- {sheets.length > 0 && <details><summary className="min-h-[44px] cursor-pointer py-2 text-sm">Storyboard reference sheets ({formatCount(sheets.length)})</summary>+ </ol>}+ {sheets.length > 0 && <details><summary className={FOLD}>Storyboard reference sheets ({formatCount(sheets.length)})</summary><p className="text-xs text-port-text-muted">Reference files may predate the current document. Compare them with the exact saved shots above.</p>- {sheets.map(sheet => <details key={sheet.id}><summary className="min-h-[44px] cursor-pointer py-2 text-sm">{sheet.title} · v{sheet.version || 1}</summary><DevArtifactPreview projectId={project.id} artifact={sheet} /></details>)}+ {sheets.map(sheet => <details key={sheet.id}><summary className={FOLD}>{sheet.title} · v{sheet.version || 1}</summary><DevArtifactPreview projectId={project.id} artifact={sheet} /></details>)}</details>}</>}</section>;diff --git a/client/src/components/musicVideo/ProductionReviewContext.test.jsx b/client/src/components/musicVideo/ProductionReviewContext.test.jsxnew file mode 100644index 0000000000..dda0db884b--- /dev/null+++ b/client/src/components/musicVideo/ProductionReviewContext.test.jsx@@ -0,0 +1,42 @@+import { describe, expect, it, vi } from 'vitest';+import { fireEvent, render, screen, within } from '@testing-library/react';+vi.mock('./DevArtifactPreview.jsx', () => ({ default: () => <div>guide preview</div> }));+import ProductionReviewContext from './ProductionReviewContext.jsx';++const project = {+ id: 'p', version: 2, composition: { mode: 'document', document: { directory: 'docs/example-doc' } },+ lyricCues: [{ id: 'c1', text: 'Example line' }],+ devArtifacts: [{ id: 'g', title: 'Example guide', version: 1 }],+ productionReview: { draft: {+ storyboardSource: 'document', guideArtifactId: 'g', cast: 'Example cast text',+ storyboard: [+ { id: 's1', label: 'Opening', startSec: 0, endSec: 12, action: 'Lights come up', staging: 'Wide', camera: 'Static', transition: 'Cut', lyricCueIds: ['c1'] },+ { id: 's2', label: 'Chorus', startSec: 72, endSec: 95, action: 'Everything moves', staging: '', camera: '', transition: '' },+ ],+ } },+};++describe('ProductionReviewContext', () => {+ it('lists each storyboard shot as one row with a play button, keeping its recipe folded', () => {+ const onSeek = vi.fn();+ render(<ProductionReviewContext stage="storyboard" project={project} onSeek={onSeek} />);+ expect(screen.getByText(/Watch the storyboard in the player, then approve/)).toBeTruthy();+ const list = screen.getByRole('list', { name: 'Current storyboard shots' });+ const rows = within(list).getAllByRole('listitem');+ expect(rows).toHaveLength(2);+ // The recipe sits inside each shot's closed fold, not on the page.+ const fold = screen.getByText('Lights come up').closest('details');+ expect(fold.open).toBe(false);+ // The flex summary draws its own disclosure chevron.+ expect(fold.querySelector('summary svg')).toBeTruthy();+ expect(within(rows[0]).getByText('Opening')).toBeTruthy();+ fireEvent.click(screen.getByRole('button', { name: 'Play shot 2 in the preview' }));+ expect(onSeek).toHaveBeenCalledWith(72);+ });++ it('shows the visual guide for art and folds the written direction', () => {+ render(<ProductionReviewContext stage="art" project={project} onOpenArtifact={vi.fn()} />);+ expect(screen.getByText('guide preview')).toBeTruthy();+ expect(screen.getByText('Example cast text').closest('details').open).toBe(false);+ });+});diff --git a/client/src/components/musicVideo/ProductionReviewPanel.jsx b/client/src/components/musicVideo/ProductionReviewPanel.jsxindex 4e61c65254..eb8566a0b6 100644--- a/client/src/components/musicVideo/ProductionReviewPanel.jsx+++ b/client/src/components/musicVideo/ProductionReviewPanel.jsx@@ -31,10 +31,11 @@ function ApprovalBox({ id, label, approved, children }) {* the page so unsaved edits survive a step switch; `onNavigate(step, anchor)`* jumps steps.*/-export default function ProductionReviewPanel({ project, review, onOpenArtifact, stage, planning = null, onNavigate = null }) {+export default function ProductionReviewPanel({ project, review, onOpenArtifact, stage, planning = null, onNavigate = null, onSeek = null }) {const showArt = stage === 'art';const showBoard = stage === 'storyboard';- const fieldId = key => `mv-review-${project.id}-${key}`;+ // Scoped by stage too, so two step panels mounted together never share a field id.+ const fieldId = key => `mv-review-${project.id}-${stage}-${key}`;const saved = project.productionReview?.draft || EMPTY;const [visibleArt, setVisibleArt] = useState(null);const [proofMedia, setProofMedia] = useState(null);@@ -154,12 +155,12 @@ export default function ProductionReviewPanel({ project, review, onOpenArtifact,{excerpt && <p className="text-xs text-port-text-muted break-words">{excerpt.filename || excerpt.status} · {project.productionReview?.proof?.basis === ready?.basis.proof ? 'Current source revision' : 'Source changed — render a new proof'}</p>}{excerpt?.status === 'error' && excerpt.error && <p role="alert" className="text-sm text-port-error break-words">{excerpt.error}</p>}- <p className="text-sm">Finish the composition above (typography, grade, render style), then render a 10–45 second chorus with its entry and exit. Watch with sound at normal speed and compare the chosen energy target and timed choreography below against the actual subject, props, camera, typography and transitions. Check accents against beat and lyric anchors, readable holds and repeated-chorus escalation. A strong static frame does not prove the motion works.</p>- <section aria-label="Saved choreography for proof comparison" className="rounded border border-port-border bg-port-bg p-3">- <h4 className="text-sm font-medium">Saved energy target and timed choreography</h4>+ <p className="text-sm">Render a 10–45 second chorus over the finished composition and watch it with sound at normal speed.</p>+ <details aria-label="Saved choreography for proof comparison" className="rounded border border-port-border bg-port-bg p-3">+ <summary className="min-h-[44px] cursor-pointer text-sm font-medium">Saved energy target and timed choreography</summary><p className="mt-1 whitespace-pre-wrap text-sm">{saved.motionLanguage || 'Save an energy target and timed choreography in the planning editor before judging the proof.'}</p><p className="mt-2 text-xs text-port-text-muted">Compare playback with this saved plan. If the chosen energy or actions are missing, record revision feedback with a time range before approving.</p>- </section>+ </details><div id="mv-review-render" tabIndex={-1} style={{ scrollMarginTop: 'calc(var(--mv-header-h, 9rem) + 1rem)' }} className="flex flex-wrap items-end gap-2"><label htmlFor={fieldId('proof-start')} className="text-sm">Proof start (seconds)<input id={fieldId('proof-start')} type="number" min="0" step="0.01" value={startSec} onChange={e => setStartSec(Number(e.target.value))} className={fieldClass} /></label><label htmlFor={fieldId('proof-end')} className="text-sm">Proof end (seconds)<input id={fieldId('proof-end')} type="number" min="0" step="0.01" value={endSec} onChange={e => setEndSec(Number(e.target.value))} className={fieldClass} /></label>@@ -224,7 +225,7 @@ export default function ProductionReviewPanel({ project, review, onOpenArtifact,{review.error && <p role="alert" className="text-port-error">{review.error}</p>}<ApprovalBox id={`mv-review-${key}`} label={label} approved={!!ready?.[key].approved}><div id={fieldId(`${key}-prerequisites`)}>{(ready?.[key].problems || []).map(problem => <p key={problem} className="mt-1 text-xs text-port-text-muted">{problem}</p>)}</div>- {key === 'proof' ? proofContent : <ProductionReviewContext stage={key} project={project} basis={ready?.basis[key]} approved={ready?.[key].approved} onOpenArtifact={onOpenArtifact} onArtReady={available => setVisibleArt(available ? artIdentity : null)} />}+ {key === 'proof' ? proofContent : <ProductionReviewContext stage={key} project={project} basis={ready?.basis[key]} approved={ready?.[key].approved} onOpenArtifact={onOpenArtifact} onArtReady={available => setVisibleArt(available ? artIdentity : null)} onSeek={onSeek} />}<p id={fieldId(`${key}-approval-help`)} role="status" className="mt-2 text-sm text-port-text-muted">{approvalHelp(key)}</p><button type="button" className={`${buttonClass} mt-2`} onClick={() => approve(key)}aria-describedby={`${fieldId(`${key}-prerequisites`)} ${fieldId(`${key}-approval-help`)}${key === 'proof' && !machineReview ? ` ${fieldId('playback-attestation')}` : ''}`}diff --git a/client/src/components/musicVideo/ProductionReviewPanel.test.jsx b/client/src/components/musicVideo/ProductionReviewPanel.test.jsxindex 09a269fdf0..d3958f3e47 100644--- a/client/src/components/musicVideo/ProductionReviewPanel.test.jsx+++ b/client/src/components/musicVideo/ProductionReviewPanel.test.jsx@@ -307,7 +307,7 @@ describe('Production proof playback evidence', () => {expect(screen.getByRole('button', { name: 'Approve art direction' }).disabled).toBe(true);view.rerender(<Steps stage="proof" />);fireEvent.loadedData(screen.getByLabelText('Animated proof with master audio'));- expect(screen.getByText('Save your planning edits before approving this revision.', { selector: '#mv-review-example-project-proof-approval-help' })).toBeTruthy();+ expect(screen.getByText('Save your planning edits before approving this revision.', { selector: '#mv-review-example-project-proof-proof-approval-help' })).toBeTruthy();expect(screen.getByLabelText('Timecoded playback notes').disabled).toBe(true);expect(screen.getByRole('button', { name: proofAction }).disabled).toBe(true);expect(review.approve).not.toHaveBeenCalled();diff --git a/client/src/components/musicVideo/StoryboardAnimatic.jsx b/client/src/components/musicVideo/StoryboardAnimatic.jsxindex fe11c5e89d..3494bf7052 100644--- a/client/src/components/musicVideo/StoryboardAnimatic.jsx+++ b/client/src/components/musicVideo/StoryboardAnimatic.jsx@@ -30,6 +30,7 @@ export default function StoryboardAnimatic({ project, audioUrl, seekRequest, colapplied.current = seekRequest.n;audioRef.current.currentTime = seekRequest.t;setTime(seekRequest.t);+ if (seekRequest.play) audioRef.current.play?.()?.catch?.(() => {});}, [seekRequest]);const shot = shotAt(scenes, time);const timed = timedShots(scenes);diff --git a/client/src/components/musicVideo/StoryboardAnimatic.play.test.jsx b/client/src/components/musicVideo/StoryboardAnimatic.play.test.jsxnew file mode 100644index 0000000000..7c27d018a4--- /dev/null+++ b/client/src/components/musicVideo/StoryboardAnimatic.play.test.jsx@@ -0,0 +1,15 @@+import { describe, expect, it, vi } from 'vitest';+import { render } from '@testing-library/react';+import StoryboardAnimatic from './StoryboardAnimatic.jsx';++describe('StoryboardAnimatic seek requests', () => {+ it('plays from a shot when the request asks to play, and only cues it otherwise', () => {+ const play = vi.spyOn(window.HTMLMediaElement.prototype, 'play').mockImplementation(() => Promise.resolve());+ const project = { id: 'p', scenes: [{ sceneId: 'a', label: 'Opening', startSec: 0 }, { sceneId: 'b', label: 'Chorus', startSec: 10 }] };+ const { rerender } = render(<StoryboardAnimatic project={project} audioUrl="/song.mp3" seekRequest={{ t: 10, n: 1 }} />);+ expect(play).not.toHaveBeenCalled();+ rerender(<StoryboardAnimatic project={project} audioUrl="/song.mp3" seekRequest={{ t: 10, n: 2, play: true }} />);+ expect(play).toHaveBeenCalledTimes(1);+ play.mockRestore();+ });+});diff --git a/client/src/lib/musicVideoStages.js b/client/src/lib/musicVideoStages.jsindex 88fb43c0be..0ca8e0fb6e 100644--- a/client/src/lib/musicVideoStages.js+++ b/client/src/lib/musicVideoStages.js@@ -135,7 +135,9 @@ export function boardJobEstimate(project) {/*** Everything the docked preview can play, in the order it picks a default:* the final render (its resolved `finalVideoSrc`), the composition document,- * then each finished draft excerpt, newest first. While editing the+ * then each finished draft excerpt, newest first (`draftsFirst`, on Final+ * render, puts the drafts before the composition; `storyboardFirst`, on+ * Storyboard, puts the live document, then the animatic, first). While editing the* composition (`liveFirst`, the Compose stage) the live document leads so an* old final render is not what the user sees by default. A final render whose* inputs changed is labelled out of date. Last comes the storyboard animatic —@@ -143,7 +145,7 @@ export function boardJobEstimate(project) {* shots always has something to watch. Each entry has a stable `id` (the* `?play=` value) and a `label` for the source picker.*/-export function listPreviewSources(project, { finalVideoSrc = null, liveFirst = false } = {}) {+export function listPreviewSources(project, { finalVideoSrc = null, liveFirst = false, draftsFirst = false, storyboardFirst = false } = {}) {const sources = [];const final = project?.renderHistoryId && finalVideoSrc? { id: 'final', kind: 'video', label: project.renderDependencyState?.status === 'stale' ? 'Final render (out of date)' : 'Final render', src: finalVideoSrc, startSec: 0, endSec: null }@@ -151,17 +153,20 @@ export function listPreviewSources(project, { finalVideoSrc = null, liveFirst =const live = project?.composition?.mode === 'document' && project.composition.document? { id: 'document', kind: 'document', label: 'Composition (live)' }: null;- sources.push(...(liveFirst ? [live, final] : [final, live]).filter(Boolean));- const excerpts = (project?.excerpts || []).filter((e) => e.status === 'complete' && e.filename).reverse();- for (const excerpt of excerpts) {- sources.push({- id: `excerpt:${excerpt.id}`, kind: 'video', src: `/data/videos/${excerpt.filename}`,- startSec: excerpt.startSec, endSec: excerpt.endSec,- label: `${excerpt.dependencyState?.status === 'stale' ? 'Older draft' : 'Draft'} ${formatTimecode(excerpt.startSec)}–${formatTimecode(excerpt.endSec)} · ${excerpt.id.slice(-6)}`,- });- }+ const drafts = (project?.excerpts || []).filter((e) => e.status === 'complete' && e.filename).reverse().map((excerpt) => ({+ id: `excerpt:${excerpt.id}`, kind: 'video', src: `/data/videos/${excerpt.filename}`,+ startSec: excerpt.startSec, endSec: excerpt.endSec,+ label: `${excerpt.dependencyState?.status === 'stale' ? 'Older draft' : 'Draft'} ${formatTimecode(excerpt.startSec)}–${formatTimecode(excerpt.endSec)} · ${excerpt.id.slice(-6)}`,+ }));+ // Final render is reviewed by watching its drafts until the final render exists.+ const ordered = liveFirst || storyboardFirst ? [live, final, ...drafts] : draftsFirst ? [final, ...drafts, live] : [final, live, ...drafts];+ sources.push(...ordered.filter(Boolean));if (projectHasAudio(project) && (project?.scenes || []).length > 0) {- sources.push({ id: 'animatic', kind: 'animatic', label: 'Storyboard animatic' });+ const animatic = { id: 'animatic', kind: 'animatic', label: 'Storyboard animatic' };+ // On Storyboard the storyboard itself leads (the live document, else the animatic): a draft+ // clip covers only its own range, so most shots could not be played from it.+ if (storyboardFirst) sources.splice(live ? 1 : 0, 0, animatic);+ else sources.push(animatic);}return sources;}@@ -584,11 +589,15 @@ export function stageChecklist(stageId, project, readiness = project?.production}case 'board': {const planned = scenes.length > 0 || (draft.storyboard || []).length > 0;+ const problems = storyboardProblemItems(readiness);+ const storyboardApproval = approval('storyboard', 'Timed storyboard', 'Ready for your review below.');return [{ 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 below.'),+ ...problems,+ // The problems are listed above, one row per group; the approval row need not repeat the first.+ // A stale approval keeps its "changed since" text: it is the only place the checklist names what changed.+ problems.length && !storyboardApproval.stale ? { ...storyboardApproval, detail: 'Approve once the items above are done.' } : storyboardApproval,];}case 'produce': {diff --git a/client/src/lib/musicVideoStages.test.js b/client/src/lib/musicVideoStages.test.jsindex df4bb829ae..e010aa25be 100644--- a/client/src/lib/musicVideoStages.test.js+++ b/client/src/lib/musicVideoStages.test.js@@ -451,6 +451,11 @@ describe('stageChecklist', () => {const items = stageChecklist('board', castProject({ scenes: [scene()] }), readiness);expect(items.find((i) => i.id === 'board-manifest')).toMatchObject({ label: 'Document shot manifest', action: { label: 'Import the shot manifest', anchor: 'mv-review-planning' } });expect(items.some((i) => i.id === 'board-timing')).toBe(false);+ // The approval row points at the items above instead of repeating the first problem.+ expect(items.at(-1)).toMatchObject({ id: 'approve-storyboard', detail: 'Approve once the items above are done.' });+ // A stale approval keeps naming what changed, even with an art problem listed above it.+ const stale = { ...readiness, storyboard: { approved: false, problems: ['Review and approve the current art direction first.'], stale: { changedFields: ['art direction', 'cast'] } } };+ expect(stageChecklist('board', castProject({ scenes: [scene()] }), stale).at(-1).detail).toMatch(/changed since: art direction, cast/);});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 };@@ -552,6 +557,25 @@ describe('stepNotes', () => {});});+describe('preview source order on Storyboard', () => {+ it('leads with the storyboard, the live document or else the animatic, ahead of draft clips', () => {+ const drafts = [{ id: 'aaaaaa', status: 'complete', filename: 'a.mp4', startSec: 72, endSec: 95 }];+ const board = { trackId: 't1', scenes: [scene()], excerpts: drafts };+ expect(listPreviewSources(board).map((s) => s.id)).toEqual(['excerpt:aaaaaa', 'animatic']);+ expect(listPreviewSources(board, { storyboardFirst: true }).map((s) => s.id)).toEqual(['animatic', 'excerpt:aaaaaa']);+ const doc = { ...board, composition: { mode: 'document', document: { directory: 'd' } } };+ expect(listPreviewSources(doc, { storyboardFirst: true }).map((s) => s.id)).toEqual(['document', 'animatic', 'excerpt:aaaaaa']);+ });+});++describe('preview source order on Final render', () => {+ it('puts the drafts ahead of the live composition until a final render exists', () => {+ const project = { composition: { mode: 'document', document: { directory: 'd' } }, excerpts: [{ id: 'aaaaaa', status: 'complete', filename: 'a.mp4', startSec: 0, endSec: 5 }] };+ expect(listPreviewSources(project).map((s) => s.id)).toEqual(['document', 'excerpt:aaaaaa']);+ expect(listPreviewSources(project, { draftsFirst: true }).map((s) => s.id)).toEqual(['excerpt:aaaaaa', 'document']);+ });+});+describe('storyboard animatic preview source', () => {it('is offered last once the project has a track and shots', () => {expect(listPreviewSources({ trackId: 't1', scenes: [scene()] }).map((s) => s.id)).toEqual(['animatic']);diff --git a/client/src/pages/MusicVideo.jsx b/client/src/pages/MusicVideo.jsxindex 25ca32a438..df43399644 100644--- a/client/src/pages/MusicVideo.jsx+++ b/client/src/pages/MusicVideo.jsx@@ -112,6 +112,8 @@ const EMPTY_PRODUCTION_DRAFT = { cast: '', environments: '', visualLanguage: '',lyricsMode: 'vocal', timingStatus: 'provisional', timingNotes: '', storyboard: [] };// The step each production approval closes (#10151); it sits at the bottom of that step.const APPROVAL_STAGE_BY_TAB = { 'cast-sets': 'art', board: 'storyboard', produce: 'proof' };+// Steps reviewed by watching: the player leads them, with the approval beside it.+const PLAYER_FIRST_STAGES = new Set(['board', 'produce', 'review']);const STAGE_VIEWS = {setup: SetupStage, 'cast-sets': CastSetsStage, board: BoardStage, produce: ProduceStage, review: ReviewStage, publish: PublishStage,};@@ -970,14 +972,16 @@ export default function MusicVideo() {return next;}, { replace: !!tab && !!settingsTab });- // The docked preview: scene cards seek it; on a phone it is a mini-player- // that starts collapsed. Both reset with the project.+ // The preview: scene cards and storyboard rows seek it. Steps reviewed by+ // watching put it first (open); elsewhere, below xl, it is a folded row until+ // the director opens it. `dockCollapsed` is null until they toggle it.const [seekRequest, setSeekRequest] = useState(null);- const [dockCollapsed, setDockCollapsed] = useState(true);- useEffect(() => { setSeekRequest(null); setDockCollapsed(true); }, [selectedId]);- const seekToScene = (scene) => {+ const [dockCollapsed, setDockCollapsed] = useState(null);+ useEffect(() => { setSeekRequest(null); setDockCollapsed(null); }, [selectedId]);+ // `play` starts playback from there (a storyboard row); a scene card only cues the shot.+ const seekToScene = (scene, { play = false } = {}) => {if (typeof scene?.startSec !== 'number') return;- setSeekRequest((prev) => ({ t: scene.startSec, n: (prev?.n || 0) + 1 }));+ setSeekRequest((prev) => ({ t: scene.startSec, n: (prev?.n || 0) + 1, play }));};const audioFilename = projectAudioFilename(selected);@@ -1147,13 +1151,14 @@ export default function MusicVideo() {seekToScene,} : null;const StageView = STAGE_VIEWS[activeStage];+ const playerFirst = PLAYER_FIRST_STAGES.has(activeStage);const projectStatus = !selected ? null : statusKnown && productionReview.readiness? describeProjectStatus(selected, { progress, nextAction: productionNextAction, reviewingDraft, reviewDraftState }): statusKnown? { headline: `Status unavailable: ${productionReview.readinessError}`, tone: 'warn', needsYouStage: null }: { headline: 'Loading status…', tone: 'muted', needsYouStage: null };- const previewSources = selected ? listPreviewSources(selected, { finalVideoSrc: finalVideo.src, liveFirst: activeStage === 'produce' }) : [];+ const previewSources = selected ? listPreviewSources(selected, { finalVideoSrc: finalVideo.src, liveFirst: activeStage === 'produce', draftsFirst: activeStage === 'review', storyboardFirst: activeStage === 'board' }) : [];return (// Below md the whole page scrolls (title bar and project header with it), so the step gets the screen.@@ -1454,6 +1459,27 @@ export default function MusicVideo() {notes={stepNotes(selected, productionReview.readiness, publish)}autopilot={autopilotStatus(selected)}onOpenSettings={setSettingsTab}+ playerFirst={playerFirst}+ lead={(+ <StageChecklist+ items={stageChecklist(activeStage, selected, productionReview.readiness, publish)}+ onAction={(action) => goToStage(action.stage || activeStage, action.anchor, action.params)}+ onRevert={productionReview.revert}+ headerAnchor={nextAction?.kind === 'goto' ? nextAction.anchor : null}+ />+ )}+ review={APPROVAL_STAGE_BY_TAB[activeStage] ? (+ <ProductionReviewPanel+ key={`${selected.id}-${activeStage}`}+ project={selected}+ review={productionReview}+ onOpenArtifact={openArtifact}+ stage={APPROVAL_STAGE_BY_TAB[activeStage]}+ planning={planningDraft}+ onNavigate={goToStage}+ onSeek={(startSec) => seekToScene({ startSec }, { play: true })}+ />+ ) : null}attention={(<NeedsAttentionBanneritems={attentionItems}@@ -1476,29 +1502,12 @@ export default function MusicVideo() {sources={previewSources}audioUrl={audioUrl}seekRequest={seekRequest}- collapsed={dockCollapsed}- onToggleCollapsed={() => setDockCollapsed((c) => !c)}+ collapsed={dockCollapsed ?? !playerFirst}+ onToggleCollapsed={() => setDockCollapsed(!(dockCollapsed ?? !playerFirst))}/>)}>- <StageChecklist- items={stageChecklist(activeStage, selected, productionReview.readiness, publish)}- onAction={(action) => goToStage(action.stage || activeStage, action.anchor, action.params)}- onRevert={productionReview.revert}- headerAnchor={nextAction?.kind === 'goto' ? nextAction.anchor : null}- /><StageView key={selected.id} board={board} />- {APPROVAL_STAGE_BY_TAB[activeStage] && (- <ProductionReviewPanel- key={`${selected.id}-${activeStage}`}- project={selected}- review={productionReview}- onOpenArtifact={openArtifact}- stage={APPROVAL_STAGE_BY_TAB[activeStage]}- planning={planningDraft}- onNavigate={goToStage}- />- )}</MusicVideoLayout>)}</div>diff --git a/client/src/pages/MusicVideo.test.jsx b/client/src/pages/MusicVideo.test.jsxindex 3793ef996f..9be4a02812 100644--- a/client/src/pages/MusicVideo.test.jsx+++ b/client/src/pages/MusicVideo.test.jsx@@ -2526,7 +2526,7 @@ describe('MusicVideo stage tabs (#9243)', () => {expect(dialog.contains(document.getElementById('mv-auto-edit'))).toBe(true);});- it('puts the selected step before its own approval, keeps the run in Project settings, and keeps unsaved planning edits across steps', async () => {+ it('leads Storyboard and Make with the player and their approval, closes Look with its approval, keeps the run in Project settings and unsaved planning edits across steps', async () => {listMusicVideoProjects.mockResolvedValue([{ ...PROJECT_WITH_CLIP,autonomousRun: { status: 'needs-human', stage: 'video', output: {}, brief: {} },}]);@@ -2547,9 +2547,16 @@ describe('MusicVideo stage tabs (#9243)', () => {const title = selectedTab().textContent.split(',')[0];expect(within(panel).getByRole('heading', { level: 3, name: title })).toBeInTheDocument();expect(panel).toHaveAccessibleName(title);- // The step's own work comes first; the one approval that closes it sits at the bottom.const stageReview = within(panel).getByRole('region', { name: 'Production review' });- expect(panel.lastElementChild).toBe(stageReview);+ if (stage === 'cast-sets') {+ // Look is reviewed through its visual guide: the step's work comes first and the approval closes it.+ expect(panel.lastElementChild).toBe(stageReview);+ } else {+ // Storyboard and Make are reviewed by watching: the player leads, the approval beside it, then the work.+ const player = within(panel).getByRole('complementary', { name: 'Preview' });+ expect(player.compareDocumentPosition(stageReview) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();+ expect(stageReview.parentElement).toBe(player.parentElement.parentElement);+ }expect(within(stageReview).getAllByRole('region', { name: /^Approve: / })).toHaveLength(1);expect(within(stageReview).getByRole('region', { name: `Approve: ${approvals[stage]}` })).toBeInTheDocument();// The run is no longer a shared panel under every step.@@ -2769,13 +2776,16 @@ describe('MusicVideo stage tabs (#9243)', () => {{ id: 'mve-2', startSec: 10, endSec: 20, status: 'complete', filename: 'excerpt-new.mp4', notes: [] },],};- await openProject(project, 'board');+ // Final render plays the newest draft; Storyboard leads with the storyboard animatic instead.+ await openProject(project, 'review');const player = await screen.findByLabelText('Draft excerpt preview');expect(player.getAttribute('src')).toBe('/data/videos/excerpt-new.mp4');expect(screen.queryByTitle('Composition document preview')).toBeNull();// Every finished draft stays reachable from the dock's source picker.fireEvent.change(screen.getByLabelText('Preview source'), { target: { value: 'excerpt:mve-1' } });await waitFor(() => expect(screen.getByLabelText('Draft excerpt preview').getAttribute('src')).toBe('/data/videos/excerpt-old.mp4'));+ await openStage('board', false);+ await waitFor(() => expect(screen.getByLabelText('Preview source')).toHaveValue('excerpt:mve-1'));});it('plays the final render first and keeps a picked draft across stage tabs', async () => {diff --git a/server/routes/musicVideoRichAuthoring.browser.test.js b/server/routes/musicVideoRichAuthoring.browser.test.jsindex 874e00419f..4284eda95d 100644--- a/server/routes/musicVideoRichAuthoring.browser.test.js+++ b/server/routes/musicVideoRichAuthoring.browser.test.js@@ -184,6 +184,14 @@ describe.skipIf(!canRun)('rich document authoring in a real browser (Chrome, ffmexpect(await candidate.json()).toMatchObject({ candidate: { directory: staged }, source: { directory: staged }, stale: false, providerId: 'stub-provider' });await traced('the candidate response did not render a reviewable candidate', () => page.getByRole('button', { name: 'Accept reviewed version' }).waitFor());expect(author.prompt).toContain(JSON.stringify(choreography));+ // The generate response replaces the project, which refetches the candidate and the review readiness.+ // Clicking Accept while those are still in flight was seen to send no accept request under load, so+ // the click waits for the page's music-video requests to settle and the button to be enabled.+ await traced('the page did not settle after generation', async () => {+ const settleBy = Date.now() + 30000;+ while (inFlight.size && Date.now() < settleBy) await new Promise(r => setTimeout(r, 100));+ await page.waitForFunction(() => [...document.querySelectorAll('button')].some(b => b.textContent === 'Accept reviewed version' && !b.disabled));+ });const [accepted] = await Promise.all([apiResponse('POST', '/composition/document/accept'),page.getByRole('button', { name: 'Accept reviewed version' }).click(),@@ -196,7 +204,7 @@ describe.skipIf(!canRun)('rich document authoring in a real browser (Chrome, ffmawait page.locator('video').waitFor({ timeout: 120000 });await page.locator('video').evaluate(async video => { await video.play(); await new Promise(r => setTimeout(r, 400)); video.pause(); });expect(await page.locator('video').evaluate(v => v.videoWidth)).toBeGreaterThan(0);- expect(await page.getByRole('region', { name: 'Saved choreography for proof comparison' }).textContent()).toContain(choreography);+ expect(await page.locator('[aria-label="Saved choreography for proof comparison"]').textContent()).toContain(choreography);expect(await page.getByRole('button', { name: 'Approve — I reviewed this proof with audio' }).isDisabled()).toBe(true);await page.getByLabel('Playback energy compared with the saved plan').fill('The synthetic fixture demonstrates a driving chorus: the modeled subject changes pose and travels while the camera moves through the scene.');await page.getByLabel('Timecoded playback notes').fill('0:02 — subject enters the frame; 0:07 — pose and camera position differ and readable type remains clear. This is a synthetic workflow test, not artistic approval of a production video.');