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

ExPlat: Add support to experiment_names parameter #1970

Merged
merged 6 commits into from
Apr 22, 2021

Conversation

renanferrari
Copy link
Member

This PR updates the ExPlat implementation so it can support the new experiment_names parameter which was added to the "fetch assignments" endpoint, as defined in https://github.com/Automattic/experimentation-platform/issues/606.

This depends on #1969.

In practice, this mainly impacts the usage of ExperimentStore::fetchAssignments, which now requires a list of String with the experiment names as its second parameter:

val platform = Platform.WORDPRESS_ANDROID

// Before
val result = experimentStore.fetchAssignments(platform)
result.assignments.variations // Contained variations for all active experiments

// Now
val result = experimentStore.fetchAssignments(platform, listOf("experiment_one", "experiment_two"))
result.assignments.variations // Contains variations only for experiment_one and experiment_two (if they are active)

To test

Make sure all unit tests pass and/or use the following steps on the example app:

  1. On the initial screen, tap Experiments.
  2. On the next screen, select a platform to query.
  3. Under "Experiment names", add the name of all experiments which you want to request, separated by a comma (keep in mind only active experiments will be returned, so check Abacus if you want to see which ones to request).
  4. Optionally, you can add or generate an Anonymous ID to be included in the request as well.
  5. Tap Fetch Assignments.
  6. Check the results printed by the in-app console and verify they match what was requested.

Repeat providing single/multiple experiment names and also no experiment name at all (which should return 0 assignments).

val result = experimentStore.fetchAssignments(platform, anonymousId)
val result = experimentStore.fetchAssignments(platform, experimentNames, anonymousId)
result.assignments.variations // Contained variations for experiments which were currently running
result.assignments.variations // Contains variations only for the requests experiments
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I understand these two lines. They are exactly the same and don't do anything with the value. What am I missing? Is it for debugging purposes?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oops, those were not supposed to be there. Fixed in ab44de3.

Base automatically changed from feature/general-explat-improvements to develop April 21, 2021 09:13
Copy link
Contributor

@planarvoid planarvoid left a comment

Choose a reason for hiding this comment

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

thanks for the fix 👍

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

Successfully merging this pull request may close these issues.

2 participants