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: reject incomplete video stitch selections

[._.]/ Adam Eivy4bfbc1bf72b1
diff --git a/server/services/videoGen/derivedBackupAdmission.test.js b/server/services/videoGen/derivedBackupAdmission.test.js
index d4b5bff89f..6d39e06db8 100644
--- a/server/services/videoGen/derivedBackupAdmission.test.js
+++ b/server/services/videoGen/derivedBackupAdmission.test.js
@@ -154,6 +154,19 @@ afterEach(async () => {
});
afterAll(cleanupTempDataRoots);
+describe('stitch selection integrity', () => {
+ it('refuses a missing selected clip before publishing a shortened video', async () => {
+ const before = await loadHistory();
+ const selected = [sourceIds[0], randomUUID(), sourceIds[1]];
+
+ await expect(stitchVideos(selected)).rejects.toMatchObject({ status: 400, code: 'VALIDATION_ERROR' });
+
+ expect(await loadHistory()).toEqual(before);
+ expect((await readdir(PATHS.videos)).sort()).toEqual(sourceIds.map(id => `${id}.mp4`).sort());
+ expect(await readdir(PATHS.videoThumbnails)).toEqual([]);
+ });
+});
+
for (const [name, run] of Object.entries(lanes)) describe(`${name} backup publication`, () => {
it('holds a completed producer out of a cut; bypass demonstrates dangling copied records', async () => {
let cut = await acquireBackupSnapshotCut();
diff --git a/server/services/videoGen/stitchVideos.js b/server/services/videoGen/stitchVideos.js
index f3cd287a1c..b1fe0f3cc9 100644
--- a/server/services/videoGen/stitchVideos.js
+++ b/server/services/videoGen/stitchVideos.js
@@ -107,7 +107,7 @@ export async function stitchVideos(videoIds, opts = {}) {
const history = await loadHistory();
const videos = videoIds.map((vid) => history.find((h) => h.id === vid)).filter(Boolean);
- if (videos.length < 2) throw new ServerError('Some videos not found', { status: 400, code: 'VALIDATION_ERROR' });
+ if (videos.length !== videoIds.length) throw new ServerError('Some videos not found', { status: 400, code: 'VALIDATION_ERROR' });
// Validate every history-supplied filename through safeUnder before
// letting it reach ffmpeg's concat manifest. Tampered history entries