-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
process: deprecate process._tickCallback #29671
Conversation
this would need to start with a docs deprecation |
@devsnek where would that be exactly? The "private" function |
I think you'd have to add it like you did here. |
Ok, so i'm a little confused here. I tried to follow other commits that introduced deprecations to get a sense of what needed to be done. This particular case doesn't have docs associated with it since the function is a "private" function. So perhaps it is a little different?
Does this mean that a first PR should be updating documentation, then another PR is adding the deprecation to code? That one liner wasn't so clear to me. Is there an actual doc that covers the steps for deprecating something. Perhaps i could add that once i've gone through the process with this PR. Another aspect of this PR is if this deprecation/addition makes sense. |
I'm definitely no expert in deprecation, I'm just thinking in terms of making sure we don't have too much disruption. I believe this particular function has some non-trivial ecosystem usage. |
ping @joyeecheung , i saw from twitter you were traveling, so my original ping might have missed you. Just wanted to get your thoughts on this, since you are the author of the original |
IIRC we don’t do need to do doc depreciations for undocumented stuff - we can just start with runtime documentation. However an entry in depreciations.md is a must. I am not aware of anyone using this, but this needs an CITGM run. (On the phone right now, I will try starting one later) |
cc @nodejs/tsc @nodejs/process Any concerns about this? Do we actually need that alias exposed instead? |
thanks for the update |
I'm not aware of anyone using |
I just ran Gzemnid on the top code (frequently used modules) and the output looks pretty good (I already filtered false entries):
Only two modules seem to actively use this. We could try to determine alternatives for deasync and to open a PR there. That way we should be fine to deprecate the property without exposing an alias publicly. |
Frankly, I don't really mind if we cause warnings in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
process._tickCallback
seems to be widely used in userland although I would argue that process.runNextTicks
is not an API we should expose anyway (and docs is missing in this PR anyway) - the user can just let their code finish which will cause microtasks to run. Users should generally not mess with scheduling.
Userland examples are plentyful in random user code, unpopular libraries, popular libraries and just more code. I doubt these 4 examples from the first 2 GitHub search pages are that rare.
I think it needs to be documented and doc-deprecated first to begin with and I would not be comfortable with a runtime deprecation without a TSC vote and docs deprecation first.
Fair point about needing docs for this. I wanted to ask the question first, if we even needed this public alternative. so if there is consensus that having this public function added, then we can add those docs in |
@benjamingr interesting that @jdalton is it maybe possible to use something else instead of |
Personally: I don't think we should have a public API for this at all. As @Fishrock123 said this is inherently dangerous. However, I am not blocking on this. If the TSC decides that we need a public API for this then I will be fine with it. I am blocking on deprecating My personal preference would be:
@BridgeAR I assume esm was just the first popular module I found in GitHub code search. I just went through the first few pages of results. I would not assume this is something we can fix by just changing that package. |
wrt to the public function, i have no strong feelings either way. With the docs deprecation, @benjamingr just want to clarify,
|
That sounds reasonable to me :] |
While it's documentation-only deprecated, you could also add code so that it was one of the documentation-only deprecations that becomes a runtime deprecation when Node.js is run with the |
That sounds reasonable. Would this still be a separate PR? |
It could be either in this PR or in a separate PR. I have a slight preference for doing it in a separate PR, but either would be fine in my opinion. |
I've just created this PR, #29781, that starts with a documentation only deprecation. Leaving this PR open, so i can come back to it, when/if necessary |
Hey, thanks a ton for following up on this! I have removed my blocking code review and now I am not sure what the process is for landing this. @Trott since the docs deprecation was uncontroversial but runtime deprecation might be very controversial - what should we do in order to solicit feedback? I am hesitant to add the tsc-agenda tag but I would like to solicit feedback. If @Fishrock123 and @BridgeAR think this should land (on v13) as a runtime deprecation I'm game. LGTMing the actual code change. |
Since it will require two TSC approvals anyway, maybe let's start by pinging @nodejs/tsc. If that fails to attract adequate attention, we can always ping more widely.... |
Just wanted to ping here to see if i needed to do anything else with this PR atm |
This needs a second TSC approval for it to land (or a request for changes) @nodejs/tsc |
At the risk of repeating an annoying opinion I’ve already voiced in the past: I feel it’s unnecessary to runtime-deprecate something that’s a direct alias of a documented, public API, because to me that means there’s no point in changing or removing that alias in the future. (That’s basically what’s kept me from approving this.) |
Actually, this needs docs for |
wrt to documenting |
I agree with @addaleax, keeping the alias "forever" costs us almost nothing, while emitting a runtime deprecation forces our users to take time to migrate to the other name without giving them something in return. |
When there is evidence that the API has been used in the wild (and there is, thanks @benjamingr for looking into it), I think we should hold off deprecating something until we are certain that the usage drops to a point where it's safe to deprecate it. Chrome has a similar practice with telemetry (remove something when the usage drops to 0.000?% of the Web but don't do anything disruptive if it's used by more than ?% of the Web) when they try to deprecate things. |
sounds good. I'm good with just waiting until this doesn't affect users. Just was asking to see if i needed to do anything else. Thanks! |
Pardon my naivety: If this is removed, what's the recourse for implementing a fake timers drain for testing when native promises are in the mix? |
8ae28ff
to
2935f72
Compare
Closing due to the lack of continued activity on this. Can reopen if it is picked back up |
This comment:
suggests that the
process._tickCallback
isn't the correct name for this function, but since it is exposed on the process object, it needs to stay, and that it should be removed(or made public).This PR deprecates the
process._tickCallback
funciton as well as adding the more appropriately named `process.runNextTicks to the process object.While this PR does both, deprecate and make the renamed function public, I am open to changing this to just deprecate and not add a new, possibly unneeded function to the process object.
I am also looking for some guidance on where a test for a change like this should be added
ping @joyeecheung
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes