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
fix: refreshed review snapshot counts as newest (#12067)
[._.]/ Adam Eivy013422f7bc12
diff --git a/server/services/musicVideo/productionReview.js b/server/services/musicVideo/productionReview.jsindex 4272f2eaf2..56eb125d0d 100644--- a/server/services/musicVideo/productionReview.js+++ b/server/services/musicVideo/productionReview.js@@ -908,7 +908,7 @@ export function approveProductionStage(project, { stage, basis, proofReview, app}return { ...project, productionReview: { ...project.productionReview,approvalHistory: [...(project.productionReview?.approvalHistory || []), decision].slice(-MAX_APPROVAL_HISTORY),- reviewedRevisions: pruneReviewedRevisions({ ...project.productionReview?.reviewedRevisions, [basis]: { draft: structuredClone(project.productionReview?.draft || {}), scenes: structuredClone(project.scenes || []), proof: structuredClone(project.productionReview?.proof || null), capturedAt: new Date().toISOString() } }, project.productionReview?.feedback),+ reviewedRevisions: pruneReviewedRevisions({ ...omitKey(project.productionReview?.reviewedRevisions, basis), [basis]: { draft: structuredClone(project.productionReview?.draft || {}), scenes: structuredClone(project.scenes || []), proof: structuredClone(project.productionReview?.proof || null), capturedAt: new Date().toISOString() } }, project.productionReview?.feedback),approvals: { ...project.productionReview?.approvals, [stage]: decision } } };}@@ -950,6 +950,8 @@ export function carryStoryboardApproval(before, after, reason) {return { ...after, productionReview: { ...after.productionReview, approvals } };}+// A refreshed snapshot is re-inserted last so insertion order doubles as recency.+const omitKey = (obj, key) => Object.fromEntries(Object.entries(obj || {}).filter(([k]) => k !== key));const MAX_APPROVAL_HISTORY = 50;const MAX_RECENT_REVISIONS = 5;diff --git a/server/services/musicVideo/productionReview.retention.test.js b/server/services/musicVideo/productionReview.retention.test.jsindex 8f6b0870a1..7eb9d31d2c 100644--- a/server/services/musicVideo/productionReview.retention.test.js+++ b/server/services/musicVideo/productionReview.retention.test.js@@ -36,6 +36,20 @@ describe('production review record growth', () => {expect(project.productionReview.approvalHistory.at(-1).basis).toBe(project.productionReview.approvals.art.basis);});+ it('treats a refreshed snapshot as newest when timestamps tie', () => {+ vi.useFakeTimers();+ vi.setSystemTime(new Date('2026-01-01T00:00:00Z'));+ try {+ let project = artProject('Grain 0');+ const first = productionReadiness(project).basis.art;+ project = approve(project);+ for (let n = 1; n < 5; n++) project = approve(revise(project, n));+ project = approve(revise(project, 0));+ project = approve(revise(project, 5));+ expect(Object.keys(project.productionReview.reviewedRevisions)).toContain(first);+ } finally { vi.useRealTimers(); }+ });+it('keeps the snapshot an open comment points at, and drops it once resolved', () => {let project = artProject('Grain 0');const commentBasis = productionReadiness(project).basis.art;