Skip to content
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

Ask for the push API key again when validation fails #197

Merged
merged 5 commits into from
Mar 8, 2024

Conversation

unflxw
Copy link
Contributor

@unflxw unflxw commented Mar 7, 2024

Greet before asking questions

It's just common courtesy.

Do not use @cached_property for prompts

Using @cached_property to define these prompting functions (which
are, fundamentally, not really properties at all) makes it a lot
harder to reason about what happens when you invoke them. Furthermore,
as far as I'm aware, there's no documented way to clear the cache for
a cached property.

This change is, in the wise words of Mickey Mouse, "a surprise tool
that will help us later".

Ask for the push API key again if it's invalid

If the push API key does not validate, ask for it again instead of
kicking the user out of the installer.

Move the logic out of the install command and to its own function.
Spice it up with some emojis (they're free!)

Handle unexpected validation errors

Handle unexpected validation errors, such as AppSignal's servers
not being reachable.

Test asking again for API key

Make it so that the mock_input context manager can indicate the
expectation of an unanswered prompt by using None instead of an
answer.

When this happens, the expected StopIteration that indicates that
a prompt was asked for which no answer was given is not raised as an
error.

Delete several duplicates of mock_input and move it to a single
utils.py file.

unflxw added 4 commits March 7, 2024 12:56
It's just common courtesy.
Using `@cached_property` to define these prompting functions (which
are, fundamentally, not really properties at all) makes it a lot
harder to reason about what happens when you invoke them. Furthermore,
as far as I'm aware, there's no documented way to clear the cache for
a cached property.

This change is, in the wise words of Mickey Mouse, "a surprise tool
that will help us later".
If the push API key does not validate, ask for it again instead of
kicking the user out of the installer.

Move the logic out of the install command and to its own function.
Spice it up with some emojis (they're free!)
Handle unexpected validation errors, such as AppSignal's servers
not being reachable.
@unflxw unflxw self-assigned this Mar 7, 2024
@backlog-helper
Copy link

backlog-helper bot commented Mar 7, 2024

Hi @unflxw,

We've found some issues with your Pull Request.

  • This Pull Request does not include a changeset. Add a changeset if the change impacts users and should be included in the changelog upon release. Read more about changesets.
    Ignore this rule by adding [skip changeset] to your Pull Request body. - (More info)

New issue guide | Backlog management | Rules | Feedback

@unflxw unflxw force-pushed the try-validate-api-key-again branch from e492015 to 1b55359 Compare March 7, 2024 15:35
@unflxw unflxw changed the title Try validate api key again Ask for the push API key again when validation fails Mar 7, 2024
Make it so that the `mock_input` context manager can indicate the
expectation of an unanswered prompt by using `None` instead of an
answer.

When this happens, the expected `StopIteration` that indicates that
a prompt was asked for which no answer was given is not raised as an
error.

Delete several duplicates of `mock_input` and move it to a single
`utils.py` file.
@unflxw unflxw force-pushed the try-validate-api-key-again branch from 1b55359 to 4544c88 Compare March 7, 2024 15:37
@unflxw unflxw added the chore label Mar 7, 2024
@unflxw unflxw merged commit 874c003 into main Mar 8, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants