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

Look step: checklist buttons do the work, approval card waits quietly

Claude307aac51df01
diff --git a/client/src/components/musicVideo/CastAndSetsCheckin.jsx b/client/src/components/musicVideo/CastAndSetsCheckin.jsx
index 1d7f075f8f..43cecb4a52 100644
--- a/client/src/components/musicVideo/CastAndSetsCheckin.jsx
+++ b/client/src/components/musicVideo/CastAndSetsCheckin.jsx
@@ -37,7 +37,7 @@ function statusLine(stage) {
* concept, style, subjects or song changed since (`stale`, from the server's
* readiness) says what changed and offers Keep approved beside Rebuild (#10141).
*/
-export default function CastAndSetsCheckin({ project, stale = null, busy, onOpenSheet, onApprove, onRegenerate, onEditDirection, onResume, onRebuild, onReconfirm, onRevert, onSkip }) {
+export default function CastAndSetsCheckin({ id, project, stale = null, busy, onOpenSheet, onApprove, onRegenerate, onEditDirection, onResume, onRebuild, onReconfirm, onRevert, onSkip }) {
const stage = project.castAndSets;
if (!stage) return null;
const working = WORKING.has(stage.status) && !stage.interrupted;
@@ -46,7 +46,7 @@ export default function CastAndSetsCheckin({ project, stale = null, busy, onOpen
const staleText = stage.status === 'approved' ? staleApprovalText(stale) : null;
const tone = stage.status === 'review' || staleText ? 'warning' : stage.status === 'approved' ? 'success' : stage.status === 'failed' ? 'error' : 'muted';
return (
- <div className={`rounded-lg border bg-port-card p-3 space-y-2 ${stage.status === 'review' ? 'border-port-warning/60' : 'border-port-border'}`} aria-label="Cast & Sets check-in">
+ <div id={id} tabIndex={-1} style={{ scrollMarginTop: 'calc(var(--mv-header-h, 9rem) + 1rem)' }} className={`rounded-lg border bg-port-card p-3 space-y-2 ${stage.status === 'review' ? 'border-port-warning/60' : 'border-port-border'}`} aria-label="Cast & Sets check-in">
<div className="flex flex-wrap items-center gap-2">
<Users size={14} className="text-port-accent shrink-0" aria-hidden="true" />
<span className="text-sm font-medium">Cast &amp; Sets check-in</span>
diff --git a/client/src/components/musicVideo/DevArtifactsPanel.jsx b/client/src/components/musicVideo/DevArtifactsPanel.jsx
index 7994bc3657..37bc2763e4 100644
--- a/client/src/components/musicVideo/DevArtifactsPanel.jsx
+++ b/client/src/components/musicVideo/DevArtifactsPanel.jsx
@@ -32,10 +32,11 @@ const GUIDE_MIME_TYPES = ['text/html', 'image/png', 'image/jpeg'];
* `kinds` narrows the list to those artifact kinds (the Look step shows
* only its own sheets); without `onUpload` the import control is left out.
* With `onUseAsGuide(artifactId)` each usable sheet or image gets a
- * "Use as visual guide" action; `guideId` marks the one already chosen.
+ * "Use as visual guide" action; `guideId` marks the one already chosen. `id`
+ * makes the panel a scroll target.
*/
export default function DevArtifactsPanel({
- project, busy, onOpen, onUpload = null, onUseAsGuide = null, guideId = null, kinds = null, title = 'Development',
+ id = undefined, project, busy, onOpen, onUpload = null, onUseAsGuide = null, guideId = null, kinds = null, title = 'Development',
emptyText = 'Check-in sheets, animatics and other working files',
}) {
const artifacts = (project.devArtifacts || [])
@@ -51,7 +52,8 @@ export default function DevArtifactsPanel({
};
return (
- <section className="bg-port-card border border-port-border rounded-lg p-3 space-y-2 min-w-0" aria-labelledby={`${idPrefix}-title`}>
+ <section id={id} tabIndex={id ? -1 : undefined} style={id ? { scrollMarginTop: 'calc(var(--mv-header-h, 9rem) + 1rem)' } : undefined}
+ className="bg-port-card border border-port-border rounded-lg p-3 space-y-2 min-w-0" aria-labelledby={`${idPrefix}-title`}>
<div className="flex flex-wrap items-center gap-2">
<FolderOpen size={16} className="text-port-accent shrink-0" aria-hidden="true" />
<h3 id={`${idPrefix}-title`} className="text-sm font-medium">{title}</h3>
diff --git a/client/src/components/musicVideo/ProductionReviewContext.jsx b/client/src/components/musicVideo/ProductionReviewContext.jsx
index 48a3f329fe..e2e1fa44b8 100644
--- a/client/src/components/musicVideo/ProductionReviewContext.jsx
+++ b/client/src/components/musicVideo/ProductionReviewContext.jsx
@@ -18,17 +18,20 @@ export default function ProductionReviewContext({ stage, project, onOpenArtifact
const document = draft.storyboardSource === 'document';
const shots = draft.storyboard || [];
const sheets = (project.devArtifacts || []).filter(a => !a.deleted && a.kind === 'storyboard');
+ const written = [['Cast', draft.cast], ['Environments', draft.environments], ['Visual language', draft.visualLanguage], ['Motion and energy', draft.motionLanguage]]
+ .filter(([, value]) => typeof value === 'string' && value.trim());
return <section aria-label={`${stage === 'art' ? 'Art direction' : 'Storyboard'} review content`} className="min-w-0 space-y-3 py-3">
{stage === 'art' ? <>
{guide ? <figure className="min-w-0 space-y-2">
<figcaption className="text-sm font-medium">Selected visual guide: {guide.title} · v{guide.version || 1}</figcaption>
<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>}
- <details>
+ </figure> : null}
+ {/* Only what is written: the step's checklist says what is still missing and how to get it. */}
+ {written.length > 0 && <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>
+ <dl className="space-y-2 text-sm">{written.map(([label, value]) => <div key={label}><dt className="font-medium">{label}</dt><dd className="whitespace-pre-wrap break-words">{value}</dd></div>)}</dl>
+ </details>}
</> : <>
<p className="text-sm">
Watch the storyboard in the player, then approve. {formatCount(shots.length)} {document ? 'document shots' : 'storyboard shots'}
diff --git a/client/src/components/musicVideo/ProductionReviewPanel.jsx b/client/src/components/musicVideo/ProductionReviewPanel.jsx
index 00f40ab09f..982b838422 100644
--- a/client/src/components/musicVideo/ProductionReviewPanel.jsx
+++ b/client/src/components/musicVideo/ProductionReviewPanel.jsx
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
import ProductionReviewContext from './ProductionReviewContext.jsx';
import OverlayTextCheck from './OverlayTextCheck.jsx';
import { formatTimecode } from '../../utils/formatters.js';
-import { summarizeStoryboardProblems } from '../../lib/musicVideoStages.js';
+import { ART_DIRECTION_ANCHOR, artDirectionGaps, summarizeStoryboardProblems } from '../../lib/musicVideoStages.js';
const EMPTY = { cast: '', environments: '', visualLanguage: '', motionLanguage: '', guideArtifactId: null,
lyricsMode: 'vocal', timingStatus: 'provisional', timingNotes: '', storyboard: [] };
@@ -20,11 +20,12 @@ const EMPTY_PLAYBACK = { method: 'playback', timecodedNotes: '', visualReview: '
const FOLD_STYLE = { scrollMarginTop: 'calc(var(--mv-header-h, 9rem) + 1rem)' };
/**
* The open box that closes a step: heading, then the approval's content and
- * Approve / Request changes, highlighted until approved.
+ * Approve / Request changes, highlighted until approved. A `waiting` box has
+ * nothing to review yet, so it is not highlighted either.
*/
-function ApprovalBox({ id, label, approved, optional = false, children }) {
+function ApprovalBox({ id, label, approved, optional = false, waiting = false, children }) {
return <section id={id} tabIndex={-1} aria-label={`Approve: ${label}`} style={FOLD_STYLE}
- className={`rounded-lg border p-3 focus:outline focus:outline-2 focus:outline-port-accent ${approved || optional ? 'border-port-border' : 'border-port-accent bg-port-accent/5'}`}>
+ className={`rounded-lg border p-3 focus:outline focus:outline-2 focus:outline-port-accent ${approved || optional || waiting ? 'border-port-border' : 'border-port-accent bg-port-accent/5'}`}>
{/* An optional check isn't highlighted: it never competes with the step's real next action. */}
<h4 className="text-sm font-semibold">{approved ? `${label} approved` : optional ? label : `Approve the ${label.toLowerCase()}`}{optional && !approved && <span className="ml-2 font-normal text-port-text-muted">Optional</span>}</h4>
{children}
@@ -222,9 +223,13 @@ export default function ProductionReviewPanel({ project, review, onOpenArtifact,
</>;
const key = stage;
const label = labels[stage];
+ // Art with no written direction or guide has nothing to approve: the box says
+ // so in one line, and the step's checklist offers what produces them.
+ const artWaiting = key === 'art' && !!ready && !ready.art.approved && !ready.art.stale && !artDirectionGaps(project).ready;
return <section id="mv-production-review" aria-label="Production review" className="space-y-3">
{review.error && <p role="alert" className="text-port-error">{review.error}</p>}
- <ApprovalBox id={`mv-review-${key}`} label={label} optional={!!OPTIONAL[key]} approved={!!ready?.[key].approved}>
+ <ApprovalBox id={`mv-review-${key}`} label={label} optional={!!OPTIONAL[key]} approved={!!ready?.[key].approved} waiting={artWaiting}>
+ {artWaiting ? <p role="status" className="mt-1 text-sm text-port-text-muted">Opens once the art direction is written and a visual guide is chosen.</p> : <>
{/* The decision comes first, at the top of the box, with one line on what it still needs. */}
{key === 'proof' && proofNeedsRender && !ready?.[key].approved && <div className="mt-2">{renderControls}</div>}
<div className="mt-2 flex flex-wrap items-center gap-2">
@@ -252,6 +257,7 @@ export default function ProductionReviewPanel({ project, review, onOpenArtifact,
{key === 'storyboard' && ready?.storyboard.text && <OverlayTextCheck report={ready.storyboard.text} busy={review.busy}
onCheck={() => review.checkOverlayText()} onSeek={onSeek} />}
{key === 'proof' ? proofContent : <ProductionReviewContext stage={key} project={project} onOpenArtifact={onOpenArtifact} onArtReady={available => setVisibleArt(available ? artIdentity : null)} onSeek={onSeek} />}
+ </>}
{openRequests(key).length > 0 && <div role="group" aria-label={`${label} change requests`} className="mt-2 space-y-2 rounded border border-port-warning p-2">
<p className="text-sm">Resolve these change requests to approve.</p>
<ul className="list-disc pl-5 text-sm">{openRequests(key).map(item => <li key={item.id} className="break-words"><strong>{item.target}</strong>: {item.text}</li>)}</ul>
@@ -326,7 +332,7 @@ export default function ProductionReviewPanel({ project, review, onOpenArtifact,
{draft.sourceArtifactId && <button type="button" className={buttonClass} onClick={() => onOpenArtifact(draft.sourceArtifactId)}>Read preserved original planning draft</button>}
<button type="button" className={buttonClass} disabled={dirty || review.busy || documentShots} onClick={review.prepare}>Draft art direction and shots</button>
<p className="text-xs text-port-text-muted">Uses the saved authoring provider and allowed tools. Builds Cast & Sets first, then pauses for art approval before planning shots. Existing edits are retained.</p>
- <div className="grid gap-3 sm:grid-cols-2">
+ <div id={ART_DIRECTION_ANCHOR} className="grid gap-3 sm:grid-cols-2" style={FOLD_STYLE}>
{Object.entries({ cast: 'Cast guide', environments: 'Environment guide', visualLanguage: 'Visual language and mood board' }).map(([key, label]) =>
<label key={key} htmlFor={fieldId(key)} className="text-sm">{label}<textarea id={fieldId(key)} rows={4} value={draft[key]} onChange={e => set(key, e.target.value)} className={fieldClass} /></label>)}
</div>
diff --git a/client/src/components/musicVideo/ProductionReviewPanel.test.jsx b/client/src/components/musicVideo/ProductionReviewPanel.test.jsx
index 3dddc123af..02b5839c29 100644
--- a/client/src/components/musicVideo/ProductionReviewPanel.test.jsx
+++ b/client/src/components/musicVideo/ProductionReviewPanel.test.jsx
@@ -1,5 +1,5 @@
import { afterEach, describe, expect, it, vi } from 'vitest';
-import { fireEvent, render, screen, waitFor, within } from '@testing-library/react';
+import { act, fireEvent, render, screen, waitFor, within } from '@testing-library/react';
import { useState } from 'react';
import ProductionReviewPanel from './ProductionReviewPanel.jsx';
@@ -229,18 +229,32 @@ describe('Production proof playback evidence', () => {
expect(within(proofRequests).getByRole('button', { name: 'Revise from feedback' })).toBeTruthy();
});
- it('keeps the hash-selected art approval open and highlighted when readiness arrives, until approved', () => {
+ it('keeps the art approval to one quiet line while there is no direction or guide to review', () => {
+ const review = reviewFixture(); review.readiness.art = { approved: false, problems: ['Attach a visual cast/environment sheet from Development artifacts.'] };
+ render(<ProductionReviewPanel project={project} review={review} onOpenArtifact={vi.fn()} stage="art" />);
+ const box = screen.getByRole('region', { name: 'Approve: Art direction' });
+ expect(box.textContent).toContain('Opens once the art direction is written and a visual guide is chosen.');
+ expect(within(box).queryByRole('button', { name: 'Approve art direction' })).toBeNull();
+ expect(box.textContent).not.toContain('Attach a visual cast');
+ expect(box.className).not.toContain('border-port-accent');
+ });
+
+ it('keeps the hash-selected art approval open and highlighted when readiness arrives, until approved', async () => {
+ vi.stubGlobal('fetch', vi.fn(async () => ({ ok: true })));
window.location.hash = '#mv-review-art';
+ const guided = { ...project, devArtifacts: [{ id: 'guide', title: 'Synthetic visual guide', version: 1, mimeType: 'image/png' }],
+ productionReview: { ...project.productionReview, draft: { ...project.productionReview.draft, guideArtifactId: 'guide' } } };
const review = reviewFixture(); review.readiness.art.approved = false;
- const view = render(<ProductionReviewPanel project={project} review={{ ...review, readiness: null }} onOpenArtifact={vi.fn()} stage="art" />);
- view.rerender(<ProductionReviewPanel project={project} review={review} onOpenArtifact={vi.fn()} stage="art" />);
+ const view = render(<ProductionReviewPanel project={guided} review={{ ...review, readiness: null }} onOpenArtifact={vi.fn()} stage="art" />);
+ view.rerender(<ProductionReviewPanel project={guided} review={review} onOpenArtifact={vi.fn()} stage="art" />);
const box = document.getElementById('mv-review-art');
expect(box).toBe(screen.getByRole('region', { name: 'Approve: Art direction' }));
expect(box.tagName).toBe('SECTION');
expect(within(box).getByRole('heading', { name: 'Approve the art direction' })).toBeTruthy();
expect(box.className).toContain('border-port-accent');
const approved = reviewFixture();
- view.rerender(<ProductionReviewPanel project={project} review={approved} onOpenArtifact={vi.fn()} stage="art" />);
+ view.rerender(<ProductionReviewPanel project={guided} review={approved} onOpenArtifact={vi.fn()} stage="art" />);
+ await act(async () => {});
expect(within(box).getByRole('heading', { name: 'Art direction approved' })).toBeTruthy();
expect(box.className).not.toContain('border-port-accent');
});
diff --git a/client/src/components/musicVideo/StageChecklist.jsx b/client/src/components/musicVideo/StageChecklist.jsx
index 364140763f..1587fe74f2 100644
--- a/client/src/components/musicVideo/StageChecklist.jsx
+++ b/client/src/components/musicVideo/StageChecklist.jsx
@@ -3,12 +3,14 @@ import { ArrowRight, CheckCircle2, Circle } from 'lucide-react';
/**
* The top of every stage tab: what this stage needs before it counts as done
* (`stageChecklist(…)` items), each open item with what is still missing and,
- * where one exists, a button that scrolls to the control that settles it —
- * unless the header's next action already goes there (`headerAnchor`). A stale
+ * where one exists, a button that settles it: an `anchor` scrolls to the
+ * control, a `run` starts the work itself (`onAction` gets either) — unless the
+ * header's next action already goes there (`headerAnchor`). An item may add a
+ * quieter `secondary` choice beside it. Run buttons wait while `busy`. A stale
* approval lists a Revert button per changed input whose approved value was kept.
* An `optional` item is listed but never counted toward the step being done.
*/
-export default function StageChecklist({ items, onAction, onRevert, headerAnchor = null }) {
+export default function StageChecklist({ items, onAction, onRevert, headerAnchor = null, busy = false }) {
if (!items?.length) return null;
const required = items.filter((item) => !item.optional);
const done = required.filter((item) => item.done).length;
@@ -51,14 +53,23 @@ export default function StageChecklist({ items, onAction, onRevert, headerAnchor
</div>
)}
</div>
- {!item.done && item.action && onAction && item.action.anchor !== headerAnchor && (
- <button
- type="button"
- onClick={() => onAction(item.action)}
- className="ml-6 flex min-h-[44px] shrink-0 items-center gap-1 rounded border border-port-border px-2 py-1 text-xs text-port-accent sm:ml-0 sm:min-h-0"
- >
- {item.action.label} <ArrowRight size={12} aria-hidden="true" />
- </button>
+ {!item.done && onAction && (
+ <div className="ml-6 flex shrink-0 flex-wrap items-center gap-1.5 sm:ml-0">
+ {[item.action, item.secondary].filter((action) => action && (action.run || action.anchor !== headerAnchor)).map((action) => (
+ <button
+ key={action.label}
+ type="button"
+ onClick={() => onAction(action)}
+ disabled={action.disabled || (!!action.run && busy)}
+ title={action.reason}
+ className={`flex min-h-[44px] shrink-0 items-center gap-1 rounded px-2 py-1 text-xs disabled:opacity-50 sm:min-h-0 ${action === item.action
+ ? (action.run ? 'bg-port-accent font-medium text-white' : 'border border-port-border text-port-accent')
+ : 'text-port-text-muted hover:text-port-accent'}`}
+ >
+ {action.label} {!action.run && <ArrowRight size={12} aria-hidden="true" />}
+ </button>
+ ))}
+ </div>
)}
</li>
))}
diff --git a/client/src/components/musicVideo/stages/CastSetsStage.jsx b/client/src/components/musicVideo/stages/CastSetsStage.jsx
index f41e69350c..26281ead57 100644
--- a/client/src/components/musicVideo/stages/CastSetsStage.jsx
+++ b/client/src/components/musicVideo/stages/CastSetsStage.jsx
@@ -7,6 +7,10 @@ import VisualSpecPanel from '../VisualSpecPanel.jsx';
import AutoSizeTextarea from '../../ui/AutoSizeTextarea';
import { useState } from 'react';
import { formatCount } from '../../../utils/formatters.js';
+import { CAST_CHECKIN_ANCHOR, LOOK_GUIDES_ANCHOR } from '../../../lib/musicVideoStages.js';
+
+// Below the sticky project header when a checklist row scrolls here.
+const ANCHOR_STYLE = { scrollMarginTop: 'calc(var(--mv-header-h, 9rem) + 1rem)' };
const directionSummary = (project) => {
const refs = (project.visualSpec?.references || []).length + (project.styleReferences || []).length;
@@ -133,6 +137,7 @@ export default function CastSetsStage({ board }) {
</StageSection>
{project.castAndSets ? (
<CastAndSetsCheckin
+ id={CAST_CHECKIN_ANCHOR}
project={project}
stale={board.productionReadiness?.castAndSets?.stale || null}
busy={locked || castSets.busy || kickoff.running}
@@ -147,7 +152,7 @@ export default function CastSetsStage({ board }) {
onSkip={board.skipCastAndSets}
/>
) : (
- <div className="rounded-lg border border-port-border bg-port-card p-3 space-y-3">
+ <div id={CAST_CHECKIN_ANCHOR} tabIndex={-1} style={ANCHOR_STYLE} className="rounded-lg border border-port-border bg-port-card p-3 space-y-3">
<p className="text-sm text-port-text-muted">Build the cast and sets from your direction, or skip and add your own sheets.</p>
<div className="flex flex-wrap gap-2">
<button type="button" onClick={() => castSets.start()} disabled={locked || castSets.busy || kickoff.running || !project.audioAnalysis}
@@ -163,6 +168,7 @@ export default function CastSetsStage({ board }) {
</div>
)}
<DevArtifactsPanel
+ id={LOOK_GUIDES_ANCHOR}
project={project}
busy={board.devArtifacts.busy}
onOpen={board.openArtifact}
diff --git a/client/src/lib/musicVideoStages.js b/client/src/lib/musicVideoStages.js
index 74866aa444..4422cd00ec 100644
--- a/client/src/lib/musicVideoStages.js
+++ b/client/src/lib/musicVideoStages.js
@@ -395,7 +395,11 @@ export function deriveNextAction(project, {
// The approval panel only opens once the stage's own work exists: a stage with
// nothing built yet (no check-in, no shots) offers Start / Plan, and an open
// or interrupted check-in offers Approve / Resume — those come from the stage switch below.
- const castNeedsOwnAction = art && ((!cast && scenes.length === 0) || (cast && (cast.status === 'review' || cast.interrupted || cast.status === 'failed')));
+ // With no art direction written yet there is nothing to review either: a project
+ // whose sheet was never built (planned from a treatment, say) builds it first.
+ const artUnwritten = art && !artDirectionGaps(project).ready;
+ const castNeedsOwnAction = art && ((!cast && (scenes.length === 0 || (artUnwritten && !project.automation)))
+ || (cast && (cast.status === 'review' || cast.interrupted || cast.status === 'failed')));
// A document storyboard brings its shots from the authored source, so it has nothing to plan on the board.
const draftReview = project.productionReview?.draft || {};
const documentShots = draftReview.storyboardSource === 'document' && (draftReview.storyboard || []).length > 0;
@@ -406,6 +410,8 @@ export function deriveNextAction(project, {
if (!finishedOutside(project) && projectHasAudio(project) && project.audioAnalysis && !CAST_WORKING.has(cast?.status) && (art || board || pilotParked)
&& run?.status !== 'running' && !renderActive && !kickoffRunning
&& !castNeedsOwnAction && !boardNeedsOwnAction) {
+ // Unwritten art direction (a skipped sheet, or fields someone cleared) is written on the step, not approved.
+ if (artUnwritten) return { id: 'review-production', kind: 'goto', stage: 'cast-sets', anchor: ART_DIRECTION_ANCHOR, label: 'Write art direction', shortLabel: 'Write art' };
return { id: 'review-production', kind: 'goto', stage: art ? 'cast-sets' : board ? 'board' : 'produce',
anchor: art ? 'mv-review-art' : board ? 'mv-review-storyboard' : 'mv-review-proof',
label: art ? 'Review art direction' : board ? 'Review timed storyboard' : 'Review pilot proof',
@@ -506,6 +512,22 @@ export function deriveNextAction(project, {
// The editable art-direction fields the art approval needs before art can be approved.
const ART_DIRECTION_FIELDS = [['cast', 'cast'], ['environments', 'sets'], ['visualLanguage', 'visual language'], ['motionLanguage', 'motion']];
+/** Where the Look step's art-direction fields and its visual-guide files are on the page. */
+export const ART_DIRECTION_ANCHOR = 'mv-art-direction-editor';
+export const LOOK_GUIDES_ANCHOR = 'mv-look-guides';
+export const CAST_CHECKIN_ANCHOR = 'mv-cast-checkin';
+/**
+ * What the art approval is still waiting on before there is anything to
+ * approve: the unwritten art-direction fields (`missing`, by label) and the
+ * chosen visual guide (null when none is chosen or it was deleted). `ready`
+ * is true once both exist; until then the approval has nothing to show.
+ */
+export function artDirectionGaps(project) {
+ const draft = project?.productionReview?.draft || {};
+ 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 { missing, guide, ready: missing.length === 0 && !!guide };
+}
/** "Approved earlier — changed since: concept, scene 3 prompt" for an approval whose inputs moved; null otherwise. */
export function staleApprovalText(stale) {
if (!stale) return null;
@@ -627,15 +649,41 @@ export function stageChecklist(stageId, project, readiness = project?.production
];
}
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;
+ // The art direction and guide come from the Cast & Sets sheet (approving its
+ // check-in writes them in), so each row offers the step that produces it:
+ // build or resume the sheet, open its check-in, or fill from an approved one.
+ // A director who skipped the sheet writes the direction and picks a guide by hand.
+ const { missing, guide } = artDirectionGaps(project);
+ const cast = project.castAndSets || null;
+ const building = !!cast && CAST_WORKING.has(cast.status) && !cast.interrupted;
+ const stopped = !!cast && (cast.interrupted || cast.status === 'failed');
+ const fromSheet = cast?.status === 'approved' && !!cast.direction;
+ const stillMissing = missing.length && missing.length < ART_DIRECTION_FIELDS.length ? `Still missing: ${missing.join(', ')}. ` : '';
+ const write = { label: 'Write it yourself', anchor: ART_DIRECTION_ANCHOR };
+ const direction = missing.length === 0 ? { detail: null, action: null }
+ : !cast ? { detail: `${stillMissing}Build the cast & sets to draft it from your creative direction, song style and mood board.`,
+ action: { label: 'Build cast & sets', run: 'start-cast-sets', disabled: !project.audioAnalysis, reason: project.audioAnalysis ? undefined : 'Analyze the track first' }, secondary: write }
+ : building ? { detail: 'The cast & sets sheet is being built. Its art direction fills in when you approve it.', action: null }
+ : stopped ? { detail: 'The cast & sets sheet stopped before it finished.', action: { label: 'Resume cast & sets', run: 'resume-cast-sets' }, secondary: write }
+ : cast.status === 'review' ? { detail: 'Approve the cast & sets sheet and its art direction fills in here.', action: { label: 'Review cast & sets', anchor: CAST_CHECKIN_ANCHOR } }
+ : fromSheet ? { detail: `Still missing: ${missing.join(', ')}.`, action: { label: 'Fill in from cast & sets', run: 'prepare-art' }, secondary: write }
+ : { detail: `Still missing: ${missing.join(', ')}.`, action: { label: 'Write art direction', anchor: ART_DIRECTION_ANCHOR } };
+ const sheetPending = !cast || building || stopped || cast.status === 'review';
+ const files = (project.devArtifacts || []).some((a) => !a.deleted);
+ const pick = { label: files ? 'Choose a guide' : 'Import a guide', anchor: LOOK_GUIDES_ANCHOR };
+ const guideRow = guide ? { detail: null, action: null }
+ : fromSheet && !project.productionReview?.draft?.guideArtifactId && cast.artifactId
+ ? { detail: 'Use the cast & sets sheet as the guide, or pick another file.', action: { label: 'Use the sheet', run: 'prepare-art' }, secondary: pick }
+ : sheetPending ? { detail: 'Comes with the cast & sets sheet, or use a file of your own.', action: files ? pick : null, secondary: files ? null : pick }
+ : { detail: 'Pick a file below with Use as visual guide, or import one.', action: pick };
+ const approve = approval('art', 'Art direction', 'Ready for your review. Approving a sheet file does not approve the art direction; approve it below.');
+ // Until there is direction and a guide there is nothing to review, so the row sends nowhere
+ // (a stale approval keeps its row: it names what changed and offers the reverts).
+ const waiting = !approve.done && !approve.stale && (missing.length > 0 || !guide);
return [
- { 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 the art direction editor below.',
- 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 below.'),
+ { id: 'direction', label: 'Art direction written', done: missing.length === 0, ...direction },
+ { id: 'guide', label: guide ? `Visual guide chosen: ${guide.title || guide.filename || 'sheet'}` : 'Visual guide chosen', done: !!guide, ...guideRow },
+ waiting ? { ...approve, detail: 'Opens once the art direction is written and a guide is chosen.', action: null } : approve,
];
}
case 'board': {
diff --git a/client/src/lib/musicVideoStages.test.js b/client/src/lib/musicVideoStages.test.js
index 59bf64a6e6..38b16d9a91 100644
--- a/client/src/lib/musicVideoStages.test.js
+++ b/client/src/lib/musicVideoStages.test.js
@@ -190,7 +190,11 @@ describe('deriveStages / deriveNextAction', () => {
it('never promotes placeholder scenes or imported schematic documents to final production', () => {
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' });
- expect(deriveNextAction(project)).toMatchObject({ id: 'review-production', stage: 'cast-sets' });
+ // Planned shots with no art direction written: build the cast & sets that writes it, rather than "review" nothing.
+ expect(deriveNextAction(project)).toMatchObject({ id: 'start-cast-sets', kind: 'run' });
+ // A skipped sheet leaves the direction to the director, so the header opens its editor.
+ expect(deriveNextAction({ ...project, castAndSets: { status: 'skipped' } }))
+ .toMatchObject({ id: 'review-production', stage: 'cast-sets', anchor: 'mv-art-direction-editor', label: 'Write art direction' });
// The proof is optional: with art and storyboard approved the header moves on to rendering.
const planned = { ...project, productionReadiness: { ...APPROVED, proof: { approved: false }, readyForProduction: true } };
expect(deriveNextAction(planned)).toMatchObject({ id: 'render-final' });
@@ -425,9 +429,25 @@ describe('stageChecklist', () => {
const items = stageChecklist('cast-sets', castProject({
productionReview: { draft: { cast: 'c', environments: ' ', visualLanguage: '', motionLanguage: 'm', guideArtifactId: 'gone' } },
}), { ...NOT_APPROVED, art: { approved: false, problems: ['Attach a visual cast/environment sheet from Development artifacts.'] } });
- expect(items[0]).toMatchObject({ done: false, detail: 'Still missing: sets, visual language.' });
- expect(items[1]).toMatchObject({ done: false, label: 'Visual guide chosen' });
- expect(items[2].detail).toBe('Attach a visual cast/environment sheet from Development artifacts.');
+ // No sheet built yet: the row builds it, or the director writes the rest by hand.
+ expect(items[0]).toMatchObject({ done: false, detail: 'Still missing: sets, visual language. Build the cast & sets to draft it from your creative direction, song style and mood board.',
+ action: { label: 'Build cast & sets', run: 'start-cast-sets' }, secondary: { label: 'Write it yourself', anchor: 'mv-art-direction-editor' } });
+ expect(items[1]).toMatchObject({ done: false, label: 'Visual guide chosen', action: { label: 'Choose a guide', anchor: 'mv-look-guides' } });
+ // With nothing to approve the approval row neither repeats the server's reasons nor sends anywhere.
+ expect(items[2]).toMatchObject({ done: false, detail: 'Opens once the art direction is written and a guide is chosen.', action: null });
+ });
+
+ it('offers the Cast & Sets step that writes the art direction at each point of its life', () => {
+ const empty = { productionReview: { draft: {} }, devArtifacts: [] };
+ const rows = (castAndSets) => stageChecklist('cast-sets', castProject({ ...empty, castAndSets }), NOT_APPROVED);
+ expect(rows({ status: 'imaging' })[0]).toMatchObject({ action: null, detail: expect.stringMatching(/being built/) });
+ expect(rows({ status: 'imaging', interrupted: true })[0].action).toEqual({ label: 'Resume cast & sets', run: 'resume-cast-sets' });
+ expect(rows({ status: 'review' })[0].action).toEqual({ label: 'Review cast & sets', anchor: 'mv-cast-checkin' });
+ const approvedSheet = { status: 'approved', direction: { look: 'x' }, artifactId: 'sheet' };
+ const filled = rows(approvedSheet);
+ expect(filled[0].action).toEqual({ label: 'Fill in from cast & sets', run: 'prepare-art' });
+ expect(filled[1].action).toEqual({ label: 'Use the sheet', run: 'prepare-art' });
+ expect(rows({ status: 'skipped' })[0].action).toEqual({ label: 'Write art direction', anchor: 'mv-art-direction-editor' });
});
it('covers Song, Storyboard and Make with the same done answers deriveStages uses', () => {
diff --git a/client/src/pages/MusicVideo.jsx b/client/src/pages/MusicVideo.jsx
index 1eeb60e72a..6a1426864f 100644
--- a/client/src/pages/MusicVideo.jsx
+++ b/client/src/pages/MusicVideo.jsx
@@ -1111,6 +1111,15 @@ export default function MusicVideo() {
readiness: productionReview.readiness,
headerAction: nextAction,
}) : [];
+ // A checklist row either jumps to the control that settles it or, for work
+ // the page can start itself (build or resume the cast & sets, fill the art
+ // direction from an approved sheet), starts it.
+ const runChecklistAction = (action) => {
+ if (action.run === 'start-cast-sets') { castSets.start(); return; }
+ if (action.run === 'resume-cast-sets') { castSets.resume(); return; }
+ if (action.run === 'prepare-art') { productionReview.prepare(); return; }
+ goToStage(action.stage || activeStage, action.anchor, action.params);
+ };
const runNextAction = () => {
if (!selected || !nextAction || nextAction.disabled || compositionSavePending > 0) return;
if (nextAction.id === 'review-imported') { openArtifact(reviewDraft.artifactId); return; }
@@ -1549,7 +1558,8 @@ export default function MusicVideo() {
lead={(
<StageChecklist
items={stageChecklist(activeStage, selected, productionReview.readiness, publish)}
- onAction={(action) => goToStage(action.stage || activeStage, action.anchor, action.params)}
+ onAction={runChecklistAction}
+ busy={castSets.busy || productionReview.busy}
onRevert={productionReview.revert}
headerAnchor={nextAction?.kind === 'goto' ? nextAction.anchor : null}
/>
diff --git a/client/src/pages/MusicVideo.test.jsx b/client/src/pages/MusicVideo.test.jsx
index bc51f2c69f..ccca75e1bc 100644
--- a/client/src/pages/MusicVideo.test.jsx
+++ b/client/src/pages/MusicVideo.test.jsx
@@ -3095,26 +3095,25 @@ describe('direct production review navigation', () => {
storyboard: { approved: false, problems: ['Approve art first'] }, proof: { approved: false, problems: ['Approve storyboard first'] } } };
listMusicVideoProjects.mockResolvedValue([project]);
render(<MemoryRouter initialEntries={['/music-video/mv-3/review']}><LocationProbe /><NavTo to={-1} /><NavTo to={1} />{MV_ROUTES}</MemoryRouter>);
- const action = await screen.findByRole('button', { name: 'Review art direction' });
+ // A skipped sheet left nothing written, so the header sends the director to write it, not to approve it.
+ const action = await screen.findByRole('button', { name: 'Write art direction' });
expect(screen.getByLabelText('Project').querySelector(`option[value="${project.id}"]`).textContent).toBe(project.name);
fireEvent.click(action);
- // The art approval mounts at the bottom of the Look step, so it only exists once the jump lands.
- await waitFor(() => expect(document.getElementById('mv-review-art')).toHaveFocus());
+ // The editor mounts folded at the bottom of the Look step; the jump unfolds it and focuses its first field.
+ await waitFor(() => expect(screen.getByLabelText('Cast guide')).toHaveFocus());
+ expect(screen.getByLabelText('Cast guide').closest('details').open).toBe(true);
+ expect(screen.getByTestId('loc')).toHaveTextContent('/cast-sets#mv-art-direction-editor');
+ // With nothing to review the approval is one quiet line, not instructions and a disabled button.
const art = document.getElementById('mv-review-art');
- // On its step the approval is an always-open box, never folded away.
expect(art).toHaveAccessibleName('Approve: Art direction');
- expect(art.closest('details')).toBeNull();
- expect(art).toContainElement(screen.getByRole('button', { name: 'Approve art direction' }));
- expect(screen.getByTestId('loc')).toHaveTextContent('/cast-sets#mv-review-art');
- fireEvent.click(screen.getByRole('button', { name: 'Review art direction' }));
- expect(art).toHaveFocus();
- expect(screen.getByRole('button', { name: 'Approve art direction' })).toBeDisabled();
- expect(screen.getByText('No current visual guide selected. Choose a Development file in the planning editor below.')).toBeInTheDocument();
+ expect(art).toHaveTextContent('Opens once the art direction is written and a visual guide is chosen.');
+ expect(within(art).queryByRole('button', { name: 'Approve art direction' })).toBeNull();
+ expect(art.className).not.toContain('border-port-accent');
expect(screen.queryByLabelText('Instance password for this approval')).toBeNull();
fireEvent.click(screen.getByRole('button', { name: 'go--1' }));
expect(screen.getByTestId('loc')).toHaveTextContent('/review');
fireEvent.click(screen.getByRole('button', { name: 'go-1' }));
- await waitFor(() => expect(document.getElementById('mv-review-art')).toHaveFocus());
+ await waitFor(() => expect(screen.getByLabelText('Cast guide')).toHaveFocus());
});
});
@@ -3131,9 +3130,29 @@ describe('stage checklist and project options', () => {
await openProject(project, 'cast-sets');
const checklist = screen.getByRole('region', { name: 'What this step needs' });
expect(checklist).toHaveTextContent('1 of 3 done');
- expect(checklist).toHaveTextContent('Pick a Cast & Sets sheet as the visual guide in the art direction editor below.');
+ expect(checklist).toHaveTextContent('Pick a file below with Use as visual guide, or import one.');
expect(checklist).toHaveTextContent('Art direction approved');
- expect(checklist).toHaveTextContent('Approving a sheet file does not approve the art direction');
+ expect(checklist).toHaveTextContent('Opens once the art direction is written and a guide is chosen.');
+ // The guide row lands on the files, where each sheet has Use as visual guide.
+ fireEvent.click(within(checklist).getByRole('button', { name: 'Choose a guide' }));
+ await waitFor(() => expect(document.getElementById('mv-look-guides')).toHaveFocus());
+ expect(within(document.getElementById('mv-look-guides')).getByRole('button', { name: 'Use Cast sheet as visual guide' })).toBeInTheDocument();
+ });
+
+ it('builds the cast & sets from the Look checklist when nothing is written yet', async () => {
+ const project = { ...PROJECT_ANALYZED, scenes: [], castAndSets: undefined, devArtifacts: [],
+ productionReadiness: { readyForProduction: false, basis: {}, art: { approved: false, problems: ['Cast guide needs editable direction.'] },
+ storyboard: { approved: false, problems: [] }, proof: { approved: false, problems: [] } } };
+ startMusicVideoCastAndSets.mockResolvedValue({ project, stage: null });
+ await openProject(project, 'cast-sets');
+ const checklist = screen.getByRole('region', { name: 'What this step needs' });
+ expect(checklist).toHaveTextContent('Build the cast & sets to draft it from your creative direction, song style and mood board.');
+ expect(checklist).toHaveTextContent('Comes with the cast & sets sheet, or use a file of your own.');
+ expect(checklist).not.toHaveTextContent('needs editable direction');
+ fireEvent.click(within(checklist).getByRole('button', { name: 'Build cast & sets' }));
+ await waitFor(() => expect(startMusicVideoCastAndSets).toHaveBeenCalledWith(project.id, {}, { silent: true }));
+ fireEvent.click(within(checklist).getByRole('button', { name: 'Write it yourself' }));
+ await waitFor(() => expect(screen.getByLabelText('Cast guide')).toHaveFocus());
});
it('shows the project options in Project settings and saves a media mode and an autopilot tool change', async () => {