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: approvals wait for current readiness while stage marks keep the last value (#10136)
Adam Eivy140a81a3619e
diff --git a/client/src/components/musicVideo/ProductionReviewPanel.jsx b/client/src/components/musicVideo/ProductionReviewPanel.jsxindex b9bbf2c0f6..7285363b93 100644--- a/client/src/components/musicVideo/ProductionReviewPanel.jsx+++ b/client/src/components/musicVideo/ProductionReviewPanel.jsx@@ -28,7 +28,7 @@ export default function ProductionReviewPanel({ project, review, onOpenArtifact,const [playbackReview, setPlaybackReview] = useState({ ...EMPTY_PLAYBACK, identity: null });const [startSec, setStartSec] = useState(project.productionReview?.proof?.startSec || 0);const [endSec, setEndSec] = useState(project.productionReview?.proof?.endSec || Math.min(20, project.audioAnalysis?.durationSec || 20));- const ready = review.readiness;+ const ready = review.current === false ? null : review.readiness; // approvals never act on a stale revisionconst set = (key, value) => setLocal({ ...draft, [key]: value });const documentShots = draft.storyboardSource === 'document';const shots = documentShots ? draft.storyboard : [...draft.storyboard, ...(project.scenes || []).filter(scene => !draft.storyboard.some(s => s.sceneId === scene.sceneId)).map(scene => ({diff --git a/client/src/hooks/useMusicVideoProductionReview.js b/client/src/hooks/useMusicVideoProductionReview.jsindex 22953d2111..ad5e5b37b0 100644--- a/client/src/hooks/useMusicVideoProductionReview.js+++ b/client/src/hooks/useMusicVideoProductionReview.js@@ -6,7 +6,7 @@ import useSseJobSlot from './useSseJobSlot.js';/*** Server-authoritative approvals. A read response carries `productionReadiness`; a mutation response- * does not, so the last readiness for the same project stays in place (never a flash of "not done")+ * does not, so the last readiness for the same project stays in place (never a flash of "not done"; `current` says whether it is for this exact revision)* while one review fetch refreshes it. Approvals still bind to the server-issued basis, so a stale* basis is refused rather than honoured.*/@@ -20,9 +20,9 @@ export default function useMusicVideoProductionReview({ project, replaceProjectconst [readinessError, setReadinessError] = useState(null);useEffect(() => {let active = true;- if (project?.productionReadiness) setState({ id: project.id, readiness: project.productionReadiness });+ if (project?.productionReadiness) setState({ id: project.id, owner: project, readiness: project.productionReadiness });else if (project?.id) getMusicVideoProductionReview(project.id, { silent: true })- .then(result => { if (active) { setState({ id: project.id, readiness: result.readiness }); setReadinessError(null); } })+ .then(result => { if (active) { setState({ id: project.id, owner: project, readiness: result.readiness }); setReadinessError(null); } }).catch(err => { if (active) setReadinessError(err.message); });return () => { active = false; };}, [project]);@@ -57,7 +57,10 @@ export default function useMusicVideoProductionReview({ project, replaceProjectfinally { setBusy(false); }};const readiness = project?.productionReadiness || (state && state.id === project?.id ? state.readiness : null);- return { readiness, readinessError: readiness ? null : readinessError, busy, error, proof: { ...proof, occupied: proof.active, active: proof.active && proof.context === project?.id },+ // `current`: readiness belongs to this exact project revision. Stage marks may use a stale value;+ // approval controls must wait for a current one.+ const current = !!project?.productionReadiness || state?.owner === project;+ return { readiness, current, readinessError: readiness ? null : readinessError, busy, error, proof: { ...proof, occupied: proof.active, active: proof.active && proof.context === project?.id },feedback: body => call(() => addMusicVideoProductionFeedback(project.id, { ...body, basis: readiness?.basis[body.stage] }, { silent: true })),resolveFeedback: (feedbackId, resolution) => call(() => resolveMusicVideoProductionFeedback(project.id, { feedbackId, resolution }, { silent: true })),revise: stage => call(() => reviseMusicVideoProductionFromFeedback(project.id, { stage }, { silent: true })),diff --git a/client/src/hooks/useMusicVideoProductionReview.test.jsx b/client/src/hooks/useMusicVideoProductionReview.test.jsxindex a2c28a2be2..e7cc67313f 100644--- a/client/src/hooks/useMusicVideoProductionReview.test.jsx+++ b/client/src/hooks/useMusicVideoProductionReview.test.jsx@@ -21,8 +21,10 @@ describe('useMusicVideoProductionReview readiness source (#10136)', () => {it('uses the readiness on the read response without another request, and keeps it across a mutation response', async () => {const { result, rerender } = run({ id: 'a', productionReadiness: readiness });expect(result.current.readiness).toBe(readiness);+ expect(result.current.current).toBe(true);rerender({ p: { id: 'a' } }); // mutation response: no readiness fieldexpect(result.current.readiness).toBe(readiness);+ expect(result.current.current).toBe(false); // stale for stage marks, never for approvalsawait waitFor(() => expect(api.getMusicVideoProductionReview).toHaveBeenCalledTimes(1));});