Skip to content

fix(cli): cloud render no longer refuses a file only an unused page names - #7812

Merged
miguel-heygen merged 2 commits into
mainfrom
fix/cli-cloud-refuse-film-pages-only
Nov 15, 2026
Merged

miguel-heygen merged 2 commits into
mainfrom
fix/cli-cloud-refuse-film-pages-only

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

What

hyperframes cloud render (and --dry-run) no longer refuses a project because a page the video never plays names a missing file. The "The composition references "…", which is not in the project folder" refusal now fires for index.html and every composition it loads through data-composition-src. Other pages go up as they are. If the CLI can't be sure which pages the video plays, every page is checked, as before.

Why

The upload staging checked every .html in the folder. A storyboard page, an old draft or a notes page with an image or clip that was later deleted blocked the cloud render of a video that has every file it plays. Repro on 0.9.46: a project whose index.html plays a clip that exists, plus boards/storyboard.html containing <img src="stills/at-1.2s.png"> with no such still. cloud render --dry-run --json exits 1 with the refusal.

Related work

None.

How

  • filmPagesOf walks the pages from the staged files the upload will contain, not from disk, starting at index.html. Those staged files are regular files with archive-normalized (NFC) names, already in memory.
    • Each page is decoded with the renderer's decodeTextHonoringBom.
    • Mounted pages are found with collectSubCompositionSrcs and resolved with resolveCompositionSrc. That is the renderer's own resolver (htmlCompiler.ts resolveCompositionFile), which keeps <template> wraps and root-relative paths.
    • There is no file budget and no disk read, so a named pipe can't block it.
  • If a page the video loads is not staged as text (ignored, private, a pipe or a folder), the walk returns null. Then every page's hard references (video[src], audio[src], img[src], video[poster]) stay required, which is the old behaviour. Unknown is never treated as unused.
  • A reference that resolves outside the project is skipped, as the renderer skips it.
  • publish shares this path, so it gets the same rule.

Test plan

  • Unit tests added: packages/cli/src/utils/publishProject.missing.test.ts, 8 tests.
  • fails without the fix: "is no refusal when the page is one the video never plays" in packages/cli/src/utils/publishProject.missing.test.ts fails on origin/main.
  • Against this PR's first head (64ebc96), each new test fails for the case it names:
    • "however deep the compositions nest" (300 nested pages, past the old walk's 250 budget)
    • "mounted by one whose name is written in another Unicode form" (NFD on disk, NFC in the page)
    • "a UTF-16 index.html mounts"
    • "a page the video loads is not in the upload"
    • The named-pipe test hung there until killed at 120 s.
  • With this head, all 8 pass, 3 runs in a row on Linux.
  • Mutation: counting an unstaged page as not played turns exactly the not-in-upload and named-pipe tests red.
  • Each run alone on the rebased tree, exit 0: catalogUsage 12, publishProject 75, .absolutePath 46, .fileType 8, .privateFiles 7, .srcset 6, cloud/offload 41, offload.undecodableTrack 2, commands/publish 23, leftOutReference 3, publishProxyBake 10, submitFeedback 11.
  • oxfmt and oxlint clean on the changed files.
  • Not run:
    • publishProject.e2e.test.ts (its 2 tests skip on that box).
    • The CLI tsc there only reports errors from the unbuilt @hyperframes/inspector package, in files this PR does not touch.
    • No real cloud upload or render.
    • Windows (the pipe test skips there).
  • Comments follow CONTRIBUTING.md "Comments"

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 267 (base branch 267), smooth 97 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Quarantined, measured but not gated (8)

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 64ebc96

The ordinary unused-storyboard case is fixed, and the existing entry/loaded-composition missing-file cases still refuse. The outside-file localization and private-path decisions are unchanged in the diff and their focused tests pass.

Important — partial telemetry reachability is not proof that a page is unused (packages/cli/src/utils/publishProject.ts:699–704, packages/cli/src/utils/catalogUsage.ts:96–117). The reused walk intentionally skips reads and truncates discovery for telemetry. The new caller treats every omitted page as unused and disables its missing-media refusal. Three producer-backed probes reproduce this: a played page beyond the walk's file budget, a descendant reached through an archive-normalized Unicode filename, and a descendant mounted by a supported BOM-encoded page. In all three cases, the staged contents compile with the played page present, but staging allows that page's missing image instead of refusing. The per-file scan limit and unreadable ancestors need the same conservative treatment.

Fix: derive the played-page graph from the normalized staged contents that will actually render, with an explicit completeness result. Retain the previous strict missing-file enforcement when discovery is incomplete instead of converting unknown into unused. Cover the file/size limits, read failures, normalized-name descendants and the renderer's supported text encodings; keep the unused-page happy-path test.

Important — the new synchronous walk can block staging (packages/cli/src/utils/catalogUsage.ts:108, packages/cli/src/utils/publishProject.ts:699–704). Staging excludes non-regular inputs, but the new independent walk opens a referenced non-regular path with blocking readFileSync. A child-process probe reaches staging and then must be terminated at its deadline; the preceding implementation completes. Walk the already-staged regular buffers, or reuse the producer's nonblocking, regular-file-checked reader rather than adding a blocking filesystem pass.

Validation through the shared gate: frozen install/full bun run build passed. Missing-file, general publish staging, absolute/private/file-type guards, catalog usage, outside-reference and cloud-offload suites: 193 committed tests passed. 3 temporary staging/render parity probes fail (expected function to throw) after producer controls confirm the pages are consumed. A fourth probe times out inside staging after reaching the call. Restoring the previous staging function makes all four probes pass, while its unused-page happy-path test fails as expected. Temporary changes restored. No actual cloud upload/render or dev walkthrough performed.

Command: bun run --cwd packages/cli test src/utils/publishProject.missing.test.ts src/utils/publishProject.test.ts src/utils/publishProject.absolutePath.test.ts src/utils/publishProject.privateFiles.test.ts src/utils/publishProject.fileType.test.ts src/utils/catalogUsage.test.ts src/utils/leftOutReference.test.ts src/cloud/offload.test.ts --maxWorkers=1.

Need: yes · Size: focused refusal relaxation · Reuse: shared composition resolver and normalized staged file map · Simpler: one complete staged graph, conservative fallback when incomplete · Structure: fine (checked telemetry walker, staging normalization and the existing localization guards; the telemetry result needs a stronger contract for this caller)
Risk: medium — incomplete classification can upload a composition whose played media is missing, and a referenced non-regular input can hang staging.

Verdict: REQUEST CHANGES
Reasoning: The relaxation works for ordinary drafts, but suppresses required refusals for played pages and introduces an unbounded staging read.

— Rames

@miguel-heygen
miguel-heygen force-pushed the fix/cli-cloud-refuse-film-pages-only branch from 64ebc96 to 0e672e7 Compare November 15, 2026 07:18
@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

Both findings are fixed in 0e672e7 at the root: the walk no longer uses the telemetry walker or the disk.

1. Partial reachability treated as unused. filmPagesOf (packages/cli/src/utils/publishProject.ts) now walks the staged in-memory pages, starting at index.html:

  • archive-normalized keys, decoded with decodeTextHonoringBom
  • children found with collectSubCompositionSrcs and resolved with resolveCompositionSrc, the renderer's resolver
  • no file budget and no size skip

If any page the video loads is not staged as text, the walk returns null and every page's hard references stay required. Unknown is never unused. Tests in publishProject.missing.test.ts cover each probe:

  • 300 nested pages
  • a child mounted by an NFD-on-disk, NFC-in-page composition
  • a UTF-16 BOM index.html
  • a loaded page left out by .hyperframesignore

Each of those fails against 64ebc96 and passes now. The unused-page happy path is kept.

2. Blocking read. The walk reads only staged buffers. Staging already takes regular files only, so nothing new is opened. Test: "is refused on any page, without waiting, when the video loads a named pipe" hung at 64ebc96 until killed at 120 s. It now finishes in milliseconds and stays strict. A mutation (count an unstaged page as unused) turns exactly that test and the not-in-upload test red.

The catalogUsage export is reverted. Runs are listed in the PR body.

@miguel-heygen
miguel-heygen force-pushed the fix/cli-cloud-refuse-film-pages-only branch from 0e672e7 to d03e471 Compare November 15, 2026 10:26
@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

Rebased on main 04202e8 as one commit, d03e471. The only conflict was an import line: main renamed isCopiedOutsideFileType to isUploadedOutsideFileType in #7818. The fix itself is unchanged from 0e672e7, which answered both findings from the 64ebc96 review (see the comment above).

Re-run on the rebased tree (Linux):

  • publishProject.missing.test.ts: 8 pass, 3 runs in a row
  • every publishProject*.test.ts, catalogUsage, offload, offload.undecodableTrack, publish, leftOutReference, publishProxyBake and submitFeedback test file: exit 0 (the e2e file skips there)
  • break check: staging a page the video loads that is not text gets treated as unused, and exactly the 2 strict-fallback tests go red
  • oxfmt and oxlint clean on both files

Not run: the full CLI tsc. Its only errors there come from @hyperframes/inspector/live not being built; none are in these files.

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at d03e471c220b05572c9f5bcbfe08d6d130079513.

The earlier traversal and blocking-read findings are fixed. Discovery now walks normalized staged buffers, honors BOMs, has no telemetry file/size cutoff, and falls back to strict checks when a mounted page is absent. The three original producer-parity probes and the bounded named-pipe probe pass. Restoring the former traversal makes all four fail again, including the pipe timeout; treating an unstaged page as unused fails the two fallback tests.

Important — the selected cloud-render entry is ignored (missed in round 1). filmPagesOf (packages/cli/src/utils/publishProject.ts:710) starts at index.html, but cloud render --composition can select a different page. stageProjectFiles (packages/cli/src/commands/cloud/render.ts:754) calls staging before computing that selected entry. A valid index that does not mount alternate.html, plus an alternate page containing <img src="missing.png">, now passes cloud render --composition alternate.html --dry-run --json with exit 0 and a two-file archive. The actual selected page's missing media is classified as unused. Restoring strict missing-file enforcement rejects the same invocation with The composition references "missing.png", which is not in the project folder.

Pass the selected entry into staging/localization and seed discovery from it, retaining index.html as the default for publish callers. Add CLI-level tests for missing media on the alternate entry and for missing media on an index that the alternate entry does not play. Keep the incomplete-graph fallback and the repaired original cases.

Validation: frozen install and full bun run build passed. Seven focused staging/cloud test files: 194 tests passed, including seven temporary review controls (187 committed tests). Original traversal mutation: four review controls fail; strict-fallback mutation: two committed tests fail. The new alternate-entry CLI regression fails at head and passes with strict enforcement restored. Temporary source edits restored. No cloud upload/render, dev walkthrough or native Windows run.

Need: yes · Size: focused refusal relaxation · Reuse: staged graph and existing selected-entry contract · Simpler: thread the entry through the shared staging owner · Structure: fine (checked normalization, renderer resolver and cloud caller; no split)
Risk: medium — a selected render page can upload with missing required media.

Verdict: REQUEST_CHANGES
Reasoning: The repaired graph must start from the composition the cloud command will actually render.

— Rames

@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

Fixed in f8ce7bf: the walk now starts from the page the cloud render will render.

  • stagePublishFiles and localizeExternalAssets take the entry's archive key, and filmPagesOf starts its walk there. Both default to index.html, so publish is unchanged.
  • stageProjectFiles (packages/cli/src/commands/cloud/render.ts) works out the entry from --composition before staging and passes it in. The "excluded from the archive" check that follows is unchanged. An entry that is not staged still makes the walk return null, so every page stays strict.
  • New CLI tests in render.missingEntry.test.ts, run through cloud render --composition alternate.html --dry-run --json:
    • a missing image on the selected page is refused
    • a missing image on an index.html that the selected page does not mount is allowed

Run on Linux:

  • the new file passes 2 of 2, 3 runs in a row
  • break check: drop the entry from the render.ts call, and both new tests go red
  • break check: walk from index.html again, and both new tests go red
  • still exit 0: publishProject.missing.test.ts (8, 3 runs), every publishProject*.test.ts, catalogUsage, offload, offload.undecodableTrack, publish, leftOutReference, publishProxyBake, submitFeedback, and every render*.test.ts under commands/cloud
  • oxfmt and oxlint are clean on the 4 changed files

Not run: the full CLI tsc, whose only errors there are from the unbuilt @hyperframes/inspector/live. No real cloud upload and no Windows run either.

…ames

The video's pages are walked from the staged upload, starting at index.html, with the
renderer's resolver; when a page it loads is not staged text, every page stays strict.

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at f8ce7bf3c5869ceaef65eb5b4f172539fd82a2a2.

The selected-entry blocker is fixed on this branch: cloud staging computes the archive entry first and passes it through localization into graph discovery. Ordinary publish still defaults to index.html. The original alternate-entry CLI repro now refuses missing.png, while the new unused-index case succeeds.

Important — resolve the two integration conflicts before approval. Actual merge-tree against main e426ce4e conflicts in packages/cli/src/commands/cloud/render.ts and packages/cli/src/utils/publishProject.ts. Main uses the newly occupied argument positions for onOutsideFile; this branch uses them for entry. Preserve main's callback positions and append the entry argument:

stagePublishFiles(dir, limit, onLeftOut, onOutsideFile, entryPath);
localizeExternalAssets(dir, files, limit, onLeftOut, onOutsideFile, entry);

Keep the default entry = "index.html" last in both signatures, preserve main's outside-file collection/reporting and publish forwarding, and retain one staging call after entryPath is calculated. Rerun both selected-entry CLI tests plus outside-file reporting tests on the resolved head. No additional behavior blocker found on the reviewed branch.

Validation: frozen install/full build passed. 34 tests pass across four files, including the original temporary CLI repro, both new CLI cases, missing-reference tests and publish tests. Removing the selected-entry argument makes both new CLI tests fail. Source restored. No upload/render, dev walkthrough or native Windows run.

Need: yes · Size: focused entry propagation · Reuse: shared staging graph and main's outside-file reporting · Simpler: preserve callback and append entry · Structure: fine (checked both call chains and conflicting signatures; no split)
Risk: medium — conflicting shared staging contracts must be integrated without dropping either behavior.

Verdict: REQUEST_CHANGES
Reasoning: The code fix passes; the unresolved shared-argument conflicts need a reviewed merge result.

— Rames

@miguel-heygen
miguel-heygen force-pushed the fix/cli-cloud-refuse-film-pages-only branch from f8ce7bf to c9fac43 Compare November 15, 2026 10:56
@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

Rebased on main e426ce4 at c9fac43. The conflict came from #7831, which adds an onOutsideFile parameter to stagePublishFiles and localizeExternalAssets in the same place as this PR's entry. Both are kept, with entry last. stageProjectFiles now passes onOutsideFile, entryPath. The rest is unchanged from f8ce7bf.

Re-run on the rebased tree (Linux):

  • render.missingEntry.test.ts: 2 pass, 3 runs in a row
  • break check: drop entryPath from the call, and both tests go red
  • break check: walk from index.html, and both tests go red
  • break check: count a page that is not staged as unused, and exactly the 2 strict-fallback tests in publishProject.missing.test.ts go red
  • exit 0: every publishProject*.test.ts, including the new outsideList; every render*.test.ts, including the new outsideFiles; also catalogUsage, offload, publish, leftOutReference, publishProxyBake and submitFeedback
  • oxfmt and oxlint are clean

Not run: the full CLI tsc, since the unbuilt inspector package is its only error source there.

@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

The integration conflict from the f8ce7bf review is resolved at c9fac43, in the shape you gave:

  • stagePublishFiles(project.dir, OFFLOAD_MIN_BYTES, onLeftOut, onOutsideFile, entryPath) is the one staging call in stageProjectFiles (render.ts:799), made after entryPath is worked out
  • localizeExternalAssets(absProjectDir, fileContents, onDiskMinBytes, onLeftOut, onOutsideFile, entry)
  • entry = "index.html" is the last parameter in both signatures (publishProject.ts:757, :848)
  • buildPublishFileMap still forwards onOutsideFile (:796)

Re-run at c9fac43: both selected-entry CLI tests, render.outsideFiles.test.ts and publishProject.outsideList.test.ts pass, along with the rest of the set in the comment above. Dropping entryPath from the call turns both CLI tests red.

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at c9fac43b3e4f56d798b0701533a29e3f49981fa8.

The previous integration conflicts are resolved. Range-diff shows the two reviewed changes rebased onto main with its outside-file callback retained: stage argument 4 and localization argument 5 remain onOutsideFile, with entry appended as arguments 5/6. stageProjectFiles stages once, after computing entryPath. stageAndReport still collects and prints outside files; publish and feedback retain their index.html default and callback forwarding.

The selected-entry behavior remains correct: the original alternate.html CLI repro refuses missing.png, and an unused index.html with missing media does not block the alternate render. The earlier staged-buffer traversal and strict fallback remain intact. The automatic merge with main e426ce4 is clean.

Validation: frozen install and full build passed. Focused selected-entry, outside-file reporting, missing-reference and publish tests, including the original temporary CLI repro, passed on this head (40 tests across six files, one being the temporary reviewer repro). Commands: bun install --frozen-lockfile, bun run build, then bun run --cwd packages/cli test src/utils/review7812-entry.test.ts src/commands/cloud/render.missingEntry.test.ts src/commands/cloud/render.outsideFiles.test.ts src/utils/publishProject.outsideList.test.ts src/utils/publishProject.missing.test.ts src/commands/publish.test.ts --maxWorkers=1 through the shared gate; output: 6 passed, 40 passed. No upload/render, dev walkthrough or native Windows run.

Need: yes · Size: focused conflict resolution · Reuse: existing staging graph and outside-file callback · Simpler: preserve callback, append entry · Structure: fine (checked cloud stageAndReport and publish forwarding; no split)
Risk: medium — shared staging contract now carries both reporting and entry selection.

Verdict: APPROVE
Reasoning: The reviewed missing-file behavior and main's outside-file reporting survive together in the resolved tree.

— Rames

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit 45cc331 Nov 15, 2026
84 checks passed
@miguel-heygen
miguel-heygen deleted the fix/cli-cloud-refuse-film-pages-only branch November 15, 2026 12:45
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