fix(hir): preserve aliased native stream subclasses - #9689
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 8 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughClass heritage lowering now resolves aliased native imports to canonical constructor names. Regression tests cover declaration and expression lowering, inherited stream and EventEmitter methods, and the documented startup error. ChangesAliased native class heritage
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to Aliased native stream and EventEmitter subclasses now retain their expected inherited behavior, preventing the watcher startup TypeErrors. No current merge-readiness blocker remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 3 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches🧪 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 |
|
Landed via merge train #9694 (rebase-merge, authorship preserved). |
Summary
extends_namecanonical so native streamsuper()initializes the already-allocated subclass instead of replacing itReadableandEventEmittershapesRoot cause
Claude Code's bundled readdirp imports
Readable as utand defines its stream asclass V extends ut. Perry recognizedutas a native value, but heritage lowering matched only literal constructor names. It therefore used the dynamic-parent path; the nativeReadableconstructor returned a replacement object and the derived_readimplementation was lost. Canonicalizing the registered import export routessuper()through the native subclass initializer and preserves the complete EventEmitter surface.Verification
cargo fmt --all --checkcargo test --lib --bins -p perry-hir— 380 passed, 1 ignoredcargo test --bins -p perry -- --skip codegen_env_vars_are_build_cache_inputs— 1,073 passed (the skipped invariant currently fails unchangedmainbecausePERRY_CONCAT_SITE_CACHEis unclassified)_read, prototype surface, and listener behaviorwatch-ready, with no uncaught TypeErrorreadable-streamsubclass differential remains byte-identicalNo version bump.
Closes #9680
Summary by CodeRabbit
Bug Fixes
Tests