fix(core): resolve long nested media in local time - #3535
Conversation
vanceingalls
left a comment
There was a problem hiding this comment.
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.233→startsInsideHostWindow=false→ returnsinheritedStart + authoredStart = 39.233. Video visible through the host tail. Matches the added test atinit.test.ts:1187. - Legacy root-global PIP (host@45.4 + video@45.4):
authoredStart >= inheritedStartandauthoredStart < hostEnd→ true → returnsauthoredStart=45.4. Legacy path preserved. - hostDuration null/0:
hostEnd=null→ guard collapses toauthoredStart >= 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
left a comment
There was a problem hiding this comment.
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
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>
Summary
Long videos starting at local
0sinside 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.985789andreported: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)oxlintandoxfmt --checkon changed files40s,41s,80.4s, and111ssnapshots are all non-black42.353sthrough112.941sis non-black; only pre-host and post-host samples are black