ReviewOS

home-lang/home

Node proxy worker lifecycle leaves sanitized-URL requests incomplete

#629
Closed chris opened this 10 days ago ·
10 days ago

Scope

Port the worker, HTTP proxy, and request lifecycle needed by the unchanged copied corpus test:

test/js/node/test/parallel/test-http-proxy-request-invalid-char-in-url.mjs

Generic ESM lowering for node:worker_threads and Node common.mustCall enforcement landed in 2edc96ed2, so the reducer now executes the file instead of rejecting its module syntax.

Current evidence

zig-out/bin/home-debug test "$PWD/packages/runtime/test/bun-corpus/js/node/test/parallel/test-http-proxy-request-invalid-char-in-url.mjs"

The isolated reducer now fails with real lifecycle evidence:

  • proxy worker message callback: expected exactly 2, actual 1;
  • proxy worker exit callback: expected exactly 1, actual 0;
  • nested completion callbacks: two more expected calls remain at 0.

The first worker message arrives, but the six sanitized requests do not drive the proxy through proxy-stopped, worker termination, and target-server shutdown.

Acceptance criteria

  • Strip CR/LF from the request host/port before proxy dispatch, matching the upstream URLs and headers.
  • Complete all six responses and preserve the exact request/proxy log sets.
  • Deliver the worker's proxy-stopped message, terminate the worker, emit exit, and close the target server.
  • The unchanged upstream assertions, callback counts, topology, and workload pass.

Tracked from #66.

10 days ago

Resolved by b1fa1d017 (fix(test): align proxy URL and connection handling). Home now preprocesses ASCII tab, CR, and LF in string-form HTTP request URLs before parsing, while object-form host and port options remain strict. Proxy Connection and Proxy-Connection now follow Buns actual reuse rule: keep alive when the selected Agent has keepAlive enabled or finite maxSockets, otherwise close. The unchanged HTTP and HTTPS sanitized-URL corpus files pass, including all six worker-backed requests, exact proxy logs, the proxy-stopped message, worker exit, and server shutdown. A combined sanitized-URL, max-sockets, and socket-keep-alive run also passes with 3 files, 0 failures, and 0 unsupported.

Sign in to comment on this issue.