Registry Mirror
Skip to content

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #9251

Summary

  • split ObjectMeta prototype state into a conservative chain-divergence signal and a distinct user-origin signal
  • keep runtime prototype wiring on its existing invalidation path without classifying it as Object.setPrototypeOf
  • route Object.setPrototypeOf, object-literal proto, and recorded Object.create paths through the user-aware recorder
  • preserve divergence-based cache guards while limiting replacement dispatch to genuine user-origin overrides

No version bump is included.

Tests

  • cargo fmt --all -- --check
  • cargo test -p perry-runtime runtime_wiring_and_user_override_publish_distinct_signals
  • targeted Array-subclass, property-dispatch, and moving-GC runtime regressions
  • cargo test -p perry --test issue_9131_prototype_method_replacement
  • direct Perry/Node output diffs for iterator_helpers_2874, language_types_object_part_a, object_string_wrappers, and 5592_class_expr_rebind_computed_accessor
  • full perry-runtime run: 2,886 passed; two unrelated parallel-only failures passed immediately when rerun individually with one test thread
  • scripts/check_file_size.sh

Summary by CodeRabbit

  • Bug Fixes
    • Corrected prototype handling so internal runtime wiring is no longer mistaken for a user-applied prototype override.
    • Preserved proper method and property dispatch when prototypes are changed through user-facing operations.
    • Improved cache and optimization invalidation when prototype chains genuinely diverge.
    • Ensured built-in iterator prototype links do not trigger unnecessary user-override behavior or cache invalidation.
  • Tests
    • Added coverage confirming distinct handling for runtime wiring, default prototypes, and user overrides.

@proggeramlug
proggeramlug force-pushed the fix/9251-user-prototype-override branch from 880d0ef to 7701f8c Compare August 31, 2026 22:33
@coderabbitai

coderabbitai Bot commented Aug 31, 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: Team

Run ID: c61543f9-7b7d-4722-9bf3-073f3e5b3d6d

📥 Commits

Reviewing files that changed from the base of the PR and between 9943dd9 and 7701f8c.

📒 Files selected for processing (19)
  • changelog.d/9333-user-prototype-override-signal.md
  • crates/perry-runtime/src/array/subclass.rs
  • crates/perry-runtime/src/array/subclass_loop_guard.rs
  • crates/perry-runtime/src/array/subclass_tests.rs
  • crates/perry-runtime/src/gc/tests/dead_owner_side_tables.rs
  • crates/perry-runtime/src/object/field_get_set/prototype_override.rs
  • crates/perry-runtime/src/object/field_set_by_name.rs
  • crates/perry-runtime/src/object/field_set_by_name/tail.rs
  • crates/perry-runtime/src/object/iterator_prototypes.rs
  • crates/perry-runtime/src/object/mod.rs
  • crates/perry-runtime/src/object/native_call_method.rs
  • crates/perry-runtime/src/object/object_literal_ops.rs
  • crates/perry-runtime/src/object/object_ops/define_properties.rs
  • crates/perry-runtime/src/object/object_ops/prototype.rs
  • crates/perry-runtime/src/object/prototype_chain.rs
  • crates/perry-runtime/src/object/tests.rs
  • crates/perry-runtime/src/perf_hooks/prototypes.rs
  • crates/perry-runtime/src/proxy.rs
  • crates/perry/tests/issue_9131_prototype_method_replacement.rs

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


📝 Walkthrough

Walkthrough

The runtime now records prototype divergence and user-origin prototype overrides as separate signals. User-facing prototype operations publish both signals. Runtime wiring publishes divergence only. Cache, shape, property, and method dispatch paths use the appropriate signal.

Changes

Prototype signal separation

Layer / File(s) Summary
Prototype signal model
crates/perry-runtime/src/object/mod.rs, crates/perry-runtime/src/object/prototype_chain.rs, changelog.d/9333-user-prototype-override-signal.md, crates/perry-runtime/src/array/subclass.rs, crates/perry-runtime/src/object/iterator_prototypes.rs
PrototypeLinkKind separates class-default links, runtime wiring, and user overrides. Metadata records divergence and user-origin flags independently.
User prototype recording and dispatch
crates/perry-runtime/src/object/object_literal_ops.rs, crates/perry-runtime/src/object/object_ops/*, crates/perry-runtime/src/object/field_get_set/prototype_override.rs, crates/perry-runtime/src/object/native_call_method.rs, crates/perry-runtime/src/object/tests.rs, crates/perry-runtime/src/gc/tests/dead_owner_side_tables.rs
User-facing prototype operations use object_set_user_prototype. Property and method dispatch query the user-origin flag.
Divergence consumers and validation
crates/perry-runtime/src/array/subclass.rs, crates/perry-runtime/src/array/subclass_loop_guard.rs, crates/perry-runtime/src/object/field_set_by_name*, crates/perry-runtime/src/proxy.rs, crates/perry/tests/issue_9131_prototype_method_replacement.rs, crates/perry-runtime/src/perf_hooks/prototypes.rs
Array caches, loop guards, store-plan checks, and proxy fast paths query prototype divergence. Iterator wiring and regression-test naming reflect the separated signals.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: 🔵 Low · up to 7701f

This change separates internal prototype wiring from user-origin prototype mutations while preserving conservative cache invalidation. The runtime publication sequence still has bounded edge-case risk around repeated or interrupted transitions and failure handling, so the PR is mergeable with explicit owner awareness and follow-up.

Sequence Diagram(s)

sequenceDiagram
  participant UserOperation
  participant PrototypeChain
  participant ObjectMeta
  participant Dispatch
  UserOperation->>PrototypeChain: record UserOverride prototype link
  PrototypeChain->>ObjectMeta: set divergence and user-origin flags
  Dispatch->>ObjectMeta: query user-origin flag
  ObjectMeta-->>Dispatch: return user override state
  Dispatch->>Dispatch: use custom prototype-chain lookup
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: separating the user prototype override signal from other prototype state.
Description check ✅ Passed The description explains the change, references issue #9251, lists verification steps, and notes that no version bump is included. It omits the template headings for Changes, Test plan, and Checklist,…
Linked Issues check ✅ Passed The changes satisfy #9251. They add separate divergence and user-origin signals, route user prototype operations through the user-aware recorder, preserve divergence-based cache guards, and limit repl…
Out of Scope Changes check ✅ Passed The changes remain within scope. Runtime wiring, user prototype operations, affected consumers, documentation, regression tests, and the changelog entry all support the prototype-signal separation obj…
Docstring Coverage ✅ Passed Docstring coverage is 87.10% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 31 functions across 18 files. (1 skipped: 1…
Full details: Description check

Explanation

The description explains the change, references issue #9251, lists verification steps, and notes that no version bump is included. It omits the template headings for Changes, Test plan, and Checklist, but the required information is mostly present.

Full details: Linked Issues check

Explanation

The changes satisfy #9251. They add separate divergence and user-origin signals, route user prototype operations through the user-aware recorder, preserve divergence-based cache guards, and limit replacement dispatch to user-origin overrides. The listed regression tests are addressed.

Full details: Out of Scope Changes check

Explanation

The changes remain within scope. Runtime wiring, user prototype operations, affected consumers, documentation, regression tests, and the changelog entry all support the prototype-signal separation objective.

Full details: Docstring Coverage

Explanation

Docstring coverage is 87.10% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 31 functions across 18 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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.

OBJECT_META_FLAG_PROTO_OVERRIDE conflates runtime prototype wiring with a user setPrototypeOf

1 participant