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 the publishing-kit test hang and keep its encodes fast on a busy host

Claude877ebc6fe9c0
diff --git a/server/services/musicVideo/publishKit.test.js b/server/services/musicVideo/publishKit.test.js
index c66e3893cf..501e281a54 100644
--- a/server/services/musicVideo/publishKit.test.js
+++ b/server/services/musicVideo/publishKit.test.js
@@ -51,13 +51,14 @@ afterAll(() => cleanupTempDataRoots());
const cue = (text, startSec, endSec) => ({ id: `lc-${startSec}`, text, startSec, endSec });
const scene = (startSec, endSec, sectionLabel, shotMode = 'performance') => ({ sceneId: `mvs-${startSec}`, order: startSec, startSec, endSec, sectionLabel, shotMode, takes: [] });
-// 6 fps: the encodes upscale to 1080p, so frame count (the 25s teaser floor pins duration) sets the CPU cost under load (#10479).
+// The 25s teaser floor pins a 36s song, so the fixture shrinks per-second cost instead (#10479, #10643): 1 fps keeps
+// the 1080x1920 vertical encode to ~25 frames, and 8 kHz audio cuts the AAC re-encode every kit encode repeats.
async function renderedProject() {
const created = await projects.createProject({ name: 'Example Song' });
await mkdir(PATHS.videos, { recursive: true });
const filename = `master-${created.id.slice(3, 11)}.mp4`;
const made = await runFfmpegProcess({ bin: ffmpeg, args: ['-hide_banner', '-loglevel', 'error',
- '-f', 'lavfi', '-i', 'testsrc2=s=320x180:r=6:d=36', '-f', 'lavfi', '-i', 'sine=frequency=440:duration=36',
+ '-f', 'lavfi', '-i', 'testsrc2=s=320x180:r=1:d=36', '-f', 'lavfi', '-i', 'sine=frequency=440:duration=36:sample_rate=8000',
'-c:v', 'libx264', '-pix_fmt', 'yuv420p', '-c:a', 'aac', '-shortest', '-y', join(PATHS.videos, filename)] });
expect(made.ok).toBe(true);
await saveHistory([{ id: 'render-1', filename, durationSec: 36 }]);
@@ -257,7 +258,12 @@ describe('publishing kit build (#9281)', () => {
const native = vi.spyOn(excerptRender, 'renderSeekedWindow').mockImplementation(async (_project, { outputPath, signal }) => {
partial = outputPath;
await writeFile(outputPath, 'partial');
- await new Promise((_, reject) => signal.addEventListener('abort', () => reject(Object.assign(new Error('Render cancelled'), { code: 'CANCELED' })), { once: true }));
+ // The cancel can land while the write is still pending; a listener added after it would never fire (#10643).
+ await new Promise((_, reject) => {
+ const cancelled = () => reject(Object.assign(new Error('Render cancelled'), { code: 'CANCELED' }));
+ if (signal.aborted) cancelled();
+ else signal.addEventListener('abort', cancelled, { once: true });
+ });
});
const encode = vi.spyOn(ffmpegService, 'runFfmpegProcess');
try {
diff --git a/server/services/videoGen/poster.test.js b/server/services/videoGen/poster.test.js
index a72f831974..1d79adf643 100644
--- a/server/services/videoGen/poster.test.js
+++ b/server/services/videoGen/poster.test.js
@@ -47,8 +47,9 @@ it('persists a playhead poster, exports only a changed first frame with identica
const tail = ['-vf', 'select=gte(n\\,1)', '-fps_mode', 'passthrough'];
expect(mae(await decode(copy.path, tail), await decode(source, tail))).toBeLessThan(8);
const audio = async path => (await exec(ffmpeg, ['-v', 'error', '-i', path, '-map', '0:a:0', '-c:a', 'copy', '-f', 'adts', '-'], { encoding: 'buffer', maxBuffer: 4 * 1024 * 1024 })).stdout;
- expect(await audio(copy.path)).toEqual(await audio(source));
- expect(await readFile(source)).toEqual(original);
+ // Buffer#equals, not toEqual: Vitest's deep equality walks a media buffer byte by byte (#10643).
+ expect((await audio(copy.path)).equals(await audio(source))).toBe(true);
+ expect((await readFile(source)).equals(original)).toBe(true);
} finally { await copy.cleanup(); }
const clamped = await updateVideoPoster('example', 100);
expect(clamped.posterSec).toBeCloseTo(14.9);