-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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: add CLI opt to hide experimental warnings #31000
Conversation
What's the use case for this? I want to make sure we're not allowing the suppression of warnings that we might not actually want to permit the suppression of..... |
This is a really good question and I can see both sides as valid. First off, I think that the experimental warning feature is a good way to inform users about the stability of features they're using in their code and how quickly they can change. However, I can also see the argument about these warnings potentially being too numerous and could create clutter in error logs while a user is searching for an issue that is occurring in their code or debugging an unexpected condition. We've tried to reduce that as much as possible by not repeating experimental warnings and granted, they're probably not too difficult to ignore. But I think giving users an additional level of control to suppress these warnings while not suppressing all warnings provides some benefit in the long run as they can better monitor warnings which are more critical to them. Additionally, I think that since the user has to explicitly request to ignore these through the CLI, they will be knowledgeable with what they're doing and accidental misuse will be low. |
654fce4
to
5bf1ba3
Compare
I'm not really in favor of this change right now. The warnings in this case serve a very important purpose. |
@@ -100,6 +100,8 @@ function patchProcessObject(expandArgv1) { | |||
addReadOnlyProcessAlias('_preload_modules', '--require'); | |||
addReadOnlyProcessAlias('noDeprecation', '--no-deprecation'); | |||
addReadOnlyProcessAlias('noProcessWarnings', '--no-warnings'); | |||
addReadOnlyProcessAlias('noExperimentalWarnings', | |||
'--no-experimental-warnings'); |
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.
If this happens, please don’t use this. This is only for legacy flags that already have corresponding entries on the process
object.
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.
Thanks, good to know. I'll look into the code more for the correct place to add the flag.
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.
@codeman869 You can look around for getOptionValue()
in our source tree, that should help :)
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.
Just making the -1 explicit.
IMO - given that experimental features are out for use, it is fair for users to expect to use those cleanly, or at least have some control over the prints. It may be unnecessary to force warnings every time, onto an informed user? |
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.
👎 from me. Using experimental features should be discouraged for normal use. Allowing the warnings to be silenced suggests that the warnings against using those features are not important.
I don't really have a strong opinion on whether or not this should land, but... While I do think experimental warnings are important, I think explicitly opting out of them with a feature like this is a better option than, say, silencing all warnings with |
@Qard -
But then we have been producing experimental features in release builds, including LTS all these while - I guess with an intent of folks using and experimenting those in the field?
May be at least for a subset of the users, who have seen the warning a few times, want to supress it because otherwise their scripts / monitors that process the My bottom line is: if we are looking at the field to gather usability insights to improve on experimental features, we also need to provide improved user experience with these features. |
In my opinion, the only reason they are shipped behind runtime flags on release builds rather than behind build flags is because it increases the likelihood people will actually try the new things out and encounter the bugs so we can be more certain of stability before giving it a proper release. If you had to build your own custom Node.js just to try a new feature I suspect out "release" features would be a lot less stable due to less user testing. |
i don't think experimental warnings should be suppressible. when experimental features are enabled, node is running in an unstable state, and that should be made very clear to whoever is running it. (maybe we should whitelist them from --no-warnings) |
Allow list SGTM. |
5bf1ba3
to
7d73b67
Compare
Adds a command line option to supress experimental warnings. Currently this cannot be accomplished without supressing all warnings (by using the --no-warnings option). However, once this option is enabled, a user can miss out on essential warnings as this supresses all warnings. This commit adds the --no-experimental-warnings command line option to allow users to ignore warnings they will expect while still being able to monitor unexpected warnings. Fixes: nodejs#30810
7d73b67
to
0693a79
Compare
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.
LGTM, this is a good idea 👍
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.
Nice idea, LGTM
@devsnek -
looks like the double negative statement (which translates to
One can bring in a counter argument that: on the same ground, There is no disagreement about the importance of the experimental warnings. The question is about its consumability - when message are produced We have evidence of experimental features being used in production ( |
Since this seems to be a controversial change, do we want to have TSC evaluate for a final decision to either move forward or close this PR and related issue/feature request? |
AddOption("--no-experimental-warnings", | ||
"silence all experimental process warnings", | ||
&EnvironmentOptions::no_experimental_warnings, | ||
kAllowedInEnvironment); |
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.
If this did move forward, it should not be permitted within NODE_OPTIONS
I would be ok with moving forward on this if it were a mechanism to disable specific identified warnings rather than an entire category. Specifically, we have the ability to attach identifiers to warnings that we currently use for deprecations (e.g. the |
This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open. |
Closing this because it has stalled. Feel free to reopen if this PR is still relevant, or to ping the collaborator who labelled it stalled if you have any questions. |
2 PRs on it, re-opening |
So what exactly is holding this up at the moment? What work needs to be done to close it out? Not sure if I can be of help or not but I'm having to disable all warnings with |
My concern is that many people will just always run with that flag and ignore experimental warnings entirely. Even worse would be if test runners and the like start using it by default, creating an environment with different behaviour from what is typical. Experimental features should not be used in a production app. We're just further enabling people to ignore our judgement about what is and is not ready for production use. If you're worried about log pollution it's because you're using something in prod that you should not be. If a thing is really not actually experimental anymore we should be advocating for marking that thing as stable, not for allowing experimental warnings to be ignored. I feel we need to be very intentional with our messaging around experimental features that they are not safe to use in production and could change or disappear at any time. The presence of experimental features in a release is intended solely for experimentation--we want people to try out an uncertain idea and provide feedback so we can iterate and move it towards stable. When it is actually ready for people to use in prod we will mark it stable. Maybe we need another stage between experimental and stable to indicate something that's no longer in a could-break-at-any-time state but not quite yet at a point where we want to make firm promises about the stability? |
I would be good with anything that adds meaningful clarity. For any robust production setup, the messages aren't an issue, IMO. It's easy to ship logs off to a log management system and filter through them as needed. The issue is spamming of the console in development. At the same time, I think that's really beside the point. The code I'm working on right now isn't high stakes and it isn't in production yet. The experimental features are only required for the test environment, anyway. The production code doesn't use anything experimental. I've spent plenty of time digging through the code and related issues for Node and many libs, just to get an experimental environment working and to make sure I understand the limitations and potential problems. That's all to say, I know what I'm doing. As someone that knows what I'm doing, has a use for the experimental feature, is happy to test the experimental feature and provide feedback, and has already knowingly & explicitly enabled the feature, I would like the option to not have my console spammed with messages telling me what I've done. Also, I don't think the console spamming is what's stopping test runners from relying on experimental features. They're already in a position to easily filter out that noise if desired. In reality, it would incur too much risk to support. It would be insane for any remotely popular project which is exactly why it isn't already being done. |
I maintain that my preference is for an option to disable individual experimental warnings by code/id as opposed to all warnings, and for that not to be permitted on |
I very much agree. That would be ideal. I have no idea how to implement that myself or I would. It sounds a bit more involved than a naive, if less ideal, solution. Would it be worth an initial quick, blunt mechanism before iterating to the more nuanced flags? |
Not permitting disabling experimental warnings and not permitting disabling experimental warnings in |
Same here, Jest kicks of as many processes as there are test files (as possible.) Therefore the spamming is real. |
Ditto. Using
Landed on this PR after seeing this several 1,000 times and hoping there was a simple way to suppress the warning (because I'm using
💯 agree. I would much prefer not being forced into an all-or-nothing situation on this. FWIW, in the above case I'd expect to fix the issue with something like |
We discussed in the TSC meeting today (note we only had 6 people so a smallish subset). From the discussion there would be no objection from those who were there if there was an option to disabled specific experimental warnings and that was also supported in NODE_OPTIONS. |
The warnings should vanish in case the modules contain a The cache is public and that can not change anymore. It has also been publicly documented from very early on. It's existance is documented but not really how to add new entries. This is something that would be benefitial. We could in theory detect properties being added to the cache and ignore those from the circularity check. The implementation of such check would not be trivial though (using proxies with a complicated behavior). |
@BridgeAR great thanks for that hint. Interestingly I do not see those warnings anymore, but also a lot of has changed in this code area since my last comment. If I'll see the warnings again, I'll check if your solution helps |
Warnings are no longer observed without this util so it appears as obsolete BREAKING CHANGE: `preventCicrularDepPropertyWarning` util was removed as no longer needed. If issue surfaces again, it'll be great to see if solution proposed in following comment helps: nodejs/node#31000 (comment)
Warnings are no longer observed without this util so it appears as obsolete BREAKING CHANGE: `preventCicrularDepPropertyWarning` util was removed as no longer needed. If issue surfaces again, it'll be great to see if solution proposed in following comment helps: nodejs/node#31000 (comment)
Closing this in favor of #40940, being able to skip individual warnings is going to be less contentious. |
Adds a command line option to supress experimental warnings. Currently
this cannot be accomplished without supressing all warnings (by using
the --no-warnings option). However, once this option is enabled, a user
can miss out on essential warnings as this supresses all warnings.
This commit adds the --no-experimental-warnings command line option to
allow users to ignore warnings they will expect while still being able
to monitor unexpected warnings.
Fixes: #30810
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes