Repository navigation
Fix TLA sibling import running before shared dep settles (#30259) - #30262
Conversation
|
Updated 6:47 PM PT - May 6th, 2026
❌ @sosukesuzuki, your commit 812e833 has 2 failures in
🧪 To try this PR locally: bunx bun-pr 30262That installs a local version of the PR into your bun-30262 --bun |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughUpdates the exported ChangesWebKit version bump + TLA static-sibling tests
Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/build/deps/webkit.ts`:
- Line 6: The WEBKIT_VERSION string produces non-discriminating slices; derive a
short, unique identifier by extracting the commit-hash suffix from
WEBKIT_VERSION (e.g., take the substring after the last '-' or match
/([0-9a-f]{7,})$/) into a new variable like webkitVersionHash (falling back to
WEBKIT_VERSION if no hash found), then replace uses that currently call slice(…)
on WEBKIT_VERSION for cache keys and log identifiers with this webkitVersionHash
(or the full WEBKIT_VERSION where you prefer full uniqueness) so cache keys and
logs become discriminative.
- Line 6: The comparison in sync-webkit-source.ts currently does
checkedOutCommit == expectedCommit where checkedOutCommit is a 40-char SHA (from
git rev-parse HEAD) and expectedCommit is now a tag string like
WEBKIT_VERSION/autobuild-preview-pr-215-df660a83, so update the logic in the
function that performs the checkout check (variables checkedOutCommit and
expectedCommit) to either resolve the tag to its full SHA via git rev-parse
<tag> and compare SHAs, or detect if HEAD points to that tag by checking git
describe --exact-match HEAD or git name-rev --name-only HEAD and comparing
names; also update the cache key generation (the code that uses slice(0, 16) on
the WEBKIT_VERSION/tag string) to use a longer slice such as slice(0, 25) so
preview builds including the PR number produce distinct cache keys.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: df105d9e-4476-413d-a33f-a4b54431a8c2
📒 Files selected for processing (2)
scripts/build/deps/webkit.tstest/js/bun/resolve/dynamic-import-tla-cycle.test.ts
| * From https://github.com/oven-sh/WebKit releases. | ||
| */ | ||
| export const WEBKIT_VERSION = "39862040be27e0b6e1d103aaa5dc6796f21a581f"; | ||
| export const WEBKIT_VERSION = "autobuild-preview-pr-215-df660a83"; |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial | ⚡ Quick win
Consider improving cache key and logging discriminability.
The version format "autobuild-preview-pr-215-df660a83" will produce non-discriminating substrings when sliced:
- Line 86:
slice(0, 16)→"autobuild-previe"(same for allautobuild-preview-pr-*builds) - Context snippet 3:
slice(0, 10)→"autobuild-"(same for all autobuild variants)
These slices are used in cache keys and build logs. Consider either:
- Using the full version string for cache keys (line 86), or
- Extracting and using the commit hash suffix (
df660a83) for shorter identifiers
♻️ Proposed fix to use the hash suffix for cache keys
At line 86, extract the hash suffix instead of a fixed-length slice:
function prebuiltDestDir(cfg: Config): string {
- const version16 = cfg.webkitVersion.slice(0, 16);
+ // Extract hash suffix for autobuild-* tags, or use first 16 chars for plain hashes
+ const match = cfg.webkitVersion.match(/-([0-9a-f]{8,})$/);
+ const versionKey = match ? match[1].slice(0, 8) : cfg.webkitVersion.slice(0, 16);
// Cross-compiled targets share a host (and cache dir) with native builds,And at line 92, use the extracted key:
- return resolve(cfg.cacheDir, `webkit-${version16}${osKey}${archKey}${prebuiltSuffix(cfg)}`);
+ return resolve(cfg.cacheDir, `webkit-${versionKey}${osKey}${archKey}${prebuiltSuffix(cfg)}`);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/build/deps/webkit.ts` at line 6, The WEBKIT_VERSION string produces
non-discriminating slices; derive a short, unique identifier by extracting the
commit-hash suffix from WEBKIT_VERSION (e.g., take the substring after the last
'-' or match /([0-9a-f]{7,})$/) into a new variable like webkitVersionHash
(falling back to WEBKIT_VERSION if no hash found), then replace uses that
currently call slice(…) on WEBKIT_VERSION for cache keys and log identifiers
with this webkitVersionHash (or the full WEBKIT_VERSION where you prefer full
uniqueness) so cache keys and logs become discriminative.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Verify WEBKIT_VERSION usage and potential format mismatches
# Check sync-webkit-source.ts comparison logic
echo "=== sync-webkit-source.ts comparison logic ==="
rg -nA2 -B2 'WEBKIT_VERSION.*expectedCommit|checkedOutCommit.*WEBKIT_VERSION' scripts/
# Check all slice operations on webkitVersion/WEBKIT_VERSION
echo -e "\n=== All slice operations on webkit version ==="
rg -nP '(webkitVersion|WEBKIT_VERSION)\.slice\(' scripts/
# Check if there are any git checkout commands using WEBKIT_VERSION
echo -e "\n=== Git checkout usage ==="
rg -n 'git checkout.*WEBKIT_VERSION|git checkout.*expectedCommit' scripts/Repository: oven-sh/bun
Length of output: 834
Fix git checkout comparison to handle tag-based versions.
The new format "autobuild-preview-pr-215-df660a83" is a git tag name, not a commit SHA. In sync-webkit-source.ts line 17, the comparison checkedOutCommit == expectedCommit will always fail—checkedOutCommit is a full 40-character SHA from git rev-parse HEAD, while expectedCommit is now a tag name string. This causes unnecessary git checkout attempts even when already at the correct commit. Update the comparison logic to either resolve the tag to a full SHA or check if the current HEAD matches the tag name.
Additionally, the cache key at line 86 using slice(0, 16) produces "autobuild-previe" for all "autobuild-preview-pr-*" versions, causing cache collisions between different preview builds. Increase the slice length to distinguish between builds (e.g., slice(0, 25) to include the PR number).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/build/deps/webkit.ts` at line 6, The comparison in
sync-webkit-source.ts currently does checkedOutCommit == expectedCommit where
checkedOutCommit is a 40-char SHA (from git rev-parse HEAD) and expectedCommit
is now a tag string like WEBKIT_VERSION/autobuild-preview-pr-215-df660a83, so
update the logic in the function that performs the checkout check (variables
checkedOutCommit and expectedCommit) to either resolve the tag to its full SHA
via git rev-parse <tag> and compare SHAs, or detect if HEAD points to that tag
by checking git describe --exact-match HEAD or git name-rev --name-only HEAD and
comparing names; also update the cache key generation (the code that uses
slice(0, 16) on the WEBKIT_VERSION/tag string) to use a longer slice such as
slice(0, 25) so preview builds including the PR number produce distinct cache
keys.
|
Found 2 issues this PR may fix:
🤖 Generated with Claude Code |
…aluate() Regression tests for #30259. Requires oven-sh/WebKit#215.
dc64adc to
812e833
Compare
There was a problem hiding this comment.
LGTM — thanks for swapping to the merged commit SHA; that resolves my earlier concern about the preview-PR tag.
Extended reasoning...
Overview
On the Bun side this PR is now just two things: a one-line WEBKIT_VERSION bump from 39862040… to 88b2f7a2… (the merged commit for oven-sh/WebKit#215), and two new regression tests in test/js/bun/resolve/dynamic-import-tla-cycle.test.ts that exercise the #30259 repro and an indirect-parent variant. The actual behavioural fix lives in the WebKit fork and was reviewed/merged there.
What changed since my last review
Previously WEBKIT_VERSION was set to the ephemeral autobuild-preview-pr-215-df660a83 tag, which I flagged for artifact-GC and cache-key-collision risk. The author has replaced it with the stable 40-char merged SHA exactly as requested, which also moots CodeRabbit's slice(0,16) cache-key concern (88b2f7a2159c913f is unique). Nothing else changed.
Security risks
None. This is a dependency pin bump within Bun's own WebKit fork plus added test fixtures that spawn bunExe() in a temp dir. No auth, crypto, network, or user-input handling is touched.
Level of scrutiny
Low-to-moderate. WebKit bumps are a routine, well-trodden path in this repo and CI runs the full suite against the new build. The new tests are copy-pattern siblings of the three existing tests in the same file (same tempDir/Bun.spawn/expect(stderr).toBe("") structure) — straightforward to verify by inspection.
Other factors
The bug-hunting system found no issues in the current revision. The added tests directly encode the issue repro and a guard against an alternative (incorrect) discriminator, and the pre-existing deadlock-avoidance tests in the same file remain to catch regressions in the other direction.
… module no longer hangs (#30537) A second `await import()` of a path whose first import threw used to hang forever instead of re-throwing. Two reported variants: - **#23139**: same path twice - **#22743**: path X, then a *different* error path Y, then X again (true regression, 1.2.20 → 1.2.21) While verifying #30527 I checked whether oven-sh/WebKit#225 covered these — turns out both were **already fixed** before that bump (main + WebKit `88b2f7a2` doesn't hang either). The fix landed somewhere in the module-loader rewrite window (#29393 → #30262); the issues just never got re-tested. | build | #23139 | #22743 | |---|---|---| | 1.3.13 | hangs | hangs | | main + WebKit `88b2f7a2` (pre-#30527) | ✅ | ✅ | | main + WebKit `5488984d` | ✅ | ✅ | Both tests fail on `USE_SYSTEM_BUN=1` (stdout missing the post-hang lines, killed by spawn timeout) and pass on `bun bd test`. Fixes #23139 Fixes #22743
Fixes #30259. Bumps WebKit to
88b2f7a2159c913f7dd0d73c0e88d66138cd67ba(oven-sh/WebKit#215, merged).What
A static import that re-imports a TLA dep already visited by a sibling earlier in the same
Evaluate()pass was skipping the spec-mandated wait and running with the dep's post-awaitbindings still in TDZ:Why
The Bun-specific skip at
innerModuleEvaluation11.c.v (which avoids self-deadlock whenrequire(esm)/ dynamic import re-enters a TLA module from inside its own suspension) usedpendingAsyncDependencies == 0as the discriminator for "body already entered". A TLA dep with no async deps of its own also has count 0 after suspending at its firstawaitwithin the same DFS, so the discriminator matched the sibling case.How (oven-sh/WebKit#215)
Snapshot
vm.moduleAsyncEvaluationCount()at the start of eachEvaluate()and thread it throughinnerModuleEvaluationasasyncOrderWatermark. Only skip the wait when the cycle root'sasyncEvaluationOrder()predates the watermark (i.e. it becameEvaluatingAsyncin a priorEvaluate()— the re-entrant deadlock case). Siblings that transition during the current DFS getorder >= watermarkand keep the spec wait.Tests
Two regression tests in
test/js/bun/resolve/dynamic-import-tla-cycle.test.ts:Existing re-entrancy / deadlock-avoidance tests in the same file continue to pass.