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

address review (claude): resolve guides from every image root, keep guide picks consistent

[._.]/ Adam Eivyfad3428dfca7
diff --git a/client/src/components/musicVideo/SceneCastVariant.jsx b/client/src/components/musicVideo/SceneCastVariant.jsx
index 6f602aba65..283e86ecf6 100644
--- a/client/src/components/musicVideo/SceneCastVariant.jsx
+++ b/client/src/components/musicVideo/SceneCastVariant.jsx
@@ -13,7 +13,14 @@ export default function SceneCastVariant({ project, scene, castMedia = null, onE
if (!cast.length) return null;
const variant = scene.characterVariant || null;
const id = (name) => `mv-scene-${scene.sceneId}-cast-${name}`;
- const save = (next) => { onEditLocal(scene.sceneId, { characterVariant: next }); onSave(scene.sceneId, { characterVariant: next }); };
+ // A shot's hand-picked references keep their guide ids only for the variant that picked them.
+ const save = (next) => {
+ const patch = Array.isArray(scene.frameReferenceIds)
+ ? { characterVariant: next, frameReferenceIds: scene.frameReferenceIds.filter((refId) => !refId.startsWith('mvr-guide-')) }
+ : { characterVariant: next };
+ onEditLocal(scene.sceneId, patch);
+ onSave(scene.sceneId, patch);
+ };
const withField = (key, value) => {
const next = { ...variant, [key]: value };
if (value === undefined) delete next[key];
diff --git a/client/src/components/musicVideo/SceneCastVariant.test.jsx b/client/src/components/musicVideo/SceneCastVariant.test.jsx
index 92638475b8..4ff806461b 100644
--- a/client/src/components/musicVideo/SceneCastVariant.test.jsx
+++ b/client/src/components/musicVideo/SceneCastVariant.test.jsx
@@ -33,6 +33,14 @@ describe('a shot\'s Cast guides picker', () => {
expect(onSave).toHaveBeenLastCalledWith('s1', { characterVariant: null });
});
+ // Uniquely catches hand-picked guide ids from the previous variant surviving a variant change.
+ it('drops the previous variant guide ids from hand-picked references', () => {
+ const onSave = vi.fn();
+ render(<SceneCastVariant project={project} scene={{ sceneId: 's1', characterVariant: { ingredientId: 'cat-chr-x' }, frameReferenceIds: ['r1', 'mvr-guide-a.png'] }} onEditLocal={vi.fn()} onSave={onSave} />);
+ fireEvent.change(screen.getByLabelText('Era'), { target: { value: 'teen' } });
+ expect(onSave).toHaveBeenLastCalledWith('s1', { characterVariant: { ingredientId: 'cat-chr-x', era: 'teen' }, frameReferenceIds: ['r1'] });
+ });
+
it('renders nothing when no subject is saved to Casting', () => {
const { container } = render(<SceneCastVariant project={{ concept: { subjects: [project.concept.subjects[1]] } }} scene={{ sceneId: 's1' }} onEditLocal={vi.fn()} onSave={vi.fn()} />);
expect(container.firstChild).toBeNull();
diff --git a/client/src/components/musicVideo/SceneFrameReferences.jsx b/client/src/components/musicVideo/SceneFrameReferences.jsx
index d4b92d3fb9..cd48046bff 100644
--- a/client/src/components/musicVideo/SceneFrameReferences.jsx
+++ b/client/src/components/musicVideo/SceneFrameReferences.jsx
@@ -53,6 +53,9 @@ export default function SceneFrameReferences({ project, scene, castMedia = null,
if (longPressed.current) { longPressed.current = false; return; }
action();
};
+ // Until the cast member's guides load, an edit would save the row without them.
+ const variantId = scene.characterVariant?.ingredientId;
+ const locked = disabled || Boolean(castMedia && variantId && castMedia[variantId] === undefined);
const set = (next) => { onEditLocal(scene.sceneId, { frameReferenceIds: next }); onSave(scene.sceneId, { frameReferenceIds: next }); };
return (
@@ -60,7 +63,7 @@ export default function SceneFrameReferences({ project, scene, castMedia = null,
<div className="flex flex-wrap items-center gap-x-2 text-[11px] text-port-text-muted">
<span className="font-medium text-port-text">References</span>
{auto ? <span>Auto: from the prompt</span> : (
- <button type="button" onClick={() => set(null)} disabled={disabled} className="min-h-[44px] underline sm:min-h-0">Back to auto</button>
+ <button type="button" onClick={() => set(null)} disabled={locked} className="min-h-[44px] underline sm:min-h-0">Back to auto</button>
)}
</div>
<ul className="flex flex-wrap gap-1">
@@ -68,7 +71,7 @@ export default function SceneFrameReferences({ project, scene, castMedia = null,
<li key={ref.id} className={CHIP} {...previewProps(ref)}>
{thumb(ref)}
<span className="min-w-0 max-w-[10rem] truncate">{nameOf(ref)}</span>
- <button type="button" onClick={unlessLongPress(() => { set(ids.filter((id) => id !== ref.id)); setPreview((shown) => (shown?.id === ref.id ? null : shown)); })} disabled={disabled} aria-label={`Don't send ${nameOf(ref)}`}
+ <button type="button" onClick={unlessLongPress(() => { set(ids.filter((id) => id !== ref.id)); setPreview((shown) => (shown?.id === ref.id ? null : shown)); })} disabled={locked} aria-label={`Don't send ${nameOf(ref)}`}
className="inline-flex min-h-[40px] min-w-[32px] items-center justify-center rounded hover:bg-port-border disabled:opacity-50 sm:min-h-[28px] sm:min-w-[24px]">
<X size={12} aria-hidden="true" />
</button>
@@ -76,7 +79,7 @@ export default function SceneFrameReferences({ project, scene, castMedia = null,
))}
{others.length > 0 && (
<li>
- <button type="button" onClick={() => setAdding((open) => !open)} disabled={disabled || full} aria-expanded={adding}
+ <button type="button" onClick={() => setAdding((open) => !open)} disabled={locked || full} aria-expanded={adding}
title={full ? `Up to ${MUSIC_VIDEO_MAX_CONDITIONING_REFERENCES} references` : 'Send another character or set'}
className={`${CHIP} px-2 disabled:opacity-50`}>
<Plus size={12} aria-hidden="true" /> Add
@@ -90,7 +93,7 @@ export default function SceneFrameReferences({ project, scene, castMedia = null,
<ul aria-label="References to add" className="grid grid-cols-2 gap-1 sm:grid-cols-3 lg:grid-cols-4">
{others.map((ref) => (
<li key={ref.id} className="min-w-0">
- <button type="button" onClick={unlessLongPress(() => { set([...ids, ref.id]); setAdding(false); setPreview(null); })} disabled={disabled} {...previewProps(ref)}
+ <button type="button" onClick={unlessLongPress(() => { set([...ids, ref.id]); setAdding(false); setPreview(null); })} disabled={locked} {...previewProps(ref)}
className={`${CHIP} w-full text-left hover:bg-port-border/40`}>
{thumb(ref)}<span className="min-w-0 truncate">{nameOf(ref)}</span>
</button>
diff --git a/client/src/components/musicVideo/SceneFrameReferences.test.jsx b/client/src/components/musicVideo/SceneFrameReferences.test.jsx
index 334ac8305b..e2aedfd052 100644
--- a/client/src/components/musicVideo/SceneFrameReferences.test.jsx
+++ b/client/src/components/musicVideo/SceneFrameReferences.test.jsx
@@ -63,3 +63,14 @@ describe('a shot that names a Casting cast member', () => {
expect(onSave).toHaveBeenCalledWith('s1', { frameReferenceIds: ['mvr-guide-child.png', 'mvr-guide-adult.png'] });
});
});
+
+describe('a shot whose Casting guides are still loading', () => {
+ // Uniquely catches an edit made before the guides load saving the shot's references without them.
+ it('locks the row until the cast member\'s media arrives', () => {
+ const scene = { sceneId: 's1', characterVariant: { ingredientId: 'cat-chr-x' }, frameReferenceIds: ['r1', 'mvr-guide-child.png'] };
+ const { rerender } = render(<SceneFrameReferences project={project} scene={scene} castMedia={{}} onEditLocal={vi.fn()} onSave={vi.fn()} />);
+ expect(screen.getByRole('button', { name: /Don't send Lead/ }).disabled).toBe(true);
+ rerender(<SceneFrameReferences project={project} scene={scene} castMedia={{ 'cat-chr-x': null }} onEditLocal={vi.fn()} onSave={vi.fn()} />);
+ expect(screen.getByRole('button', { name: /Don't send Lead/ }).disabled).toBe(false);
+ });
+});
diff --git a/client/src/hooks/useMusicVideoSceneMedia.js b/client/src/hooks/useMusicVideoSceneMedia.js
index 2149d3bbee..f6f3cbb068 100644
--- a/client/src/hooks/useMusicVideoSceneMedia.js
+++ b/client/src/hooks/useMusicVideoSceneMedia.js
@@ -11,6 +11,7 @@ import { generateImage } from '../services/apiSystem.js';
import { generateVideo } from '../services/apiImageVideo.js';
import useSceneBatch from './useSceneBatch.js';
import useSceneRenderLifecycle from './useSceneRenderLifecycle.js';
+import { useVisibilityEvent } from './useVisibilityEvent.js';
import { isLtx2FamilyRuntime } from '../lib/runnerFamilies';
import { isLayeredComposition, isSelfDrawnLayer, sceneVisualLayer } from '../lib/musicVideoLayers.js';
import { musicVideoFrameGenSize } from '../lib/musicVideoAspect.js';
@@ -159,18 +160,22 @@ export default function useMusicVideoSceneMedia({ project, videoSettings, applyS
return () => { live = false; };
}, [projectId, restoreFrameJobs, restoreVideoJobs, restoreEndFrameJobs]);
// The Casting media of every cast member a shot names in its `characterVariant`
- // (#12763), keyed by ingredient id. A shot's frames lead with that member's
- // guides; until a load lands (or when it fails) the shot uses the automatic set.
+ // (#12763), keyed by ingredient id: an array once loaded, null when the load
+ // failed, absent while pending. A shot's frames lead with that member's guides;
+ // without an array the shot uses the automatic set. Casting has no change event,
+ // so the board reloads them when its tab comes back into view.
const castIds = [...new Set((project?.scenes || []).map((scene) => scene?.characterVariant?.ingredientId).filter(Boolean))].sort().join(',');
const [castMedia, setCastMedia] = useState({});
+ const [castRefresh, setCastRefresh] = useState(0);
+ useVisibilityEvent((state) => { if (state === 'visible') setCastRefresh((n) => n + 1); });
useEffect(() => {
if (!castIds) return undefined;
let active = true;
Promise.all(castIds.split(',').map((id) => listCatalogIngredientMedia(id, { silent: true })
- .then((media) => (Array.isArray(media) ? [id, media] : null), () => null)))
- .then((entries) => { if (active) setCastMedia(Object.fromEntries(entries.filter(Boolean))); });
+ .then((media) => [id, Array.isArray(media) ? media : null], () => [id, null])))
+ .then((entries) => { if (active) setCastMedia(Object.fromEntries(entries)); });
return () => { active = false; };
- }, [castIds]);
+ }, [castIds, castRefresh]);
const genScenes = frameLane.genScenes;
const genVideoScenes = videoLane.genScenes;
diff --git a/server/services/musicVideo/productionDispatch.js b/server/services/musicVideo/productionDispatch.js
index 32375d483f..a8db0c8ceb 100644
--- a/server/services/musicVideo/productionDispatch.js
+++ b/server/services/musicVideo/productionDispatch.js
@@ -27,7 +27,7 @@ import { currentPlateEvidence } from '../../lib/musicVideoPlateEvidence.js';
import { withMusicVideoStyle } from './styleReferences.js';
import { ServerError } from '../../lib/errorHandler.js';
-import { resolveGalleryImage } from '../../lib/pathSafety.js';
+import { resolveGalleryImage, resolveImageInputPath } from '../../lib/pathSafety.js';
import { RENDER_TARGET } from '../../lib/renderTargets.js';
import { falSceneTake, falTakeRequestFields, grokCoverage, runwaySceneTake, runwayTakeRequestFields } from '../../lib/musicVideoShotTiming.js';
import { authoredShotPrompt, musicVideoFrameModelInput } from '../../lib/musicVideoShotPrompt.js';
@@ -55,8 +55,9 @@ async function dispatchFrame({ project, scene, route, tag, settings }) {
const fixes = typeof scene.stillFixes?.text === 'string' ? scene.stillFixes.text : '';
const { prompt, promptAdditions } = musicVideoFrameModelInput(project, scene, { repairs: unmet, fixes });
if (!prompt) throw unprompted(scene, 'frame');
+ // A Casting guide may live in any image-input root (catalog.js validates it with resolveImageInputPath).
const referenceImagePaths = conditioningReferences(project, scene, await loadSceneCastMedia(scene))
- .map((ref) => resolveGalleryImage(ref.imageId, { mustExist: false })).filter(Boolean);
+ .map((ref) => (ref.castGuide ? resolveImageInputPath(ref.imageId) : resolveGalleryImage(ref.imageId, { mustExist: false }))).filter(Boolean);
const [{ resolveRenderTargetConfig }, { resolveImageCleaners }, { enqueueJob }] = await Promise.all([
import('../imageGen/cloudProviderConfig.js'),
import('../../lib/imageCleanDefaults.js'),