Page MenuHomePhabricator

[lib] Avoid clearing CSAT on identityRegisterActionTypes.success
ClosedPublic

Authored by ashoat on Mar 24 2024, 7:47 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 25, 6:59 AM
Unknown Object (File)
Sun, Nov 24, 8:50 PM
Unknown Object (File)
Sun, Nov 24, 9:39 AM
Unknown Object (File)
Wed, Nov 13, 8:41 AM
Unknown Object (File)
Fri, Nov 8, 4:03 AM
Unknown Object (File)
Wed, Nov 6, 3:52 PM
Unknown Object (File)
Fri, Nov 1, 9:38 AM
Unknown Object (File)
Wed, Oct 30, 6:47 AM
Subscribers

Details

Summary

This addresses ENG-7366 more details there.

@inka, curious if you think there are other actions we should consider here, or other parts of the Redux state that need to consider identityRegisterActionTypes.success.

Test Plan

I tested and found that this fix the new account registration flow on master when using a multi-keyserver workflow. Prior to this, I was experiencing the issue details in ENG-7366

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

In the issue you said:

However, reduceServicesAccessToken does not have code to set the CSAT on identityRegisterActionTypes.success. The end result is that the CSAT is cleared on this action, after initially being set by AccessTokenHandler via setAccessTokenActionType (triggered by getCommServicesAuthMetadataEmitter that comes before identityRegisterActionTypes.success).

This is going to be the case for login as well once ENG-6598 is implemented. This makes me wonder if AccessTokenHandler is needed at all. If we will be setting CSAT on login and register actions, is there a need for it? I guess the CSAT can change while being logged in, but then how do we handle that on web, and why is native different?

On web we handle register and login in a special reducer - D11238. This was done following the discussion in D11022. This diff should then remove handling identityRegisterActionTypes.success from reduceServicesAccessToken in web/redux/services-access-token-reducer.js
But I still don't know how we handle / plan to handle CSAT changes while the user is logged in (which I think are possible if identity invalidates the session? cc. @varun )

This revision is now accepted and ready to land.Mar 25 2024, 6:15 AM

This is going to be the case for login as well once ENG-6598 is implemented. This makes me wonder if AccessTokenHandler is needed at all. If we will be setting CSAT on login and register actions, is there a need for it? I guess the CSAT can change while being logged in, but then how do we handle that on web, and why is native different?

The point of AccessTokenHandler is to avoid inconsistency between native and JS layers. When we introduced it, I think our thinking was that on native, changes to the CSAT would all be initiated from the native layer, and then be propagated to the JS layer.

I am skeptical about getting rid of it, because it seems likely that some inconsistency would end up being introduced.

I think we can keep the principle that the CSAT is owned by native. But in that case, we should not be resetting the CSAT in Redux directly via resetUserSpecificState. Instead we should reset it in native first (eg. via clearSensitiveData), and then we would expect that the change will trickle into native.

I'm going to land this for now, but @inka can you create a task to discuss how we want to handle this long-term? Make sure to subscribe myself, @marcin, and @tomek.