-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
isFinished incorrect? #30
Comments
Thanks. So what would need to be changed in this lib? Do you have a test case that can be added to the test suite to demonstrate the issue? |
I think the following needs to be changed: https://github.com/jshttp/on-finished/blob/master/index.js#L70 To return Boolean((!socket && msg.finished) || (socket && !socket.writable)) i.e. This is a bit of a theoretical edge case so finding a test case might be a bit difficult. |
What do you think the assumptions are of this library? Nothing in the README makes any guarantee that matches what it sounds like you are saying you think this module does. For example, that it returns true iff all bytes have been flushed to the network. |
With no test case, then how do you know the change does anything different from what the current implementation does? How do we not regress back to "broken" behavior? A test case would need to accompany any change. I can help come up with a test case that works in the test suite even if the only test case you can make may not be fully Node.js. |
The
If the existing tests pass then I would expect no regression in any currently well-defined behavior. This is no biggie for me. I've used this library as a reference when discussing other node related issues. I'm hoping that either the current definition of |
So the argument here is that the behavior is not very well defined, so even if tests all pass with the changes, how do we know this won't create some subtle behavior change in dependent libraries and apps? Ideally, even without a test case (thought the change will not be accepted without one) a description on what, specifically, is being changed (i.e. fixed) here from the perspective of consumers of this library. So if this fixes a bug, consumers of this library would be exposed to said bug, ideally which the change log would note of what it is. |
Yes, I've further raised issues over at nodejs. nodejs/node#28411 I'm not actually sure what the best course of action here is. This is a potentially very subtle bug. Fixing it might break existing code. Not sure where this lands on the semantic versioning side of things.
Something like that. I think the way |
This is only a problem if an |
PR-URL: nodejs#28411 Refs: jshttp/on-finished#30 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
PR-URL: #28411 Refs: jshttp/on-finished#30 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
Looking at the implementation in NodeJS.
finished
only means thatend()
has been called on the response object, not necessarily that it actually has "finished
", i.e. all data is not guaranteed to have been sent nor is it guaranteed that no further errors will occur...I think the definition of
finished
in Node is a little bit confusing. None the less, the semantics are well defined and I don't think the match the assumptions of this library...The text was updated successfully, but these errors were encountered: