Page MenuHomePhabricator

[native][lib][web] update IdentityServiceClient implementations and useLogOut in user-actions.js
ClosedPublic

Authored by varun on Mar 14 2024, 9:20 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 26, 2:22 AM
Unknown Object (File)
Thu, Apr 25, 7:48 AM
Unknown Object (File)
Thu, Apr 25, 7:48 AM
Unknown Object (File)
Thu, Apr 25, 7:23 AM
Unknown Object (File)
Mon, Apr 15, 11:33 PM
Unknown Object (File)
Wed, Apr 3, 2:18 AM
Unknown Object (File)
Wed, Apr 3, 2:18 AM
Unknown Object (File)
Wed, Apr 3, 2:18 AM

Details

Summary

add logOut to the IdentityServiceClient type and implementations. use the client logOut method in useLogOut

Depends on D11334

Test Plan

successfully logged out of identity on web and native. confirmed that access token and device were removed from ddb

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

varun held this revision as a draft.
varun edited the test plan for this revision. (Show Details)
varun added reviewers: ashoat, tomek.

update diff details

varun published this revision for review.Mar 15 2024, 12:43 PM
ashoat added 1 blocking reviewer(s): inka.
ashoat added inline comments.
lib/actions/user-actions.js
87 ↗(On Diff #38108)

Should this be renamed to keyserverLogOut?

87 ↗(On Diff #38108)

Maybe add a newline above here to avoid the implication that logOutActionTypes is tied to only this function

110 ↗(On Diff #38108)

This seems broken...

callKeyserverEndpoint appears to return { +[keyserverID: string]: any }.

But we're assigning that to currentUserInfo here, which doesn't match that type.

I recognize this diff doesn't change that stuff, so won't block the review here. But would love to get @inka's perspective on this, and to understand if there's a task tracking fixing this. (I suspect we should probably prioritize that task... it seems like this code is currently broken.)

varun added a subscriber: michal.

after rebasing i started getting a flow error. updated web/grpc/identity-service-client-proxy.js to resolve it, but not really sure what this code does... going to add @michal as a reviewer

address feedback on previous revision

Looks good on the identity-service-client-proxy part.

Short explanation is -> we are moving the identity client to worker so that multiple tabs can synchronize the identity calls between them and not conflict. identity-service-client-wrapper.js will run on web worker and identity-service-client-proxy.js will run in the tab JS context and pass the method calls to the worker (we didn't "flip the switch" yet so for now the identity-service-client-wrapper.js is still running in the tab JS context though).

lib/actions/user-actions.js
110 ↗(On Diff #38108)

This is a ternary operator - if response is truthy, then I assign loggedOutUserInfo (a constant) to currentUserInfo. Otherwise I assign null to currentUserInfo.
response is not being assigned to currentUserInfo in either of these cases.
response can be falsy, if before logout request succeeds, timeout 500 finishes and an error if thrown.
Am I misunderstanding something?

lib/actions/user-actions.js
129 ↗(On Diff #38150)

I don't think it makes sense for this callback to take a list of keyserver ids anymore? I don't think we ever want to logout of identity and only a subset of keyservers...
And it looks like we are not using logout with an array of keyservers anywhere in the code, so it can probably be removed form keyserverLogOut altogether

140 ↗(On Diff #38150)

Is this typically is enough time for identity logout to succeed? Of is this error silently thrown most of the time?

lib/actions/user-actions.js
140 ↗(On Diff #38150)

i tested on staging and it typically succeeded in under 500 ms. the error was silently thrown a few times, though

lib/actions/user-actions.js
110 ↗(On Diff #38108)

Sorry, I'm not sure what I was thinking!

lib/actions/user-actions.js
129 ↗(On Diff #38150)

it it's alright with you i'd like to address this in a follow up diff. will link a linear task here before landing

This revision is now accepted and ready to land.Mar 20 2024, 4:58 AM

Looks good on the identity-service-client-proxy part.

Short explanation is -> we are moving the identity client to worker so that multiple tabs can synchronize the identity calls between them and not conflict. identity-service-client-wrapper.js will run on web worker and identity-service-client-proxy.js will run in the tab JS context and pass the method calls to the worker (we didn't "flip the switch" yet so for now the identity-service-client-wrapper.js is still running in the tab JS context though).

thanks for explaining!