Repository navigation
Bump WebKit: align V8 heap snapshot output with Chrome DevTools expectations - #29557
Jarred-Sumner wants to merge 6 commits into
Conversation
Truncates long strings in V8 heap snapshots to 1024 chars to match V8's --heap-snapshot-string-limit default, keeping snapshot files bounded when the heap contains very large strings. oven-sh/WebKit@4d5e75e...ce78f86
|
Found 1 issue this PR may fix:
🤖 Generated with Claude Code |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughBumped the vendored WebKit revision constant and changed decorator tests to run concurrently in the test runner. Changes
Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@scripts/build/deps/webkit.ts`:
- Line 6: The WEBKIT_VERSION constant in scripts/build/deps/webkit.ts was
changed to "ce78f86a3ec34a178a672250e9045e807811eb7e" which maps to a
non-existent prebuilt tag (autobuild-ce78f86a3ec34a178a672250e9045e807811eb7e);
fix by either reverting WEBKIT_VERSION back to the last known-good hash in
scripts/build/deps/webkit.ts or ensure the matching release and its prebuilt
assets are published in oven-sh/WebKit before merging so CI can download the
prebuilt binary (reference the WEBKIT_VERSION symbol to locate the change).
🪄 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: 6b8ac536-97df-47fa-a1a1-805ff0d6487e
📒 Files selected for processing (1)
scripts/build/deps/webkit.ts
| * From https://github.com/oven-sh/WebKit releases. | ||
| */ | ||
| export const WEBKIT_VERSION = "4d5e75ebd84a14edbc7ae264245dcd77fe597c10"; | ||
| export const WEBKIT_VERSION = "ce78f86a3ec34a178a672250e9045e807811eb7e"; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
TAG="autobuild-ce78f86a3ec34a178a672250e9045e807811eb7e"
API="https://api.github.com/repos/oven-sh/WebKit/releases/tags/${TAG}"
echo "Checking ${API}"
curl -fsSL "${API}" | jq -r '
"tag=\(.tag_name)",
"published_at=\(.published_at)",
"asset_count=\(.assets | length)",
"assets:",
(.assets[]?.name // empty)
'Repository: oven-sh/bun
Length of output: 239
Release assets must be published before merge—prebuilt tag does not exist.
Line 6 updates the hash to ce78f86a3ec34a178a672250e9045e807811eb7e, which derives the prebuilt download tag autobuild-ce78f86a3ec34a178a672250e9045e807811eb7e. This release tag does not exist in oven-sh/WebKit (verified via GitHub API), so CI and all build systems will fail to fetch the prebuilt binary post-merge. Either publish the release with assets before merge, or revert this change.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@scripts/build/deps/webkit.ts` at line 6, The WEBKIT_VERSION constant in
scripts/build/deps/webkit.ts was changed to
"ce78f86a3ec34a178a672250e9045e807811eb7e" which maps to a non-existent prebuilt
tag (autobuild-ce78f86a3ec34a178a672250e9045e807811eb7e); fix by either
reverting WEBKIT_VERSION back to the last known-good hash in
scripts/build/deps/webkit.ts or ensure the matching release and its prebuilt
assets are published in oven-sh/WebKit before merging so CI can download the
prebuilt binary (reference the WEBKIT_VERSION symbol to locate the change).
There was a problem hiding this comment.
LGTM — routine WebKit version bump.
Extended reasoning...
Overview
This PR changes a single line in scripts/build/deps/webkit.ts, updating the WEBKIT_VERSION constant from 4d5e75ebd84a... to ce78f86a3ec3.... This constant determines which prebuilt WebKit tarball is downloaded (or which commit is checked out in local mode). The actual behavioral change (string truncation in BunV8HeapSnapshotBuilder) lives in the oven-sh/WebKit repo and is not part of this diff.
Security risks
None in this diff. It is a hash constant pointing at a commit in Bun's own WebKit fork, consumed by the existing prebuilt-download / local-checkout machinery. No new code paths, no user-controlled input, no auth/crypto/permissions surface.
Level of scrutiny
Low. This is a mechanical dependency version bump following the established pattern documented at the top of the file. The only thing that could go wrong is the artifact not existing yet, which the PR description already calls out (CI will fail until the autobuild release is published) — that is self-correcting via CI.
Other factors
No CODEOWNERS entry covers this file. No prior reviewer comments to address. The bug-hunting system found no issues. The change is a single-line constant swap with clear intent and a detailed PR description linking the upstream diff.
|
This PR may be a duplicate of:
🤖 Generated with Claude Code |
Align V8 heap snapshot node/edge classification and JSON layout with V8: JSArray as kObject (was kArray, which made DevTools zero its shallow size), scopes as kObject with "system / " names, GC-root edges as kInternal, Promise/Array node names use constructor name for proper Summary grouping, ropes named "(concatenated string)", and trace_tree ordered before samples/locations.
There was a problem hiding this comment.
LGTM — routine WebKit version bump; the bun-side change is a single hash constant and the upstream JSC changes are well-documented in the description.
Extended reasoning...
Overview
This PR changes exactly one line in scripts/build/deps/webkit.ts: the WEBKIT_VERSION constant is bumped from 4d5e75ebd84a to c9f26a68b86c. All substantive behavioral changes (V8 heap snapshot builder fixes) live in the oven-sh/WebKit fork, not in this repo. The PR description gives a thorough breakdown of what changed upstream.
Security risks
None in the bun-side diff — it is a hash constant update with no logic, parsing, auth, or user-input handling. The referenced WebKit changes affect heap-snapshot serialization (node type/name classification, string truncation, JSON key ordering) which is a debugging/diagnostics surface, not a security boundary.
Level of scrutiny
Low for the bun repo change itself. WebKit version bumps are a well-established, frequently-exercised pattern here (the two most recent commits on main are both WebKit bumps, including one to this exact hash). The build system treats WEBKIT_VERSION purely as a download-tag/checkout identifier; there is no conditional logic keyed off the value. Review of the actual JSC code belongs on the WebKit side, and the author has clearly already done that comparison work against V8's heap-snapshot-generator.cc.
Other factors
- CI is currently red, but the author explicitly notes this is expected until the
autobuild-c9f26a68b86c…release artifacts finish publishing — this is the normal sequencing for WebKit bumps and CI acts as the gate. - CodeRabbit's "tag does not exist" warning references a stale intermediate hash (
ce78f86a3ec3), not the final one in this diff, and is moot once artifacts publish. - No bugs were found by the bug-hunting system.
- A bot flagged possible overlap with #29389; that's a coordination question for the author, not a correctness issue with this one-line change.
Sequential collision-free node IDs (was 24-bit hash), synthetic (GC roots) subtree + root→shortcut→global so DevTools' Distance column works, and fix the analyzeNode TOCTOU that could create duplicate nodes under parallel marking.
There was a problem hiding this comment.
♻️ Duplicate comments (1)
scripts/build/deps/webkit.ts (1)
6-6:⚠️ Potential issue | 🔴 CriticalRelease artifacts must be published before merge—this is a known blocker.
The updated hash
59188212cf11248f0cd3578b62207664c4f7adbdderives the prebuilt download tagautobuild-59188212cf11248f0cd3578b62207664c4f7adbd. As noted in the PR objectives, CI will fail until WebKit autobuild release artifacts for this commit are published in oven-sh/WebKit. The bot has already reported build failures across multiple platforms (Build#46921).This must be resolved before merge by publishing the release with all required platform assets.
Run the following script to verify the release status:
#!/bin/bash set -euo pipefail TAG="autobuild-59188212cf11248f0cd3578b62207664c4f7adbd" API="https://api.github.com/repos/oven-sh/WebKit/releases/tags/${TAG}" echo "Checking release: ${TAG}" curl -fsSL "${API}" | jq -r ' if .message == "Not Found" then "❌ Release does not exist" else "✅ Release exists:", " Published: \(.published_at)", " Assets: \(.assets | length)", " Asset names:", (.assets[]?.name // empty) end ' || echo "❌ Release tag not found (HTTP 404)"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/build/deps/webkit.ts` at line 6, The WEBKIT_VERSION constant in scripts/build/deps/webkit.ts was updated to "59188212cf11248f0cd3578b62207664c4f7adbd", which requires a corresponding published GitHub release with tag autobuild-59188212cf11248f0cd3578b62207664c4f7adbd containing all prebuilt platform assets; publish that release (with all required platform assets) to oven-sh/WebKit, then verify the release exists and assets are present (use the provided script or GitHub API) before merging so CI will pass, and only then keep the new WEBKIT_VERSION value.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@scripts/build/deps/webkit.ts`:
- Line 6: The WEBKIT_VERSION constant in scripts/build/deps/webkit.ts was
updated to "59188212cf11248f0cd3578b62207664c4f7adbd", which requires a
corresponding published GitHub release with tag
autobuild-59188212cf11248f0cd3578b62207664c4f7adbd containing all prebuilt
platform assets; publish that release (with all required platform assets) to
oven-sh/WebKit, then verify the release exists and assets are present (use the
provided script or GitHub API) before merging so CI will pass, and only then
keep the new WEBKIT_VERSION value.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 2fa44dbf-5bc6-4a37-b52a-f9da686c6e5e
📒 Files selected for processing (1)
scripts/build/deps/webkit.ts
There was a problem hiding this comment.
LGTM — routine WebKit version bump following the established pattern; substantive changes live in oven-sh/WebKit.
Extended reasoning...
Overview
This PR changes a single line in scripts/build/deps/webkit.ts, updating the WEBKIT_VERSION constant from 4d5e75ebd84a to 59188212cf11. The constant determines which prebuilt WebKit tarball is downloaded (or which commit is checked out in local mode). All substantive code changes — the BunV8HeapSnapshotBuilder fixes for node/edge classification, sequential node IDs, the (GC roots) subtree, the TOCTOU fix, and JSON key ordering — live in the oven-sh/WebKit repo and are not part of this diff.
Security risks
None in this diff. The change is a hardcoded commit hash pointing to the project's own WebKit fork; no user input, no URL construction changes, no auth/crypto/permissions code touched. The upstream heap-snapshot changes are diagnostic-output formatting and don't expand attack surface.
Level of scrutiny
Low for the bun-side diff: this is a mechanical version bump matching an established pattern (the recent commit history shows three consecutive WebKit bumps of identical shape). The real review surface is the WebKit-side diff, which is out of scope for this repo and would be reviewed in oven-sh/WebKit's own PR process. CI acts as the gate here — the author explicitly noted that builds will fail until the autobuild-59188212cf11... release artifacts are published, so there's no risk of a silent bad merge.
Other factors
- CodeRabbit flagged a missing release tag, but that was for an intermediate hash and the author already acknowledged the artifacts caveat in the description.
- The bug-hunting system found no issues.
- No prior reviews from me on this PR.
- The PR description is unusually thorough, documenting each upstream change and known limitations (cross-snapshot ID stability), which gives confidence the author understands the impact.
Persist V8 heap snapshot node IDs across snapshots via HeapProfiler's HeapSnapshot chain so DevTools' "Objects allocated between A and B" filter and snapshot diffing work.
There was a problem hiding this comment.
LGTM — routine WebKit hash bump plus a test-only concurrency tweak.
Extended reasoning...
Overview
This PR touches two files with one-line changes each: scripts/build/deps/webkit.ts updates the WEBKIT_VERSION constant to a new oven-sh/WebKit commit hash, and test/bundler/transpiler/es-decorators-esbuild.test.ts switches the generated tests from test(...) to test.concurrent(...). The substantive heap-snapshot changes described in the PR body live in the WebKit repo, not in this diff.
Security risks
None. The version-bump line only changes which prebuilt tarball/tag is fetched from the trusted oven-sh/WebKit releases; no new URLs, auth, or input handling are introduced. The test change is test-infrastructure only.
Level of scrutiny
Low. WebKit hash bumps are a routine, mechanical pattern in this repo (see recent commits doing the same), and correctness is gated by CI once the autobuild artifacts publish — which the PR description already calls out, so the CodeRabbit warning about the missing release tag is expected and acknowledged. The test.concurrent change is safe: each iteration creates its own tempDir and spawns an isolated subprocess, so there is no shared mutable state between tests.
Other factors
No bugs were found by the bug-hunting system, and there are no outstanding human reviewer comments. The diff is minimal and follows established patterns, so human review adds little value here.
| * From https://github.com/oven-sh/WebKit releases. | ||
| */ | ||
| export const WEBKIT_VERSION = "4d5e75ebd84a14edbc7ae264245dcd77fe597c10"; | ||
| export const WEBKIT_VERSION = "c1fc04865a915e0ef7ab2c8724025caac2665336"; |
There was a problem hiding this comment.
🔴 The Bun-side callers still call heapProfiler.clearSnapshots() immediately before constructing BunV8HeapSnapshotBuilder (BunHeapProfiler.cpp:943, BunObject.cpp:811, JSWorker.cpp:696), which wipes the HeapProfiler chain so mostRecentSnapshot() is always null and IDs restart from scratch on every call — defeating the cross-snapshot ID stability this bump advertises. Worse, since the builder now appendSnapshot()s, Bun pays the ~16B/live-object retention cost between calls while getting none of the diffing benefit; the clearSnapshots() calls on the V8-builder paths should be dropped as part of landing this bump.
Extended reasoning...
What the bug is
This WebKit bump's headline structural change is cross-snapshot node-ID stability: the new BunV8HeapSnapshotBuilder constructor reads m_previousSnapshot = profiler.mostRecentSnapshot(), analyzeNodeInternal() reuses an existing identifier via m_previousSnapshot->nodeForCell(cell), and json()/jsonBytes() call m_profiler.appendSnapshot(...) so the next snapshot can chain off this one. The WebKit diff explicitly removed the internal m_profiler.clearSnapshots() that used to sit at the top of json()/jsonBytes() precisely to enable this chaining.
However, all three Bun-side call sites that construct the V8 builder still call heapProfiler.clearSnapshots() immediately before constructing it:
src/bun.js/bindings/BunHeapProfiler.cpp:943(generateHeapSnapshotV8→v8.writeHeapSnapshot/v8.getHeapSnapshot)src/bun.js/bindings/BunObject.cpp:811(Bun.generateHeapSnapshot)src/bun.js/bindings/webcore/JSWorker.cpp:696(worker.getHeapSnapshot)
HeapProfiler::clearSnapshots() does m_snapshots.clear(), which empties exactly the chain the new builder relies on.
Step-by-step proof
- User calls
v8.getHeapSnapshot()→generateHeapSnapshotV8(vm). - Line 943:
heapProfiler.clearSnapshots()→m_snapshotsis now empty. - Line 945:
BunV8HeapSnapshotBuilder builder(heapProfiler)→ ctor setsm_previousSnapshot = profiler.mostRecentSnapshot()=nullptr(vector is empty). - During
analyzeNodeInternal, them_previousSnapshot->nodeForCell(cell)reuse path is skipped for every cell; each gets a freshgetNextObjectIdentifier(). builder.json()runsm_profiler.appendSnapshot(...)→ snapshot A is now retained inHeapProfiler(~16 B per live object).- User calls
v8.getHeapSnapshot()again. - Line 943:
heapProfiler.clearSnapshots()→ snapshot A is destroyed before the new builder can read it. - New builder again sees
m_previousSnapshot == nullptr, assigns brand-new IDs to the same survivingJSCells.
So the same object gets different IDs in snapshot A vs B, and DevTools' "Objects allocated between Snapshot A and B" / comparison view cannot correlate them — exactly the feature the PR description says is now enabled.
Why existing code doesn't prevent it
These clearSnapshots() calls were correct (or at least harmless) before this bump, because the old builder cleared snapshots internally anyway and used a 24-bit pointer hash for IDs. They were not updated when the WebKit-side semantics changed in c1fc04865a91, and this PR only bumps the hash without touching the Bun callers.
Impact
- Feature dead-on-arrival: the advertised cross-snapshot diffing / "allocated between A and B" filter will not work via any of Bun's public entry points (
v8.getHeapSnapshot,v8.writeHeapSnapshot,Bun.generateHeapSnapshot('v8'),worker.getHeapSnapshot()). - Memory regression with no upside: because
appendSnapshot()now retains the snapshot inHeapProfiler, Bun holds ~16 bytes per live object from the end of one snapshot call until the start of the nextclearSnapshots(). Previously the snapshot was freed whenjson()returned. So the bump adds the retention cost while the upfront clear throws away the only benefit.
Fix
Drop the heapProfiler.clearSnapshots() calls on the three V8-builder code paths (leave the one at BunHeapProfiler.cpp:118 for the JSC GCDebuggingSnapshot path alone — that's a different builder). If an explicit reset is desired, expose it as a separate user-facing API rather than wiping on every call.
|
Closing as superseded. The BunV8HeapSnapshotBuilder commits this bump carries (ce78f86a3ec3, c9f26a68b86c, 59188212cf11, c1fc04865a91, b173a72ad722) were already on the fork's main line and shipped in Bun with the 87fd0daba19a upgrade (#29393, merged 2026-04-25). Main's current pin, 7b763944 (#37525), still contains all of them, and the only later changes to the builder were upstream-merge build fixes. The test.concurrent change to es-decorators-esbuild.test.ts landed separately in #29534, and that file has since been reworked to run all cases from a single spawn (#30875). |
Bumps WebKit to
b173a72ad722— four commits toBunV8HeapSnapshotBuilderthat bring the.heapsnapshotoutput into line with what Chrome DevTools actually parses, found by auditing against V8'sheap-snapshot-generator.cc.Why
Bun's
v8.writeHeapSnapshot()and the inspector'sHeapProfiler.takeHeapSnapshotproduce a V8-format JSON file. DevTools is the only real consumer of that format and it makes a lot of structural assumptions that aren't in any spec — node-type semantics drive shallow-size attribution, thesystem /name prefix drives styling, root topology drives the Distance column, and node IDs drive snapshot diffing. Several of those assumptions were silently violated, so snapshots loaded but showed misleading data.User-visible fixes in DevTools
Arrayshows 0 shallow size; bytes reattributed to whatever references itkArray, which V8 reserves for internal FixedArray backing stores; DevTools'calculateShallowSizes()zeroes those and reassignskObject, name"Array""Array (123)"; DevTools matcheskObject && rawName()==='Array'exactlykCodeforLexicalEnvironment,ModuleEnvironment,WithScope, etc.kObjectwith"system / <ClassName>"names — DevTools greys them out as internals while still showing them in retainer chains. Captured variables continue to render as named children via the existinganalyzeVariableNameEdgepathConservativeScan,StrongHandles,JITStubRoutinesetc. were emitted askContextVariableedges, which V8 reserves strictly for closure-captured localskInternalPromise (pending),Promise (fulfilled: Object),Promise (rejected)…"Promise"; status/result are visible by expanding the node's properties like in V81for everything(GC roots)intermediary and noshortcutedge to the global; DevTools' BFS couldn't distinguish user roots from system roots(GC roots)node;from==nullptredges route through it; eachJSGlobalObjectgets aroot → shortcut → globaledgeHeapProfilerHeapSnapshotchain — same cell keeps the same ID across snapshots, new cells get monotone-increasing IDs from the sharedgetNextObjectIdentifier()counter, andHeap::removeDeadHeapSnapshotNodesprunes dead entries viaforEachDeadCellon every GC so address reuse doesn't alias--heap-snapshot-string-limitdefault), no ellipsis, dedup on truncated content"(concatenated string)"; smaller ropes are resolved so the first 1024 chars show as the node nameCorrectness / robustness fixes
analyzeNodeTOCTOU under parallel marking: the old check-m_cellToNodeId-then-release-then-insert sequence let two GC marking threads each append aNodefor the same cell.analyzeNodenow just callsgetOrCreateNodeId, which holdsm_cellToNodeIdMutexacross the entire find-or-insert.trace_treeis now emitted immediately aftertrace_function_infos(beforesamples/locations) to match V8's serializer. DevTools' streaming loader is positional oncetrace_function_count > 0; we hard-code 0 today so this was latent, but it's a one-line landmine to leave in.ShadowRealm,WebAssembly.Module,WebAssembly.Instanceare nowkObject(werekCode).Cost
The cross-snapshot ID chain pins ~16 bytes per live object (
{JSCell*, unsigned}) inHeapProfilerfor the duration of the profiling session — same footprint as V8'sHeapObjectsMap. Each cell lives in exactly one snapshot in the chain (the one where it first appeared) and dead entries are swept on every GC, so the bound is live-object count, not objects-ever-seen. One-offv8.writeHeapSnapshot()calls pay this until theHeapProfileris torn down.Commits
addStringand string node namessystem /scope names, Promise/Array naming, rope literal,kInternalroot edges, JSON key order(GC roots)subtree + shortcut-to-global,analyzeNodeTOCTOUHeapSnapshotchain;getNextObjectIdentifiermade publicFull range: oven-sh/WebKit@4d5e75e...b173a72