Adding error tracking and response for logins over CLI - #96
Open
davidpcls wants to merge 1 commit into
Open
Conversation
* Adds error response Now the queueserver-api client will actually report failures instead of just polling forever. * This add login error reporting for CLI clients This will report back to the CLI client that there was an error logging in, so the user doesn't just wait forever. * Fixing pre-commit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Now the queueserver-api client will actually report failures instead of just polling forever, as it can get the failed status from the bluesky-httpserver instance it is talking to.
Description
This adds a new key into the auth database called "error" that tracks the authentication status for a particular authentication flow. This key gets updated asynchronously when an update from the external authenticator is processed and stored. When the CLI requests an update regarding the status of the authentication, the application checks the database and reports back if there was an error, otherwise it assumes authentication is still pending.
Motivation and Context
This solves the edge case of logging in over http using the bluesky-queueserver-api client, where when logging in there is an error and the login fails (for any number of reasons). Without this, the client will poll until a timeout is reached. Now the error is reported quickly back to the CLI so the user doesn't have to ctrl-c out of the auth attempt.
Is this needed? Possibly not, since the user is the one doing the auth and if their auth fails they "should" know and would know to cancel the auth in the command line. However this seems like a nicer user experience when the tool actually knows something broke.
Summary of Changes for Release Notes
Fixed
Added
Changed
Removed
How Has This Been Tested?
Testing was done by starting up the httpserver locally with an entraauthenticator properly configured, but with the api resource policy set to fail. Then every login attempt does not function correctly. I used this specific commit of the bluesky-queueserver-api to test against: bluesky/bluesky-queueserver-api@c03b090
On an error, this then creates an exception like so:
HTTPClientError: 400: {'error': 'access_denied'} http://localhost:60610/api/auth/provider/entra/tokenWhich, while not a great user experience to have a python exception get raised, it does break out of the login attempt. Further cleanup could be done with bluesky-queueserver-api to make it just report "login failed" if desired. But that change does not affect bluesky-httpserver.