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

feat: name what changed since an earlier music-video approval (#10141)

Adam Eivy8b12b23da858
diff --git a/client/src/components/musicVideo/DependencyImpactPanel.jsx b/client/src/components/musicVideo/DependencyImpactPanel.jsx
index 5850a72767..6a4d05cd64 100644
--- a/client/src/components/musicVideo/DependencyImpactPanel.jsx
+++ b/client/src/components/musicVideo/DependencyImpactPanel.jsx
@@ -1,4 +1,4 @@
-import { useEffect, useState } from 'react';
+import { useEffect, useMemo, useState } from 'react';
import { getMusicVideoDependencyImpact } from '../../services/apiMusicVideo.js';
import { openRevisionOf } from '../../lib/musicVideoAttention.js';
import { formatCount } from '../../utils/formatters.js';
@@ -10,6 +10,9 @@ export default function DependencyImpactPanel({ project, busy, onRepair }) {
const [result, setResult] = useState(null);
const [error, setError] = useState(null);
const [retry, setRetry] = useState(0);
+ // Refetch only when an approval basis moves, not on every project object change.
+ const basis = project.productionReadiness?.basis;
+ const basisKey = useMemo(() => basis ? `${basis.art}|${basis.storyboard}|${basis.proof}` : '', [basis]);
useEffect(() => {
let active = true;
setResult(null);
@@ -20,7 +23,7 @@ export default function DependencyImpactPanel({ project, busy, onRepair }) {
if (active) setError(err.message || 'Could not check asset dependencies');
});
return () => { active = false; };
- }, [project, retry]);
+ }, [project.id, basisKey, retry]);
const revisionActive = !!openRevisionOf(project);
if (error) return <div role="alert" className="text-xs text-port-error">{error} <button type="button" onClick={() => setRetry((value) => value + 1)}>Retry dependency check</button></div>;
if (!result || (!result.shots.length && !result.evidence.length)) return null;
diff --git a/client/src/components/musicVideo/LyricsPanel.jsx b/client/src/components/musicVideo/LyricsPanel.jsx
index 122ed00f53..a6be9fbb3f 100644
--- a/client/src/components/musicVideo/LyricsPanel.jsx
+++ b/client/src/components/musicVideo/LyricsPanel.jsx
@@ -226,6 +226,11 @@ export default function LyricsPanel({ project, onEditLocal, onSave, onImport, im
· {phrases.length} phrase{phrases.length === 1 ? '' : 's'}
<span className="block sm:inline sm:ml-1">— AI Plan cuts on timed lines and phrase edges; no lyrics = an instrumental plan.</span>
</Heading>
+ {project.productionReadiness?.storyboard?.approved && (
+ <p role="note" className="mt-2 rounded border border-port-warning/40 bg-port-warning/5 p-2 text-port-warning">
+ The storyboard is approved. Editing lyrics, markers or phrases will need re-approval of the storyboard.
+ </p>
+ )}
<div className="mt-2 grid grid-cols-1 gap-3 lg:grid-cols-2">
<section className="space-y-2 min-w-0">
diff --git a/client/src/components/musicVideo/StageChecklist.jsx b/client/src/components/musicVideo/StageChecklist.jsx
index 37bf2a7b1b..9457b8e99e 100644
--- a/client/src/components/musicVideo/StageChecklist.jsx
+++ b/client/src/components/musicVideo/StageChecklist.jsx
@@ -22,9 +22,10 @@ export default function StageChecklist({ items, onAction, headerAnchor = null })
<li key={item.id} className="flex min-w-0 items-start gap-2 text-sm">
{item.done
? <CheckCircle2 size={16} className="mt-0.5 shrink-0 text-port-success" aria-label="done" />
- : <Circle size={16} className="mt-0.5 shrink-0 text-port-warning" aria-label="to do" />}
+ : <Circle size={16} className="mt-0.5 shrink-0 text-port-warning" aria-label={item.stale ? 'approved earlier, stale' : 'to do'} />}
<div className="min-w-0 flex-1">
<span className={item.done ? 'text-port-text-muted' : ''}>{item.label}</span>
+ {item.stale && <span className="ml-2 rounded bg-port-warning/10 px-1.5 py-0.5 text-xs text-port-warning">done · stale</span>}
{!item.done && item.detail && <p className="break-words text-xs text-port-text-muted">{item.detail}</p>}
</div>
{!item.done && item.action && onAction && item.action.anchor !== headerAnchor && (
diff --git a/client/src/lib/musicVideoStages.js b/client/src/lib/musicVideoStages.js
index 2129b1a045..6746eaaa70 100644
--- a/client/src/lib/musicVideoStages.js
+++ b/client/src/lib/musicVideoStages.js
@@ -421,6 +421,13 @@ 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']];
+/** "Approved earlier — changed since: concept, scene 3 prompt" for an approval whose inputs moved; null otherwise. */
+export function staleApprovalText(stale) {
+ if (!stale) return null;
+ const shown = stale.changedFields.slice(0, 4).join(', ');
+ const more = stale.changedFields.length > 4 ? ` +${stale.changedFields.length - 4} more` : '';
+ return stale.changedFields.length ? `Approved earlier — changed since: ${shown}${more}.` : 'Approved earlier — its inputs changed since.';
+}
const APPROVAL_ANCHORS = { art: 'mv-review-art', storyboard: 'mv-review-storyboard', proof: 'mv-review-proof' };
/**
@@ -441,9 +448,10 @@ export function stageChecklist(stageId, project, readiness = project?.production
const mode = project.composition?.mode || 'concat';
const approval = (key, label, waitingText) => {
const approved = !!readiness?.[key]?.approved;
+ const stale = staleApprovalText(readiness?.[key]?.stale);
return {
- id: `approve-${key}`, label: `${label} approved`, done: approved,
- detail: approved || !readiness ? null : (readiness[key]?.problems?.[0] || waitingText),
+ id: `approve-${key}`, label: `${label} approved`, done: approved, stale: !!stale,
+ detail: approved || !readiness ? null : (stale ? `${stale} Re-approve in Production approvals.` : readiness[key]?.problems?.[0] || waitingText),
action: approved ? null : { label: `Review ${label.toLowerCase()}`, anchor: APPROVAL_ANCHORS[key] },
};
};
diff --git a/client/src/lib/musicVideoStages.test.js b/client/src/lib/musicVideoStages.test.js
index 829b82f7bd..4fe4a68106 100644
--- a/client/src/lib/musicVideoStages.test.js
+++ b/client/src/lib/musicVideoStages.test.js
@@ -375,3 +375,12 @@ describe('compareMusicVideoProjectsNewestFirst', () => {
expect(sorted.map((p) => p.id)).toEqual(['p1', 'p2']);
});
});
+
+describe('stale approval text (#10141)', () => {
+ it('says what changed since an earlier approval and marks the checklist item stale', () => {
+ const readiness = { art: { approved: false, problems: [], stale: { approvedAt: 'x', changedFields: ['concept', 'scene 3 prompt'] } }, storyboard: { approved: false, problems: [] }, proof: { approved: false, problems: [] } };
+ const item = stageChecklist('cast-sets', { productionReview: { draft: {} } }, readiness).find((i) => i.id === 'approve-art');
+ expect(item).toMatchObject({ done: false, stale: true });
+ expect(item.detail).toMatch(/^Approved earlier — changed since: concept, scene 3 prompt\./);
+ });
+});
diff --git a/server/services/musicVideo/productionReview.js b/server/services/musicVideo/productionReview.js
index 5c5daa666b..5ff5480bc5 100644
--- a/server/services/musicVideo/productionReview.js
+++ b/server/services/musicVideo/productionReview.js
@@ -83,11 +83,51 @@ export function productionReviewBasis(project) {
return { art, storyboard, proof };
}
+/** Labeled per-input hashes so a stale approval can name what changed since. */
+const h = v => hash(v ?? null);
+export function productionApprovalInputs(project) {
+ const draft = project.productionReview?.draft || {};
+ const art = {
+ concept: h(project.concept), 'visual spec': h(project.visualSpec), 'style references': h(project.styleReferences),
+ 'media mode': h([project.mediaMode, project.composition?.authoringRenderer, project.composition?.mode, project.productionPolicy]),
+ 'art direction': h(project.castAndSets?.direction), cast: h(draft.cast), environments: h(draft.environments),
+ 'visual language': h(draft.visualLanguage), 'motion language': h(draft.motionLanguage),
+ 'implementation plan': h(draft.implementationPlan), 'visual guide': h(artifactBasis(artifact(project, draft.guideArtifactId))),
+ };
+ const scenes = {};
+ for (const [i, s] of (project.scenes || []).entries()) {
+ const n = i + 1;
+ scenes[`scene ${n} timing`] = h([s.startSec, s.endSec]);
+ scenes[`scene ${n} lyrics`] = h(s.lyricText);
+ scenes[`scene ${n} prompt`] = h([s.visualIntent, s.prompt, s.framePrompt]);
+ }
+ const storyboard = { ...art, song: h([source(project).trackId, source(project).uploadedAudioFilename, source(project).duration, source(project).beats, source(project).sections]),
+ lyrics: h([source(project).lyrics, source(project).markers, source(project).phrases]), 'lyric timing': h([draft.lyricsMode, draft.timingStatus, draft.timingNotes]),
+ 'storyboard shots': h([draft.storyboard, draft.storyboardSource, project.productionReview?.documentStoryboard]), treatment: h(project.treatment), ...scenes };
+ const window = project.productionReview?.proof;
+ const proof = { ...storyboard, composition: h(project.composition), 'proof window': h(window && [window.startSec, window.endSec]),
+ takes: h((project.scenes || []).map(({ sceneId, referenceImageId, videoHistoryId, performanceEdit, direction, visualLayer }) =>
+ ({ sceneId, referenceImageId, videoHistoryId, performanceEdit, direction, visualLayer }))),
+ 'sound bed': h(project.soundBed), 'video settings': h(project.videoSettings) };
+ return { art, storyboard, proof };
+}
+
+/** `{ approvedAt, changedFields }` when a stage was approved on inputs that have since moved; null otherwise. */
+function staleApproval(project, stage, current, inputs) {
+ const approval = project.productionReview?.approvals?.[stage];
+ if (!approval || approval.basis === current) return null;
+ const before = approval.inputs;
+ const changedFields = before ? Object.keys(inputs[stage]).filter(k => before[k] !== inputs[stage][k])
+ .concat(Object.keys(before).filter(k => !(k in inputs[stage]))) : [];
+ return { approvedAt: approval.approvedAt || null, changedFields: changedFields.length ? changedFields : (before ? ['proof render'] : []) };
+}
+
export function productionReadiness(project) {
const review = project.productionReview || {};
const draft = review.draft || {};
const basis = productionReviewBasis(project);
const alignmentBasis = productionAlignmentBasis(project);
+ const inputs = productionApprovalInputs(project);
const unresolved = stage => (review.feedback || []).filter(f => f.stage === stage && f.decision === 'request-changes' && !f.resolvedAt);
const artProblems = unresolved('art').map(f => `Resolve art feedback for ${f.target}: ${f.text}`);
for (const [key, label] of [['cast', 'Cast guide'], ['environments', 'Environment guide'],
@@ -154,9 +194,9 @@ export function productionReadiness(project) {
}
const proofApproved = !proofProblems.length && hasProofEvidence(review.approvals?.proof?.proofReview) && review.approvals?.proof?.basis === hash({ basis: basis.proof, excerptId: excerpt.id, filename: excerpt.filename });
return { basis, alignment: { basis: alignmentBasis, status: draft.lyricsMode === 'instrumental' ? 'instrumental'
- : draft.timingStatus !== 'verified' ? 'provisional' : review.alignmentBasis === alignmentBasis ? 'verified' : 'stale' }, documentShotImport: { documentDirectory: project.composition?.document?.directory || null, audioBasis: alignmentBasis }, art: { approved: artApproved, problems: [...new Set(artProblems)] },
- storyboard: { approved: storyboardApproved, problems: [...new Set(boardProblems)] },
- proof: { approved: proofApproved, problems: proofProblems, excerptId: excerpt?.id || null },
+ : draft.timingStatus !== 'verified' ? 'provisional' : review.alignmentBasis === alignmentBasis ? 'verified' : 'stale' }, documentShotImport: { documentDirectory: project.composition?.document?.directory || null, audioBasis: alignmentBasis }, art: { approved: artApproved, problems: [...new Set(artProblems)], stale: artApproved ? null : staleApproval(project, 'art', basis.art, inputs) },
+ storyboard: { approved: storyboardApproved, problems: [...new Set(boardProblems)], stale: storyboardApproved ? null : staleApproval(project, 'storyboard', basis.storyboard, inputs) },
+ proof: { approved: proofApproved, problems: proofProblems, excerptId: excerpt?.id || null, stale: proofApproved ? null : staleApproval(project, 'proof', basis.proof, inputs) },
readyForProduction: proofApproved };
}
@@ -186,7 +226,7 @@ export function approveProductionStage(project, { stage, basis, proofReview, app
throw new ServerError('The rendered proof changed. Play and review the new excerpt before approving.', { status: 409, code: 'MUSIC_VIDEO_REVIEW_STALE' });
}
}
- const decision = { stage, basis: expected, approvedAt: new Date().toISOString(),
+ const decision = { stage, basis: expected, inputs: productionApprovalInputs(project)[stage], approvedAt: new Date().toISOString(),
...(approvedBy ? { approvedBy } : {}), ...(reviewer ? { reviewer: structuredClone(reviewer) } : {}),
...(stage === 'proof' ? { proofReview: structuredClone(proofReview) } : {}) };
return { ...project, productionReview: { ...project.productionReview,
diff --git a/server/services/musicVideo/productionReview.stale.test.js b/server/services/musicVideo/productionReview.stale.test.js
new file mode 100644
index 0000000000..ca435a3876
--- /dev/null
+++ b/server/services/musicVideo/productionReview.stale.test.js
@@ -0,0 +1,27 @@
+import { describe, it, expect } from 'vitest';
+import { productionReadiness, productionApprovalInputs } from './productionReview.js';
+
+// Approval records the labeled inputs it was granted on, so a later change can be named.
+const approvedArt = (project) => ({ ...project, productionReview: { ...project.productionReview,
+ approvals: { art: { stage: 'art', basis: productionReadiness(project).basis.art, inputs: productionApprovalInputs(project).art, approvedAt: '2026-01-01T00:00:00.000Z' } } } });
+
+describe('stale approval reporting', () => {
+ const base = { id: 'p1', concept: 'Example concept', scenes: [{ sceneId: 's1', startSec: 0, endSec: 4, prompt: 'a' }, { sceneId: 's2', startSec: 4, endSec: 8, prompt: 'b' }], productionReview: { draft: {} } };
+
+ it('names the changed inputs once an approved basis moves', () => {
+ const approved = approvedArt(base);
+ expect(productionReadiness(approved).art.stale).toBeNull();
+ const changed = { ...approved, concept: 'Different concept' };
+ expect(productionReadiness(changed).art.stale).toEqual({ approvedAt: '2026-01-01T00:00:00.000Z', changedFields: ['concept'] });
+ });
+
+ it('reports no stale state for a stage that was never approved', () => {
+ expect(productionReadiness(base).art.stale).toBeNull();
+ });
+
+ it('labels per-scene edits for the storyboard stage', () => {
+ const inputs = productionApprovalInputs(base).storyboard;
+ const edited = productionApprovalInputs({ ...base, scenes: [base.scenes[0], { ...base.scenes[1], prompt: 'c' }] }).storyboard;
+ expect(Object.keys(edited).filter(k => edited[k] !== inputs[k])).toEqual(['scene 2 prompt']);
+ });
+});