stream: hide afterWriteTickInfo property#31287
stream: hide afterWriteTickInfo property#31287Hakerh400 wants to merge 2 commits intonodejs:masterfrom Hakerh400:stdout
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. |
jasnell
left a comment
There was a problem hiding this comment.
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.
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. |
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 |
Pull request #30710 has introduced
afterWriteTickInfoproperty 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