Skip to content

fix(util): validate system error helpers#3500

Merged
proggeramlug merged 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-util-system-errors
May 31, 2026
Merged

fix(util): validate system error helpers#3500
proggeramlug merged 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-util-system-errors

Conversation

@andrewtdiz

Copy link
Copy Markdown
Contributor

Summary

  • validate util.getSystemErrorName(err) and util.getSystemErrorMessage(err) inputs with Node-shaped ERR_INVALID_ARG_TYPE / ERR_OUT_OF_RANGE behavior
  • require negative safe-integer error codes before libuv lookup, including unsafe integer range formatting
  • align the Linux libuv error map entries so getSystemErrorMap() has Node's 85-entry shape and the expected EFTYPE / EUNATCH / EREMOTEIO / ENONET keys
  • update the util parity gap counts for the covered system-error helpers

Issues

Closes #3022
Refs #2514

Why This Cut

The validation gap and the existing node-suite/util/get-system-error map-size mismatch share the same util_syserr lookup path and one deterministic parity fixture. The broader #2514 tracker remains open for unrelated util helpers.

Tests Added

  • expanded test-parity/node-suite/util/get-system-error.ts with invalid input validation, unsafe integer handling, and Linux libuv alias/map-size probes
  • added focused util_syserr Rust unit coverage for range-number formatting and Linux libuv alias entries

Verification

  • pre-fix expanded fixture failed on the expected output mismatch: test-parity/reports/parity_report_20260531_005655.json
  • post-fix/rebase focused fixture passed 1/1: test-parity/reports/parity_report_20260531_011354.json
  • post-fix/rebase full util suite passed 74/74: test-parity/reports/parity_report_20260531_011516.json
  • TMPDIR="$PWD/target/tmp" RUSTC_WRAPPER= cargo test -p perry-runtime util_syserr passed with existing warnings
  • TMPDIR="$PWD/target/tmp" CARGO_BUILD_JOBS=1 RUSTC_WRAPPER= cargo check -p perry-runtime -p perry-codegen -p perry-api-manifest passed with existing warnings
  • cargo fmt --all -- --check
  • git diff --check HEAD
  • ./scripts/check_file_size.sh

Known Limitations

Non-goals

  • No changes to util.debuglog, util.diff, util.parseEnv, MIME helpers, or other node:util APIs.

@proggeramlug proggeramlug merged commit 87962b0 into PerryTS:main May 31, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

node:util: validate getSystemErrorName and getSystemErrorMessage inputs

2 participants