Skip to content
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

doc: deprecate calling promisify on a function that returns a promise #49647

Merged

Conversation

aduh95
Copy link
Contributor

@aduh95 aduh95 commented Sep 14, 2023

The plan is to have it throw a runtime warning in the next major, so it will help catch cases like #49607, and will likely never be EOL.

@nodejs-github-bot nodejs-github-bot added the doc Issues and PRs related to the documentations. label Sep 14, 2023
@aduh95 aduh95 added notable-change PRs with changes that should be highlighted in changelogs. deprecations Issues and PRs related to deprecations. labels Sep 14, 2023
@github-actions
Copy link
Contributor

The notable-change PRs with changes that should be highlighted in changelogs. label has been added by @aduh95.

Please suggest a text for the release notes if you'd like to include a more detailed summary, then proceed to update the PR description with the text or a link to the notable change suggested text comment.

@LiviaMedeiros
Copy link
Contributor

The deprecation is about calling util.promisify() on such functions but we can emit warning only when the function returns it, right?

I wonder if it will be possible to trace the promisify() call itself with --trace-deprecation.

@aduh95
Copy link
Contributor Author

aduh95 commented Sep 14, 2023

@LiviaMedeiros that's correct, the reliable way to know if a function returns a promise is to call it. It's going to trace where the call to the promisified function happened, so given:

// file.js

const promisified = promisify(async () => {});

promisified();

node --trace-warnings file.js will show at file.js:5:1. Hopefully that will give enough info to debug it.

@aduh95 aduh95 added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Sep 14, 2023
Copy link
Contributor

@LiviaMedeiros LiviaMedeiros left a comment

Choose a reason for hiding this comment

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

LGTM with pr-url fix.

doc/api/deprecations.md Outdated Show resolved Hide resolved
doc/api/util.md Outdated Show resolved Hide resolved
Co-authored-by: Livia Medeiros <livia@cirno.name>
@aduh95 aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Sep 15, 2023
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Sep 16, 2023
@nodejs-github-bot
Copy link
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/49647
✔  Done loading data for nodejs/node/pull/49647
----------------------------------- PR info ------------------------------------
Title      doc: deprecate calling `promisify` on a function that returns a promise (#49647)
   ⚠  Could not retrieve the email or name of the PR author's from user's GitHub profile!
Branch     aduh95:deprecate-promisify-async-function -> nodejs:main
Labels     doc, notable-change, author ready, deprecations
Commits    2
 - doc: deprecate calling `promisify` on a function that returns a promise
 - Apply suggestions from code review
Committers 2
 - Antoine du Hamel 
 - GitHub 
PR-URL: https://github.com/nodejs/node/pull/49647
Reviewed-By: Benjamin Gruenbaum 
Reviewed-By: LiviaMedeiros 
Reviewed-By: Trivikram Kamat 
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/49647
Reviewed-By: Benjamin Gruenbaum 
Reviewed-By: LiviaMedeiros 
Reviewed-By: Trivikram Kamat 
--------------------------------------------------------------------------------
   ℹ  This PR was created on Thu, 14 Sep 2023 09:32:18 GMT
   ✔  Approvals: 3
   ✔  - Benjamin Gruenbaum (@benjamingr) (TSC): https://github.com/nodejs/node/pull/49647#pullrequestreview-1627341349
   ✔  - LiviaMedeiros (@LiviaMedeiros): https://github.com/nodejs/node/pull/49647#pullrequestreview-1627522210
   ✔  - Trivikram Kamat (@trivikr): https://github.com/nodejs/node/pull/49647#pullrequestreview-1629793683
   ✔  Last GitHub CI successful
   ℹ  Green GitHub CI is sufficient
--------------------------------------------------------------------------------
   ✔  No git cherry-pick in progress
   ✔  No git am in progress
   ✔  No git rebase in progress
--------------------------------------------------------------------------------
- Bringing origin/main up to date...
From https://github.com/nodejs/node
 * branch                  main       -> FETCH_HEAD
✔  origin/main is now up-to-date
- Downloading patch for 49647
From https://github.com/nodejs/node
 * branch                  refs/pull/49647/merge -> FETCH_HEAD
✔  Fetched commits as db8217b1bfe4..5a380cfe99d5
--------------------------------------------------------------------------------
[main c2d979e3e3] doc: deprecate calling `promisify` on a function that returns a promise
 Author: Antoine du Hamel 
 Date: Thu Sep 14 11:30:01 2023 +0200
 2 files changed, 20 insertions(+)
[main 3f477cf7d4] Apply suggestions from code review
 Author: Antoine du Hamel 
 Date: Thu Sep 14 20:25:23 2023 +0200
 2 files changed, 2 insertions(+), 2 deletions(-)
   ✔  Patches applied
There are 2 commits in the PR. Attempting autorebase.
Rebasing (2/4)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
doc: deprecate calling promisify on a function that returns a promise

PR-URL: #49647
Reviewed-By: Benjamin Gruenbaum benjamingr@gmail.com
Reviewed-By: LiviaMedeiros livia@cirno.name
Reviewed-By: Trivikram Kamat trivikr.dev@gmail.com

[detached HEAD 92f9fdb2a5] doc: deprecate calling promisify on a function that returns a promise
Author: Antoine du Hamel duhamelantoine1995@gmail.com
Date: Thu Sep 14 11:30:01 2023 +0200
2 files changed, 20 insertions(+)
Rebasing (3/4)
Rebasing (4/4)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
Apply suggestions from code review

Co-authored-by: Livia Medeiros livia@cirno.name
PR-URL: #49647
Reviewed-By: Benjamin Gruenbaum benjamingr@gmail.com
Reviewed-By: LiviaMedeiros livia@cirno.name
Reviewed-By: Trivikram Kamat trivikr.dev@gmail.com

[detached HEAD cd4ad065a6] Apply suggestions from code review
Author: Antoine du Hamel duhamelantoine1995@gmail.com
Date: Thu Sep 14 20:25:23 2023 +0200
2 files changed, 2 insertions(+), 2 deletions(-)

Successfully rebased and updated refs/heads/main.

ℹ Add commit-queue-squash label to land the PR as one commit, or commit-queue-rebase to land as separate commits.

https://github.com/nodejs/node/actions/runs/6206595979

@aduh95 aduh95 added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Sep 16, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Sep 16, 2023
@nodejs-github-bot nodejs-github-bot merged commit 71b90fa into nodejs:main Sep 16, 2023
26 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 71b90fa

@aduh95 aduh95 deleted the deprecate-promisify-async-function branch September 16, 2023 12:13
ruyadorno pushed a commit that referenced this pull request Sep 28, 2023
PR-URL: #49647
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
ruyadorno added a commit that referenced this pull request Sep 28, 2023
Notable changes:

doc:
  * deprecate `fs.F_OK`, `fs.R_OK`, `fs.W_OK`, `fs.X_OK` (Livia Medeiros) #49683
  * promote fetch/webstreams from experimental to stable (Steven) #45684
  * deprecate `util.toUSVString` (Yagiz Nizipli) #49725
  * deprecate calling `promisify` on a function that returns a promise (Antoine du Hamel) #49647
esm:
  * set all hooks as release candidate (Geoffrey Booth) #49597
stream:
  * use bitmap in writable state (Raz Luvaton) #49834
  * use bitmap in readable state (Benjamin Gruenbaum) #49745
  * improve webstream readable async iterator performance (Raz Luvaton) #49662

PR-URL: TODO
@ruyadorno ruyadorno mentioned this pull request Sep 28, 2023
ruyadorno added a commit that referenced this pull request Sep 28, 2023
Notable changes:

doc:
  * deprecate `fs.F_OK`, `fs.R_OK`, `fs.W_OK`, `fs.X_OK` (Livia Medeiros) #49683
  * promote fetch/webstreams from experimental to stable (Steven) #45684
  * deprecate `util.toUSVString` (Yagiz Nizipli) #49725
  * deprecate calling `promisify` on a function that returns a promise (Antoine du Hamel) #49647
esm:
  * set all hooks as release candidate (Geoffrey Booth) #49597
stream:
  * use bitmap in writable state (Raz Luvaton) #49834
  * use bitmap in readable state (Benjamin Gruenbaum) #49745
  * improve webstream readable async iterator performance (Raz Luvaton) #49662

PR-URL: #49917
ruyadorno added a commit that referenced this pull request Sep 28, 2023
Notable changes:

doc:
  * deprecate `fs.F_OK`, `fs.R_OK`, `fs.W_OK`, `fs.X_OK` (Livia Medeiros) #49683
  * deprecate `util.toUSVString` (Yagiz Nizipli) #49725
  * deprecate calling `promisify` on a function that returns a promise (Antoine du Hamel) #49647
esm:
  * set all hooks as release candidate (Geoffrey Booth) #49597
src:
  * (SEMVER-MINOR) allow embedders to override NODE_MODULE_VERSION (Cheng Zhao) #49279
stream:
  * use bitmap in writable state (Raz Luvaton) #49834
  * use bitmap in readable state (Benjamin Gruenbaum) #49745
  * improve webstream readable async iterator performance (Raz Luvaton) #49662
test_runner:
  * (SEMVER-MINOR) accept `testOnly` in `run` (Moshe Atlow) #49753
  * (SEMVER-MINOR) add junit reporter (Moshe Atlow) #49614

PR-URL: TODO
@ruyadorno ruyadorno mentioned this pull request Sep 28, 2023
ruyadorno added a commit that referenced this pull request Sep 28, 2023
Notable changes:

deps:
  * add v8::Object::SetInternalFieldForNodeCore() (Joyee Cheung) #49874
doc:
  * deprecate `fs.F_OK`, `fs.R_OK`, `fs.W_OK`, `fs.X_OK` (Livia Medeiros) #49683
  * deprecate `util.toUSVString` (Yagiz Nizipli) #49725
  * deprecate calling `promisify` on a function that returns a promise (Antoine du Hamel) #49647
esm:
  * set all hooks as release candidate (Geoffrey Booth) #49597
module:
  * fix the leak in SourceTextModule and ContextifySript (Joyee Cheung) #48510
  * fix leak of vm.SyntheticModule (Joyee Cheung) #48510
  * use symbol in WeakMap to manage host defined options (Joyee Cheung) #48510
src:
  * (SEMVER-MINOR) allow embedders to override NODE_MODULE_VERSION (Cheng Zhao) #49279
stream:
  * use bitmap in writable state (Raz Luvaton) #49834
  * use bitmap in readable state (Benjamin Gruenbaum) #49745
  * improve webstream readable async iterator performance (Raz Luvaton) #49662
test_runner:
  * (SEMVER-MINOR) accept `testOnly` in `run` (Moshe Atlow) #49753
  * (SEMVER-MINOR) add junit reporter (Moshe Atlow) #49614

PR-URL: #49932
ruyadorno added a commit that referenced this pull request Sep 28, 2023
Notable changes:

deps:
  * add v8::Object::SetInternalFieldForNodeCore() (Joyee Cheung) #49874
doc:
  * deprecate `fs.F_OK`, `fs.R_OK`, `fs.W_OK`, `fs.X_OK` (Livia Medeiros) #49683
  * deprecate `util.toUSVString` (Yagiz Nizipli) #49725
  * deprecate calling `promisify` on a function that returns a promise (Antoine du Hamel) #49647
esm:
  * set all hooks as release candidate (Geoffrey Booth) #49597
module:
  * fix the leak in SourceTextModule and ContextifySript (Joyee Cheung) #48510
  * fix leak of vm.SyntheticModule (Joyee Cheung) #48510
  * use symbol in WeakMap to manage host defined options (Joyee Cheung) #48510
src:
  * (SEMVER-MINOR) allow embedders to override NODE_MODULE_VERSION (Cheng Zhao) #49279
stream:
  * use bitmap in writable state (Raz Luvaton) #49834
  * use bitmap in readable state (Benjamin Gruenbaum) #49745
  * improve webstream readable async iterator performance (Raz Luvaton) #49662
test_runner:
  * (SEMVER-MINOR) accept `testOnly` in `run` (Moshe Atlow) #49753
  * (SEMVER-MINOR) add junit reporter (Moshe Atlow) #49614

PR-URL: #49932
ruyadorno added a commit that referenced this pull request Sep 29, 2023
Notable changes:

deps:
  * add v8::Object::SetInternalFieldForNodeCore() (Joyee Cheung) #49874
doc:
  * deprecate `fs.F_OK`, `fs.R_OK`, `fs.W_OK`, `fs.X_OK` (Livia Medeiros) #49683
  * deprecate `util.toUSVString` (Yagiz Nizipli) #49725
  * deprecate calling `promisify` on a function that returns a promise (Antoine du Hamel) #49647
esm:
  * set all hooks as release candidate (Geoffrey Booth) #49597
module:
  * fix the leak in SourceTextModule and ContextifySript (Joyee Cheung) #48510
  * fix leak of vm.SyntheticModule (Joyee Cheung) #48510
  * use symbol in WeakMap to manage host defined options (Joyee Cheung) #48510
src:
  * (SEMVER-MINOR) allow embedders to override NODE_MODULE_VERSION (Cheng Zhao) #49279
stream:
  * use bitmap in writable state (Raz Luvaton) #49834
  * use bitmap in readable state (Benjamin Gruenbaum) #49745
  * improve webstream readable async iterator performance (Raz Luvaton) #49662
test_runner:
  * (SEMVER-MINOR) accept `testOnly` in `run` (Moshe Atlow) #49753
  * (SEMVER-MINOR) add junit reporter (Moshe Atlow) #49614

PR-URL: #49932
alexfernandez pushed a commit to alexfernandez/node that referenced this pull request Nov 1, 2023
PR-URL: nodejs#49647
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
alexfernandez pushed a commit to alexfernandez/node that referenced this pull request Nov 1, 2023
Notable changes:

deps:
  * add v8::Object::SetInternalFieldForNodeCore() (Joyee Cheung) nodejs#49874
doc:
  * deprecate `fs.F_OK`, `fs.R_OK`, `fs.W_OK`, `fs.X_OK` (Livia Medeiros) nodejs#49683
  * deprecate `util.toUSVString` (Yagiz Nizipli) nodejs#49725
  * deprecate calling `promisify` on a function that returns a promise (Antoine du Hamel) nodejs#49647
esm:
  * set all hooks as release candidate (Geoffrey Booth) nodejs#49597
module:
  * fix the leak in SourceTextModule and ContextifySript (Joyee Cheung) nodejs#48510
  * fix leak of vm.SyntheticModule (Joyee Cheung) nodejs#48510
  * use symbol in WeakMap to manage host defined options (Joyee Cheung) nodejs#48510
src:
  * (SEMVER-MINOR) allow embedders to override NODE_MODULE_VERSION (Cheng Zhao) nodejs#49279
stream:
  * use bitmap in writable state (Raz Luvaton) nodejs#49834
  * use bitmap in readable state (Benjamin Gruenbaum) nodejs#49745
  * improve webstream readable async iterator performance (Raz Luvaton) nodejs#49662
test_runner:
  * (SEMVER-MINOR) accept `testOnly` in `run` (Moshe Atlow) nodejs#49753
  * (SEMVER-MINOR) add junit reporter (Moshe Atlow) nodejs#49614

PR-URL: nodejs#49932
debadree25 pushed a commit to debadree25/node that referenced this pull request Apr 15, 2024
Notable changes:

deps:
  * add v8::Object::SetInternalFieldForNodeCore() (Joyee Cheung) nodejs#49874
doc:
  * deprecate `fs.F_OK`, `fs.R_OK`, `fs.W_OK`, `fs.X_OK` (Livia Medeiros) nodejs#49683
  * deprecate `util.toUSVString` (Yagiz Nizipli) nodejs#49725
  * deprecate calling `promisify` on a function that returns a promise (Antoine du Hamel) nodejs#49647
esm:
  * set all hooks as release candidate (Geoffrey Booth) nodejs#49597
module:
  * fix the leak in SourceTextModule and ContextifySript (Joyee Cheung) nodejs#48510
  * fix leak of vm.SyntheticModule (Joyee Cheung) nodejs#48510
  * use symbol in WeakMap to manage host defined options (Joyee Cheung) nodejs#48510
src:
  * (SEMVER-MINOR) allow embedders to override NODE_MODULE_VERSION (Cheng Zhao) nodejs#49279
stream:
  * use bitmap in writable state (Raz Luvaton) nodejs#49834
  * use bitmap in readable state (Benjamin Gruenbaum) nodejs#49745
  * improve webstream readable async iterator performance (Raz Luvaton) nodejs#49662
test_runner:
  * (SEMVER-MINOR) accept `testOnly` in `run` (Moshe Atlow) nodejs#49753
  * (SEMVER-MINOR) add junit reporter (Moshe Atlow) nodejs#49614

PR-URL: nodejs#49932
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-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. deprecations Issues and PRs related to deprecations. doc Issues and PRs related to the documentations. notable-change PRs with changes that should be highlighted in changelogs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants