Skip to content

fix(producer): render -c <scene> uses the scene's own duration, not the project's#2087

Draft
miguel-heygen wants to merge 1 commit into
mainfrom
fix/render-c-scene-duration
Draft

fix(producer): render -c <scene> uses the scene's own duration, not the project's#2087
miguel-heygen wants to merge 1 commit into
mainfrom
fix/render-c-scene-duration

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

Problem

Rendering a single sub-composition standalone —

hyperframes render -c compositions/scene.html

— renders it for the whole project's duration instead of the scene's own. A 2s scene mounted in a 12s project renders as 12s. When the project's master root derives its length from sibling mounts (rather than a literal data-duration), the same path instead throws:

[FrameCapture] Composition has zero duration

This is a false-negative against the documented QA flow: the scene snapshots and validates correctly standalone, so the wrong length only shows up in the final render.

Root cause

To render a scene standalone, the producer reuses the real index.html shell and isolates the matching mount (extractStandaloneEntryFromIndexcreateStandaloneEntryRenderClone). It shallow-clones the master root and hangs only the scene's mount under it — but the shallow clone keeps the master's data-duration, so the extracted composition advertises the project length. The compiler reads that root duration verbatim.

Fix

Re-point the extracted wrapper's data-duration at the scene's own, read from the scene file's <template> root (the source of truth for that scene), with a fallback to the mount's data-duration. Full-project renders never take the extraction branch, so they're unaffected.

Verification

End-to-end via the pre-capture duration gate on a 3-scene project (master 12s; scene1 2s; scene2 10s):

render target before after
-c scene1 (own 2s) 12s ❌ 2s
-c scene2 (own 10s) 12s ❌ 10s
index.html (master) 12s ✅ 12s ✅

Adds unit coverage for both the scene-file and mount-fallback paths.

…he project's

When rendering a single sub-composition standalone (`hyperframes render -c
compositions/scene.html`), the producer extracts the scene's mount from
index.html and wraps it in a shallow clone of the master root. That clone
kept the master's `data-duration`, so the standalone composition advertised
the whole project's length instead of the scene's own: a 2s scene rendered
for the full 12s project, and a master that derives its length from sibling
mounts (now removed) produced "Composition has zero duration".

Re-point the extracted wrapper's `data-duration` at the scene's own, read
from the scene file's `<template>` root (the source of truth for that scene),
with a fallback to the mount's `data-duration`. Full-project renders are
unaffected — they never take the extraction branch.

Verified end-to-end via the pre-capture duration gate: a 2s scene now resolves
to 2s and a 10s scene to 10s (both were 12s), while the full index render stays
at 12s. Adds unit coverage for both the scene-file and mount-fallback paths.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant