fix(process): validate usage snapshots and exit codes#3497
Closed
andrewtdiz wants to merge 1 commit into
Closed
Conversation
This was referenced May 31, 2026
Contributor
Author
Contributor
Author
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.
Summary
Closes #3040
Closes #2927
Closes #3041
Closes #3049
process.cpuUsage(previousValue)objects like Node, including array/non-object rejection, required numericuser/system, and finite non-negative countersprocess.threadCpuUsage(previousValue)lowering/codegen/runtime support with the same previous-value validation and delta calculationprocess.exit(code)validation for numeric strings, fractional values,NaN/Infinity, and non-number inputsprocess.setMaxListeners(n), preserve fractional/Infinitylistener limits, and return the realprocessobject for chainingWhy Batched
These issues all sit in
node:processvalidation/readback behavior, share the same parity harness surface, and reuse the same runtime helpers for Node-style numeric/error formatting.Tests Added
test-parity/node-suite/process/cpu/cpu-usage-validation.tstest-parity/node-suite/process/cpu/thread-cpu-usage-previous.tstest-parity/node-suite/process/events/max-listeners-validation.tstest-parity/node-suite/process/methods/exit-validation.tsVerification
Using Node v25.9.0 on
PATHfor parity expected output:./run_parity_tests.sh --suite node-suite --module process --filter validation- 4 pass, 0 fail./run_parity_tests.sh --suite node-suite --module process/cpu --filter thread-cpu-usage-previous- 1 pass, 0 fail./run_parity_tests.sh --suite node-suite --module process/cpu- 5 pass, 0 fail./run_parity_tests.sh --suite node-suite --module process/events- 8 pass, 0 fail./run_parity_tests.sh --suite node-suite --module process/methods- 12 pass, 0 failcargo check -p perry-runtime -p perry-hir -p perry-codegen -p perrycargo build --release --quiet -p perry -p perry-runtime -p perry-stdlibcargo fmt --all -- --checkgit diff --check./scripts/check_file_size.shjq empty test-parity/known_failures.jsonKnown Limitations
process.threadCpuUsage()keeps Perry's current per-thread CPU split behavior: available thread CPU time is reported asuserwithsystem: 0on supported platforms. This PR adds previous-value support and validation around that existing measurement.Non-Goals
process.hrtime()changesknown_failures.jsonedits