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
cjs: find-my-way@9 init throws 'Cannot convert undefined or null to object' — blocks #6559 e2e #6587
Found while landing #6559 (PR #6584): find-my-way@9 compiles natively (compilePackages) but throws TypeError: Cannot convert undefined or null to object at load — before any route is registered or any runtime-generated code runs.
Uncharacterized beyond the failure point: something during module init passes undefined/null into an Object.* operation (likely Object.keys/assign/setPrototypeOf over a value perry resolves differently at CJS init — needs a bisect into find-my-way's init graph: handler-storage maps, http-methods table, or its Object.create(null) trees).
Repro: the #[ignore]d e2e in crates/perry/tests/issue_6559_real_libs_e2e.rs (PERRY_REQUIRE_NPM_E2E=1 … -- --ignored).
Blocks: #6559 real-library acceptance (router leg), kimi-code target #6565 (fastify routing = find-my-way). Interpreter side already proven against find-my-way's captured matcher codegen incl. new NullObject() on a host class (PR #6584 fixtures).
Root cause:OrdinaryHasInstance (ECMA-262 7.3.21) with a null/undefined left operand threw TypeError: Cannot convert undefined or null to object instead of returning false. find-my-way@9's FindMyWay(opts) is called without new, so its Router body evaluates this instanceof Router with this === undefined; because the RHS is a function value, it routed through js_instanceof_dynamic's prototype-walk tail (ordinary_has_instance_prototype_walk), which called getPrototypeOf(undefined) and aborted module init before any route was registered.
Fix: the prototype walk now short-circuits to false for every non-object LHS (null/undefined/boolean/int32/string/bigint/symbol), per step 3 ("If Type(O) is not Object, return false"), and Symbol() instanceof Object is now false. Verified byte-identical to Node across 26 instanceof cases; real_find_my_way_router in crates/perry/tests/issue_6559_real_libs_e2e.rs is un-ignored and green.
Note: one minor CodeRabbit suggestion — set PERRY_REQUIRE_NPM_E2E=1 for the e2e-scoped CI job so that e2e can't silently skip — was not included in #6598 and remains as optional CI hardening.
Activity
fix(runtime): instanceof primitive LHS returns false uniformly (CodeR…
fix(runtime): instanceof with null/undefined LHS returns false, not t…
proggeramlug commentedon Jul 18, 2026
Resolved by #6598 (merged to
mainas 49db1ac).Root cause:
OrdinaryHasInstance(ECMA-262 7.3.21) with anull/undefinedleft operand threwTypeError: Cannot convert undefined or null to objectinstead of returningfalse. find-my-way@9'sFindMyWay(opts)is called withoutnew, so itsRouterbody evaluatesthis instanceof Routerwiththis === undefined; because the RHS is a function value, it routed throughjs_instanceof_dynamic's prototype-walk tail (ordinary_has_instance_prototype_walk), which calledgetPrototypeOf(undefined)and aborted module init before any route was registered.Fix: the prototype walk now short-circuits to
falsefor every non-object LHS (null/undefined/boolean/int32/string/bigint/symbol), per step 3 ("If Type(O) is not Object, return false"), andSymbol() instanceof Objectis nowfalse. Verified byte-identical to Node across 26 instanceof cases;real_find_my_way_routerincrates/perry/tests/issue_6559_real_libs_e2e.rsis un-ignored and green.Note: one minor CodeRabbit suggestion — set
PERRY_REQUIRE_NPM_E2E=1for thee2e-scopedCI job so that e2e can't silently skip — was not included in #6598 and remains as optional CI hardening.