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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
Keep an earlier storyboard approval when shots are locked one at a time (#11224)
[._.]/b811a4a594e3
diff --git a/server/services/musicVideo/productionReview.js b/server/services/musicVideo/productionReview.jsindex e6dbb6e52f..072befc0a7 100644--- a/server/services/musicVideo/productionReview.js+++ b/server/services/musicVideo/productionReview.js@@ -126,13 +126,21 @@ function shotApprovalBasis(project, scene) {row: row ? { action: row.action, staging: row.staging, camera: row.camera, transition: row.transition, lyricCueIds: row.lyricCueIds } : null });}-/** Each Board shot's lock: `locked`, `changed` (locked, then edited) or `open`. Null for a document storyboard. */+/** Is the whole-board storyboard approval (given before shots locked one by one, or by Approve all) current? */+const boardApprovalCovers = project => storyboardApprovalCurrent(project.productionReview?.approvals?.storyboard, productionReviewBasis(project));++/**+ * Each Board shot's lock: `locked`, `changed` (locked, then edited) or `open`. Null for a document storyboard.+ * A shot with no lock of its own is locked while a current whole-board approval covers it, so a board+ * approved before per-shot locks existed stays approved after one shot is locked or unlocked.+ */export function shotLocks(project) {if (project.productionReview?.draft?.storyboardSource === 'document') return null;const approvals = project.productionReview?.shotApprovals || {};+ const covered = (project.scenes || []).some(scene => !approvals[scene.sceneId]) && boardApprovalCovers(project);return Object.fromEntries((project.scenes || []).map(scene => {const approval = approvals[scene.sceneId];- return [scene.sceneId, !approval ? 'open' : approval.basis === shotApprovalBasis(project, scene) ? 'locked' : 'changed'];+ return [scene.sceneId, !approval ? (covered ? 'locked' : 'open') : approval.basis === shotApprovalBasis(project, scene) ? 'locked' : 'changed'];}));}@@ -145,6 +153,15 @@ export function setShotLocks(project, { sceneIds, locked, reviewer = null, approif (scenes.some(scene => !scene)) throw new ServerError('Scene not found', { status: 404, code: 'NOT_FOUND' });const approvals = { ...project.productionReview?.shotApprovals };const approvedAt = new Date().toISOString();+ // A current whole-board approval becomes a lock on every shot it covers first, so withdrawing it+ // below (or a later edit staling it) never opens the shots the director did not touch.+ if (boardApprovalCovers(project)) {+ const carried = project.productionReview.approvals.storyboard;+ for (const scene of project.scenes || []) {+ if (!approvals[scene.sceneId]) approvals[scene.sceneId] = { basis: shotApprovalBasis(project, scene), approvedAt: carried.approvedAt || approvedAt, fromBoardApproval: true,+ ...(carried.approvedBy ? { approvedBy: carried.approvedBy } : {}), ...(carried.reviewer ? { reviewer: structuredClone(carried.reviewer) } : {}) };+ }+ }for (const scene of scenes) {if (!locked) delete approvals[scene.sceneId];else approvals[scene.sceneId] = { basis: shotApprovalBasis(project, scene), approvedAt,diff --git a/server/services/musicVideo/productionReview.storyboard.test.js b/server/services/musicVideo/productionReview.storyboard.test.jsindex 152aad5704..16ffc3373f 100644--- a/server/services/musicVideo/productionReview.storyboard.test.js+++ b/server/services/musicVideo/productionReview.storyboard.test.js@@ -158,6 +158,25 @@ describe('locking shots one at a time', () => {expect(productionReadiness(relocked).storyboard.approved).toBe(true);});+ // Uniquely catches a board approved before per-shot locks shipped dropping to "N shots not locked"+ // the moment one shot is locked or unlocked.+ it('keeps an earlier whole-board approval as a lock on every shot it covers', () => {+ const art = artApproved();+ const approved = approveProductionStage(art, { stage: 'storyboard', basis: productionReadiness(art).basis.storyboard });+ const { shotApprovals: _none, ...review } = approved.productionReview;+ const legacy = { ...approved, productionReview: review };+ expect(productionReadiness(legacy).storyboard).toMatchObject({ approved: true, unlocked: [] });+ // The shape already saved by the first release: one shot locked on top of the old approval.+ const s2 = { basis: setShotLocks(legacy, { sceneIds: ['s2'], locked: true }).productionReview.shotApprovals.s2.basis };+ expect(productionReadiness({ ...legacy, productionReview: { ...review, shotApprovals: { s2 } } }).storyboard)+ .toMatchObject({ approved: true, unlocked: [] });+ // Locking now carries the approval onto every shot, so it outlives the approval going stale.+ expect(Object.keys(setShotLocks(legacy, { sceneIds: ['s2'], locked: true }).productionReview.shotApprovals)).toEqual(['s1', 's2', 's3']);+ const unlocked = setShotLocks(legacy, { sceneIds: ['s2'], locked: false });+ expect(productionReadiness(unlocked).storyboard).toMatchObject({ approved: false, unlocked: ['s2'] });+ expect(() => assertShotApproval(unlocked, 's1')).not.toThrow();+ });+// Uniquely catches unlocking every shot falling back to the old whole-board approval.it('leaves the board unapproved after every shot of an approved board is unlocked', () => {const art = artApproved();