Repository navigation
fix(core): a runtime that fails to start names its real error instead of a half-built page - #5406
Open
miguel-heygen wants to merge 9 commits into
Open
miguel-heygen wants to merge 9 commits into
miguel-heygen wants to merge 9 commits into
Conversation
… longer aborts the runtime
… or throwing entry
Contributor
Edit accuracy: accurate 2061 (base branch 2061), smooth 1664 of thoseThe gate passes. Quarantined, measured but not gated (0) |
…ad of a half-built page
…nd a later good post clears it
…d of reading it as stuck at 0
…ng cleared by a later post
… cannot be printed
…startup error recorder
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes for the user
hyperframes checkno longer dies withcheck_runtime_failure: Cannot access 'nS' before initializationon a project whose sub-composition registers a partial timeline, such aswindow.__timelines["extra"] = { duration: 4, seek() {} }or one whoseduration()throws. The browser audit runs and reports layout, motion and contrast again. Preview and render of the same page stop half-initialising too.Root cause
During runtime start-up the timeline is announced, which builds the clip tree and the timeline payload. Both read each registered sub-composition timeline's
duration:clipTree.tscalledregistry[id]?.duration?.(). Optional call only skipsnull/undefined, so a numericdurationwas called and threwTypeError: registry[compId]?.duration is not a function.timeline.tschecked thatdurationwas a function but did not guard the call, so aduration()that throws escaped too.Either throw aborted start-up partway, before the seek helpers further down were initialised. The next seek from
checkthen hit the temporal dead zone ofactivateSiblingTimelines(minifiednS), an error that names an internal variable instead of the real cause.The same guarded read existed in five places (
init.ts,timeline.tstwice,startResolver.ts,clipTree.ts) with two of them missing a guard. They now share one reader,readTimelineDurationSeconds: a finiteduration()ornull, with the type check inside the guard so a throwing getter or a Proxy entry reads asnulltoo. Each caller keeps its own rule on top (> 0, or clamped at 0).A start-up that throws now says so
Removing the trigger leaves the class: any exception during runtime start-up left a half-built page that the next seek reported as an internal "before initialization" error. Now:
recordStartupError(diagnostics.ts), setswindow.__hfStartupError("HyperFrames runtime failed: : . Check the composition's scripts and window.__timelines entries; if they look right, report this as a HyperFrames bug."). A thrown value that cannot be printed is recorded as "unknown error" rather than making the recorder throw.entry.tscalls it when start-up throws, and the render-ready publish calls it when its timeline post throws, including publishes after start-up (GSAP batching finishing, the deferred rebind, adapter readiness). Both still rethrow. Studio's editor refresh posts are a separate path: they keep their own retry and do not record.check,snapshot,keyframes,compare,layout,validate) and the engine's render wait fail at once with that message instead of timing out or seeking a half-built page.duration()that throws (it runs in the page and cannot import the shared reader); its handling of a non-finite duration is unchanged.position-edits-render-inline.tsis regenerated because the bundle it holds importsdiagnostics.ts.frameCapture.tscomment no longer cites a doc file that was never committed.Also in this PR (same
checkaudit)check's seek-clock probe (collectSeekClock) read a custom timeline'stime()withNumber(...), sotime: () => nullbecame0and a working custom root looked like a stuck clock (exit 1). It now accepts only a finite number.Verification
init.test.tscases run real runtime start-up and a seek with a sub-composition timeline whosedurationis a number, a method that throws, or a getter that throws. With main's runtime files all three fail (registry[compId]?.duration is not a function,boom,getter); with this change they pass.clipTree.test.tscovers the same shapes at the unit level.entry.startupFailure.test.ts: a throwing start-up records the named error, a start-up whose timeline post throws is not left render-ready, a post that throws after start-up (the deferred rebind) is named and leaves the page not ready, and a start-up error survives a later successful post. Both fail on the previous code. The CLI and engine waits each have a test that fails without the change, and so does the producer probe; acheckBrowser.test.tscase pins the nulltime()clock (fails on the previous code).0,null,NaN,Infinityfromduration()give the same results).Known limits
validatereports only the start-up error on such a page, not the other console errors it collected.