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

test: cover the lastImage staging rollback, the one upload field with no case (#3289)

[._.]/ Adam Eivyafa46f10b35d
diff --git a/server/routes/videoGen.test.js b/server/routes/videoGen.test.js
index b16e6d4a42..327184862b 100644
--- a/server/routes/videoGen.test.js
+++ b/server/routes/videoGen.test.js
@@ -1268,6 +1268,13 @@ describe('videoGen routes', () => {
mimetype: 'image/png',
size: 2048,
};
+ const lastImageUpload = {
+ fieldname: 'lastImage',
+ path: '/tmp/upload-end-frame.png',
+ originalname: 'end-frame.png',
+ mimetype: 'image/png',
+ size: 3072,
+ };
const audioUpload = {
fieldname: 'audioFile',
path: '/tmp/upload-beats.wav',
@@ -1355,6 +1362,28 @@ describe('videoGen routes', () => {
]));
});
+ it('unlinks both staged frames when an FFLF request mixes legacy inputs with keyframes', async () => {
+ // lastImage is the one upload field with no rollback coverage above —
+ // it stages between the source frame and the audio/IC fields, so a
+ // durable copy that never made it into stagedDurablePaths would leak
+ // here alone while every other case stayed green.
+ setPendingUpload(sourceUpload, lastImageUpload);
+ const r = await request(app).post('/api/video-gen/').send({
+ prompt: 'morph between the anchors',
+ mode: 'fflf',
+ keyframes: [{ file: 'a.png', index: 0 }, { file: 'b.png', index: 24 }],
+ });
+ expect(r.status).toBe(400);
+ expect(r.body.code).toBe('KEYFRAMES_LEGACY_INPUTS_CONFLICT');
+ expect(mediaJobQueue.enqueueJob).not.toHaveBeenCalled();
+ expect(unlinkedPaths()).toEqual(expect.arrayContaining([
+ expect.stringMatching(/^\/mock\/uploads\/video-source-[^/]+\.png$/),
+ expect.stringMatching(/^\/mock\/uploads\/video-last-[^/]+\.png$/),
+ sourceUpload.path,
+ lastImageUpload.path,
+ ]));
+ });
+
it('drops only the OS temp file on the happy path — the durable copy survives for the worker', async () => {
setPendingUpload(sourceUpload);
const r = await request(app).post('/api/video-gen/').send({