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

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

Adapt callsites which used getHooksArrays() as workaround.
@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 80.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 88.51%. Comparing base (4f24aff) to head (616ff90).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/async_hooks.js 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #61054      +/-   ##
==========================================
- Coverage   88.53%   88.51%   -0.02%     
==========================================
  Files         703      703              
  Lines      208546   208544       -2     
  Branches    40217    40220       +3     
==========================================
- Hits       184634   184594      -40     
- Misses      15926    15972      +46     
+ Partials     7986     7978       -8     
Files with missing lines Coverage Δ
lib/async_hooks.js 100.00% <100.00%> (ø)
lib/internal/streams/end-of-stream.js 97.41% <100.00%> (-0.01%) ⬇️
src/env.cc 85.23% <ø> (-0.16%) ⬇️
lib/internal/async_hooks.js 99.37% <50.00%> (ø)

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

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++. 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

3 participants