Skip to content

fix(core,engine,producer): handle id-less media in sub-composition renders - #96

Merged
miguel-heygen merged 4 commits into
mainfrom
fix/parse-videos-without-id
Apr 1, 2026
Merged

miguel-heygen merged 4 commits into
mainfrom
fix/parse-videos-without-id

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Mar 27, 2026 •

Copy link
Copy Markdown
Collaborator

What

Move the id-less media fix into the shared timing compiler so producer can resolve durations for sub-composition videos before inlining, then carry the merged result through engine parsing, regression coverage, and the regression Docker image used in CI.

This PR now does five concrete things:

  • assigns stable ids to id-less media in core compileTimingAttrs() so unresolved duration injection can target them
  • keeps the engine-side parseVideoElements() support for video[src] plus the newer data-duration / natural-duration fallback from main
  • makes producer prefer sub-composition media metadata over the later inlined-document parse when the same media id appears in both places
  • makes sub-composition-video a runnable regression test by fixing its metadata and checking in the missing output/compiled.html snapshot
  • removes the stale pnpm-workspace.yaml copy step from Dockerfile.test, so regression CI builds the Bun-based test image from the current workspace layout

Why

  • media without an explicit id could not participate in unresolved-duration resolution early enough
  • producer could lose the resolved sub-composition timing by overwriting it with the later inlined parse
  • the regression fixture intended to cover this case was not actually running in CI because its meta.json was incomplete and the required compiled snapshot was missing
  • the regression image definition still expected a deleted pnpm-workspace.yaml, so GitHub Actions failed before the test shard could start

Putting the id-generation step in core makes the behavior reusable instead of relying on producer-only HTML patching.

How

Shared compiler

  • core compileTimingAttrs() now auto-assigns stable ids to id-less video / audio tags
  • those generated ids are returned in unresolved, so injectDurations() can add data-duration and data-end to the same media element later in the pipeline
  • added core tests that cover auto-id assignment and duration injection for generated ids

Producer

  • when producer combines subVideos / subAudios with the media re-parsed from the final inlined HTML, it now lets the sub-composition metadata win
  • this preserves the resolved/clamped timing already computed for nested media instead of overwriting it with the later parse
  • sub-composition-video now has valid regression metadata and a checked-in output/compiled.html snapshot so CI actually executes it

Engine

  • resolved the merge conflict in videoFrameExtractor by keeping the broader video[src] parsing from this branch and the data-duration / natural-duration fallback that landed on main
  • added a focused engine unit test for videos without ids

CI image

  • Dockerfile.test now copies only package.json and bun.lock at the workspace root before bun install --frozen-lockfile
  • this matches the current monorepo layout and removes the obsolete pnpm-era dependency on pnpm-workspace.yaml

Test plan

  • bun run --filter @hyperframes/core test
  • bun run --filter @hyperframes/engine test
  • bun run --filter @hyperframes/producer test --update --sequential sub-composition-video
  • bun run --filter @hyperframes/producer test --sequential sub-composition-video
  • Browser check with agent-browser against the compiled fixture page (http://127.0.0.1:8123/compiled.html)
  • Clean tracked-only Docker build of Dockerfile.test with the PR version of the file applied

Notes

  • Latest regression workflow is green on main, but before this PR the sub-composition-video fixture was being skipped by the harness rather than exercised end to end.
  • The CI Docker fix was validated from a tracked-only export to avoid local untracked worktree artifacts affecting the result.

parseVideoElements required video[id][src] but agent-generated
sub-compositions often omit the id on nested videos. Without an id,
the producer can't extract frames via ffmpeg, causing black rectangles
in rendered output while the preview works fine.

Now auto-generates stable IDs (__auto_video_0, etc.) for id-less
videos so the producer's frame extraction pipeline handles them.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Copy link
Copy Markdown
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Resolve the videoFrameExtractor conflict by keeping the broader src-based parsing and the newer duration fallback logic.

Move the id-less media timing fix into core compileTimingAttrs so producer can resolve durations for auto-generated media ids before inlining sub-compositions.

Also make producer prefer sub-composition media timing over the later inlined parse and add runnable regression coverage for sub-composition-video.
@miguel-heygen miguel-heygen changed the title fix(engine): parse video elements without id attribute fix(core,engine,producer): handle id-less media in sub-composition renders Mar 31, 2026
@miguel-heygen
miguel-heygen marked this pull request as ready for review March 31, 2026 23:33
@miguel-heygen
miguel-heygen merged commit 110ea12 into main Apr 1, 2026
22 checks passed

Copy link
Copy Markdown
Collaborator Author

Merge activity

@miguel-heygen
miguel-heygen deleted the fix/parse-videos-without-id branch April 6, 2026 23:24
dahans-msft2 pushed a commit to dahans-msft2/hyperframes that referenced this pull request Aug 6, 2026
…nders (heygen-com#96)

## What

Move the id-less media fix into the shared timing compiler so producer can resolve durations for sub-composition videos before inlining, then carry the merged result through engine parsing, regression coverage, and the regression Docker image used in CI.

This PR now does five concrete things:

- assigns stable ids to id-less media in core `compileTimingAttrs()` so unresolved duration injection can target them
- keeps the engine-side `parseVideoElements()` support for `video[src]` plus the newer `data-duration` / natural-duration fallback from `main`
- makes producer prefer sub-composition media metadata over the later inlined-document parse when the same media id appears in both places
- makes `sub-composition-video` a runnable regression test by fixing its metadata and checking in the missing `output/compiled.html` snapshot
- removes the stale `pnpm-workspace.yaml` copy step from `Dockerfile.test`, so regression CI builds the Bun-based test image from the current workspace layout

## Why

- media without an explicit `id` could not participate in unresolved-duration resolution early enough
- producer could lose the resolved sub-composition timing by overwriting it with the later inlined parse
- the regression fixture intended to cover this case was not actually running in CI because its `meta.json` was incomplete and the required compiled snapshot was missing
- the regression image definition still expected a deleted `pnpm-workspace.yaml`, so GitHub Actions failed before the test shard could start

Putting the id-generation step in core makes the behavior reusable instead of relying on producer-only HTML patching.

## How

### Shared compiler

- core `compileTimingAttrs()` now auto-assigns stable ids to id-less `video` / `audio` tags
- those generated ids are returned in `unresolved`, so `injectDurations()` can add `data-duration` and `data-end` to the same media element later in the pipeline
- added core tests that cover auto-id assignment and duration injection for generated ids

### Producer

- when producer combines `subVideos` / `subAudios` with the media re-parsed from the final inlined HTML, it now lets the sub-composition metadata win
- this preserves the resolved/clamped timing already computed for nested media instead of overwriting it with the later parse
- `sub-composition-video` now has valid regression metadata and a checked-in `output/compiled.html` snapshot so CI actually executes it

### Engine

- resolved the merge conflict in `videoFrameExtractor` by keeping the broader `video[src]` parsing from this branch and the `data-duration` / natural-duration fallback that landed on `main`
- added a focused engine unit test for videos without ids

### CI image

- `Dockerfile.test` now copies only `package.json` and `bun.lock` at the workspace root before `bun install --frozen-lockfile`
- this matches the current monorepo layout and removes the obsolete pnpm-era dependency on `pnpm-workspace.yaml`

## Test plan

- [x] `bun run --filter @hyperframes/core test`
- [x] `bun run --filter @hyperframes/engine test`
- [x] `bun run --filter @hyperframes/producer test --update --sequential sub-composition-video`
- [x] `bun run --filter @hyperframes/producer test --sequential sub-composition-video`
- [x] Browser check with `agent-browser` against the compiled fixture page (`http://127.0.0.1:8123/compiled.html`)
- [x] Clean tracked-only Docker build of `Dockerfile.test` with the PR version of the file applied

## Notes

- Latest regression workflow is green on `main`, but before this PR the `sub-composition-video` fixture was being skipped by the harness rather than exercised end to end.
- The CI Docker fix was validated from a tracked-only export to avoid local untracked worktree artifacts affecting the result.
philipp676767 pushed a commit to philipp676767/hyperframes that referenced this pull request Nov 26, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013kqj2XLEj7NbFbvWVzMgo4
philipp676767 pushed a commit to philipp676767/hyperframes that referenced this pull request Nov 26, 2026
… scene

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013kqj2XLEj7NbFbvWVzMgo4
philipp676767 pushed a commit to philipp676767/hyperframes that referenced this pull request Nov 26, 2026
philipp676767 pushed a commit to philipp676767/hyperframes that referenced this pull request Nov 26, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013kqj2XLEj7NbFbvWVzMgo4
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.

2 participants