-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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: add notes about non-conforming streams #29895
Conversation
6c7173d
to
7ce4453
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.
I am in general fine with the note but isn't this a general problem we have? There are still lots of "internal" APIs used and or overridden in the wild.
We also do not have "internal" events, so it's even more difficult to prevent any such usage.
Yes, nothing we can do about that... but we can still discourage it so future users are able to implement streams as correctly as possible?
What do you mean? I don't think most people that override public methods are aware of the problems it might cause. |
typo in commit message: s/confirming/conforming/ |
Text looks fine to me but would prefer reviews from @nodejs/streams to mine. |
doc/api/stream.md
Outdated
@@ -1667,6 +1667,12 @@ of a stream that are intended for use by consumers (as described in the | |||
[API for Stream Consumers][] section). Doing so may lead to adverse side effects | |||
in application code consuming the stream. | |||
|
|||
It is highly discouraged to override any public method or to emit | |||
`'error'` events manually through `.emit(err)` instead of using API-provided |
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.
We also do not have "internal" events, so it's even more difficult to prevent any such usage.
I think that @BridgeAR was referring to events like 'data'
, 'finish'
, 'end'
, 'close'
, etc. not only 'error'
.
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.
I see. Not sure what to do with that though? Should I add "internal events" to the paragraph?
a963259
to
e2207eb
Compare
3c45c5a
to
1ac15d1
Compare
Maybe a quick review from @mcollina? |
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, good note.
Co-Authored-By: Ruben Bridgewater <ruben@bridgewater.de>
@Trott: I believe this can land? |
Maybe @lundibundi & @yorkie has some last minute feedback? |
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.
👍
9a3f364
to
fdba619
Compare
I left a bunch of small suggestions, but none of them are blocking. Lite CI: https://ci.nodejs.org/job/node-test-pull-request-lite-pipeline/4087/ |
Co-Authored-By: Rich Trott <rtrott@gmail.com>
PR-URL: #29895 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Landed in d67c377 |
PR-URL: #29895 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
PR-URL: #29895 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
PR-URL: #29895 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
A lot of streams in the ecosystem are overriding public stream methods that lead to very subtle and hard to find bugs. Discourage this usage and encourage using the existing framework.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes