Skip to content

test(inline): cover class expression evaluation-owner remapping - #11222

Merged
proggeramlug merged 2 commits into
mainfrom
fix/11154-inline-class-owner
Sep 24, 2026
Merged

proggeramlug merged 2 commits into
mainfrom
fix/11154-inline-class-owner

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Closes #11154.

A named class-expression factory used to lose its self-binding when inlined: captures were remapped to the caller's locals, but ClassExprFresh.evaluation_owner retained the callee's local. A static block reading C.prototype then threw on undefined.

The production fix has now landed on main through #11142 (aec71db). This PR adds dedicated regression coverage without changing that implementation:

  • Transform tests require the owner, static initializers, computed keys, and captures to use the same mapping exactly once, while absent and unrelated owners remain unchanged.
  • A native parity fixture checks repeated direct factory calls, a function-value call, distinct class/prototype identities, and isolated prototype writes.

Validation after rebasing onto main ba9adf1:

  • All 160 transform unit tests pass.
  • Formatting, test registration, and diff checks pass.
  • The remapping regression failed before the original fix. Before the rebase, the native fixture and seven related class-expression fixtures all matched Node 26.5.1 using a fresh compiler and static runtime/stdlib archives; the same production remapping is now supplied by main.

No version bump. The changelog fragment is keyed to this PR.

Summary by CodeRabbit

  • Tests
    • Added regression coverage for classes created by repeated factory calls, verifying that each class receives its own prototype and that prototype changes remain isolated.
    • Added checks for class initialization values and indirect factory calls.
    • Expanded coverage to verify consistent handling of class bindings when mappings are present, absent, or unchanged.
  • Documentation
    • Added a changelog entry summarizing the regression coverage.

@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: d1b109b7-63c9-4769-a5ff-ac557c797b24

📥 Commits

Reviewing files that changed from the base of the PR and between bfd767c and c44076f.

📒 Files selected for processing (2)
  • changelog.d/11222-inline-class-owner.md
  • crates/perry-transform/src/inline/substitute.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • changelog.d/11222-inline-class-owner.md

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


📝 Walkthrough

Walkthrough

The change adds substitution tests for fresh class evaluation owners and a TypeScript regression test for repeated class-factory calls. The changelog entry records this coverage.

Changes

Fresh class owner remapping

Layer / File(s) Summary
Remap and validate fresh class owners
crates/perry-transform/src/inline/substitute.rs, test-files/test_gap_11154_inline_class_self_binding.ts, changelog.d/11222-inline-class-owner.md
Substitution tests cover mapped, absent, and unmapped evaluation owners, including remapping a captured local. The regression test checks repeated factory calls, distinct prototypes, and isolated prototype writes. The changelog records the coverage.

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

Merge Risk: ⚪ Minimal · up to c4407

The new tests exercise the reported self-binding regression. No issue requiring a fix before merge was identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Issue [#11154] requires the named class-expression self-binding to remain correct after inlining. The reviewed head contains the existing ClassExprFresh.evaluation_owner remapping in `substitute_loc…
Out of Scope Changes check ✅ Passed The changes stay within issue [#11154]. The substitute.rs tests verify the remapping behavior. The native fixture reproduces the reported class-expression factory case. The changelog records the sam…
Title check ✅ Passed The title clearly and concisely describes the main change: regression coverage for class-expression evaluation-owner remapping.
Description check ✅ Passed The description covers the change, related issue, test scope, validation results, and version-bump status. The optional screenshots section is not needed for this test-only change.
Full details: Docstring Coverage

Explanation

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

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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

Copy link
Copy Markdown
Contributor Author

Merge queue: this now conflicts with main in crates/perry-transform/src/inline/substitute.rs (main moved: #11188/#11190/#11206/#11219 landed class-evaluation changes nearby). Please rebase onto current main and push; CI is otherwise the gate. Owner: please reply here so the queue knows who has this.

@proggeramlug
proggeramlug force-pushed the fix/11154-inline-class-owner branch from bfd767c to c44076f Compare September 24, 2026 14:29
@proggeramlug proggeramlug changed the title fix(inline): remap class expression evaluation owners test(inline): cover class expression evaluation-owner remapping Sep 24, 2026
@proggeramlug
proggeramlug merged commit 69b6c10 into main Sep 24, 2026
22 checks passed
@proggeramlug
proggeramlug deleted the fix/11154-inline-class-owner branch September 24, 2026 14:52
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.

Inlining a class-expression factory leaves ClassExprFresh.evaluation_owner unremapped: static block reads its self-binding as undefined

1 participant