Skip to content

CLI media commands miss scenes nested inside templates #7819

Closed

Description

@weiweiwu007

Describe the bug

media-treatment cannot automatically find a clip in a scene mounted from inside another scene's <template>. The project walker finds the outer scene but never visits the inner scene.

If the same selector also matches a clip in index.html, the command silently selects that file instead of reporting that the selector matches multiple files. The same walker is used by normalize-audio; command regression tests also reproduce a missing nested audio target and missed duplicate audio IDs.

Minimal reproduction

Use a HyperFrames source checkout at ad3a2389ee82b87eaee4bbf9a046c6a4273a6661 (version 0.9.52), with dependencies installed and bun run build completed. Create a separate repro/ directory with these three files.

repro/index.html:

<!doctype html>
<html>
<body>
  <div data-composition-id="main" data-width="1920" data-height="1080" data-duration="4">
    <div data-composition-id="outer"
         data-composition-src="compositions/outer.html"
         data-start="0" data-duration="4"></div>
  </div>
</body>
</html>

repro/compositions/outer.html:

<template id="outer-template">
  <div data-composition-id="outer" data-width="1920" data-height="1080">
    <div data-composition-id="inner"
         data-composition-src="compositions/inner.html"
         data-start="0" data-duration="4"></div>
  </div>
</template>

repro/compositions/inner.html:

<template id="inner-template">
  <div data-composition-id="inner" data-width="1920" data-height="1080">
    <video id="hero" class="clip" src="hero.mp4"
           data-start="0" data-duration="4"></video>
  </div>
</template>

This reproduces HTML file selection only. The dry-run does not render or analyze media, so no hero.mp4 bytes or FFmpeg installation are needed.

Steps to reproduce

From the source checkout, replace /path/to/repro with the directory above:

node packages/cli/bin/hyperframes.mjs media-treatment \
  --project /path/to/repro --selector '#hero' \
  --grading '{"preset":"warm-daylight"}' --dry-run --json

Then repeat with --file compositions/inner.html.

For the ambiguity case, add a second <video id="hero" class="clip" src="root.mp4" data-start="0" data-duration="4"></video> inside the main composition in index.html, then rerun the first command without --file.

Expected behavior

The first command finds compositions/inner.html automatically. With a matching clip in both the root and inner scene, the command reports both files and requires --file.

Actual behavior

Automatic selection exits 1 with:

Selector did not match: #hero. The file has no <video>, <img> or <canvas> yet.

The explicit --file compositions/inner.html control exits 0 with ok: true, dryRun: true, and lint.ok: true.

The ambiguity case incorrectly exits 0 with file: "index.html".

Environment

Reproduced on macOS 27.0.1, Apple silicon, using Bun 1.4.4 and the built source CLI at the revision above. Relevant doctor --json output from the same development environment:

{
  "ok": false,
  "platform": "darwin",
  "arch": "arm64",
  "checks": [
    {"name": "Version", "ok": true, "detail": "0.9.52 (not checked yet)"},
    {"name": "Node.js", "ok": true, "detail": "v22.23.5 (darwin arm64)"},
    {"name": "FFmpeg", "ok": false, "detail": "FFmpeg is required to encode video."},
    {"name": "FFprobe", "ok": false, "detail": "FFprobe is required to probe media assets. It ships with FFmpeg but was not found on PATH."},
    {"name": "Chrome", "ok": true, "detail": "system: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome"}
  ]
}

The update check was disabled; this is a source-revision reproduction, not a claim about the latest npm release. The excerpt omits unrelated optional-tool and local-path checks.

Additional context

projectCompositionFiles uses document.querySelectorAll("[data-composition-src]"), which does not enter template contents. The existing collectSubCompositionSrcs parser already handles this structure.

PR #6362 added mounted-scene lookup, but its command tests cover a single directly mounted scene. PR #7534 added path containment. This nested-template case still fails at the revision above.

A local fix reuses the existing parser and adds regression tests for discovery and ambiguity in both commands.

Activity

  1. added
    bug
    triage/needs-triage
    on Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugtriage/needs-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions