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

FIX: Forced variation not available in experiment #237

Merged
merged 6 commits into from
Dec 22, 2021

Conversation

mnoman09
Copy link
Contributor

Summary

  • Searching forced decision variation from flags first if its not available then we search it in experiment variation map. This is because of forced decision setting variation of flag delivery rule and setting rule key of experiment rule

Test plan

All unit test and FSC tests should pass

@coveralls
Copy link

coveralls commented Dec 13, 2021

Coverage Status

Coverage decreased (-0.5%) to 97.293% when pulling 451fb2a on mnoman/phpForcedDecisionFix into ebfed83 on master.

@@ -251,10 +251,9 @@ public function createImpressionEvent($config, $experimentId, $variationKey, $fl
{
$eventParams = $this->getCommonParams($config, $userId, $attributes);
$experiment = $config->getExperimentFromId($experimentId);
$variation = $config->getFlagVariationByKey($flagKey, $variationKey);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a comment above this line that mapped flagKey can be directly used in variation so no experimentKey exist.

@msohailhussain msohailhussain marked this pull request as ready for review December 13, 2021 23:56
@msohailhussain msohailhussain requested a review from a team as a code owner December 13, 2021 23:56
Copy link
Contributor

@jaeopt jaeopt left a comment

Choose a reason for hiding this comment

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

See comments

@@ -251,10 +251,9 @@ public function createImpressionEvent($config, $experimentId, $variationKey, $fl
{
$eventParams = $this->getCommonParams($config, $userId, $attributes);
$experiment = $config->getExperimentFromId($experimentId);
$variation = $config->getFlagVariationByKey($flagKey, $variationKey);
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like we need check empty both 'flagKey' (line 256) and 'experimentId' (line 260).
Also consider switching line 260 and 256 since 256 is common cases while 256 is for FD only and slow.

@mnoman09 mnoman09 removed their assignment Dec 17, 2021
Copy link
Contributor

@jaeopt jaeopt left a comment

Choose a reason for hiding this comment

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

The change looks good! Can we have a unit test covering these cases?

@@ -251,10 +251,9 @@ public function createImpressionEvent($config, $experimentId, $variationKey, $fl
{
$eventParams = $this->getCommonParams($config, $userId, $attributes);
$experiment = $config->getExperimentFromId($experimentId);
$variation = $config->getFlagVariationByKey($flagKey, $variationKey);
Copy link
Contributor

Choose a reason for hiding this comment

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

We also need a unit test covering this bug?

@mnoman09
Copy link
Contributor Author

@jaeopt I have already added the test you can see this commit link.

@mnoman09 mnoman09 removed their assignment Dec 21, 2021
@jaeopt
Copy link
Contributor

jaeopt commented Dec 21, 2021

@mnoman09 ah ok, I was confused. all looks good!

Copy link
Contributor

@jaeopt jaeopt left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@msohailhussain msohailhussain left a comment

Choose a reason for hiding this comment

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

lgtm

@msohailhussain msohailhussain merged commit 34e8e66 into master Dec 22, 2021
@msohailhussain msohailhussain deleted the mnoman/phpForcedDecisionFix branch December 22, 2021 06:08
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.

6 participants