-
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
stream: hide afterWriteTickInfo property #31287
Conversation
@Hakerh400 maybe also add a regression test? |
Perhaps we can find a better way to do this?
|
Using a symbol instead should have less performance impact. |
This also needs a test. |
This is also likely semver-major. |
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.
Moving to an internal symbol and aliasing afterWriteTickInfo is likely the better option here.
Changed to a symbol and added a test. I don't think this should be a semver-major. The PR that introduced this property was released in a semver-minor release (and could propably be a semver-patch). This PR can be considered as a fix for a broken use case. |
Benchmarks with symbol:
|
@jasnell LGTY? |
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'm a little curious about this stringify the stream state use case. That's not really something I believe we support and expecting stringify/parse to work could be a bit dangerous, e.g. if you have callbacks buffered.
I would at least like a test here to avoid similar regressions.
I agree, it is not documented anywhere that a stream object should not contain circular structures. That is why initially I didn't add any test, but @BridgeAR and @mscdex were explicit about adding a test. The point of this PR is to fix a use case in which a code stopped working after a semver-minor release, which may leave users unprepared. I am more than happy to remove the test if we all agree. |
The test is fine. I’m actually asking whether we should add further tests. |
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
Pull request #30710 has introduced afterWriteTickInfo property for optimizing synchronous write completions and it is backported to v12.x as a semver-minor release, but it breaks use case of JSON stringifying writable stream object. This PR hides that property behind a symbol.
Given that #31187 has landed without explicit enumerability, I tend to assume that we have decided what the consensus regarding this topic is to omit default values in object property definitions. Removed default |
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 fully agree with what @ronag said above – this is a hack to make something work that we don’t actually support. I’m okay with landing this with the understanding that a semver-major revert PR is opened afterwards.
Pull request #30710 has introduced
afterWriteTickInfo
property for optimizing synchronous write completions and it is backported to v12.x as a semver-minor release, but it breaks use case of JSON stringifying writable stream object. This PR hides that property behind a symbol.Fixes #31277
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes