Skip to content

fix: Correct decision notification payload type for getVariation feature test decision #375

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

Merged
merged 2 commits into from
Dec 17, 2019

Conversation

mjc1283
Copy link
Contributor

@mjc1283 mjc1283 commented Dec 17, 2019

Summary

In createProjectConfig, we attempt to create an object experimentFeatureMap whose keys are experiment IDs, and whose values are arrays of feature IDs. We loop over each experiment ID in each feature flag's experimentIds, and update experimentFeatureMap accordingly.

The problem occurs when one of these experiments is in a group (had a groupId property). The inner loop breaks out by returning false (this early iteration exit by returning false is a feature of lodash forEach). Then, any remaining experiment IDs are wrongfully excluded from experimentFeatureMap. For any of these skipped feature experiment IDs, the isFeatureExperiment function will wrongly return false, leading to an incorrect decision notification payload.

With this change, the loop always runs over all experiment IDs of each feature. The previous behavior of only assigning feature.groupId once is maintained.

Test plan

New unit tests for isFeatureExperiment function of project config module

Issues

https://optimizely.atlassian.net/browse/OASIS-5759

Matt Carroll added 2 commits December 16, 2019 12:11
Copy link
Contributor

@mikeproeng37 mikeproeng37 left a comment

Choose a reason for hiding this comment

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

lgtm, can we run @Mat001 's FSC test on this branch and confirm that it passes?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.005%) to 97.511% when pulling 8929d58 on mcarroll/OASIS-5759 into 9a4d96b on master.

@mjc1283 mjc1283 merged commit 8b2177b into master Dec 17, 2019
@mjc1283 mjc1283 deleted the mcarroll/OASIS-5759 branch December 17, 2019 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants