Skip to content

fix(runtime): materialize ordinary parent prototypes - #8768

Closed
proggeramlug wants to merge 2 commits into
mainfrom
codex/class-parent-prototype-read
Closed

fix(runtime): materialize ordinary parent prototypes#8768
proggeramlug wants to merge 2 commits into
mainfrom
codex/class-parent-prototype-read

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Release-blocker follow-up to #8766.

The full gap shard exposed a second lazy-prototype case on current main: an ordinary runtime-valued function superclass (class Child extends WithDefault) threw Class extends value does not have valid prototype property unless some unrelated code had read WithDefault.prototype first.

#8766 correctly added lazy materialization for bound native constructor exports, but implemented it as a raw dynamic-slot probe plus an ordinary_function_prototype_value_for_read fallback. This follow-up routes the class-definition Get(superclass, "prototype") through the existing canonical js_function_prototype_value_for_read helper instead. That one path preserves explicit/deleted/generator prototype semantics while lazily materializing both ordinary-function and bound-native-constructor prototypes.

The existing failing regression is test_gap_class_extends_runtime_value_super; no snapshot or expectation is weakened.

Validation on the rebased result:

  • cargo fmt --all -- --check

  • git diff --check

  • cargo test -p perry-runtime class_parent_prototype_tests: 2 passed, 0 failed

  • release-profile compiler/runtime rebuilt from this branch

  • exact Node/Perry output parity for test_gap_class_extends_runtime_value_super:

    s.x: 7
    s.y: 9
    c.flag: default-from-parent
    w.ownField: subclass-init
    

No version bump and no tag.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed inheritance for subclasses of runtime-valued functions.
    • Subclasses now correctly observe and link the same prototype object returned by reading the parent function’s prototype, including when it has not been accessed previously.
    • Improved consistency for plain functions, bound constructors, and functions with explicit, deleted, or generator prototypes.

@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 77c7cf97-4551-4c5e-891d-4a50c30a88dc

📥 Commits

Reviewing files that changed from the base of the PR and between 1b0c300 and a49a724.

📒 Files selected for processing (2)
  • changelog.d/8768-runtime-parent-function-prototype.md
  • crates/perry-runtime/src/object/class_registry/state.rs

Included review availability: Your plan provides up to 8 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The class registry now resolves runtime-valued function parent prototypes through the observable prototype-read path. This materializes unread lazy prototypes and preserves explicit, deleted, and generator prototype behavior. A changelog entry documents the fix.

Changes

Runtime parent prototype resolution

Layer / File(s) Summary
Standardize parent prototype reads
crates/perry-runtime/src/object/class_registry/state.rs, changelog.d/8768-runtime-parent-function-prototype.md
Dynamic parent prototype resolution uses js_function_prototype_value_for_read. The changelog documents lazy prototype materialization and prototype linking for subclasses.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to a49a7

This localized runtime change materializes ordinary parent prototypes through the canonical prototype-read path and includes targeted regression and parity validation; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: thehypnoo

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the runtime fix for materializing ordinary parent prototypes.
Description check ✅ Passed The description explains the issue, implementation, related issue, validation steps, expected output, and release constraints.
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/class-parent-prototype-read

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

proggeramlug added a commit that referenced this pull request Aug 24, 2026
…es, reactor HTTP scheduling (#8778)

Lands #8765, #8767, #8768 and #8769.

#8765 stops mysql2 prepared statements and pool transactions leaking
state across requests: each SQL string and parameter vector lives in one
owned request, a parameterless `query()` uses the text protocol, prepared
statements are request-scoped, and registry-backed mutable connection
references become serialized owned handles with safe close/release around
in-flight work.

#8767 admits arrays reached through one validated forwarding edge into
version-stable indexed loops, canonicalizing the compiler-private local
to the live array after the full header/fingerprint check. Per-iteration
fingerprint guards are retained, so callback-driven growth or a GC still
side-exits before the next effect, and invalid targets or longer chains
fail closed to the generic loop.

#8768 materializes ordinary parent prototypes.

#8769 schedules HTTP and HTTPS accept loops through the reactor-owned
async bridge, using the same path for Unix round-robin fd injection.

Changelog fragments added for #8765, #8767 and #8769; none carried one or
a skip-changelog label. No version bump.

Co-authored-by: Ralph Küpper <ralph@skelpo.com>
@proggeramlug

Copy link
Copy Markdown
Contributor Author

Landed on main via #8778 (squash 1f5c3bb80), with the rest of this batch.

Validated on the merged result: all 30 lint checkers, runtime 2674/0 at RUST_TEST_THREADS=1, codegen 1230/0, all codegen integration suites clean, and perry-ext-mysql2 --lib 10/0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant