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

stream: make null an invalid chunk to write in object mode #6170

Closed
wants to merge 1 commit into from

Conversation

calvinmetcalf
Copy link
Contributor

Checklist
  • tests and code linting passes
  • a test and/or benchmark is included
  • documentation is changed or added (current documentation implies this behavior)
  • the commit message follows commit guidelines
Affected core subsystem(s)
Description of change

as discussed by @nodejs/streams

this harmonizes behavior between readable, writable, and transform
streams so that they all handle nulls in object mode the same way by
considering them invalid chunks.

@mscdex mscdex added stream Issues and PRs related to the stream subsystem. semver-major PRs that contain breaking changes and should be released in the next major version. labels Apr 12, 2016
@mscdex
Copy link
Contributor

mscdex commented Apr 12, 2016

@Fishrock123
Copy link
Contributor

@calvinmetcalf mind linking to the discussion for posterity?

@calvinmetcalf
Copy link
Contributor Author

Yeah which reminds me I have to figure out how to post that

On Tue, Apr 12, 2016, 4:23 PM Jeremiah Senkpiel [email protected]
wrote:

@calvinmetcalf https://github.com/calvinmetcalf mind linking to the
discussion for posterity?


You are receiving this because you were mentioned.

Reply to this email directly or view it on GitHub
#6170 (comment)

@calvinmetcalf
Copy link
Contributor Author


var stream = require('stream');
var util = require('util');

Copy link
Member

Choose a reason for hiding this comment

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

The requires can use const :-)

@jasnell
Copy link
Member

jasnell commented Apr 13, 2016

Few nits, but otherwise LGTM

@@ -177,13 +177,17 @@ function writeAfterEnd(stream, cb) {
// how many bytes or characters.
Copy link
Member

Choose a reason for hiding this comment

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

I would add an explanation on the validation rules on before this function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this somewhat implies I 100% understand the current validation rules 😕

@mcollina
Copy link
Member

LGTM.

Even though it's a major change, I will run it through CITGM, we should have no breakage.

You might also give a spin to the benchmarks, just to check if there any regression (I had some unexpected surprises in the past).

@calvinmetcalf
Copy link
Contributor Author

ok fixed the nits and also reordered the checks to make them more clear and added the note

var er = false;
// always throw error if a null is written
// if we are not in object mode then throw
// if it is not a buffer, string, or undefined
Copy link
Member

Choose a reason for hiding this comment

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

very minor nit: capitalize Always, add punctuation at the end.

@mcollina
Copy link
Member

LGTM again :)

this harmonizes behavior between readable, writable, and transform
streams so that they all handle nulls in object mode the same way by
considering them invalid chunks.
@jasnell
Copy link
Member

jasnell commented Apr 18, 2016

@nodejs/streams ... is this ready to go?

@MylesBorins
Copy link
Contributor

@mcollina
Copy link
Member

All good for me.

@jasnell
Copy link
Member

jasnell commented Apr 20, 2016

I plan to land this one today but I'm asking @thealphanerd to do a quick smoketest after landing 75487f0

@jasnell
Copy link
Member

jasnell commented Apr 20, 2016

jasnell pushed a commit that referenced this pull request Apr 20, 2016
this harmonizes behavior between readable, writable, and transform
streams so that they all handle nulls in object mode the same way by
considering them invalid chunks.

PR-URL: #6170
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
@jasnell
Copy link
Member

jasnell commented Apr 20, 2016

Landed in e7c077c

@jasnell jasnell closed this Apr 20, 2016
joelostrowski pushed a commit to joelostrowski/node that referenced this pull request Apr 25, 2016
this harmonizes behavior between readable, writable, and transform
streams so that they all handle nulls in object mode the same way by
considering them invalid chunks.

PR-URL: nodejs#6170
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
jasnell pushed a commit that referenced this pull request Apr 26, 2016
this harmonizes behavior between readable, writable, and transform
streams so that they all handle nulls in object mode the same way by
considering them invalid chunks.

PR-URL: #6170
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-major PRs that contain breaking changes and should be released in the next major version. stream Issues and PRs related to the stream subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants