mozilla-vpn-client icon indicating copy to clipboard operation
mozilla-vpn-client copied to clipboard

VPN-5855 - Part 2 - Update TaskGetFeatureList to use new Guardian endpoint and scheduling

Open brizental opened this issue 1 year ago • 1 comments

The /featurelist Guardian enpoint is being update to also return experimental features from Nimbus, see https://github.com/mozilla-services/guardian-website/pull/1688.

This pull request updates TaskGetFeatureList to use the new endpoint. The new enpoint

  1. is a POST endpoint,
  2. expects either an Authorization header from which to derive the experimenter id or the experimenter id to be in the body of the request

This pull request also updates the scheduling of the calls to this endpoint. Previously this endpoint would only be called once the user was logged in, on a timer. Now it should be called

  1. As soon as possible when the application is started
  2. Regardless of being logged in or not
  3. Periodically
  4. Whenever the experimenter id changes

About the experimenter id

The experimenter id is used by Nimbus to calculate the experimental features that should be enable and with which parameters.

As described in https://github.com/mozilla-mobile/mozilla-vpn-client/blob/main/docs/rfcs/0006-cirrus-experiments.md, we will use the FxA id as the experimenter id. However, if the user is logged out we will generate a random UUID and use that instead.

Therefore, whenever the user logged in state changes TaskGetFeatureList needs to be re-run with a different experimenter id. Note that the way this is implemented, the logged out experimenter id is only calculated once i.e. it doesn't get recalculated everytime the user logs out. As I write this I realize we should probably rotate it as well when telemetry is disabled -- will send a commit with that.

brizental avatar Jan 15 '24 10:01 brizental

Merging this is blocked until https://github.com/mozilla-services/guardian-website/pull/1688 is merged and released to staging.

brizental avatar Jan 25 '24 15:01 brizental