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: require an applied medium plan before production (#9301)

[._.]/ Adam Eivy038d76e23c08
diff --git a/client/src/components/musicVideo/AutopilotPanel.test.jsx b/client/src/components/musicVideo/AutopilotPanel.test.jsx
index 6ba3169e69..9438e572d8 100644
--- a/client/src/components/musicVideo/AutopilotPanel.test.jsx
+++ b/client/src/components/musicVideo/AutopilotPanel.test.jsx
@@ -173,7 +173,7 @@ describe('AutopilotPanel production run', () => {
productionPolicy: { strategy: 'code-first', maxGeneratedVideoPercent: 0 },
composition: { mode: 'document' }, audioAnalysis: { durationSec: 8 },
scenes: [{ sceneId: 'code', startSec: 0, endSec: 8 }],
- treatment: { shotDirections: [{ sceneId: 'code', medium: 'procedural', mediumRationale: 'Typography' }] },
+ treatment: { revision: 1, appliedRevision: 1, shotDirections: [{ sceneId: 'code', medium: 'procedural', mediumRationale: 'Typography' }] },
}} />);
expect(api.startMusicVideoProduction).not.toHaveBeenCalled();
fireEvent.click(screen.getByRole('button', { name: 'Start production' }));
diff --git a/server/lib/musicVideoMediumPlan.js b/server/lib/musicVideoMediumPlan.js
index ed349ab113..acbc2e1070 100644
--- a/server/lib/musicVideoMediumPlan.js
+++ b/server/lib/musicVideoMediumPlan.js
@@ -96,6 +96,9 @@ export function codeFirstProductionAssets(project) {
const directions = new Map((project?.treatment?.shotDirections || []).map((d) => [d.sceneId, d]));
const steps = [];
const conflicts = plan.unresolved.filter((item) => item.blocking || item.message.startsWith('Visible performance')).map((item) => item.message);
+ if (!Number.isInteger(project.treatment?.revision) || project.treatment.appliedRevision !== project.treatment.revision) {
+ conflicts.push('Apply the current medium plan to approve it before production.');
+ }
for (const scene of project?.scenes || []) {
const direction = directions.get(scene.sceneId);
const medium = direction?.medium;
diff --git a/server/services/musicVideo/productionService.test.js b/server/services/musicVideo/productionService.test.js
index be824b3876..4821ec1b9d 100644
--- a/server/services/musicVideo/productionService.test.js
+++ b/server/services/musicVideo/productionService.test.js
@@ -544,7 +544,7 @@ function seedCodeFirst({ scenes, directions, percent = 0, ...patch } = {}) {
return seedProject({ composition: { mode: 'document' },
productionPolicy: { strategy: 'code-first', maxGeneratedVideoPercent: percent },
scenes: scenes || [{ sceneId: 'mvs-code', label: 'Code', startSec: 0, endSec: 8 }],
- treatment: { shotDirections: directions || [{ sceneId: 'mvs-code', medium: 'procedural', mediumRationale: 'Typography' }] }, ...patch,
+ treatment: { revision: 1, appliedRevision: 1, shotDirections: directions || [{ sceneId: 'mvs-code', medium: 'procedural', mediumRationale: 'Typography' }] }, ...patch,
});
}
function documentDoubles() {
@@ -633,6 +633,14 @@ describe('code-first production execution (#9301)', () => {
await expect(start({ pool: POOL, authoring: AUTHORING })).rejects.toMatchObject({ code: 'PRODUCTION_MEDIUM_CONFLICT' });
});
+ it('requires the current plan to be applied before starting any provider work', async () => {
+ seedCodeFirst(); const { author } = documentDoubles();
+ store.get('mv-example').treatment.revision = 2;
+ await expect(start({ pool: [], authoring: AUTHORING })).rejects.toMatchObject({ code: 'PRODUCTION_MEDIUM_CONFLICT' });
+ expect(dispatch).not.toHaveBeenCalled(); expect(author).not.toHaveBeenCalled();
+ expect(current().productionRuns).toBeUndefined();
+ });
+
it('refuses an approved performance disguised by a legacy card layer before any provider call', async () => {
seedCodeFirst({ percent: 100,
scenes: [{ sceneId: 'mvs-code', shotMode: 'performance', visualLayer: 'card', startSec: 0, endSec: 8 }],