You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
runtime: builtins must throw spec-mandated TypeError/RangeError on invalid this/args #3662
Built-in functions and methods do not throw the spec-mandated TypeError / RangeError on invalid arguments or invalid this. A parity sweep shows 282
failures with the signature "Expected a … to be thrown but no exception was
thrown at all" (test262) / "Missing expected exception" (node-core) — the single
largest behavioral cluster in the report.
This is the runtime-validation side of Perry's "no runtime type validation"
design: where the spec requires an operation to reject bad input, Perry silently
proceeds.
282 failures. Top categories: Set (28), WeakSet (28), Function (24), WeakMap
(23), fs (20), Map (13), TypedArray (11), buffer (8), process (8), zlib (8),
http (6), ArrayBuffer (5).
The cleanest sub-pattern is this-not-object / not-callable brand checks —
e.g. calling a Set/Map/WeakSet/WeakMap prototype method with a non-object this
must throw, and Function.prototype.apply/bind/Symbol.hasInstance must reject a
non-callable this:
On the node-core side the same gap surfaces as missing ERR_INVALID_ARG_TYPE / ERR_OUT_OF_RANGE throws across fs / buffer / process / zlib.
Repro
consts=newSet();Set.prototype.add.call({},1);// should throw TypeError (this is not a Set); Perry: no throwFunction.prototype.apply.call(undefined,null,[]);// should throw TypeError; Perry: no throw
Why it's high-leverage
One semantic — "perform the spec's brand/type check and throw before doing the
work" — applied across the collection prototypes and Function.prototype clears
the largest single block of failures (~100+ from Set/Map/Weak*/Function alone),
and the same pattern extends to the node-core arg-validation cases.
Suggested scope
Add the this/argument brand checks at the top of the affected builtin methods
(Set/Map/WeakSet/WeakMap prototype methods, Function.prototype.apply/bind/
hasInstance) and the constructor/method arg-range checks for the node-core APIs,
each throwing the spec-correct error type.
Filed from the parity-gap radar. Cluster: 282 "no exception was thrown" /
"Missing expected exception" failures across ~25 categories.
This umbrella (~282 "no exception thrown" failures) has been largely cleared by
general work + targeted PRs. A re-sweep against node --experimental-strip-types
shows most categories now behave correctly (Set/Map/Weak*, Function apply/call/bind,
fs/zlib/process, all String.prototype this-coercibility, ArrayBuffer/TypedArray
prototype this checks, Number toFixed/toString/etc.).
Update: the #4099 crash (highest-value remaining item) now has a fix in PR #4111 — installing the collection size accessor before the data methods (root-caused to an accessor-install desync corrupting Map.prototype.set). The pre-existing test_gap_3662_collection_brand_check.ts (which crashed on main) now passes. Remaining: #4100 (primitive-wrapper brand checks), #4101, #4102, #4103.
Resolved — full cluster verified byte-identical to Node
All decomposed sub-issues are fixed and merged, and the whole cluster was re-verified end-to-end against node --experimental-strip-types on a clean main build (HEAD includes #4124):
Spot-checked all of: collection/Function/String/Number/Boolean/Symbol/BigInt prototype this brand checks (computed and statically-typed .call), typed-array constructor + view validation, hasInstance, dynamic instanceof, and Function.prototype.toString — every case matches Node.
Activity
fix(runtime): brand-check collection prototype methods (#3662)
fix(runtime): brand-check collection prototype methods (#3662)
fix(runtime): brand-check collection prototype methods (#3662)
fix(runtime): brand-check collection prototype methods (#3662)
fix(runtime): brand-check collection prototype methods (#3662)
fix(runtime): brand-check collection prototype methods (#3662) (#3739)
fix(runtime): brand-check Function.prototype apply/call/bind this (#3662
fix(node): throw spec arg-validation errors for fs/process/zlib (#3662)…
fix(runtime): validate typed-array constructor length (#3662) (#4093)
proggeramlug commentedon Jun 2, 2026
Status / decomposition (2026-06-02)
This umbrella (~282 "no exception thrown" failures) has been largely cleared by
general work + targeted PRs. A re-sweep against
node --experimental-strip-typesshows most categories now behave correctly (Set/Map/Weak*, Function apply/call/bind,
fs/zlib/process, all String.prototype
this-coercibility, ArrayBuffer/TypedArrayprototype
thischecks, Number toFixed/toString/etc.).Merged sub-clusters
Function.prototype.{apply,call,bind}not-callablethisOpen PRs
RangeError(negative / Infinity / ≥2^53)Function.prototype[Symbol.hasInstance](wasundefined)Remaining tail — filed as granular issues (per the workable-backlog preference):
Map/WeakMap.prototype.setreflective on a bad receiver crashes (SIGBUS) instead of throwing. Also masks the rest of thetest_gap_3662_collection_brand_check.tsoutput. High (crash).Number/Boolean/Symbol/BigIntprototype methods don't brand-checkthis(reflective call returns[object Object]instead ofTypeError; also fixes wrong-value reflectivetoString)Function.prototype.toStringreturns[object Object]for functions (source reconstruction + brand check)instanceof/ reflectivehasInstancewithArray/Object/Dateconstructor valuesnew TA(buffer, byteOffset, length)offset/length validationSuggest closing this umbrella once #4093 + #4098 land, tracking the rest via the
granular issues above.
fix(runtime): implement Function.prototype[Symbol.hasInstance] (#3662) (
proggeramlug commentedon Jun 2, 2026
Update: the #4099 crash (highest-value remaining item) now has a fix in PR #4111 — installing the collection
sizeaccessor before the data methods (root-caused to an accessor-install desync corruptingMap.prototype.set). The pre-existingtest_gap_3662_collection_brand_check.ts(which crashed on main) now passes. Remaining: #4100 (primitive-wrapper brand checks), #4101, #4102, #4103.fix(runtime): stop size-accessor install corrupting Map/Set.prototype…
proggeramlug commentedon Jun 2, 2026
Final disposition (this work cycle)
The substantive, tractable items are fixed and the remainder is decomposed into granular, investigation-backed issues.
Shipped this cycle (CI-green):
RangeErrorFunction.prototype[Symbol.hasInstance](wasundefined)sizeaccessor install was corruptingMap.prototype.set, soMap.prototype.set.call(...)SIGBUS'd. Root-caused to an accessor/data-field desync; install the accessor before the data methods. The previously-crashingtest_gap_3662_collection_brand_check.tsnow passes.Remaining — tracked, each needs a deeper/architectural change (not the collection recipe):
populate_builtin_prototype_methodsinterception (which works for collections) does not work here —Number.prototype.valueOf.call(x)doesn't read from the populated singleton prototype; it resolves via the shared noop thunk that re-dispatches by name and loses theNumberorigin. Needs interception at the reflective-dispatch site. (Full analysis in the issue.)Function.prototype.toStringreturns[object Object](needs function-source retention).instanceof/ reflectivehasInstancewithArray/Object/Dateconstructor values (needs constructor-value identity on the dynamic path).new TA(buffer, byteOffset, length)offset/length validation (needs real view modeling).Recommend closing this umbrella once #4093/#4098/#4111 merge, and letting #4100–#4103 proceed as independent issues.
fix(runtime): cap field_count to inline capacity in ensure_key_in_key…
proggeramlug commentedon Jun 2, 2026
Resolved — full cluster verified byte-identical to Node
All decomposed sub-issues are fixed and merged, and the whole cluster was re-verified end-to-end against
node --experimental-strip-typeson a cleanmainbuild (HEAD includes #4124):Function.prototype.{apply,call,bind}not-callablethisRangeErrorFunction.prototype[Symbol.hasInstance]instanceofArray/Object/Date (#4102)Function.prototype.toStringsource + brand check (#4101).call)Spot-checked all of: collection/Function/String/Number/Boolean/Symbol/BigInt prototype
thisbrand checks (computed and statically-typed.call), typed-array constructor + view validation,hasInstance, dynamicinstanceof, andFunction.prototype.toString— every case matches Node.Closing as completed.
runtime: bind thisArg in dynamic array-method dispatch; V8 receiver i…
fix: dynamic array-method dispatch dropped the thisArg — extracted bu…