-
Notifications
You must be signed in to change notification settings - Fork 103
fix: create websockets ConnectionClosed error correctly #1255
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
fix: create websockets ConnectionClosed error correctly #1255
Conversation
479d75f to
d670e79
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.
There seems to be 3 cases of raise ConnectionClose*** in the codebase.
Pls check if those other invocations also need a fix or could use a simplification.
60b6c10 to
ec3420f
Compare
|
The two in On line 383 we have On line 571 we have I've updated the instance in |
|
This repo CI would ideally run against oldest and newest supported versions of dependencies. |
|
Sounds good. What would a manual spot check entail in this case? |
|
Raising these exceptions using oldest/newest versions of websockets that we support. |
|
Another possibility is to look if the code should be raising |
|
The signature was changed in websockets 10.0, but there's no direct guidance how to "update your code". My take is that we should either not supply any arguments, or supply the minimal arguments that are required. |
|
P.S. ugh websockets==13.1 release was not made form the 13.x maintenance branch 🙈 |
|
Let's update every single place this package raises a websockets exception:
As far as I can see, websockets versions that are new enough don't require arguments for these exception classes. Edit: as James rightfully points out below, |
Two arguments are required, rcvd and sent, both of which should be a `websockets.frames.Closed` object or None. If neither are None, the third argument should also be provided to say in which order sent and rcvd occurred. The existing style appears to have been based on an older API which looks more similar to raising a `Closed` object directly (a code and reason are provided). The exception types are exposed on websockets directly, so I've also removed references to websockets.exceptions.ConnectionClosed.
|
It seems that for the oldest version of The instance that caused our users problems here did I'm not sure what's expected typically, but in the cases where we raise a For a little bit more user facing information, I've changed them to Oh and the exception types are exposed on |
|
Test coverage is clearly not great here, as it didn't catch the issue our users encountered, nor did it catch my original broken 'fix' of raising with no arguments (two arguments are required), but I've manually verified on oldest (13.0.1) and newest (15.0.1) versions of |
|
I suspect that bundle errors are unrelated. |
|
I think the latest anbox bundle is broken: https://bugs.launchpad.net/anbox-cloud/+bug/2103485 |
|
/build |
|
/merge |
#1257 ## What's Changed * chore: fix changelog format by @dimaqq in #1248 * docs: move docs from juju.is by @tmihoc in #1244 * chore: type hint improvements from the helper thread branch by @dimaqq in #1250 * chore: remove pyrfc3339 and change to datetime.datetime.fromisoformat… by @EdmilsonRodrigues in #1247 * fix: create websockets ConnectionClosed error correctly by @james-garner-canonical in #1255
Description
Fixes: #1252
QA Steps
Test should keep passing.
Notes & Discussion
I wonder if we need to bump our minimum websockets version.