This repository has been archived by the owner on Nov 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 473
Closes #5050: Improve handling of authentication problems #5103
Merged
bors
merged 5 commits into
mozilla-mobile:master
from
grigoryk:missingAccountStartup5050
Nov 20, 2019
Merged
Closes #5050: Improve handling of authentication problems #5103
bors
merged 5 commits into
mozilla-mobile:master
from
grigoryk:missingAccountStartup5050
Nov 20, 2019
Conversation
This file contains 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
grigoryk
force-pushed
the
missingAccountStartup5050
branch
from
November 19, 2019 21:48
f9600df
to
83f6dff
Compare
Codecov Report
@@ Coverage Diff @@
## master #5103 +/- ##
============================================
+ Coverage 80.78% 81.68% +0.89%
+ Complexity 4018 391 -3627
============================================
Files 515 42 -473
Lines 18142 1976 -16166
Branches 2633 273 -2360
============================================
- Hits 14656 1614 -13042
+ Misses 2417 246 -2171
+ Partials 1069 116 -953
Continue to review full report at Codecov.
|
csadilek
approved these changes
Nov 19, 2019
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's a bit of a problem with the profile cache - we need to keep |
I'm not sure it was ever necessary, to be honest. I think the way the 'refresh' method is currently structured, simply marking internal 'constellationState' as Volatile is enough - we're not concerned about concurrent access to it, only about memory visibility across threads. It's true that currently, work in this class happens on a pool thread, so it's possible to have two racing 'refresh' methods running. Having one of them loose the race and drop results on the floor should be just fine in this case.
Before this patch, we'd clear out account storage after we see an unrecoverable authentication error. In this context, a password change would be an unrecoverable error. We'll transition account into an AuthenticationProblem state, but upon re-initialization of the state machine we'll end up in NotAuthenticated instead, because there's no longer a locally persisted account state. So, this is just a straight-up bug in the state machine. So, step 1: do not erase account storage if we encounter auth problems we can't auto-recover from this will make sure account isn't disappearing after a restart this has an additional benefit of not erasing fetched profile data, as well! it's part of the persisted account state Also, add in some debug logging into the samples-sync app to make testing this a bit easier.
…storation If we don't do this, we end up calling onAuthenticated _after_ callin onAuthenticationProblems. This isn't a very principled solution, since other similar situations aren't covered. And, we may fail 'ensureCapabilities' for reasons other than authentication (e.g. network failures). Arguably, stopping here _is_ better than progressing with an uncertain state.
grigoryk
force-pushed
the
missingAccountStartup5050
branch
from
November 20, 2019 00:29
83f6dff
to
767cf4b
Compare
bors r=csadilek |
bors bot
pushed a commit
that referenced
this pull request
Nov 20, 2019
5103: Closes #5050: Improve handling of authentication problems r=csadilek a=grigoryk This PR ensures that account doesn't disappear on app restart after hitting authentication problems. Also: - there's some FxaDeviceConstellation cleanup/simplification - profile cache is now used; this way, we don't need to fetch profile every time account manager is instantiated Co-authored-by: Grisha Kruglov <[email protected]>
Build succeeded
|
2 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This PR ensures that account doesn't disappear on app restart after hitting authentication problems.
Also:
Pull Request checklist
After merge