Conversation
- Node 20.20.2 reads each worker stdout pipe as V8 frames. A non-ASCII console.log can land in the length field and abort the file at :1:1. - npm run test:node now imports a setup that sends console.log and console.info to stderr. Raw stdout writes are left alone. - The new test failed on the unwired script, then passed on Node 20.20.2 and Node 26.9.0. Without the import, the banner fixture still crashes Node 20.20.2.
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 #158.
What problem does this solve?
On Node 20.20.2,
npm run test:nodecan fail a file at:1:1withUnable to deserialize cloned data due to invalid or unsupported version. The stack is Node's test-runner parser. The named file is the worker whose stdout pipe carried the bytes, not a failed assertion.node --testreads that pipe as V8 frames. A frame isFF 0Fplus a 4-byte size. On Node 20.20.2 the size is a signed read. A UTF-8 lead byte spliced into that field makesreadHeader()throw. Boot logs already do this onmain.PathManager.js:76logs📁 AGNT root:. Line 74 logsAGNT datawhen the directories match, and line 77 logsAGNT datawhen they differ.database/index.jshas 39console.logcalls that include a checkmark, including the column log at line 634. Those lines are non-ASCII.How does it solve it?
npm run test:nodenow loadstests/setup/node-test-stdout.mjswith--import. That runs in the worker before the test file. It sendsconsole.logandconsole.infoto stderr. The runner reads stderr as text and does not deserialize it.--importis already forwarded to the worker, so no second hook is required.The banner fixture is
tests/fixtures/node-test-stdout-banner.js, not*.test.js. Vitest's default include would otherwise collect it, andvitest.config.jsexcludestests/unit/**for that reason but nottests/fixtures/**.Left alone on purpose:
process.stdout.writeandfs.writeSync(1). A write of the bytesFF 0Fplus a plausible size still crashes Node 20.20.2 and Node 26.9.0. That is test_runner: parent runner still crashes on child stdout bytes that mimic an event frame (survives the #64706 fix) nodejs/node#66164 and test_runner: do not crash on stdout that mimics a v8 frame nodejs/node#66273. Hiding it here would be wrong.continue-on-erroron the currentmainjob. This does not make that job a gate.tests/unit/providers.test.js.How did you verify it?
Red, before the script imported the setup.
node --test tests/unit/nodeTestStdout.test.json Node 26.9.0:Same tree, Node 20.20.2,
node --test tests/fixtures/node-test-stdout-banner.jswith no--importexited 1:Green, after the change.
node --test tests/unit/nodeTestStdout.test.js:The same fixture with
--import ./tests/setup/node-test-stdout.mjson Node 20.20.2 exited 0: tests 4, pass 4, fail 0, and it did not print the deserialize error.npm run test:nodeon Node 26.9.0 is not green on this machine either before or after. The new test passed inside that run. The other failures are the pre-existing provider, async-tool, and two file-level failures. Neither suite run printed the deserialize error. I did not runnpm testor the frontend suite.Checklist
npm testpassesnpm --prefix frontend testpasses