Page MenuHomePhabricator

[web/native] Add lastCommunicatedPlatformDetails to redux
ClosedPublic

Authored by michal on Jun 28 2023, 1:52 AM.
Tags
None
Referenced Files
F3500024: D8350.id28569.diff
Fri, Dec 20, 12:43 AM
F3500023: D8350.id28203.diff
Fri, Dec 20, 12:43 AM
F3500022: D8350.id28204.diff
Fri, Dec 20, 12:43 AM
F3500021: D8350.id28375.diff
Fri, Dec 20, 12:43 AM
F3499986: D8350.id.diff
Fri, Dec 20, 12:42 AM
F3499916: D8350.diff
Fri, Dec 20, 12:38 AM
Unknown Object (File)
Fri, Nov 22, 10:33 PM
Unknown Object (File)
Nov 12 2024, 10:25 PM
Subscribers

Details

Summary

https://linear.app/comm/issue/ENG-3905/platform-details-arent-updated-on-http-communication

Currently platform details are only send on web socket intialization and login. This is a problem because before the websocket is connected the client can already communicate with the keyserver with http endpoints. This diff adds lastCommunicatedPlatformDetails to redux which will keep track of the last send platform details, so we can resend them if they change. We track this as map of urlPrefix -> PlatformDetails, in preparation for multi keyservers.

NOTE: for some reason flow throws an error in a few places after adding the new action. To fix this I've added a few no-op casts (the types that I'm casting to, are the types flow infered for these values already).
Test Plan

Test if redux is updated on login. Test if the action works with the next diff

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

LGTM but please address my inline comment

lib/reducers/last-communicated-platform-details-reducer.js
14 ↗(On Diff #28204)

looks like logInActionTypes.success is not enough

what about other auth actions:

  • siweAuthActionTypes.success
  • registerActionTypes.success
This revision is now accepted and ready to land.Jul 4 2023, 2:13 AM

Handle other auth actions

ashoat added inline comments.
lib/reducers/last-communicated-platform-details-reducer.js
17 ↗(On Diff #28375)

@inka has a task with all of the different Redux properties we need to migrate to multi-keyserver. We should probably add a subtask to migrate this one... the collection is future-proof, but the reducer will need to be updated

34 ↗(On Diff #28375)

Should we "unset" things on a log out / account deletion / session invalidation?

lib/reducers/last-communicated-platform-details-reducer.js
34 ↗(On Diff #28375)

I don't think that's needed. This is a device-wide data, not account specific.

lib/reducers/last-communicated-platform-details-reducer.js
34 ↗(On Diff #28375)

Is it possible that the keyserver will delete the data when the user logs out? In that case, the data might not be up-to-date on the keyserver, but the client might skip sending it because it thinks it's up-to-date

lib/reducers/last-communicated-platform-details-reducer.js
34 ↗(On Diff #28375)

After logging out the anonymous cookie that is created keeps the platform details of the user. Additionally the client will still always send the platform on login, so if for some reason the they get out-of-sync they will synchronise at login.