Skip to content

async_hooks: use validateBoolean for trackPromises - #64731

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
soulee-dev:async-hooks-validate-boolean
Jul 29, 2026
Merged

async_hooks: use validateBoolean for trackPromises#64731
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
soulee-dev:async-hooks-validate-boolean

Conversation

@soulee-dev

Copy link
Copy Markdown
Contributor

The trackPromises validation added in #61415 hand-rolls a check that validateBoolean() already performs — same error code, same expected type string, same argument order. This replaces it with the validator.

lib/async_hooks.js already imports validateString() and validateFunction() and uses them for type and fn, so this also makes the file internally consistent. With the last manual check gone, the ERR_INVALID_ARG_TYPE import is dropped as well.

No behavior change: validateBoolean() is wrapped in hideStackFrames(), so the thrown error is identical from a caller's perspective, including the top stack frame. The existing coverage in test/async-hooks/test-track-promises-validation.js already asserts this, so no new tests are added.

Refs: #61415

The `trackPromises` check duplicated `validateBoolean()` exactly: same
error code, same expected type string, same argument order. Replace it
with the validator, matching how this file already validates `type` and
`fn` via `validateString()`/`validateFunction()`.
`ERR_INVALID_ARG_TYPE` had no other use in this file, so drop the
import. Since `validateBoolean` is wrapped in `hideStackFrames()`, the
thrown error is unchanged from a caller's perspective.
Signed-off-by: Soul Lee <alus20x@gmail.com>
@nodejs-github-botnodejs-github-bot added async_hooks Issues and PRs related to the async hooks subsystem. needs-ci PRs that need a full CI run. labels Jul 25, 2026
@codecov

codecovBot commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.14%. Comparing base (0618e9f) to head (3ce515c).
⚠️ Report is 31 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #64731 +/- ##
==========================================
- Coverage 90.14% 90.14% -0.01% 
==========================================
Files 743 743 Lines 242408 242408 Branches 45656 45650 -6 ==========================================
- Hits 218520 218507 -13 
Misses 15387 15387 - Partials 8501 8514 +13 
Files with missing linesCoverage Δ
lib/async_hooks.js100.00% <100.00%> (ø)

... and 31 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@soulee-dev

Copy link
Copy Markdown
ContributorAuthor

@daeyeon Thanks for approving the CI run!

The only failing check is aarch64-linux: with shared boringssl on parallel/test-repl-function-definition-edge-case.

The same test-shared.yml workflow fails on main, with the same test and error (e.g. https://github.com/nodejs/node/actions/runs/30136256627).

make test passes locally on this branch. Could you re-trigger CI?

@daeyeondaeyeon added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 26, 2026
@avivkelleravivkeller added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jul 26, 2026
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 26, 2026
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@soulee-dev

Copy link
Copy Markdown
ContributorAuthor

The failures look unrelated to this change. Could you re-trigger CI? Thanks!

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/75277/

@daeyeondaeyeon added the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 29, 2026
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 29, 2026
@nodejs-github-bot
nodejs-github-bot merged commit 41525ab into nodejs:mainJul 29, 2026
143 of 149 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 41525ab

aduh95 pushed a commit that referenced this pull request Aug 3, 2026
The `trackPromises` check duplicated `validateBoolean()` exactly: same
error code, same expected type string, same argument order. Replace it
with the validator, matching how this file already validates `type` and
`fn` via `validateString()`/`validateFunction()`.
`ERR_INVALID_ARG_TYPE` had no other use in this file, so drop the
import. Since `validateBoolean` is wrapped in `hideStackFrames()`, the
thrown error is unchanged from a caller's perspective.
Signed-off-by: Soul Lee <alus20x@gmail.com>
PR-URL: #64731
Refs: #61415
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Aviv Keller <me@aviv.sh>
aduh95 pushed a commit that referenced this pull request Aug 4, 2026
The `trackPromises` check duplicated `validateBoolean()` exactly: same
error code, same expected type string, same argument order. Replace it
with the validator, matching how this file already validates `type` and
`fn` via `validateString()`/`validateFunction()`.
`ERR_INVALID_ARG_TYPE` had no other use in this file, so drop the
import. Since `validateBoolean` is wrapped in `hideStackFrames()`, the
thrown error is unchanged from a caller's perspective.
Signed-off-by: Soul Lee <alus20x@gmail.com>
PR-URL: #64731
Refs: #61415
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Aviv Keller <me@aviv.sh>
aduh95 pushed a commit that referenced this pull request Aug 5, 2026
The `trackPromises` check duplicated `validateBoolean()` exactly: same
error code, same expected type string, same argument order. Replace it
with the validator, matching how this file already validates `type` and
`fn` via `validateString()`/`validateFunction()`.
`ERR_INVALID_ARG_TYPE` had no other use in this file, so drop the
import. Since `validateBoolean` is wrapped in `hideStackFrames()`, the
thrown error is unchanged from a caller's perspective.
Signed-off-by: Soul Lee <alus20x@gmail.com>
PR-URL: #64731
Refs: #61415
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Aviv Keller <me@aviv.sh>
aduh95 pushed a commit that referenced this pull request Aug 6, 2026
The `trackPromises` check duplicated `validateBoolean()` exactly: same
error code, same expected type string, same argument order. Replace it
with the validator, matching how this file already validates `type` and
`fn` via `validateString()`/`validateFunction()`.
`ERR_INVALID_ARG_TYPE` had no other use in this file, so drop the
import. Since `validateBoolean` is wrapped in `hideStackFrames()`, the
thrown error is unchanged from a caller's perspective.
Signed-off-by: Soul Lee <alus20x@gmail.com>
PR-URL: #64731
Refs: #61415
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Aviv Keller <me@aviv.sh>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

async_hooksIssues and PRs related to the async hooks subsystem.author readyPRs that have at least one approval, no pending requests for changes, and a CI started.needs-ciPRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@soulee-dev@nodejs-github-bot@daeyeon@avivkeller