Skip to content

fix(core): resolve long nested media in local time - #3535

Merged
miga-heygen merged 2 commits into
mainfrom
fix/nested-snapshot-media-time-1787898835
Aug 29, 2026
Merged

fix(core): resolve long nested media in local time#3535
miga-heygen merged 2 commits into
mainfrom
fix/nested-snapshot-media-time-1787898835

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

Long videos starting at local 0s inside delayed sub-compositions no longer disappear from late snapshots. Media starts before the host’s absolute window now inherit the host offset even when their long duration overlaps that window; legacy media authored with a start already inside the global host window keeps its existing behavior.

Fixes reported:1787898835.985789 and reported:1787908114.998239.

Test plan

  • packages/core/src/runtime/init.test.ts (91 passed, including legacy global-PIP coverage)
  • packages/cli/src/commands/snapshot.test.ts (33 passed)
  • Core and CLI typechecks
  • oxlint and oxfmt --check on changed files
  • Exact Terra point fixture: 40s, 41s, 80.4s, and 111s snapshots are all non-black
  • Exact Terra 18-frame sweep: every in-host sample from 42.353s through 112.941s is non-black; only pre-host and post-host samples are black

Compound Engineering
Codex

@vanceingalls vanceingalls 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.

Correctness read:

The fix drops authoredEnd-based overlap and disambiguates purely on authoredStart's position relative to the host window. That's the right call — a long local clip can end past the host's absolute window without changing what the start means, so the duration was a false signal. Three shape checks:

  • Composition-local (host@39.233 + video@0/dur=80): authoredStart=0 < inheritedStart=39.233startsInsideHostWindow=false → returns inheritedStart + authoredStart = 39.233. Video visible through the host tail. Matches the added test at init.test.ts:1187.
  • Legacy root-global PIP (host@45.4 + video@45.4): authoredStart >= inheritedStart and authoredStart < hostEnd → true → returns authoredStart=45.4. Legacy path preserved.
  • hostDuration null/0: hostEnd=null → guard collapses to authoredStart >= inheritedStart, same as the pre-fix branch. No behavior change on unknown-duration hosts.

The retained inline comment on lines 663-669 explains why duration was unsound — first-principles, no ticket citation. Good comment.

CI note: Tests on windows-latest shows red, but the vitest report inside it is 196 files / 2852 tests passing with Exited with code 0; the wrapper exits 1 after an LFS-pointer checkout phase warning ("Encountered 68 files that should have been pointers"). Reads as runner LFS-state flake, not a regression from this change — and this check isn't in the required set (mergeable: MERGEABLE). Worth a rerun to green-up the record if you'd like.

Review by Via

@vanceingalls vanceingalls 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.

R3 re-stamp at d55f9f2 — test-only additive delta (single initSandboxRuntimeModular test covering long nested media staying visible across host schedule window at 11 checkpoints from 42.353s to 112.941s + resolver=39.233s). Same fix as approved at 4d9d5ba, no production code touched. All 30 required checks green.

— Via

@miga-heygen
miga-heygen merged commit 3dc1856 into main Aug 29, 2026
57 checks passed
@miga-heygen
miga-heygen deleted the fix/nested-snapshot-media-time-1787898835 branch August 29, 2026 02:48
felipecaldas added a commit to felipecaldas/hyperframes that referenced this pull request Aug 30, 2026
15 releases and 154 commits of upstream drift, taken in one merge rather than
letting it compound. Measured cost: 25 of our 114 patched files overlapped
upstream's 674, producing 10 real code hunks across 6 files (plus bun.lock,
regenerated).

Three carried patches are dropped because upstream now owns them:

  - TAB-792 (79e8858). Upstream heygen-com#3535 landed a logically identical
    start-based predicate for the local-vs-root-global timing convention.
    Taken verbatim so the file returns to upstream identity and stops
    conflicting here forever.
  - The heygen-com#3349 cherry-pick (0d1d683). Upstream refactored the same bound
    into `clampNativeMediaVolume`, which `withUnclampedVolume` also uses, so
    the two cannot drift.
  - The studio-server lint *route*. Upstream heygen-com#3393 runs whole-project lint
    first and only falls back to per-file for uncovered HTML — a superset of
    ours, and a better answer to the TAB-780/781 problem. The
    `helpers/projectLint.ts` helper STAYS: agent/providers.ts and
    agent/runtime.ts still import it.

Patches kept, re-sited onto upstream's refactors:

  - PromptPreviewModal moved to its own file upstream and gained a focus trap,
    a dirty-draft close veto and copy-failure state. Our "Create with Agent"
    button and `registryItem` prop are ported onto that version rather than
    keeping our older in-file copy.
  - EditModal's agent-bridge handoff keeps its behaviour and adopts upstream's
    draft clearing. No copy-failure branch: openAgentBridge is a synchronous
    window event, not a clipboard write the browser can refuse.
  - PropertyPanelFlat's caption section composes with upstream's new audio-fx
    fallback.

Verified on this branch: build exit 0; typecheck clean in core, studio and
studio-server; lint 0 errors; core 2598 tests, studio 4604, studio-server 534,
all passing with real summary lines. Fork invariants measured on the built
dist — vendorRoute=3, sameOriginMotionPath=1, jsdelivrGsap=0, jsdelivrAll=0,
__hfStudioManualEditsApply=6 (fork count, not upstream's 3), so TAB-697,
TAB-746 and PR heygen-com#2909 all survived.

Renders are NOT proven frame-stable: 674 upstream files changed and no render
evidence was gathered here.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

3 participants