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: keep treatment note edits and Apply from tripping over each other (#8980)
[._.]/ Adam Eivy3e918a4eb2a6
diff --git a/client/src/components/musicVideo/TreatmentPanel.jsx b/client/src/components/musicVideo/TreatmentPanel.jsxindex f5512b2436..38018d6de7 100644--- a/client/src/components/musicVideo/TreatmentPanel.jsx+++ b/client/src/components/musicVideo/TreatmentPanel.jsx@@ -62,7 +62,9 @@ export default function TreatmentPanel({ project, treatment: api }) {const [notesSaving, setNotesSaving] = useState(false);const saveNotes = (referenceNotes) => {setNotesSaving(true);- return saveBrief({ referenceNotes }).finally(() => setNotesSaving(false));+ // Only the editable fields go back: source/addedAt are server-stamped provenance.+ const editable = referenceNotes.map(({ id, note, url }) => ({ ...(id ? { id } : {}), note, url }));+ return saveBrief({ referenceNotes: editable }).finally(() => setNotesSaving(false));};const notes = brief.referenceNotes || [];const urlValid = !noteUrl.trim() || /^https?:\/\/\S+$/i.test(noteUrl.trim());diff --git a/client/src/components/musicVideo/TreatmentPanel.test.jsx b/client/src/components/musicVideo/TreatmentPanel.test.jsxindex b4462c00ad..22ec136911 100644--- a/client/src/components/musicVideo/TreatmentPanel.test.jsx+++ b/client/src/components/musicVideo/TreatmentPanel.test.jsx@@ -167,6 +167,19 @@ describe('TreatmentPanel edits and compile', () => {await waitFor(() => expect(api.compileMusicVideoTreatment).toHaveBeenCalledWith('mv-1', { baseRevision: 3, useAi: false }, { silent: true }));});+ it('re-sends only the editable fields of existing reference notes', async () => {+ api.updateMusicVideoTreatment.mockResolvedValue({ treatment: { ...TREATMENT, revision: 4 } });+ const stored = { id: 'mvn-1', note: 'grainy 16mm', url: 'https://example.com/a', source: 'user', addedAt: '2026-01-01T00:00:00.000Z' };+ render(<Harness initial={{ ...PROJECT, treatment: { ...TREATMENT, brief: { ...TREATMENT.brief, referenceNotes: [stored] } } }} />);+ fireEvent.change(screen.getByLabelText('Reference note'), { target: { value: 'hand-drawn overlays' } });+ fireEvent.click(screen.getByText('Add note'));+ await waitFor(() => expect(api.updateMusicVideoTreatment).toHaveBeenCalledTimes(1));+ expect(api.updateMusicVideoTreatment.mock.calls[0][1].brief.referenceNotes).toEqual([+ { id: 'mvn-1', note: 'grainy 16mm', url: 'https://example.com/a' },+ { note: 'hand-drawn overlays', url: null },+ ]);+ });+it('serializes quick brief edits so each carries the revision the previous save returned', async () => {let revision = 3;api.updateMusicVideoTreatment.mockImplementation(async (_id, body) => {diff --git a/client/src/hooks/useMusicVideoTreatment.js b/client/src/hooks/useMusicVideoTreatment.jsindex 33dad4fa04..e49d70cb1c 100644--- a/client/src/hooks/useMusicVideoTreatment.js+++ b/client/src/hooks/useMusicVideoTreatment.js@@ -119,7 +119,9 @@ export default function useMusicVideoTreatment({ project, onProjectPatch, replacconst id = projectId;const { revision } = preview;setApplying(true);- return chainRef.current+ // Apply joins the same write chain, so an edit or proof review started+ // meanwhile runs after it (with the revision it leaves) instead of racing it.+ const run = chainRef.current.then(() => applyMusicVideoTreatment(id, { revision, overwrite, addTextCues }, { silent: true })).then(({ project: next, result }) => {replaceProject?.(next);@@ -135,6 +137,8 @@ export default function useMusicVideoTreatment({ project, onProjectPatch, replacreturn null;}).finally(() => setApplying(false));+ chainRef.current = run;+ return run;};const reviewProof = (proofId, review) => enqueue(