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

Push Activation State Machine: validate an already-registered device on activation #543

Merged
merged 31 commits into from
May 7, 2020

Conversation

paddybyers
Copy link
Member

@paddybyers paddybyers commented Jan 3, 2020

Implements ably/docs#786

@@ -1017,6 +1017,11 @@ private static final String hmac(String text, String key) {
* @throws AblyException
*/
public void setClientId(String clientId) throws AblyException {
if(clientId == null) {
/* do nothing - we received a token without a clientId */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is possible, shouldn't it be in the spec and thus have an associated test?

@paddybyers
Copy link
Member Author

@tcard see also e70483a.

This implements ably/docs@1b775f3

(Tests to follow.)

tcard
tcard previously approved these changes Jan 7, 2020
@tcard
Copy link
Contributor

tcard commented Jan 19, 2020

I just want to link to ably/docs#786 for cross-reference in the GitHub UI.

@QuintinWillison QuintinWillison dismissed tcard’s stale review February 7, 2020 16:25

The base branch was changed.

@QuintinWillison QuintinWillison changed the base branch from develop to master February 7, 2020 16:25
@tcard tcard self-assigned this Feb 9, 2020
@tcard tcard changed the base branch from master to push-random-fixes February 9, 2020 11:22
@tcard
Copy link
Contributor

tcard commented Feb 9, 2020

I've extracted #553 from this and rebased the rest on top. Once #553 is merged, base should be changed back to master.

@tcard
Copy link
Contributor

tcard commented Feb 24, 2020

Screenshot 2020-02-24 at 16 42 54

To-do:

@tcard
Copy link
Contributor

tcard commented Feb 26, 2020

While talking to @QuintinWillison I noticed that now that we've renamed AfterRegistrationUpdateFailed to AfterRegistrationSyncFailed, if clients update were to update the library where the previous persistent state was AfterRegistrationUpdateFailed, loading the state from persistence would fail, as no such state exists now. We need to make sure we upgrade deprecated states to their new counterparts.

@tcard
Copy link
Contributor

tcard commented Feb 26, 2020

Screenshot 2020-02-26 at 17 07 52

@tcard
Copy link
Contributor

tcard commented Feb 27, 2020

@paddybyers PTAL

This should be easier to review on a per-commit basis.

paddybyers and others added 10 commits March 9, 2020 16:57
Co-Authored-By: Toni Cárdenas <toni@tcardenas.me>
Conform to the spec as to which callbacks should be called from
WaitingForRegistrationSync.
This isn't in the spec (yet). The previous behavior causes the
activation callback to be called right away with no error, while a
previous activation is ongoing. The correct behavior is to serialize
the calls, so that the second call is processed after the first has
finished.

At the same time, remove the CalledActivate enqueue from
NotActivated, which relied on the old behavior but wasn't doing
anything really useful. (This needs to be removed from the spec
too.)
Realtime seems to expect it, even if we set the device token header.
Also, fix a test that relied on broken behavior.
tcard added 21 commits March 9, 2020 16:57
So that we can mock it in tests. OnCompleteListeners can only be fired
by Android.

So now, we need to brigde Android's native OnCompleteListener to our
Callback.
This provides more flexibility for further tests, and supersedes the
need for TestActivationStateMachine.ignoreRegistrationTokenRequest.
Otherwise, we're resetting it each time, which then breaks client ID
updates detection.
For a broken test, take blocks indefinitely.
Will be needed to test RSH8i.
Copy link
Member Author

@paddybyers paddybyers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't approve this because I was the original author, but LGTM. Thanks @tcard , good work. Rescued my half-baked implementation :)

Copy link
Contributor

@tcard tcard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @paddybyers. Approving on your behalf so that this thing lets me merge.

@tcard tcard merged commit 1399a98 into master May 7, 2020
@tcard tcard deleted the push-local-device-validate branch May 7, 2020 18:18
@QuintinWillison
Copy link
Contributor

🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants