fix(node:diagnostics_channel): forward runStores callback arguments (#3082)#3182
Merged
Merged
Conversation
This was referenced May 30, 2026
proggeramlug
added a commit
that referenced
this pull request
May 30, 2026
…_channel) (#3266) * Revert "fix(node:console): validate Console stream write methods (#3080) (#3201)" This reverts commit c9f5894. * Revert "fix(node:diagnostics_channel): forward runStores callback arguments (#3082) (#3182)" This reverts commit 98c36e0. --------- Co-authored-by: Ralph Küpper <ralph@skelpo.com>
proggeramlug
added a commit
that referenced
this pull request
May 30, 2026
…l) + #3201 (console) re-merges (#3275) * Revert "fix(node:diagnostics_channel): forward runStores callback arguments (#3082) (#3182)" This reverts commit 98c36e0. * Revert "fix(node:console): validate Console stream write methods (#3080) (#3201)" This reverts commit c9f5894. --------- Co-authored-by: Ralph Küpper <ralph@skelpo.com>
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.
What
Extends Node argument-validation parity (#2013) to the global
Bufferfactory methods, following thefsslice landed in #2035 / #2328. These functions previously coerced bad input silently, soassert.throws-style tests reported "Missing expected exception".Buffer.alloc/allocUnsafe/allocUnsafeSlowsizeTypeError [ERR_INVALID_ARG_TYPE]NaN/Infinity/ negative /> kMaxLengthRangeError [ERR_OUT_OF_RANGE]Buffer.concatlistTypeError [ERR_INVALID_ARG_TYPE]TypeError [ERR_INVALID_ARG_TYPE](list[i])totalLengthERR_INVALID_ARG_TYPE/ERR_OUT_OF_RANGEBuffer.byteLengthTypeError [ERR_INVALID_ARG_TYPE]Non-integer sizes still truncate toward zero (
Buffer.alloc(2.5).length === 2), matching Node.How
fs::validateprimitives (describe_received,throw_type_error_with_code,throw_range_error_with_code,validate_int32) — the issue explicitly names this the shared validation home.describe_receivedgains string/bigint rendering (Node'sdetermineSpecificTypeshape) — purely additive;fsnever reaches those branches.buffer/validate.rswithjs_buffer_validate_size,js_buffer_validate_concat_list,validate_concat_length,validate_byte_length_arg.size/listvalues reach validation as raw NaN-boxed values: the Buffer factory codegen (env_clones.rs,array_methods.rs) now calls the validators before coercing toi32/ treating as anArrayHeader(the latter also closes a latent UB whereBuffer.concat('x')cast a string pointer to an array header).byteLength/concat(totalLength)validate inside the runtime entry points.Buffer.alloc()/allocUnsafe()with no argument now default toundefinedso they surfaceERR_INVALID_ARG_TYPElike Node, instead of silently allocating empty.Testing
Verified byte-identical to Node v25 across the full
buffernode-suite (120 cases, including 3 new arg-validation tests underallocation/,concat/,byte-length/) — 0 diffs, 0 regressions.cargo fmt --all --checkclean.Scope
#2013 is a cross-cutting umbrella (~85 tests across fs/buffer/net/http/crypto/zlib/process/url).
fslanded earlier; this is the buffer slice.Buffer.compareis deferred (it lowers to an instancea.compare(b)dispatch — a separate path); remaining APIs remain follow-ups.