Skip to content

Conversation

@Flarna
Copy link
Member

@Flarna Flarna commented Dec 13, 2025

Correct the implementaton of enabledHooksExist to return true if there are enabled hooks.

Adapt callsites which used getHooksArrays() as workaround.

fixes: #61019

refs: #59873

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/streams

@nodejs-github-bot nodejs-github-bot added async_hooks Issues and PRs related to the async hooks subsystem. c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. stream Issues and PRs related to the stream subsystem. labels Dec 13, 2025
@Flarna Flarna added the async_local_storage AsyncLocalStorage label Dec 13, 2025
@codecov
Copy link

codecov bot commented Dec 14, 2025

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 88.53%. Comparing base (28f468a) to head (474e67e).
⚠️ Report is 18 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/async_hooks.js 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #61054   +/-   ##
=======================================
  Coverage   88.53%   88.53%           
=======================================
  Files         703      703           
  Lines      208588   208586    -2     
  Branches    40233    40232    -1     
=======================================
+ Hits       184666   184681   +15     
+ Misses      15942    15908   -34     
- Partials     7980     7997   +17     
Files with missing lines Coverage Δ
lib/async_hooks.js 100.00% <100.00%> (ø)
lib/internal/process/task_queues.js 100.00% <100.00%> (ø)
lib/internal/streams/end-of-stream.js 97.41% <100.00%> (-0.01%) ⬇️
src/env.cc 85.39% <ø> (ø)
lib/internal/async_hooks.js 99.37% <50.00%> (ø)

... and 33 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.

@Flarna Flarna added dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. dont-land-on-v24.x PRs that should not land on the v24.x-staging branch and should not be released in v24.x. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. and removed dont-land-on-v24.x PRs that should not land on the v24.x-staging branch and should not be released in v24.x. labels Dec 15, 2025

function enabledHooksExist() {
return hasHooks(kCheck);
return active_hooks.array.length > 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the same as calling getHookArrays, I don't know if you already considering the implications of .array and tmp_array.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not the same code but to my understanding it fits the usecase it is used for.

Correct the implementaton of enabledHooksExist to return true if
there are enabled hooks.

Adapt callsites which used getHooksArrays() as workaround.
@Flarna Flarna force-pushed the async_hooks_get_enabled_hooks branch from 616ff90 to 474e67e Compare December 22, 2025 16:08
@Flarna
Copy link
Member Author

Flarna commented Dec 22, 2025

rebased and adapted as #60913 was merged.
fyi @gurgunday

@Flarna Flarna added the commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. label Dec 22, 2025
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 22, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 22, 2025
@nodejs-github-bot

This comment was marked as outdated.

@Flarna Flarna added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 23, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 23, 2025
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@gurgunday gurgunday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

async_hooks Issues and PRs related to the async hooks subsystem. async_local_storage AsyncLocalStorage author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. needs-ci PRs that need a full CI run. stream Issues and PRs related to the stream subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

enabledHooksExist() doesn't work as intended

5 participants