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: show every prompt a treatment would replace and require notes on proof verdicts (#8980)

[._.]/ Adam Eivy9348519b963d
diff --git a/client/src/components/musicVideo/TreatmentApplyReview.jsx b/client/src/components/musicVideo/TreatmentApplyReview.jsx
index 58239a76db..690a701652 100644
--- a/client/src/components/musicVideo/TreatmentApplyReview.jsx
+++ b/client/src/components/musicVideo/TreatmentApplyReview.jsx
@@ -9,6 +9,7 @@ const PROMPT_LABELS = {
none: 'prompts untouched',
};
+const PROMPT_FIELDS = [['framePrompt', 'Frame prompt'], ['prompt', 'Motion prompt']];
const snippet = (text) => (text && text.length > 90 ? `${text.slice(0, 89)}…` : text || '—');
/**
@@ -82,8 +83,13 @@ export default function TreatmentApplyReview({ project, api }) {
</div>
{s.prompt === 'manual' && (
<div className="mt-1 space-y-0.5">
- <p className="text-port-text-muted">Yours: {snippet(s.current.framePrompt || s.current.prompt)}</p>
- <p className="text-port-text-muted">Treatment: {snippet(s.suggested.framePrompt || s.suggested.prompt)}</p>
+ {/* Every hand-edited field the tick would replace, side by side. */}
+ {PROMPT_FIELDS.filter(([field]) => s.fields?.[field] === 'manual').map(([field, name]) => (
+ <div key={field}>
+ <p className="text-port-text-muted">{name} — yours: {snippet(s.current[field])}</p>
+ <p className="text-port-text-muted">{name} — treatment: {snippet(s.suggested[field])}</p>
+ </div>
+ ))}
<label className="flex items-center gap-1.5">
<input type="checkbox" checked={!!overwrite[s.sceneId]}
onChange={(e) => setOverwrite((prev) => ({ ...prev, [s.sceneId]: e.target.checked }))} />
diff --git a/client/src/components/musicVideo/TreatmentPanel.jsx b/client/src/components/musicVideo/TreatmentPanel.jsx
index 1b0c0087b5..3ff816c669 100644
--- a/client/src/components/musicVideo/TreatmentPanel.jsx
+++ b/client/src/components/musicVideo/TreatmentPanel.jsx
@@ -57,6 +57,13 @@ export default function TreatmentPanel({ project, treatment: api }) {
const saveBrief = (patch) => api.save({ brief: patch });
const [noteText, setNoteText] = useState('');
const [noteUrl, setNoteUrl] = useState('');
+ // Note edits send the whole list, built from the rendered one: hold further
+ // add/remove until the previous save lands so neither can drop the other.
+ const [notesSaving, setNotesSaving] = useState(false);
+ const saveNotes = (referenceNotes) => {
+ setNotesSaving(true);
+ return saveBrief({ referenceNotes }).finally(() => setNotesSaving(false));
+ };
const notes = brief.referenceNotes || [];
const urlValid = !noteUrl.trim() || /^https?:\/\/\S+$/i.test(noteUrl.trim());
const {
@@ -66,8 +73,8 @@ export default function TreatmentPanel({ project, treatment: api }) {
const applied = t?.appliedRevision != null && t.appliedRevision === t.revision;
const addNote = () => {
- if ((!noteText.trim() && !noteUrl.trim()) || !urlValid) return;
- saveBrief({ referenceNotes: [...notes, { note: noteText.trim(), url: noteUrl.trim() || null }] });
+ if (notesSaving || (!noteText.trim() && !noteUrl.trim()) || !urlValid) return;
+ saveNotes([...notes, { note: noteText.trim(), url: noteUrl.trim() || null }]);
setNoteText('');
setNoteUrl('');
};
@@ -121,7 +128,7 @@ export default function TreatmentPanel({ project, treatment: api }) {
<li key={n.id} className="flex items-start gap-2 text-xs">
<span className="min-w-0 flex-1 break-words">{n.note}{n.url && <span className="text-port-text-muted"> — {n.url}</span>}</span>
<button type="button" aria-label="Remove reference note" title="Remove reference note"
- onClick={() => saveBrief({ referenceNotes: notes.filter((x) => x.id !== n.id) })}
+ onClick={() => saveNotes(notes.filter((x) => x.id !== n.id))} disabled={notesSaving}
className="min-h-[32px] min-w-[32px] inline-flex items-center justify-center text-port-error">
<Trash2 size={12} />
</button>
@@ -140,7 +147,7 @@ export default function TreatmentPanel({ project, treatment: api }) {
<input id={idFor('url')} value={noteUrl} maxLength={2000} onChange={(e) => setNoteUrl(e.target.value)}
placeholder="https://… (optional)" className={`${inputCls} ${urlValid ? '' : 'border-port-error'}`} />
</div>
- <button type="button" onClick={addNote} disabled={(!noteText.trim() && !noteUrl.trim()) || !urlValid || notes.length >= 20}
+ <button type="button" onClick={addNote} disabled={notesSaving || (!noteText.trim() && !noteUrl.trim()) || !urlValid || notes.length >= 20}
className="flex items-center gap-1 bg-port-border hover:bg-port-border/70 disabled:opacity-50 rounded px-2 py-1 text-xs min-h-[44px] sm:min-h-0">
<Plus size={13} /> Add note
</button>
diff --git a/client/src/components/musicVideo/TreatmentPanel.test.jsx b/client/src/components/musicVideo/TreatmentPanel.test.jsx
index 75c95121e2..25fcadd073 100644
--- a/client/src/components/musicVideo/TreatmentPanel.test.jsx
+++ b/client/src/components/musicVideo/TreatmentPanel.test.jsx
@@ -61,8 +61,8 @@ const PREVIEW = {
stale: [],
blocked: false,
scenes: [
- { sceneId: 's1', label: 'Intro · 1/2', directionChanged: true, prompt: 'manual', promptFingerprint: 'fp-s1', current: { framePrompt: 'my own frame', prompt: 'my own motion' }, suggested: { framePrompt: 'train window', prompt: 'push in' }, keepsSelection: true },
- { sceneId: 's2', label: 'Intro · 2/2', directionChanged: true, prompt: 'fill', promptFingerprint: 'fp-s2', current: { framePrompt: '', prompt: '' }, suggested: { framePrompt: 'rain', prompt: 'drift' }, keepsSelection: false },
+ { sceneId: 's1', label: 'Intro · 1/2', directionChanged: true, prompt: 'manual', fields: { framePrompt: 'manual', prompt: 'manual' }, promptFingerprint: 'fp-s1', current: { framePrompt: 'my own frame', prompt: 'my own motion' }, suggested: { framePrompt: 'train window', prompt: 'push in' }, keepsSelection: true },
+ { sceneId: 's2', label: 'Intro · 2/2', directionChanged: true, prompt: 'fill', fields: { framePrompt: 'fill', prompt: 'fill' }, promptFingerprint: 'fp-s2', current: { framePrompt: '', prompt: '' }, suggested: { framePrompt: 'rain', prompt: 'drift' }, keepsSelection: false },
],
missingSceneIds: [],
unmappedSceneIds: [],
@@ -98,6 +98,9 @@ describe('TreatmentPanel apply review', () => {
expect(await screen.findByText(/2 of 2 scenes would change/)).toBeTruthy();
expect(screen.getByText(/your edited prompts are kept/)).toBeTruthy();
expect(screen.getByText(/selected takes kept/)).toBeTruthy();
+ // Both hand-edited fields the tick would replace are shown, not just one.
+ expect(screen.getByText('Frame prompt — yours: my own frame')).toBeTruthy();
+ expect(screen.getByText('Motion prompt — treatment: push in')).toBeTruthy();
fireEvent.click(screen.getByLabelText(/Use the treatment's prompts for this scene/));
fireEvent.click(screen.getByText('Apply treatment'));
diff --git a/client/src/components/musicVideo/TreatmentProofs.jsx b/client/src/components/musicVideo/TreatmentProofs.jsx
index d8fd6a3043..ba194132de 100644
--- a/client/src/components/musicVideo/TreatmentProofs.jsx
+++ b/client/src/components/musicVideo/TreatmentProofs.jsx
@@ -75,8 +75,8 @@ function ProofRow({ project, proof, onReview }) {
className="flex items-center gap-1 bg-port-success/20 text-port-success disabled:opacity-50 rounded px-2 py-1 min-h-[44px] sm:min-h-0">
<CheckCircle2 size={12} /> Passed
</button>
- <button type="button" onClick={() => submit('failed')}
- className="flex items-center gap-1 bg-port-error/20 text-port-error rounded px-2 py-1 min-h-[44px] sm:min-h-0">
+ <button type="button" onClick={() => submit('failed')} disabled={!note.trim()}
+ className="flex items-center gap-1 bg-port-error/20 text-port-error disabled:opacity-50 rounded px-2 py-1 min-h-[44px] sm:min-h-0">
<XCircle size={12} /> Failed
</button>
{proof.status !== 'proposed' && (
diff --git a/server/routes/musicVideoTreatment.test.js b/server/routes/musicVideoTreatment.test.js
index 2b4411b127..ea768ab49f 100644
--- a/server/routes/musicVideoTreatment.test.js
+++ b/server/routes/musicVideoTreatment.test.js
@@ -358,6 +358,10 @@ describe('treatment proofs, clone and motion references', () => {
const noNote = await review(body.treatment.revision, { status: 'passed', evidence: { videoHistoryId: 'clip-a' } });
expect(noNote.body.code).toBe('PROOF_EVIDENCE_REQUIRED');
+ const bareFail = await review(body.treatment.revision, { status: 'failed' });
+ expect(bareFail.body.code).toBe('PROOF_EVIDENCE_REQUIRED');
+ const foreign = await review(body.treatment.revision, { status: 'failed', evidence: { videoHistoryId: 'not-this-project', note: 'looked wrong' } });
+ expect(foreign.body.code).toBe('PROOF_EVIDENCE_NOT_FOUND');
const still = await review(body.treatment.revision, { status: 'passed', evidence: { imageId: 'frame-a.png', note: 'contact sheet looks fine' } });
expect(still.status).toBe(422);
expect(still.body.code).toBe('PROOF_EVIDENCE_INSUFFICIENT');
diff --git a/server/services/musicVideo/treatment.js b/server/services/musicVideo/treatment.js
index 50da531b40..1cba1a0341 100644
--- a/server/services/musicVideo/treatment.js
+++ b/server/services/musicVideo/treatment.js
@@ -436,7 +436,8 @@ function proofArtifacts(project, proof) {
}
/**
- * Record a proof review. `passed` must cite a real artifact of this project
+ * Record a proof review. Either verdict needs a note of what was reviewed, and
+ * any artifact it cites must belong to the proof. `passed` must cite a real artifact of this project
* that can actually show every check: the final render for audio alignment,
* lip-sync and composited text; a clip (or the render) for motion and cut
* continuity; any frame or clip for identity. Lip-sync cannot pass while the
@@ -451,18 +452,20 @@ export function reviewTreatmentProof(project, proofId, { baseRevision, status, e
let recorded = null;
if (status !== 'proposed') {
recorded = normalizeEvidence({ ...(evidence || {}), reviewedAt: now });
+ // Either verdict records what was reviewed, and any artifact it cites must
+ // really belong to this proof.
+ if (!recorded.note) throw treatmentError(422, 'PROOF_EVIDENCE_REQUIRED', `Describe what you reviewed before marking a proof ${status}`);
+ const { clips, frames, render } = proofArtifacts(project, proof);
+ const isRender = !!recorded.videoHistoryId && recorded.videoHistoryId === render;
+ const isClip = !!recorded.videoHistoryId && (clips.has(recorded.videoHistoryId) || isRender);
+ const isFrame = !!recorded.imageId && frames.has(recorded.imageId);
+ if (recorded.videoHistoryId && !isClip) {
+ throw treatmentError(422, 'PROOF_EVIDENCE_NOT_FOUND', 'That video is not a clip of this proof\'s scenes or the project\'s final render');
+ }
+ if (recorded.imageId && !isFrame) {
+ throw treatmentError(422, 'PROOF_EVIDENCE_NOT_FOUND', 'That image is not a frame of this proof\'s scenes');
+ }
if (status === 'passed') {
- if (!recorded.note) throw treatmentError(422, 'PROOF_EVIDENCE_REQUIRED', 'Describe what you reviewed before marking a proof passed');
- const { clips, frames, render } = proofArtifacts(project, proof);
- const isRender = !!recorded.videoHistoryId && recorded.videoHistoryId === render;
- const isClip = !!recorded.videoHistoryId && (clips.has(recorded.videoHistoryId) || isRender);
- const isFrame = !!recorded.imageId && frames.has(recorded.imageId);
- if (recorded.videoHistoryId && !isClip) {
- throw treatmentError(422, 'PROOF_EVIDENCE_NOT_FOUND', 'That video is not a clip of this proof\'s scenes or the project\'s final render');
- }
- if (recorded.imageId && !isFrame) {
- throw treatmentError(422, 'PROOF_EVIDENCE_NOT_FOUND', 'That image is not a frame of this proof\'s scenes');
- }
if (proof.checks.includes('lip-sync') && treatment.capabilityGaps.some((g) => g.id === 'lip-sync')) {
throw treatmentError(422, 'PROOF_CAPABILITY_MISSING', 'This install has no source-audio lip-sync, so a lip-sync check cannot pass');
}