Skip to content

test: move test-child-process-server-close.js into test/js/node/test/parallel/ - #43723

Closed
robobun wants to merge 2 commits into
mainfrom
robobun/f1bf2217/move-stranded-node-tests
Closed

robobun wants to merge 2 commits into
mainfrom
robobun/f1bf2217/move-stranded-node-tests

Conversation

@robobun

@robobun robobun commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

  • test/js/node/parallel/ holds two node tests that CI never runs: test-child-process-server-close.js (Fix test-child-process-server-close #20062) and test-http-socket-encoding-error.js (Fix http socket encoding check #20031).
  • isNodeTest() (scripts/runner.node.ts:2467) accepts only js/node/test/parallel/, js/node/test/sequential/ and js/bun/test/parallel/. isTestStrict() needs .test or spec. in the file name. The two files match neither.
  • The files also cannot run in place: Cannot find module '../common'. The directory is test/js/node/test/common.

Fix

  • Move test-child-process-server-close.js to test/js/node/test/parallel/ with the text of Node.js v26.3.0 (same git blob, 65a4ebb87c). A search of test/ finds no other test that passes a net.Socket as a stdio entry of a child.
  • Delete test-http-socket-encoding-error.js. node:http/https/http2: raise Node v26.3.0 compat to ~94%, sync the upstream suites, and fix the Windows/macOS transport-layer teardown bugs they exposed #32488 already put the v26.3.0 text of this test in test/js/node/test/parallel/.
  • Add a [ WINDOWS ] entry to test/expectations.txt. On Windows the handle of a named pipe has no fd, and spawn() throws ERR_INVALID_ARG_TYPE: file descriptor must be a positive integer. Node v26.3.0 passes there.
  • Verified: the runner finds the file and it passes on Linux (debug ASAN build and 1.4.3-canary.1). On Windows x64 the runner fails the file without the entry and skips it with the entry.

Background

  • The files in test/js/node/test/ are copies of Node.js tests. The runner starts each with bun run. Exit code 0 is a pass.
  • This test accepts a connection on common.PIPE (a unix socket on POSIX, a named pipe on Windows). It spawns bun -v with that connection as the stdout of the child. The client must receive the version text.
  • An entry in test/expectations.txt removes a file from the run on the platforms that its modifier names.
Notes

No src/ change. The test passes on main once it is in the right directory.

Runs on Linux x64, each through scripts/runner.node.ts (so with BUN_TEST_DRAIN_EVENT_LOOP=1, the exception-check validation and LeakSanitizer on the debug build):

$ bun scripts/runner.node.ts --exec-path ./build/debug/bun-debug test-child-process-server-close test-http-socket-encoding-error
Filtering tests: 2 / 5990
  test/js/node/test/parallel/test-child-process-server-close.js
  test/js/node/test/parallel/test-http-socket-encoding-error.js
Passed Tests 4, Failing Tests 0     (two of the four are the `bun install` steps)

The test is not empty on POSIX. A copy that logs the chunk prints client got: "1.4.3\n".

The two files in place, on main:

$ bun test/js/node/parallel/test-child-process-server-close.js
error: Cannot find module '../common' from '/workspace/bun/test/js/node/parallel/test-child-process-server-close.js'

The deleted copy of test-http-socket-encoding-error.js differs from the copy that stays only by the missing 'use strict' line and one string concatenation.

Windows x64, 1.4.3-canary.1+9cba9036a, the v26.3.0 text:

TypeError: file descriptor must be a positive integer
 code: "ERR_INVALID_ARG_TYPE"
      at spawn (node:child_process:736:35)
      at <anonymous> (test-child-process-server-close.js:28:3)

A probe on the same machine (a server on \\.\pipe\..., spawn(process.execPath, ['-v'], { stdio: ['ignore', conn, 'ignore'] })):

conn._handle.fd result
node v26.3.0 -1 client receives v26.3.0\r\n, child closes with 0
bun 1.4.3-canary.1 -1 spawn() throws ERR_INVALID_ARG_TYPE

streamFdOf() in src/js/node/child_process.ts reads _handle.fd and gives it to Bun.spawn. Node does not need an fd here: libuv takes the uv_pipe_t of a connected named pipe as UV_INHERIT_STREAM. Support for this in Bun.spawn on Windows is separate work. I found no issue or open PR for it. Remove the [ WINDOWS ] entry when that support exists.

The Windows runner with and without the entry:

without: Filtering tests: 1 / 5989, Failing Tests 1, exit 1
with:    Filtering tests: 0 / 5988, Running tests: 0, exit 0

Not checked on macOS. It uses the same POSIX path as Linux (common.PIPE is a unix socket and _handle.fd is a real descriptor).

Two open PRs, #34659 and #41400, also add test/js/node/test/parallel/test-child-process-server-close.js. Both carry the same v26.3.0 blob, so this change does not give them a conflict in that file. Neither removes test/js/node/parallel/.

A scan of test/ for other test-*.js files outside the directories that the runner accepts finds only fixtures and helper modules.


no test proof · iteration 0 · no src or test change; test-proof not applicable

The test runner takes node tests only from test/js/node/test/parallel/,
test/js/node/test/sequential/ and test/js/bun/test/parallel/. Two files
were in test/js/node/parallel/, so the runner never ran them. From that
directory they also could not load '../common'.

- Move test-child-process-server-close.js to test/js/node/test/parallel/
  and use the text of Node.js v26.3.0.
- Delete test-http-socket-encoding-error.js. The v26.3.0 text of the same
  test is already in test/js/node/test/parallel/.
- Add a Windows entry for test-child-process-server-close.js to
  test/expectations.txt. On Windows, spawn() rejects a named-pipe
  net.Socket as a stdio entry.
@robobun

robobun commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator Author

Status: ready for review. This PR changes only files under test/.

How I reproduced it:

  • On main, bun test/js/node/parallel/test-child-process-server-close.js fails with Cannot find module '../common'. scripts/runner.node.ts lists neither file of test/js/node/parallel/.
  • On this branch, bun scripts/runner.node.ts --exec-path ./build/debug/bun-debug test-child-process-server-close finds the file and it passes (Linux x64, debug ASAN build).
  • On Windows x64 the file fails with ERR_INVALID_ARG_TYPE: file descriptor must be a positive integer. Node v26.3.0 passes there. test/expectations.txt has a [ WINDOWS ] entry for the file.

@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

Warning

Review limit reached

  • Run on-demand review

This review includes 1 billable file and costs up to $0.25.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 4 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: oven-sh/bun/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Essentials

Run ID: 40bb2882-f4ba-4e60-9743-8746932efd2b

📥 Commits

Reviewing files that changed from the base of the PR and between b3b9106 and e1321e6.

📒 Files selected for processing (1)
  • test/expectations.txt

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: oven-sh/bun/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Essentials

Run ID: 338ab243-ce5d-487f-a68e-8c59476a3baf

📥 Commits

Reviewing files that changed from the base of the PR and between b7ea95a and b3b9106.

📒 Files selected for processing (4)
  • test/expectations.txt
  • test/js/node/parallel/test-child-process-server-close.js
  • test/js/node/parallel/test-http-socket-encoding-error.js
  • test/js/node/test/parallel/test-child-process-server-close.js
💤 Files with no reviewable changes (2)
  • test/js/node/parallel/test-child-process-server-close.js
  • test/js/node/parallel/test-http-socket-encoding-error.js

Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review.


Walkthrough

Changes

Child-process server-close regression

Layer / File(s) Summary
Replace and classify server-close test
test/js/node/test/parallel/test-child-process-server-close.js, test/js/node/parallel/test-child-process-server-close.js, test/expectations.txt
A forked test now verifies pipe connection, spawned-process, and server cleanup. The previous test is removed. Windows marks the test as expected to fail.

HTTP socket encoding test removal

Layer / File(s) Summary
Remove HTTP socket encoding test
test/js/node/parallel/test-http-socket-encoding-error.js
The HTTP socket encoding error test is deleted.

Priority: ⬇️ Low

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely identifies the main change: moving the test into the directory where the runner discovers it.
Description check ✅ Passed The description explains the problem, fix, platform-specific behavior, and verification results. It does not use the template headings exactly, but it provides the required information in equivalent s…

Comment @coderabbitai help to get the list of available commands.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed this PR and didn't find any bugs. It is a small test-only relocation, but it adds an entry to test/expectations.txt, which is CODEOWNER-gated and removes the whole file from the Windows lanes, so a human look at that entry is still worthwhile.

What was reviewed:

  • The re-added test/js/node/test/parallel/test-child-process-server-close.js carries blob 65a4ebb8 in the diff header, matching the upstream v26.3.0 blob the description names; the 'use strict', indentation, and mustCall wrappers are the upstream text, not local edits.
  • The deleted test/js/node/parallel/test-http-socket-encoding-error.js is superseded by the existing canonical copy (same body plus 'use strict' and a split string), which already has an expected-durations.json entry; test/js/node/parallel/ no longer exists after the change.
  • The Windows expectation's stated cause checks out against streamFdOf() in src/js/node/child_process.ts:1752-1758, which returns _handle.fd as-is (so -1 for a named pipe) to Bun.spawn; the entry format matches its neighbors, though unlike them it does not cite a CI build number for the Windows verification.
Extended reasoning...

The change touches four files: it deletes two stray node tests under test/js/node/parallel/ (a directory the runner never scanned), re-adds test-child-process-server-close.js at the canonical test/js/node/test/parallel/ path with the upstream Node text, and adds a [ WINDOWS ] quarantine line to test/expectations.txt. No runtime source is modified and no security-sensitive surface is touched. The decision to defer rather than approve rests on test/expectations.txt being owned by a CODEOWNER (.github/CODEOWNERS line 5) and on the header of that file reserving entries for files that cannot run at all, which makes the whole-file Windows quarantine a judgment call for the owner. Independent verification of the upstream blob was not possible in this environment beyond the blob hash shown in the diff header.

@robobun

robobun commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator Author

Two points about the test/expectations.txt entry:

  • The entry now says where I verified the failure: Windows x64 with 1.4.3-canary.1+9cba9036a, on a machine outside CI (e1321e6). There is no CI build number to cite. The file never ran in CI before this PR, and with the entry CI does not run it on Windows.
  • The file holds one scenario, and on Windows spawn() throws before that scenario starts. A skip inside the file would change the upstream v26.3.0 text. The [ WINDOWS ] entry is the smallest exclusion. It has the same shape as the test-net-pingpong.js entry above it.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — a test relocation plus a duplicate cleanup, no runtime code touched.

What was reviewed:

  • The new test/js/node/test/parallel/test-child-process-server-close.js matches the upstream Node text ('use strict', common.mustCall on the createServer/listen callbacks are upstream, not local edits), so it complies with the no-modification rule for that directory.
  • The deleted test/js/node/parallel/test-http-socket-encoding-error.js differs from the surviving copy in test/js/node/test/parallel/ only by the 'use strict' line and a string-concatenation split — a true duplicate, and the stray test/js/node/parallel/ directory is now gone.
  • The [ WINDOWS ] ... [ FAIL ] line in test/expectations.txt follows the same shape as the neighbouring test-net-pingpong.js entry; I did not execute the test in this environment, so the POSIX pass relies on CI.
Extended reasoning...

The diff moves one upstream Node.js test from a directory the runner never scans into test/js/node/test/parallel/, deletes a duplicate of a test already present there, and adds a Windows FAIL expectation with a comment explaining the named-pipe stdio gap in spawn(). It touches no src/ code and no security-sensitive surface. The relocated file's text matches upstream Node verbatim and the deleted file is byte-equivalent modulo 'use strict' and a string split, which is what decided approve; the only commit since the earlier review adds a single comment line to expectations.txt.

@robobun

robobun commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator Author

Folded into #49196, which combines the open test-only PRs into one. The commit 614020ec0 in that PR is this change, unchanged.

Closing this one in favor of #49196.

@robobun robobun closed this Nov 17, 2026
robobun added a commit that referenced this pull request Nov 17, 2026
…de/test/parallel/ (#43723)"

The copy under test/js/node/test/parallel/ is not the upstream text: it adds two common.mustCall wrappers.
@robobun

robobun commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator Author

Correction: this change is not part of #49196. Its commit is reverted there (146e56441e). test/js/node/test/parallel/ holds upstream Node tests as upstream has them, and the copy in this PR adds two common.mustCall wrappers.

This PR stays closed. The branch stays.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant