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

fix: gate code video generation on server storyboard readiness, not a stale approval basis (#10163)

Adam Eivy4397add4b4bb
diff --git a/client/src/components/musicVideo/CodeVideoPanel.jsx b/client/src/components/musicVideo/CodeVideoPanel.jsx
index 0a588a5e06..20cbb91359 100644
--- a/client/src/components/musicVideo/CodeVideoPanel.jsx
+++ b/client/src/components/musicVideo/CodeVideoPanel.jsx
@@ -17,7 +17,7 @@ const inputCls = 'block w-full rounded border border-port-border bg-port-card px
* Generation is gated on storyboard approval with inline reason (#10163).
* Sections with generated code are marked in the select (#10163).
*/
-export default function CodeVideoPanel({ project, audioUrl, onProject }) {
+export default function CodeVideoPanel({ project, audioUrl, onProject, productionReadiness }) {
const [searchParams, setSearchParams] = useSearchParams();
const [doc, setDoc] = useState(null);
const [error, setError] = useState('');
@@ -136,15 +136,7 @@ export default function CodeVideoPanel({ project, audioUrl, onProject }) {
[project?.composition?.codeVideo?.sections],
);
- // Get production readiness from project (server computes this for read endpoints)
- const productionReadiness = useMemo(() => {
- if (!project?.productionReview) return null;
- // Check if storyboard is approved (simple client-side check based on available data)
- const approvalBasis = project.productionReview.approvals?.storyboard?.basis;
- const storyboardApproved = !!approvalBasis;
- return { storyboard: { approved: storyboardApproved } };
- }, [project?.productionReview]);
-
+ // Server-computed readiness: approval freshness included, null while loading.
const canGenerate = productionReadiness?.storyboard?.approved ?? false;
const generateDisabledReason = !canGenerate ? 'Approve the storyboard first' : null;
diff --git a/client/src/components/musicVideo/CodeVideoPanel.test.jsx b/client/src/components/musicVideo/CodeVideoPanel.test.jsx
index 5651601c8b..48ba172b91 100644
--- a/client/src/components/musicVideo/CodeVideoPanel.test.jsx
+++ b/client/src/components/musicVideo/CodeVideoPanel.test.jsx
@@ -72,10 +72,12 @@ beforeEach(() => {
api.regenerateMusicVideoCodeSection.mockResolvedValue({ project });
});
-function renderPanel(testProject = project) {
+const APPROVED = { storyboard: { approved: true } };
+
+function renderPanel(testProject = project, readiness = APPROVED) {
return render(
<MemoryRouter initialEntries={['/music-video/mv-1']}>
- <CodeVideoPanel project={testProject} audioUrl={null} onProject={vi.fn()} />
+ <CodeVideoPanel project={testProject} audioUrl={null} onProject={vi.fn()} productionReadiness={readiness} />
</MemoryRouter>,
);
}
@@ -125,7 +127,7 @@ describe('CodeVideoPanel section select (#10163)', () => {
});
it('disables both Generate buttons and shows reason when storyboard not approved', async () => {
- renderPanel(projectNoStoryboard);
+ renderPanel(projectNoStoryboard, { storyboard: { approved: false } });
await screen.findByLabelText('Section to regenerate');
const generateBtn = screen.getByRole('button', { name: /Generate code video/ });
const regenerateBtn = screen.getByRole('button', { name: /Regenerate section/ });
@@ -134,6 +136,13 @@ describe('CodeVideoPanel section select (#10163)', () => {
expect(await screen.findByText('Approve the storyboard first')).toBeTruthy();
});
+ it('stays gated when a saved approval is stale (server readiness says not approved)', async () => {
+ renderPanel(project, { storyboard: { approved: false } });
+ await screen.findByLabelText('Section to regenerate');
+ expect(screen.getByRole('button', { name: /Generate code video/ })).toBeDisabled();
+ expect(await screen.findByText('Approve the storyboard first')).toBeTruthy();
+ });
+
it('enables Generate buttons when storyboard is approved', async () => {
renderPanel();
await screen.findByLabelText('Section to regenerate');
diff --git a/client/src/components/musicVideo/stages/ComposeStage.jsx b/client/src/components/musicVideo/stages/ComposeStage.jsx
index 817a37417c..7bf1089fdb 100644
--- a/client/src/components/musicVideo/stages/ComposeStage.jsx
+++ b/client/src/components/musicVideo/stages/ComposeStage.jsx
@@ -26,7 +26,7 @@ export default function ComposeStage({ board }) {
</div>
<GradePanel project={project} onSave={board.saveCompositionGrade} />
{mode !== 'eidoverse' && <TypographyPanel project={project} onEditLocal={board.editProjectLocal} onSave={board.saveProjectFields} />}
- {mode === 'eidoverse' && <EidoverseVideoPanel key={project.id} project={project} onProject={board.replaceProject} />}
+ {mode === 'eidoverse' && <EidoverseVideoPanel key={project.id} project={project} onProject={board.replaceProject} productionReadiness={board.productionReadiness} />}
{mode === 'code' && (
<CodeVideoPanel project={project} audioUrl={audioUrl} onProject={board.replaceProject} />
)}