Tracked from #66.\n\nHome's copied Bun/Node HTTP pipeline regression remains expectation-gated because the runtime does not yet enforce the native parser and lifecycle contract end to end.\n\nRequired work:\n- Reject invalid request methods strictly rather than normalizing or accepting them.\n- Surface HPE_INVALID_METHOD through clientError with the original parser identity and useful context.\n- Preserve Node's default 400 response, connection close, and socket cleanup behavior when clientError is not handled.\n- Make pipelined request completion and failure callbacks run exactly once and in terminal-event order.\n- Cover uppercase custom methods and fragmented method tokens as counterexamples so the detector cannot be filename- or fixture-specific.\n- Run the unchanged maintained Bun whole-file test and require its exact pass count before removing the expectation.\n- Keep StreamWrap transport compatibility tracked separately in #430.\n\nAcceptance:\n- Focused non-vacuous runtime tests pass.\n- The maintained copied upstream file passes without injected skips or synthetic results.\n- The relevant expectation entry is removed only in the same verified commit.
fix(node:http): reject invalid methods and preserve pipeline terminal ordering
#441Read-only exact audit of the copied 1,772-line pipeline file:\n\n- 130 direct assertions: 97 strictEqual, 12 deepStrictEqual, 8 throws, 4 rejects, 2 ok, 7 bare assert.\n- 118 exact callback wrapper sites: 90 mustCall and 28 mustSucceed, plus 6 mustCallAtLeast and 7 mustNotCall.\n- 79 callback pipeline calls and 6 stream/promises pipeline calls.\n- The quarantined hanging block alone requires three exact callbacks and one at-least request handler.\n\nNative root cause: Node HTTP already selects strict method validation, but Bun's request-line scanner accepts lowercase bytes while the token is incomplete and waits for a space before the strict method lookup. The smallest native fix is immediate lowercase rejection during strict scanning while preserving uppercase A-Z and hyphen as viable prefix bytes, followed by the existing known-method lookup at the delimiter. A focused integration must send a lone lowercase h with no CRLF and observe immediate HPE_INVALID_METHOD, rawPacket/bytesParsed, default 400, and exactly-once close; fragmented G then ET must remain valid.\n\nThe Home harness also needs a real pipeline lifecycle: repeated Readable pull and destroy, required callback validation, final finish/end tracking, premature-close errors, first-error ownership, exactly-once stage destruction/callback after teardown, and a promise wrapper that delegates to the same implementation. The current microtask-success pipeline is insufficient.\n\nThe expectation at packages/runtime/test/bun-corpus/expectations.txt:27 remains until the unchanged whole file passes. Parser-only progress must not be presented as whole-file Home coverage.
First implementation slice completed locally in 13c57be (fix(runtime): reject lowercase HTTP methods early). Strict request-line scanning now rejects lowercase bytes before a delimiter in both Home's generic raw HTTP model and the vendored uWS parser source, while uppercase and hyphen prefixes remain viable and completed uppercase requests still use the normal parser path. Home-owned counterexamples cover lone h immediate default-400/close and fragmented G then ET acceptance. The copied Bun fixture was restored and verified byte-identical rather than modified. Verification: focused server parser/lifecycle contract 9/9, adjacent maintained server-parser corpus plus logical groups green, Zig fmt/diff and scoped clang-format green. This is partial progress only: test-stream-pipeline.js remains SKIP until real pipeline finish/error/premature-close/destroy ordering is implemented and the unchanged 1,772-line file passes.
Audit correction after 13c57be91d374d89eec2c783c93b2503fd4170ef: lowercase-method rejection now unblocks the copied pipeline test transport case at lines 271-303, so the expectation comment parser rationale is stale. The SKIP must remain because earlier exact cases still fail generic pipeline API validation, promise export, EOS/close coordination, teardown, Transform/PassThrough, iterable/function stages, and AbortSignal/options behavior. The next correct slice is a generic two-classic-stream pipeline coordinator; do not remove #441 until the full copied file and callback accounting are green.
Completed across 0be19c7181f6126ee6d3fb6cad17674377404d02 (#514) and 26b5a8b9165d8c65488c512d90d6d8cd58de8872 (#547), both published on codex/runtime-port as Chris Breuer without coauthors.
The generic pipeline coordinator now owns finish/error/premature-close/destroy ordering, callback and promise settlement, abort behavior, iterable/function stages, Transform/PassThrough, and exactly-once teardown. The native HTTP/1 parser object is now built from Home's tracked pinned uWebSockets mirror, so strict lowercase method rejection is active in the executable rather than dead reference source. A malformed request after a valid keep-alive response receives the default 400 Bad Request, closes the socket, and settles both pipeline ends with ERR_STREAM_PREMATURE_CLOSE; fragmented uppercase methods and valid same-buffer pipelining remain valid.
The maintained fixture has no expectation entry now. The complete unchanged 252-file Node stream scan passes 252/252, including the original 1,772-line test-stream-pipeline.js, with no injected skips, timeout changes, fixture edits, or synthetic results. The final checkpoint also passes the dedicated native parser regressions in normal, exception-validation, and VM-destruction modes; 64/64 publication regressions; 1,828 scoped Zig units; and the clean 18/18-step native build.
This fulfills this issue's exact removal gate. StreamWrap transport compatibility remains tracked in #446, and the overall #66 port remains incomplete.
Sign in to comment on this issue.