fix(runtime): resolve native-constructor superclass prototype in dynamic extends - #8766
Merged
Conversation
…mic extends Lands #8763 (fixes #8760). Booting the natively compiled Claude Code cli.js 2.1.112 bundle threw `TypeError: Class extends value does not have valid prototype property` at module init on nearly every command; only `--version` escaped. The raw `prototype` dynamic slot on a bound native-module export closure is still `undefined` at that point, so resolution must fall through to the same lazy materialization an ordinary `EE.prototype` read uses. One fix on top: `class_id_collisions.py` matches any `*CLASS_ID: u32 =` and deliberately ignores scope -- its header says the point is "not to depend on someone remembering the scope". The new test declared a function-local `const CLASS_ID` alongside the existing #8001 fixture's, so two same-named constants held different values (0x7d01_8001 vs 0x7d01_8760) and the gate read that as a drifted cross-crate mirror. Renamed the new fixture's constant to `ISSUE_8760_CLASS_ID`; the #8001 test is untouched. No version bump.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe runtime now lazily resolves prototypes for bound native-module constructors used in ChangesNative constructor prototype resolution
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Aug 24, 2026
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.
Lands #8763 (fixes #8760).
Booting the natively compiled Claude Code cli.js 2.1.112 bundle threw
TypeError: Class extends value does not have valid prototype propertyat module init on nearly every command — only--versionescaped. The rawprototypedynamic slot on a bound native-module export closure is stillundefinedat that point, so resolution has to fall through to the same lazy materialization an ordinaryEE.prototyperead uses.One fix on top
class_id_collisions.pywent red. It matches any*CLASS_ID: u32 =and deliberately ignores scope — its own header says the point is "not to depend on someone remembering the scope". The new test declared a function-localconst CLASS_IDalongside the existing #8001 fixture's, so two same-named constants held different values (0x7d01_8001vs0x7d01_8760) and the gate read that as a drifted cross-crate mirror.Since the gate's ignoring of scope is intentional, the right remedy is a distinct name rather than working around the check: the new fixture's constant is now
ISSUE_8760_CLASS_ID, and the #8001 test is untouched.Validation (on the merged result)
lint-job checkers pass (class_id_collisions.pyincluded, after the rename)perry-runtime --lib(RUST_TEST_THREADS=1): 2674 passed, 0 failed (+1)native_constructor_export_parent_links_declared_prototype... okThe PR carried its own
changelog.d/fragment. No version bump.Summary by CodeRabbit