Repository navigation
Conversation
PerformanceObserver.supportedEntryTypes advertised two entry types that could never be delivered, which defeats the feature detection the list exists for: code sees support, calls observe(), and collects nothing. 'dns': node:dns never recorded the entries that node:net and node:http already record through internal/shared's hasObserver/startPerf/stopPerf. Record one for every lookup/lookupService/resolve*/reverse that completes successfully, across the callback API, the promises API, and Resolver instances, using the entry names and detail fields Node uses. 'resource': nothing in Bun calls Performance::addResourceTiming, so no resource entry can exist. Remove it from supportedEntryTypes so feature detection reflects reality.
|
Updated 2:47 AM PT - Jun 29th, 2026
❌ @robobun, your commit a7a3b15 has 1 failures in
🧪 To try this PR locally: bunx bun-pr 33041That installs a local version of the PR into your bun-33041 --bun |
Two review findings:
detail.result for A/AAAA queries recorded the raw native [{address, ttl}]
array instead of the value the caller receives, which is what Node records.
Move the existing promisifyResolveX normalization into the promise that
observeQuery wraps, which also replaces the duplicated ttl ternaries in the
resolve4/resolve6 callback bodies with that helper. Verified the
caller-visible results of every restructured path are byte-identical.
observeLookup recorded an entry for a lookup that fulfills with no
addresses, even though the caller sees that as ENODATA (throwIfEmpty).
Skip it, matching "failed lookups record nothing".
The fixture gains a resolve4 {ttl: true} call and the test now asserts the
exact detail.result values for both ttl states and for a TXT query.
|
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)
WalkthroughDNS APIs now emit ChangesDNS perf_hooks instrumentation
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
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 `@src/js/node/dns.ts`:
- Around line 281-292: The lookup perf entry is capturing ordering metadata and
addresses before they match the actual lookup result. Update the logic in dns.ts
around the lookup/lookupPromise path so the perf detail uses the real ordering
mode when setting verbatim, and make sure the addresses passed to stopPerf are
recorded after the same ipv4first/ipv6first reordering used by lookup() and
promisifyLookup*(). Keep the fix localized to the lookup perf detail
construction and the final result mapping so the emitted dns entry reflects the
true address order.
In `@test/js/node/perf_hooks/dns-entries-fixture.ts`:
- Around line 57-63: The fixture in the dns perf hooks test is still using
OS-backed resolution through dns.lookup and dns.lookupService, so it is not
hermetic. Update the dns-entries fixture to rely only on dns.resolve* or a
Resolver instance that is actually served by the local UDP server, or make the
lookup/lookupService steps optional and adjust the parent assertion to match the
emitted entries. Keep the ordering logic in dns-entries-fixture.ts and the
corresponding perf_hooks assertion in sync so the test no longer depends on host
resolver configuration.
🪄 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: 92641ba8-979b-4be0-b8a6-1950af3aaf2e
📒 Files selected for processing (5)
src/js/node/dns.tssrc/jsc/bindings/webcore/PerformanceObserver.cpptest/js/node/perf_hooks/dns-entries-fixture.tstest/js/node/perf_hooks/perf_hooks.test.tstest/js/node/test/parallel/test-dns-perf_hooks.js
The lookup entry's detail.verbatim was derived as order !== "ipv4first", which reports true for "ipv6first"; Node reports order === "verbatim" (lib/dns.js: verbatim: order === DNS_ORDER_VERBATIM). detail.addresses was also recorded before the requested order was applied, while Node's resolver hands them back already ordered. Extract the result ordering that the three lookup consumers each wrote out inline into sortByOrder() and apply it to the recorded addresses too; re-applying it downstream is a no-op. The fixture now requests an explicit non-default order and the test asserts that entry's exact detail.
… sees it
The lookup entry's detail.addresses was always the plain address strings.
For {all: true} Node's onlookupall records the same [{address, family}]
array it hands to the caller (lib/dns.js builds the objects in place before
calling stopPerf), so record the caller-visible shape for both modes. The
fixture gains an {all: true} lookup and the test asserts the element shape
of both.
getnameinfo("127.0.0.1") fails with ENOTFOUND on the Windows CI runners:
Windows ships its hosts file without a 127.0.0.1 entry, so c-ares falls
through to a PTR query against the configured server, and the fixture's
server did not answer PTR. Reverse 192.0.2.1 (TEST-NET-1, in nobody's hosts
file) instead and answer the PTR query from the local server, so every
platform resolves it the same hermetic way. Verified on Linux, which now
takes the identical PTR-to-local-server path Windows does.
…tches promises.Resolver.prototype.resolve coerces a non-string rrtype to null (a pre-existing divergence from Node and from the other two resolve variants, which throw). The native resolver treats null as an A query, so the recorded entry said "queryNull" for a query that was really an A lookup.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@test/js/node/perf_hooks/dns-entries-fixture.ts`:
- Around line 2-5: The opening comment in dns-entries-fixture should be folded
to fit the repo’s 3-line comment limit. Update the top-of-file comment near the
fixture setup so it conveys the same purpose using at most three lines, keeping
the references to the UDP DNS server, the parent perf_hooks test, and
dns.setServers() but shortening or combining the wording.
🪄 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: 7540db91-4c91-482b-aefd-bc830fd4e600
📒 Files selected for processing (3)
src/js/node/dns.tstest/js/node/perf_hooks/dns-entries-fixture.tstest/js/node/perf_hooks/perf_hooks.test.ts
|
For a maintainer looking at the red check: every CI failure on this PR is infrastructure or a known-flaky test unrelated to this change. No job that has run the new tests has failed since ebf3278. Across the last two builds (66676 and 66684, the second an empty retrigger), the failures are:
Everything else is green, including the two Windows lanes whose earlier failure was real and was fixed in ebf3278 ( |
There was a problem hiding this comment.
All the inline issues I raised have been addressed and the latest pass found nothing new, but this restructures every node:dns call site (callback, promises, and both Resolver classes) and drops "resource" from the web-global supportedEntryTypes, so it's worth a human sanity-check before merge.
Extended reasoning...
Overview
This PR does two things: (1) wires every node:dns operation — lookup, lookupService, every resolve*/reverse, across the callback API, dns.promises, and both Resolver classes — through three new observeLookup/observeLookupService/observeQuery helpers so a PerformanceObserver({entryTypes:['dns']}) actually receives entries, and (2) removes "resource" from the WebCore PerformanceObserver.supportedEntryTypes list since nothing in Bun produces resource-timing entries. It also extracts a sortByOrder() helper that the three pre-existing lookup consumers now share. Tests: a hermetic fixture with a local UDP DNS responder asserting the exact 12-entry list and detail shapes, a supportedEntryTypes assertion, and Node's vendored test-dns-perf_hooks.js.
Security risks
None identified. The instrumentation is observe-only (it reads results already destined for the caller and reports them to a PerformanceObserver), gated on hasObserver('dns') so it's a no-op when nothing subscribes. No new inputs are parsed, no auth/crypto/permissions surfaces are touched, and the C++ change only removes a string from a static list.
Level of scrutiny
Medium-high. src/js/node/dns.ts is a core Node-compat module on the path of every DNS resolution; the diff restructures ~30 call sites (most of the visual churn is Prettier re-indentation, but each call now flows through a wrapper and several A/AAAA paths moved their promisifyResolveX transform inside the wrapped promise). Over three review rounds, five real detail-shape/semantics issues were found and fixed (empty-result entries, A/AAAA detail.result shape, verbatim for ipv6first, {all:true} detail.addresses shape, queryNameFor(null)), plus a Windows hermeticity fix for lookupService in the test fixture. All are now resolved and covered by tightened assertions, but the volume of edge cases suggests a human pass over the dns.ts restructuring is warranted before merge.
Other factors
- All inline comments from me and CodeRabbit are resolved; the current bug-hunting pass found nothing.
- The
"resource"removal is a one-line, well-justified spec-conformance change and is independently revertable. - The musl build failures in CI appear to be infrastructure (a
ci: retriggercommit was pushed) rather than caused by this change. - No CODEOWNERS entries match the touched paths.
|
Closing as part of a cleanup of stale pull requests. This PR has had no new commits since 2026-06-29, it conflicts with main, and its last CI run failed. This is not a judgment on the fix itself. If the problem still reproduces on a current build, reopen this PR after a rebase or open a new one against main. |
What
PerformanceObserver.supportedEntryTypesadvertisesdnsandresource, andobserve()accepts them, but neither type is ever delivered. That is the worst outcome for feature detection, which is the one jobsupportedEntryTypeshas: code checks the list, sees support, registers an observer, and silently collects nothing.dns: deliver the entriesnode:netandnode:httpalready record theirnetandhttpentries throughinternal/shared'shasObserver/startPerf/stopPerf, butnode:dnsnever called into it, sodnswas advertised (it is inkNodeEntryTypes) with no producer.This wires every
node:dnsoperation into that machinery:lookup,lookupService, everyresolve*,resolve(hostname, rrtype), andreverse, across the callback API, the promises API, andResolver/promises.Resolverinstances. Three small helpers wrap the native promise so each call site stays a single expression and costs nothing when nodnsobserver is registered. Semantics match Node (lib/dns.js,lib/internal/dns/{promises,callback_resolver}.js):lookuprecord nothinglookup,lookupService,queryA,queryAaaa,queryTxt, ...,getHostByAddrforreversedetailcarries the same fields Node records ({hostname, family, hints, verbatim, order, addresses}for lookup,{host, port, hostname, service}for lookupService,{host, ttl, result}for resolvers)Since
node:netresolves hostnames throughdns.lookup,net.connect("example.com", ...)now also produces adns:lookupentry, as it does in Node.Most of the
dns.tsdiff is Prettier re-indenting the call sites it touches; reviewing with whitespace hidden shows the real change.resource: stop advertising itNothing in Bun can produce a resource entry.
Performance::addResourceTiminghas zero callers,performance.markResourceTimingis a no-op stub, and the HTTP client collects no per-request timing forfetch()to report. Per the Performance Timeline spec,supportedEntryTypeslists the types for which an entry could exist in the global, soresourceis removed. This is a one-line hunk, independent of thednschange, and should be reverted by whichever change implements resource timing.Actually implementing resource timing is a separate feature, not a one-liner: the
PerformanceResourceTimingconsumer side in WebCore is real and compiled, but the producer side needs new per-phase instrumentation in the HTTP client's connection callbacks, plumbing throughHTTPClientResult, and a conversion into the synthetic clock domainPerformance::m_timeOriginuses. Happy to write that up as a tracking issue.Verification
New tests, both failing without the fix:
test/js/node/perf_hooks/perf_hooks.test.tssupportedEntryTypeslists for the web global (["mark", "measure"]) and fornode:perf_hooks(["dns", "http", "mark", "measure", "net"])dns-entries-fixture.ts, which runs a local UDP DNS responder and pointsdns.setServers()at it in its own process, so all twelve expected entries (covering every structurally distinct call-site shape) are produced hermetically and in a deterministic order, with exactdetailvalues. Also covers the negatives: an IP-literal lookup, an NXDOMAIN, and an operation afterdisconnect()record nothing.test/js/node/test/parallel/test-dns-perf_hooks.js: Node's own test for this, ported verbatim from nodejs/node. Previously failed with0 !== 4; now exits 0.Existing
test-net-perf_hooks.js,test-http-perf_hooks.js, the performance observer leak test, and thenode:dnssuites are unaffected (bun bd test test/js/node/dns/ test/js/bun/dns/reports the same set of failures as stock, all of which need direct network access).Reported by bun-sys-fuzz.