Skip to content

util: add internal assignFunctionName() function #57916

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

LiviaMedeiros
Copy link
Member

Extracted from: #57901

We have a lot of functions exposed to userspace or mentioned in stack traces that are anonymous or have something inherited like value as name; because it's not convenient to define it with name, or because the correct name is already taken by another variable, or because the name comes from a Symbol, or because of false positives from linter.

This helper function will simplify giving such functions a correct name.

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. util Issues and PRs related to the built-in util module. labels Apr 17, 2025
@BridgeAR
Copy link
Member

I think it's best to introduce the helper in the other PR, since it is used that way.

@LiviaMedeiros
Copy link
Member Author

I extracted this so it could be used for other namings (e.g. for some [Symbol(nodejs.util.promisify.custom)] functions), since it's not related to the other PR, doesn't have to depend on it, and would simplify the process (especially for backports and cherry-picking later). But it's feasible either way.

@BridgeAR
Copy link
Member

I would definitely like adding usages right away. It would otherwise feel weird to me to add a utility function for internal usage only. We could of course split it into two commits in the same PR.

Copy link

codecov bot commented Apr 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.27%. Comparing base (609df89) to head (5292de9).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #57916      +/-   ##
==========================================
- Coverage   90.27%   90.27%   -0.01%     
==========================================
  Files         630      630              
  Lines      186112   186145      +33     
  Branches    36464    36471       +7     
==========================================
+ Hits       168013   168042      +29     
+ Misses      10981    10970      -11     
- Partials     7118     7133      +15     
Files with missing lines Coverage Δ
lib/child_process.js 97.75% <100.00%> (+<0.01%) ⬆️
lib/internal/http2/core.js 95.63% <100.00%> (+<0.01%) ⬆️
lib/internal/util.js 96.30% <100.00%> (+0.56%) ⬆️

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

@LiviaMedeiros LiviaMedeiros added lib / src Issues and PRs related to general changes in the lib or src directory. commit-queue-rebase Add this label to allow the Commit Queue to land a PR in several commits. labels Apr 18, 2025
@LiviaMedeiros LiviaMedeiros force-pushed the util-internal-assign-function-name branch from fd20019 to 18b89d3 Compare April 18, 2025 06:39
@LiviaMedeiros LiviaMedeiros self-assigned this Apr 19, 2025
Copy link
Member

@H4ad H4ad left a comment

Choose a reason for hiding this comment

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

Should this be marked as minor since we change the behavior a little bit (although it's not disrupting)?

@aduh95
Copy link
Contributor

aduh95 commented Apr 19, 2025

If we change the semverness of this PR, we should definitely split it in several PRs to simplify work for releasers

@LiviaMedeiros
Copy link
Member Author

Should this be marked as minor since we change the behavior a little bit (although it's not disrupting)?

I'm okay with semverness change if needed, but not sure it can be semver-minor, since it doesn't add any userland-facing features. IMHO the helper function by itself is semver-patch, and the other changes are either semver-patch fixes or semver-major (potentially) breaking fixes.

@LiviaMedeiros LiviaMedeiros force-pushed the util-internal-assign-function-name branch from 83ced41 to 22c521b Compare April 19, 2025 17:35
@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Apr 19, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 19, 2025
@nodejs-github-bot
Copy link
Collaborator

@LiviaMedeiros LiviaMedeiros removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 20, 2025
@LiviaMedeiros LiviaMedeiros force-pushed the util-internal-assign-function-name branch from ee4de6c to 32d29fe Compare April 20, 2025 06:58
@nodejs-github-bot

This comment was marked as outdated.

@LiviaMedeiros LiviaMedeiros added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 20, 2025
@LiviaMedeiros LiviaMedeiros force-pushed the util-internal-assign-function-name branch from 345b9f0 to 5292de9 Compare April 20, 2025 07:07
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot
Copy link
Collaborator

@LiviaMedeiros LiviaMedeiros removed their assignment Apr 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-rebase Add this label to allow the Commit Queue to land a PR in several commits. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. util Issues and PRs related to the built-in util module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants