fix: Next.js standalone walls 46+47 — inherited-capture clobber + defineProperty on handle#5178
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughIn ChangesCapture Field Initializer Guard
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
…d captures class X extends _mod.default read the parent's relative-require captures (this.__perry_cap_*) as undefined from inherited methods. The captures were correct after super() but clobbered during the DERIVED class's post-super field-init phase: __perry_cap_* fields have init:None, so apply_field_initializers_recursive emitted this.field=undefined for them, re-initializing the inherited caps super() had just filled. FIX: skip __perry_cap_* in the field-initializer loop — they are populated exclusively by the ctor capture-param assignments, so a field-init undefined-write is always wrong.
31e196e to
61cb262
Compare
What
class NextNodeServer extends _baseserver.default(interop-ESM dynamic parent) read base-server's relative-requirecaptures (_iserror/_utils/_log→this.__perry_cap_*) asundefinedfrom inherited methods →Cannot read properties of undefined (reading 'getProperError')on every request (HTTP 500).Root cause
Pinned via JS read-back probes at three points on the same instance and same method path:
new NextNodeServer()returns):undefined✗undefined✗So captures were written correctly by
super()but clobbered during the derived class's own construction, aftersuper()returned — the derived field-initializer phase. Synthesized capture fields (__perry_cap_*) are declaredinit: None, andapply_field_initializers_recursiveemitsthis.<field> = undefinedfor everyinit: Nonefield. When the field-init chain included the inherited dynamic parent's fields, that undefined-write re-initialized the capturessuper()had just populated. (ES runs derived field initializers aftersuper(), so the clobber wins.)Fix
Skip
__perry_cap_*fields in the field-initializer loop (crates/perry-codegen/src/lower_call/new.rs). These synthesized fields are populated exclusively by the constructor's capture-param assignments, so a field-init undefined-write to them is always wrong.Verification
Real Next.js standalone server: all captures resolve (
_iserror/_utils/_log= object),getProperErrorTypeError gone. The request now reaches a deeper render error (separate wall). Continues the Next.js bring-up (#793; after #5152).Summary by CodeRabbit
Release Notes