Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #9719 — a bug I found while validating an unrelated PR, filed, and have now fixed.
The break
Any program importing
node:httpfailed to link from a cold auto-optimize cache:perry-ext-http'sserver/bun_server.rsdeclares that symbol andjs_bun_http_request_from_jsonin an unconditionalextern "C"block — only its#[cfg(test)]arm stubs them. Their definitions live infetch::bun_server_bridge, whichperry-stdlibcompiles only underweb-fetch. The auto-optimize feature set for anode:httpprogram isasync-runtime, external-http-{client,server}-pump, external-net-tls, external-tls-server, external-ws-pump— noweb-fetch. Definition and reference disagreed about the feature gating them.Why nothing caught it
Plain
cargo build/cargo testnever link the auto-optimize ext-http path, and any warmtarget/perry-auto-*cache hides it from a manual check. It surfaced only in a full gap sweep from a cold cache, where it accounted for eightcompile_failresults.The fix, and the two alternatives rejected
The definitions genuinely need Fetch machinery (
FETCH_RESPONSES,consume_response_body), so they cannot move out of the gated module. Making the http features depend onweb-fetchwould linkreqwest— an HTTP client — into everynode:httpserver build, which is a large widening for two small bridge functions.Instead
perry-stdlibdefines both symbols in every configuration: the real bridge underweb-fetch, and undercfg(not(web-fetch))a pair answering "nothing to bridge" (null/undefined). That is the correct answer rather than a placeholder — with nofetchmodule there are noResponseobjects to snapshot, and it is what the real bridge already returns for an unknown handle.Validation
Both feature configurations compile — no missing symbol without
web-fetch, no duplicate definition with it.All eight previously-failing gap tests now compile, link and pass against the pinned node 26.5.1:
test_gap_3527_http_ctor_prototype,test_gap_gc_http2_pending_event_callback_rooting,test_gap_http_client_no_redirect_follow,test_gap_http_overloads_3226plus,test_gap_http_req_async_iterator,test_gap_http_res_socket_writable_onfinished,test_gap_http2_settings,test_gap_regex_replace_dyn_regex_with_http.test_gap_3527's output is byte-identical to node's.64/64 lint gates;
perry-stdlib130 passed, 0 failed.On regression coverage: I wrote a
crates/perry-stdlib/tests/symbol-existence test and then deleted it. An integration test links against the rlib under-dead_strip, which removes#[no_mangle]symbols nothing references — so it failed to link while the real fix worked, testing the harness rather than the property. The eight gap tests are the real coverage: they exercise the cold auto-optimize link that no unit test reaches, which is exactly the path that broke.