Skip to content

Conversation

@Qard
Copy link
Member

@Qard Qard commented Feb 4, 2026

This adds WindowChannel, adds a using syntax equivalent to runStores, and modifies the internals to use these to avoid closures in several places.

Depends on #61674

cc @nodejs/diagnostics

Adds support for using scope = storage.withScope(data) to do
the equivalent of a storage.run(data, fn) with using syntax.
This enables avoiding unnecessary closures.
@Qard Qard self-assigned this Feb 4, 2026
@Qard Qard added the diagnostics_channel Issues and PRs related to diagnostics channel label Feb 4, 2026
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/web-infra

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Feb 4, 2026
@Qard Qard added the request-ci Add this label to start a Jenkins CI on a PR. label Feb 4, 2026
@github-actions github-actions bot added request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. and removed request-ci Add this label to start a Jenkins CI on a PR. labels Feb 4, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

Failed to start CI
   ⚠  No approving reviews found
   ✘  Refusing to run CI on potentially unsafe PR
https://github.com/nodejs/node/actions/runs/21678728231

@Qard Qard force-pushed the dc-windows branch 6 times, most recently from 302c219 to c764f06 Compare February 4, 2026 17:44
This adds WindowChannel, adds using scope support to runStores,
and modifies the internals to use these to avoid closures in
several places.
Copy link
Member

@RafaelGSS RafaelGSS left a comment

Choose a reason for hiding this comment

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

Could you please expand on PR description on why this is needed? We have channels, tracingChannels and now windowChannel, it would be great to know for which kind of situations we need each one of them.

added: REPLACEME
-->

> Stability: 1 - Experimental
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
> Stability: 1 - Experimental
> Stability: 1 - Experimental

Perhaps 1.1 Active Development instead?

@Qard
Copy link
Member Author

Qard commented Feb 4, 2026

WindowChannel is mainly just to enable using syntax scopes, but is exposed as there are possible use cases where one may want to emit events around a block/scope without the greater complexity of TracingChannel.

It's also replacing most of the internals of TracingChannel to make it more coherent since there seemed to be a lot of misunderstanding of how it worked. Now TracingChannel is just a WindowChannel around start + end, a WindowChannel around asyncStart + asyncEnd, and an error channel.

@codecov
Copy link

codecov bot commented Feb 4, 2026

Codecov Report

❌ Patch coverage is 87.82051% with 38 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.73%. Comparing base (5e818c9) to head (1018c57).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
lib/diagnostics_channel.js 86.08% 38 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #61680      +/-   ##
==========================================
- Coverage   89.74%   89.73%   -0.01%     
==========================================
  Files         674      675       +1     
  Lines      204389   204607     +218     
  Branches    39280    39291      +11     
==========================================
+ Hits       183424   183607     +183     
- Misses      13264    13293      +29     
- Partials     7701     7707       +6     
Files with missing lines Coverage Δ
...nternal/async_local_storage/async_context_frame.js 100.00% <100.00%> (ø)
lib/internal/async_local_storage/async_hooks.js 98.03% <100.00%> (+0.08%) ⬆️
lib/internal/async_local_storage/run_scope.js 100.00% <100.00%> (ø)
lib/diagnostics_channel.js 88.51% <86.08%> (-10.59%) ⬇️

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

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

Labels

diagnostics_channel Issues and PRs related to diagnostics channel lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants