Skip to content

fix(core): a runtime failure just before start-up is named too - #5444

Merged
miguel-heygen merged 1 commit into
mainfrom
fix/runtime-pre-init-errors
Oct 11, 2026
Merged

miguel-heygen merged 1 commit into
mainfrom
fix/runtime-pre-init-errors

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

What changes for the user

When the HyperFrames runtime fails in the steps just before it starts (refreshing SVG selector aliases, or running the font-gated composition scripts), check, snapshot, render and the other readiness waits now fail at once with "HyperFrames runtime failed: : …" instead of waiting out their timeout with no cause.

Root cause

The start-up error recorder (recordStartupError, which readiness waits read through window.__hfStartupError) was wired around the init call only. startAfterCompositionScripts in runtime/entry.ts runs two steps before init: refreshSvgSelectorAliases() and, when the page has font-gated scripts, runScriptsAfterFonts(...). A throw in either left nothing recorded, so the page never became ready and the wait timed out without saying why.

Fix

The recorder now wraps all of startAfterCompositionScripts: the synchronous path records and rethrows as before, and the font-gated path records the rejection and passes it to reportError (the same way afterFonts.ts reports listener errors), so it still reaches the console without an unhandled rejection. The init call no longer needs its own wrapper.

Verification

  • New entry.startupFailure.test.ts cases: a throw from refreshSvgSelectorAliases and a rejected font-gated script run each record the named error (and the latter is passed to reportError). Both fail on the previous code.
  • The entry tests (40) pass 3 runs in a row; core typecheck, oxlint, oxfmt, the comment ratchet and check:position-edits-render are clean.

Follows the start-up error work merged in the previous PR on this path.

Why this PR is small

It closes one gap left by the start-up error work: one function in entry.ts and its two regression tests.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 2061 (base branch 2061), smooth 1648 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 (0)

Unstable (1)

  • crop-none-px-r30-root-z100: tracking 0.04, pressJump 0, drop 40.08, reload 40.08, render 34.74, renderKey -, undo true, teleport true / tracking 0.04, pressJump 0, drop 0.08, reload 0.08, render 0.26, renderKey -, undo true, teleport true / tracking 0.04, pressJump 0, drop 0.08, reload 0.08, render 0.26, renderKey -, undo true, teleport true

@somanshreddy somanshreddy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving at 9c9cb490.

  • The recorder now wraps all of startAfterCompositionScripts.
    • Sync path: refreshSvgSelectorAliases, or init with no deferred scripts. It records and rethrows, as init alone did before.
    • Font-gated path: runScriptsAfterFonts awaits fonts and scripts, then calls afterRun() (init) unguarded, so an init throw still rejects the promise. The new .catch records it and passes it to reportError. Removing init's own wrapper therefore loses nothing.
  • Tests: the src/runtime/entry* tests pass 51/51. Mutants killed:
    • no record on the font-gated rejection (1 fails)
    • no record in the sync catch (4 fail)
  • CI: all required checks green. No CRs.

Review by Somu

@miguel-heygen
miguel-heygen added this pull request to the merge queue Oct 11, 2026
Merged via the queue into main with commit 721ebea Oct 11, 2026
165 checks passed
@miguel-heygen
miguel-heygen deleted the fix/runtime-pre-init-errors branch October 11, 2026 00:49
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