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: cap the music-video shot ceiling at one generated clip and bound pacing inputs (#8964)

[._.]/ Adam Eivyee785884acd8
diff --git a/client/src/components/musicVideo/LyricsPanel.jsx b/client/src/components/musicVideo/LyricsPanel.jsx
index 62d23d88d0..3f43a97657 100644
--- a/client/src/components/musicVideo/LyricsPanel.jsx
+++ b/client/src/components/musicVideo/LyricsPanel.jsx
@@ -6,10 +6,12 @@ import { Plus, Trash2, Upload } from 'lucide-react';
// tailnet origin PortOS is usually opened from).
const mintId = (prefix) => `${prefix}-${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
const toSec = (value) => (value === '' ? null : Number(value));
+// Bounds mirror musicVideoPacingSchema so an out-of-range value is refused
+// by the input rather than applied locally and then rejected by the server.
const PACING_FIELDS = [
- ['minShotSec', 'Shortest shot (s)', 'Floor for a planned shot; a shorter section stays one shot.'],
- ['maxShotSec', 'Longest shot (s)', 'Ceiling for a planned shot — defaults to one generated clip (5s local, 6/10s Grok).'],
- ['hookSec', 'Opening hook (s)', 'Cap on the very first shot so the video opens on a cut.'],
+ ['minShotSec', 'Shortest shot (s)', 'Floor for a planned shot; a shorter section stays one shot.', 0.5, 60],
+ ['maxShotSec', 'Longest shot (s)', 'Ceiling for a planned shot, never longer than one generated clip (5s local, 6/10s Grok).', 1, 120],
+ ['hookSec', 'Opening hook (s)', 'Cap on the very first shot so the video opens on a cut.', 0.5, 60],
];
const inputCls = 'bg-port-bg border border-port-border rounded px-1.5 py-1 text-xs';
@@ -39,13 +41,16 @@ export default function LyricsPanel({ project, onEditLocal, onSave, onImport, im
const replaceCues = (next) => { onEditLocal({ lyricCues: next }); saveCues(next); };
const replacePhrases = (next) => { onEditLocal({ phrases: next }); savePhrases(next); };
- const commitPacing = (key, raw) => {
+ const commitPacing = (key, raw, min, max) => {
+ const value = Number(raw);
+ if (raw !== '' && !(Number.isFinite(value) && value >= min && value <= max)) return false;
const next = { ...pacing };
if (raw === '') delete next[key];
- else next[key] = Number(raw);
- const value = Object.keys(next).length > 0 ? next : null;
- onEditLocal({ pacing: value });
- onSave({ pacing: value });
+ else next[key] = value;
+ const nextPacing = Object.keys(next).length > 0 ? next : null;
+ onEditLocal({ pacing: nextPacing });
+ onSave({ pacing: nextPacing });
+ return true;
};
const submitImport = () => {
@@ -93,13 +98,17 @@ export default function LyricsPanel({ project, onEditLocal, onSave, onImport, im
<h4 className="font-medium text-port-text pt-1">Shot pacing</h4>
<div className="flex flex-wrap gap-2">
- {PACING_FIELDS.map(([key, label, help]) => (
+ {PACING_FIELDS.map(([key, label, help, min, max]) => (
<div key={key}>
<label htmlFor={`mv-pacing-${key}`} className="block text-port-text-muted mb-0.5" title={help}>{label}</label>
- <input id={`mv-pacing-${key}`} type="number" min={0.5} max={120} step={0.5}
+ <input id={`mv-pacing-${key}`} type="number" min={min} max={max} step={0.5}
defaultValue={pacing[key] ?? ''} key={`${project.id}-${key}-${pacing[key] ?? ''}`}
placeholder="default" title={help}
- onBlur={(e) => { if (e.target.value !== String(pacing[key] ?? '')) commitPacing(key, e.target.value); }}
+ onBlur={(e) => {
+ if (e.target.value === String(pacing[key] ?? '')) return;
+ // Out of range: restore the saved value instead of showing an unsaved one.
+ if (!commitPacing(key, e.target.value, min, max)) e.target.value = pacing[key] ?? '';
+ }}
className={`${inputCls} w-24`} />
</div>
))}
diff --git a/server/lib/musicVideoValidation.js b/server/lib/musicVideoValidation.js
index 72c1e64da6..a999c19830 100644
--- a/server/lib/musicVideoValidation.js
+++ b/server/lib/musicVideoValidation.js
@@ -63,8 +63,8 @@ export const musicVideoPhraseSchema = z.object({
intent: z.string().max(2000).optional(),
}).strict();
-// Shot pacing for the planner. `maxShotSec` defaults to the renderer's clip
-// capacity; `hookSec` bounds the opening shot so the video opens on a cut.
+// Shot pacing for the planner. `maxShotSec` is capped at the renderer's clip
+// capacity (one generated clip); `hookSec` bounds the opening shot so the video opens on a cut.
export const musicVideoPacingSchema = z.object({
minShotSec: z.number().min(0.5).max(60).optional(),
maxShotSec: z.number().min(1).max(120).optional(),
diff --git a/server/services/musicVideo/planner.test.js b/server/services/musicVideo/planner.test.js
index 9d5952ff2c..3a2d981d34 100644
--- a/server/services/musicVideo/planner.test.js
+++ b/server/services/musicVideo/planner.test.js
@@ -108,11 +108,15 @@ describe('planShots', () => {
const paced = planShots(VERSE, { ...GRID, clipCapacitySec: 10, pacing: { maxShotSec: 4 } }).shots;
expect(paced.every((s) => s.endSec - s.startSec <= 4)).toBe(true);
expectTiles(paced, 0, 24);
+ // A ceiling above the clip capacity cannot plan shots no clip can cover.
+ const over = planShots(VERSE, { ...GRID, clipCapacitySec: 5, pacing: { maxShotSec: 12 } });
+ expect(over.pacing.maxShotSec).toBe(5);
+ expect(over.shots.every((s) => s.endSec - s.startSec <= 5)).toBe(true);
});
it('holds the pacing floor at half the ceiling so any span can still be tiled', () => {
const { shots, pacing } = planShots([{ label: 'Long', startSec: 0, endSec: 25 }], {
- ...GRID, pacing: { minShotSec: 8, maxShotSec: 10 },
+ ...GRID, clipCapacitySec: 10, pacing: { minShotSec: 8, maxShotSec: 10 },
});
expect(pacing.minShotSec).toBe(5);
expectTiles(shots, 0, 25);
@@ -176,7 +180,7 @@ describe('planShots', () => {
// Section edges still come from snapSectionsToGrid (#4664). A ceiling wider
// than every section keeps one shot per section so the edges are observable.
describe('section edges', () => {
- const WIDE = { pacing: { maxShotSec: 60, hookSec: 60 } };
+ const WIDE = { clipCapacitySec: 60, pacing: { hookSec: 60 } };
it('snaps off-grid section boundaries onto the beat grid, keeping the timeline contiguous', () => {
const { shots } = planShots([
diff --git a/server/services/musicVideo/shotPlan.js b/server/services/musicVideo/shotPlan.js
index 142758493e..369028982a 100644
--- a/server/services/musicVideo/shotPlan.js
+++ b/server/services/musicVideo/shotPlan.js
@@ -6,8 +6,9 @@
* generated clip. This module instead tiles every section with several
* bounded shots:
*
- * - no shot is longer than the pacing ceiling (by default the renderer's
- * clip capacity), so each shot can be covered by ONE generated clip;
+ * - no shot is longer than the pacing ceiling (the renderer's clip
+ * capacity, or a shorter project ceiling), so each shot can be covered by
+ * ONE generated clip;
* - no shot is shorter than the pacing floor (a section shorter than the
* floor stays a single shot);
* - the very first shot is capped at the opening-hook length;
@@ -31,7 +32,7 @@ const LYRIC_TEXT_MAX = 2000;
// An untimed-end cue lasts until the next cue, capped here.
const OPEN_CUE_MAX_SEC = 8;
// Grok renders fixed 6s/10s clips; a local model's default render is ~5s
-// (121 frames at 24fps). A project pacing ceiling overrides either.
+// (121 frames at 24fps). A project pacing ceiling can only shorten either.
const DEFAULT_LOCAL_CLIP_CAPACITY_SEC = 5;
const DEFAULT_MIN_SHOT_SEC = 2;
const DEFAULT_HOOK_SEC = 3;
@@ -53,7 +54,9 @@ export function resolveClipCapacitySec(videoSettings) {
* [floor, ceiling]; the hook is clamped into the same range.
*/
function resolvePacing(pacing, clipCapacitySec) {
- const maxShotSec = Math.max(1, pacing?.maxShotSec ?? clipCapacitySec);
+ // A project ceiling can shorten shots but never exceed one generated clip:
+ // a longer non-looping shot could only ever be refused at render time.
+ const maxShotSec = Math.max(1, Math.min(pacing?.maxShotSec ?? clipCapacitySec, clipCapacitySec));
const minShotSec = Math.min(pacing?.minShotSec ?? DEFAULT_MIN_SHOT_SEC, maxShotSec / 2);
const hookSec = Math.min(maxShotSec, Math.max(minShotSec, pacing?.hookSec ?? DEFAULT_HOOK_SEC));
return { minShotSec, maxShotSec, hookSec };