Narrow TLA-reentry skip to actual re-entry, not sibling static imports#216
Narrow TLA-reentry skip to actual re-entry, not sibling static imports#216robobun wants to merge 1 commit into
Conversation
innerModuleEvaluation's Bun-specific skip for the spec-mandated async-dependency wait was too broad: when a TLA leaf module (no async deps of its own, pendingAsyncDependencies always 0) is imported by a sibling in the same Evaluate() pass, the sibling skipped the wait and executed before the TLA body had progressed past its first await. Any binding declared after that await was still in TDZ, giving 'Cannot access X before initialization' on the sibling's use. The skip was designed for the Nitro-style require(esm) re-entry where a TLA module's body is synchronously re-entered from within its own continuation. Fix: additionally require that no entry in the cycle root's asyncParentModules is on the current DFS stack. When an ancestor is on stack, we're in the same Evaluate() pass that popped this SCC to EvaluatingAsync and the spec wait is mandatory. Fixes oven-sh/bun#30259.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughUpdated the top-level await dependency resolution logic in ChangesTLA Dependency Skip Condition
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
|
Closing as duplicate of #215 — same diagnosis of the root cause. sosukesuzuki's watermark-based fix is cleaner (uses the existing |
Problem
innerModuleEvaluation's Bun-specific skip for the spec-mandated async-dependency wait (11.c.v) was too broad: when a TLA leaf module (no async deps of its own,pendingAsyncDependenciesalways 0) is imported by a sibling in the sameEvaluate()pass, the sibling skipped the wait and executed before the TLA body had progressed past its firstawait. Any binding declared after that await was still in TDZ, givingCannot access X before initializationon the sibling's use.Reproduction (oven-sh/bun#30259):
Fix
The skip was designed for the Nitro-style
require(esm)re-entry where a TLA module's body is synchronously re-entered from within its own continuation. Additionally require that no entry in the cycle root'sasyncParentModulesis on the current DFS stack. When an ancestor is on stack, we're in the sameEvaluate()pass that popped this SCC toEvaluatingAsyncand the spec wait is mandatory.This keeps the existing behaviour for the dynamic-import re-entry case (Nitro) while restoring spec-compliant waiting for sibling static imports.
Companion PR
oven-sh/bun# — bumps
WEBKIT_VERSIONonce this is merged and autobuild publishes.Fixes oven-sh/bun#30259.