Repository navigation
fix(bench): install Text, Comment, and CharacterData in strong-compiler-checks DOM shim - #1490
Merged
Merged
Conversation
…er-checks DOM shim validateCachedSemantics installs a fixed list of happy-dom constructors on globalThis before executing each revision's bundled runtime. The runtime's text-binding path now does an unguarded `previous instanceof Text`, so the cached-semantics control failed with `ReferenceError: Text is not defined` and every run (including --smoke) recorded status "failed". Add Text, plus Comment (its sibling CharacterData node kind, so a future value-position reference does not break the harness the same way) and CharacterData. CharacterData is typeof-guarded in initDomOperations, so its absence did not throw, but it made the harness skip the Text/Comment expando seeding that every browser performs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
trueadm
marked this pull request as ready for review
October 1, 2026 09:27
trueadm
added a commit
that referenced
this pull request
Oct 1, 2026
Brings in #1496 (stale deferred state updates), #1498 (uncached useSyncExternalStore snapshots), and #1490. Keeps both new compiler imports in strong-mode.js. The workaround ledger records that #1498 now rejects the fresh-snapshot viewport workaround (23 → 22 compiler gaps). Prompts, references, and alternatives are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Summary
benchmarks/strong-compiler-checks/run.mjsfails on currentmainin its cached-semantics control withReferenceError: Text is not defined, thrown from the runtime'sbindSignalText. Every run, including--smoke, recordedstatus: "failed".validateCachedSemanticscopies a fixed list of happy-dom constructors ontoglobalThisbefore it runs each revision's bundled runtime. The text-binding path now usesprevious instanceof Textwith no guard, andTextwas not on that list.This adds three names to the list:
Textfixes the failure.Comment: the runtime doesn't need it today, because it only appears in type positions (node is Comment). It's the other CharacterData node kind the runtime works with, so adding it means a futureinstanceof Commentcan't break the harness the same way.CharacterData: its absence didn't throw, becauseinitDomOperationscheckstypeof CharacterDatafirst. But without it the harness skipped the Text/Comment expando seeding that every browser does. With it installed, the check exercises the same code a browser does.Audit of other DOM globals
I searched
packages/octane/srcforinstanceof X,new X,X.prototype,X.CONST, and bare browser functions. Nothing else on the load or mount path is missing:Node,Element,HTMLElementandEventare used without guards, and the harness already installs them.IntersectionObserver,requestAnimationFrame,CSSandMessageChannelare all guarded withtypeofchecks.MessageChannelstays installed asundefinedon purpose. happy-dom has none, so this hides Node's version and puts the runtime on its timer fallback, as the existing harness comment says.FormDataandDOMExceptionfall back to Node's own globals. Only form actions and RPC code reach them, and this workload doesn't.I kept the fixed list instead of copying every constructor from the window.
esbuild.buildruns while the globals are installed, and replacing Node's ownURL,Blob,TextEncoderand similar globals in that process would be riskier than the problem being fixed.Validation
pnpm format:checkpnpm typecheckpnpm test: not run. Nothing outsidebenchmarks/strong-compiler-checks/references this harness, and it is not a registered CI suite. Its README says it runs directly because it needs an external baseline.git archivesnapshot of874ca5f13(currentmain), with the snapshot's root andpackages/octanenode_modulessymlinked to the worktree's install:status: "failed", withReferenceError: Text is not defined.status: "complete", with 28 targets and thesourcesStablerecord present. All 8 lane/policy controls ran: each has 8 observations, and the client lanes each have 6 cache-identity records (server lanes have 0, as expected).main: completes, with all controls passing; see below.pnpm syncproduced no generated changes.Smoke timings are one sample each and aren't performance evidence; the harness README says the same. The full paired run against
mainis reported below.Full paired run against
mainBoth sides compile byte-identical
packages/octane/src:mainis874ca5f13, and both aggregate source SHA-256s are85ce03d8…. So this run proves the full harness completes and shows its noise on identical code. It is not a performance comparison.status: "complete", with 56 targets. Sources and dependency resolutions stayed stable, all 8 cached-semantics controls passed, and emitted output is byte-identical between the two sides in all 28 cases.Paired median ratios (candidate ÷ baseline; 1.0 is the ideal for identical code):
The ratios run from 0.966 to 1.074, with a median of 0.998. On this machine under these conditions, a difference of up to about 7% is noise, and the 100-function plain lane is the noisiest.
The conditions were not clean:
pmset -g logshows a 172 s clamshell sleep and a DarkWake at 08:54:50.cached/plain1,000-function candidate sample measured 169,780 ms; its neighbours were 225 ms and 202 ms.cached/plain1,000-function samples ran at about 500 ms instead of about 100 ms, on both sides.cached/prod-client1,000-function case had three early outliers from background load, up to 1,868 ms against a typical ~480 ms. Its paired median is 1.007.The raw JSON is not committed, because it measures noise rather than a change.
Risk / follow-ups
harnessSha256will differ from the one inresults-2026-09-14.json, which is expected for any harness edit.Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Low Risk
Only internal benchmark harness DOM globals change; no compiler or runtime code is modified.
Overview
Fixes the strong-compiler-checks harness so its happy-dom DOM shim matches what the bundled runtime expects during the cached-semantics control.
validateCachedSemanticsnow copiesCharacterData,Text, andCommentontoglobalThisalongside the existing window/DOM constructors.Textis required because signal text binding uses unguardedinstanceof Text; without it the harness failed withReferenceError: Text is not defined.CharacterDataenables the same expando seeding path browsers hit at init;Commentpreempts a similar gap if the runtime ever checksinstanceof Comment.Reviewed by Cursor Bugbot for commit 9d11f41. Bugbot is set up for automated code reviews on this repo. Configure here.