Repository navigation
fix(core): a timing observer firing after its page is gone no longer throws and fails the run - #8834
Merged
Merged
Conversation
…throws and fails the run
Contributor
Edit accuracy: accurate 273 (base branch 271), smooth 57 of thoseThe gate passes. Newly passing (2)
Not banked yet, reported and not gated (bank a full-grid run's baseline.json) (2)
Quarantined, measured but not gated (0) |
vanceingalls
approved these changes
Nov 25, 2026
vanceingalls
left a comment
Collaborator
There was a problem hiding this comment.
Approved at a51d501.
touchesincreateRecordFilternow comparesnodeTypeto a localELEMENT_NODE = 1instead of reading the globalNode. The DOM fixes that value at 1, so behaviour is unchanged, and a callback delivered after jsdom teardown no longer throws. Both late observers (timing and colour grading) go through this one filter, and no otherNode.*read remains inmutationRecords.ts.- The new test stubs the global
Nodeto undefined and fails on main with "reading 'ELEMENT_NODE'"; the PR body has the "fails without the fix:" line naming it. - 3751cd8..a51d501 changes only the test comment, shortened to fit the line limit.
- Required checks are green at a51d501, including the Windows test jobs.
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
createRecordFilter(packages/core/src/runtime/mutationRecords.ts) checks a node's type against the number1instead of the globalNode.ELEMENT_NODE. A timing or colour-grading observer whose callback runs after its page is gone no longer throws.Why
The core runtime suite (
test:runtime-coverage) printsReferenceError: Node is not defined9 times on every run. All 9 come from MutationObserver callbacks (init.tstakeTimingRecords,colorGrading.ts) that jsdom delivers after their test file's environment has torn down the globalNode. On Linux the run still exits 0. On slower Windows runners one of those prints sometimes lands while vitest's worker is closing. Vitest then reportsEnvironmentTeardownError: Closing rpc while "onUserConsoleLog" was pendingas an unhandled error, and a run whose tests all pass (3763/3763) exits 1.That is what dequeued a merge group this morning on "Windows render verification" (
engine-cli-2,test:runtime-coverage). The PR in that group touched none of this code.Related work
None.
How
touchesreadNode.ELEMENT_NODE, a lookup on the global that a page past its teardown no longer has.ELEMENT_NODE = 1is the DOM's fixed value, so the check means the same thing in a browser and keeps working when the global is gone. Both late observers go through this one function. No other runtime code that readsNode.*is reached from an observer callback: after this change the suite prints noNode is not defined.Test plan
packages/core/src/runtime/mutationRecords.test.ts"judges an inserted element without the global Node, as a callback after its page is gone does": it records an inserted<video>, removes the globalNodewithvi.stubGlobal, and expects the record to count as a timing change. 7/7 pass, 3 runs in a row.fails without the fix:
packages/core/src/runtime/mutationRecords.test.ts"judges an inserted element without the global Node, as a callback after its page is gone does" fails on main withTypeError: Cannot read properties of undefined (reading 'ELEMENT_NODE').Whole runtime suite on the devbox (
vitest run --coverage src/runtime, the commandtest:runtime-coverageruns): on main, 3763 passed, exit 0, with 9Node is not definedprints. With the fix, 3764 passed, exit 0, with 0 prints. Coretsc --noEmit,oxlint,oxfmt --checkand the comment-share ratchet are clean.