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: name a real history entry in a multi-format render result (#8960)

[._.]/ Adam Eivye1cd5abcbba5
diff --git a/docs/HTML_COMPOSITIONS.md b/docs/HTML_COMPOSITIONS.md
index a240602eaa..b50d97f74c 100644
--- a/docs/HTML_COMPOSITIONS.md
+++ b/docs/HTML_COMPOSITIONS.md
@@ -78,7 +78,8 @@ request, a job renders the composition's own size exactly as before.
Each format is its own Media History entry (`<jobId>-<format>`), all written in
one history update, so a job registers every format or none. The completed
-job result keeps `filename`/`thumbnail` for the first format and lists all of
+job result keeps `generationId` as the job and names the first format in
+`id`/`filename`/`thumbnail`, and lists all of
them in `videos: [{ format, id, filename, thumbnail, path }]`.
## Motion kit
diff --git a/server/services/htmlComposition/index.js b/server/services/htmlComposition/index.js
index 9b9c95b0a0..10f22c96da 100644
--- a/server/services/htmlComposition/index.js
+++ b/server/services/htmlComposition/index.js
@@ -181,9 +181,11 @@ export async function renderComposition({ jobId, ...input }) {
}));
await mutateVideoHistory(history => { history.unshift(...metas); return history; });
success = true;
+ // `id`/`filename` name a real history entry (the first format); `generationId`
+ // is the job. A single-format render keeps id === generationId as before.
const summary = ({ id, filename, thumbnail }) => ({ id, filename, thumbnail, path: `/data/videos/${filename}` });
const [first] = rendered;
- result = { ...(launchMetadata ? { appId: launchMetadata.appId } : {}), generationId: jobId, ...summary(first), id: jobId,
+ result = { ...(launchMetadata ? { appId: launchMetadata.appId } : {}), generationId: jobId, ...summary(first),
...(formats ? { videos: rendered.map(video => ({ format: video.format, ...summary(video) })) } : {}) };
}
} catch (error) {
diff --git a/server/services/htmlComposition/index.test.js b/server/services/htmlComposition/index.test.js
index 960ad71df3..6f93278ad9 100644
--- a/server/services/htmlComposition/index.test.js
+++ b/server/services/htmlComposition/index.test.js
@@ -177,7 +177,7 @@ describe.skipIf(!chrome || !ffmpeg)('HTML composition with real Chrome and ffmpe
const result = await renderComposition({ ...input, jobId, launchVideo, formats: ['square', 'landscape', 'vertical'] });
const expected = [['landscape', 1920, 1080, [255, 0, 0]], ['vertical', 1080, 1920, [0, 255, 0]], ['square', 1080, 1080, [0, 0, 255]]];
expect(result.videos.map(video => video.format)).toEqual(expected.map(([format]) => format));
- expect(result).toMatchObject({ generationId: jobId, id: jobId, appId: 'example', filename: `composition-${jobId}-landscape.mp4` });
+ expect(result).toMatchObject({ generationId: jobId, id: `${jobId}-landscape`, appId: 'example', filename: `composition-${jobId}-landscape.mp4` });
const history = await loadHistory();
for (const [format, width, height, rgb] of expected) {
const video = result.videos.find(item => item.format === format);