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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: remove code animation export staging when the render cannot be queued (#11856)
Adam Eivy4115f03f140e
diff --git a/server/services/codeAnimation/export.js b/server/services/codeAnimation/export.jsindex 985c7dd738..b3e1eebc4e 100644--- a/server/services/codeAnimation/export.js+++ b/server/services/codeAnimation/export.js@@ -155,16 +155,23 @@ async function startAdmittedExport(id, deps) {const directory = `${EXPORT_DIRECTORY_ROOT}/${id}/${randomUUID()}`;const dir = join(PATHS.data, directory);await sweepStaleStagings(join(PATHS.data, EXPORT_DIRECTORY_ROOT, id));- await mkdir(dir, { recursive: true });- // A three.js film imports `three` by bare name; the host's import map plus the- // hashed vendored modules beside it are the only code the render may load.- const three = importsThree(html);- const page = three ? injectThreeImportMap(html) : html;- await atomicWrite(join(dir, 'index.html'), injectExportShim(page, buildExportShim({ song })));- if (three) {- for (const { rel, data } of await threeStagedFiles()) await atomicWrite(join(dir, rel), data);+ let queued;+ try {+ await mkdir(dir, { recursive: true });+ // A three.js film imports `three` by bare name; the host's import map plus the+ // hashed vendored modules beside it are the only code the render may load.+ const three = importsThree(html);+ const page = three ? injectThreeImportMap(html) : html;+ await atomicWrite(join(dir, 'index.html'), injectExportShim(page, buildExportShim({ song })));+ if (three) {+ for (const { rel, data } of await threeStagedFiles()) await atomicWrite(join(dir, rel), data);+ }+ queued = await enqueueJob({ kind: 'html-composition', params: { directory, ...(musicTrack ? { musicTrack } : {}) } });+ } catch (error) {+ // Nothing references this staging yet (the enqueue failed or never ran), so it is litter.+ await rm(dir, { recursive: true, force: true }).catch(() => {});+ throw error;}- const queued = await enqueueJob({ kind: 'html-composition', params: { directory, ...(musicTrack ? { musicTrack } : {}) } });console.log(`🎬 Code animation ${id.slice(0, 8)} frame-exact export queued as ${queued.jobId}`);return { ...queued, notes };}diff --git a/server/services/codeAnimation/export.test.js b/server/services/codeAnimation/export.test.jsindex 35571f87eb..0ef50603a8 100644--- a/server/services/codeAnimation/export.test.js+++ b/server/services/codeAnimation/export.test.js@@ -128,6 +128,14 @@ describe('startCodeAnimationExport', () => {expect(Object.keys(enqueueJob.mock.calls[0][0].params)).toEqual(['directory']);});+ it('removes the staging directory when the render cannot be queued', async () => {+ const { access } = await import('fs/promises');+ const full = vi.fn(async ({ params }) => { lastDirectory = params.directory; throw new Error('media queue is full'); });+ await expect(startCodeAnimationExport(JOB_ID, { enqueueJob: full, beatGrid: vi.fn(async () => null) })).rejects.toThrow('media queue is full');+ expect(full).toHaveBeenCalledTimes(1);+ await expect(access(join(state.dataRoot, lastDirectory))).rejects.toMatchObject({ code: 'ENOENT' });+ });+it('refuses frame sizes the composition renderer cannot encode and unfinished jobs', async () => {state.job = { ...state.job, frame: { ...state.job.frame, width: 1440, height: 1080 } };await expect(startCodeAnimationExport(JOB_ID, { enqueueJob })).rejects.toMatchObject({ code: 'EXPORT_SIZE_UNSUPPORTED' });