Skip to content

fix(runtime): honor deleted prototype methods in direct guards - #9168

Merged
proggeramlug merged 1 commit into
PerryTS:mainfrom
proggeramlug:fix/9123-prototype-method-delete
Aug 30, 2026
Merged

fix(runtime): honor deleted prototype methods in direct guards#9168
proggeramlug merged 1 commit into
PerryTS:mainfrom
proggeramlug:fix/9123-prototype-method-delete

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • make typed-feedback direct-method contracts consult the scoped prototype invalidation latch
  • prevent a deleted declared prototype method from being re-accepted as a valid vtable direct call
  • add focused runtime coverage and an end-to-end regression for the issue repro

Testing

  • cargo fmt --all -- --check
  • cargo test -p perry-runtime typed_feedback_method_direct_guard
  • cargo test -p perry --test issue_9123_method_delete_invalidation
  • compiled and ran test-files/test_method_guard_name_invalidation.ts against the matching worktree runtime

No version bump; this includes only the standard changelog fragment.

Fixes #9123

Summary by CodeRabbit

  • Bug Fixes

    • Fixed prototype method deletion so subsequent calls no longer invoke stale compiled method code.
    • Deleted methods now correctly fall back to standard dispatch and produce a TypeError.
  • Tests

    • Added regression coverage for method deletion and invalidated direct-call guards.

@coderabbitai

coderabbitai Bot commented Aug 30, 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: ae016807-1ba4-43d1-a11d-3cc1ecf791a7

📥 Commits

Reviewing files that changed from the base of the PR and between 5f08e77 and cf5fd0d.

📒 Files selected for processing (4)
  • changelog.d/9123-prototype-method-delete-guard.md
  • crates/perry-runtime/src/typed_feedback/guards.rs
  • crates/perry-runtime/src/typed_feedback/tests.rs
  • crates/perry/tests/issue_9123_method_delete_invalidation.rs

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


📝 Walkthrough

Walkthrough

The typed-feedback direct-method contract now honors per-name prototype invalidation after method deletion. Runtime and integration tests verify guard failure, ordinary dispatch fallback, and the resulting TypeError.

Changes

Prototype method deletion guard

Layer / File(s) Summary
Guard contract invalidation
crates/perry-runtime/src/typed_feedback/guards.rs, crates/perry-runtime/src/typed_feedback/tests.rs, changelog.d/9123-prototype-method-delete-guard.md
The direct-call contract now rejects invalidated prototype methods. A runtime test verifies guard pass and failure counts. The changelog records the fix.
Prototype deletion regression
crates/perry/tests/issue_9123_method_delete_invalidation.rs
An integration test deletes C.prototype.inc and verifies execution reports threw: TypeError.

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

Merge Risk: ⚪ Minimal · up to cf5fd

This PR prevents deleted prototype methods from being incorrectly used for direct calls and restores the expected fallback and error behavior. No actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: thehypnoo

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 3 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main runtime fix: direct guards now honor deleted prototype methods.
Description check ✅ Passed The description provides a clear summary, concrete changes, targeted test commands, the linked issue, and version-bump information. It omits some template headings and checklist items, but it contains…
Linked Issues check ✅ Passed The changes satisfy issue [#9123] by consulting the prototype invalidation latch in typed-feedback direct-method contracts and adding focused runtime and end-to-end regression tests for deleted protot…
Out of Scope Changes check ✅ Passed All changes are related to issue [#9123]: the runtime guard fix, changelog fragment, focused runtime test, and end-to-end regression test. No unrelated code changes are identified.
Full details: Description check

Explanation

The description provides a clear summary, concrete changes, targeted test commands, the linked issue, and version-bump information. It omits some template headings and checklist items, but it contains the required substantive information.

Full details: Linked Issues check

Explanation

The changes satisfy issue [#9123] by consulting the prototype invalidation latch in typed-feedback direct-method contracts and adding focused runtime and end-to-end regression tests for deleted prototype methods. The existing override behavior is not changed.

Full details: Docstring Coverage

Explanation

Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 3 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ 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.

@proggeramlug
proggeramlug force-pushed the fix/9123-prototype-method-delete branch from cf5fd0d to db3839d Compare August 30, 2026 13:45
@proggeramlug

Copy link
Copy Markdown
Contributor Author

Merged via a merge train — cherry-picked with three other PRs onto one branch and validated together in a single build. Combined validation: codegen 1357 passed, runtime 2844 passed (exit 0, 0 abort markers), perry --bins 1066, fmt clean, check_file_size.sh PASS, run_lint_gates.sh all 60 gates passed, git diff origin/main --diff-filter=D empty.

Pairs with #9169, which is the other half of #9131 (prototype replacement not observed through a typed-parameter receiver). The two conflict in the prototype-guard code, so I landed this one first and am rebasing #9169 onto it — the monkey-patching probe is still 7/23 with only this applied, which is expected since #9169 carries the observation half.

@proggeramlug
proggeramlug merged commit 4c7ac33 into PerryTS:main Aug 30, 2026
19 of 20 checks passed
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.

Direct method dispatch survives delete C.prototype.method (node throws TypeError)

1 participant