Skip to content

bootstrap: expose process._rawDebug as a global function - #55907

Open
jsumners wants to merge 6 commits into
nodejs:mainfrom
jsumners:global-debug
Open

bootstrap: expose process._rawDebug as a global function#55907
jsumners wants to merge 6 commits into
nodejs:mainfrom
jsumners:global-debug

Conversation

@jsumners

Copy link
Copy Markdown
Contributor

The process._rawDebug function is very helpful when triaging bugs that cross asynchronous boundaries. It is also quite cumbersome to write out process._rawDebug everywhere such a line is needed. So this change exposes it as a global function to facilitate an improved
developer experience.

If we think that a naming collision is possible, maybe it could be named nodeDebug or similar.

The `process._rawDebug` function is very helpful when
triaging bugs that cross asynchronous boundaries. It
is also quite cumbersome to write out `process._rawDebug`
everywhere such a line is needed. So this change exposes
it as a global function to facilitate an improved
developer experience.
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/startup

@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 Nov 18, 2024
@mcollina mcollina added the semver-major PRs that contain breaking changes and should be released in the next major version. label Nov 18, 2024
@codecov

codecov Bot commented Nov 19, 2024

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.98%. Comparing base (746b17e) to head (12839f9).
⚠️ Report is 4955 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #55907      +/-   ##
==========================================
- Coverage   88.41%   87.98%   -0.44%     
==========================================
  Files         654      653       -1     
  Lines      188036   187868     -168     
  Branches    36187    35890     -297     
==========================================
- Hits       166260   165293     -967     
- Misses      14989    15738     +749     
- Partials     6787     6837      +50     
Files with missing lines Coverage Δ
lib/internal/bootstrap/node.js 99.58% <100.00%> (+0.01%) ⬆️

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

@jasnell

jasnell commented Nov 23, 2024

Copy link
Copy Markdown
Member

Hmmm... I'm not a big fan of adding new Node.js specific globals, and given that process already a global I'm not convinced this really adds much value. I'm willing to be convinced those and won't block this if others find value in it.

@jsumners

Copy link
Copy Markdown
Contributor Author

given that process already a global I'm not convinced this really adds much value

In my experience, when someone wants to use this function they are likely going to be writing it in multiple places. I hope we can agree that it is easier, and less annoying, to type out rawDebug than it is to type out process._rawDebug.

Regarding adding Node.js specific globals: isn't that the point of having a specific runtime? To be able to design it such that it provides an environment that is specific to the use cases of the developers that are using it? As an example, at least in Vivaldi and Safari, all Window properties and methods are available without needing to prefix them with window.; i.e. browser runtimes make useful utilities available to users just as being suggested here.

@aduh95

aduh95 commented Nov 26, 2024

Copy link
Copy Markdown
Contributor

As an example, at least in Vivaldi and Safari, all Window properties and methods are available without needing to prefix them with window.; i.e. browser runtimes make useful utilities available to users just as being suggested here.

window is the globalThis object, process is not, I don't think it's a fair comparison. Vivaldi and Safari are following the ECMAScript and HTML specs, it's not exactly the same thing as them exposing a Vivaldi-only API on the global object.

@jsumners

Copy link
Copy Markdown
Contributor Author

I disagree. Node.js is a runtime for writing system applications. As such, process is the equivalent of window in browsers. Even if we agreed that isn't true, my argument for improving developer experience on the runtime stands.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been marked as stale due to 90 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.

@github-actions github-actions Bot added the stale label Jul 28, 2026
@jsumners

Copy link
Copy Markdown
Contributor Author

Not stale. Just being ignored.

@github-actions github-actions Bot removed the stale label Jul 28, 2026

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

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 Aug 12, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 12, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

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

Labels

lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. semver-major PRs that contain breaking changes and should be released in the next major version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants