Skip to content

Conversation

@oakbani
Copy link
Contributor

@oakbani oakbani commented Jan 4, 2019

Summary

In Audience Evaluation, evaluate unknown audience to null and continue evaluation for other audiences.
Though we trust the datafile generation part won't generate such scenario, we still check to sync up with compat suite test here:
https://github.com/optimizely/fullstack-sdk-compatibility-suite/pull/196

Test plan

Ran compatibility suite including audience combination tests.

Issues

  • OASIS-3921

@oakbani oakbani requested a review from nchilada January 4, 2019 13:38
@coveralls
Copy link

coveralls commented Jan 4, 2019

Coverage Status

Coverage decreased (-0.008%) to 98.025% when pulling 9dc0544 on oakbani/unknown-audience-ids into c83981b on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.008%) to 98.025% when pulling 811c2d9 on oakbani/unknown-audience-ids into c83981b on master.

@mikeproeng37
Copy link
Contributor

Verified that this fixes the breaking audience match type tests that are enabled in:
https://github.com/optimizely/fullstack-sdk-compatibility-suite/pull/192

Passing test run:
https://travis-ci.com/optimizely/fullstack-sdk-compatibility-suite/builds/96655254

@aliabbasrizvi aliabbasrizvi requested a review from a team January 8, 2019 19:26
Copy link
Contributor

@nchilada nchilada 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 fixing this!

)
);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

This is a pretty minimalist test case, but I think it's good enough. @aliabbasrizvi thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

This test is fine, but no way do I know that iPhone San Francisco users are in audience 7718080042.

May be add more comments.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, yes, we could make it clearer that the experiment activates because the user passes the conditions for the known audience

$this->_errorHandler->handleError(new InvalidAudienceException('Provided audience is not in datafile.'));
return new Audience();

return null;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I will keep the previous behavior.

$conditionTreeEvaluator = new ConditionTreeEvaluator();

$audience = $config->getAudience($audienceId);
if ($audience === null) {
Copy link
Contributor

@aliabbasrizvi aliabbasrizvi Jan 8, 2019

Choose a reason for hiding this comment

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

I think I have a preference to keep previous behavior and check if $audience->getId equals null.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why do you prefer it this way? I don't see any advantage to returning empty entity objects. Instead, they have caused issues. #107
Thus we have replaced returning empty entity by null at multiple places.

Copy link
Contributor

Choose a reason for hiding this comment

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

Instead, they have caused issues. #107

I see your point. Like I said it is a preference and I am not married to the idea.
Regarding that issue, I would say that it was a bug and the implementer should have done due diligence.

)
);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

This test is fine, but no way do I know that iPhone San Francisco users are in audience 7718080042.

May be add more comments.

$conditionTreeEvaluator = new ConditionTreeEvaluator();

$audience = $config->getAudience($audienceId);
if ($audience === null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead, they have caused issues. #107

I see your point. Like I said it is a preference and I am not married to the idea.
Regarding that issue, I would say that it was a bug and the implementer should have done due diligence.

@mikeproeng37 mikeproeng37 merged commit 513039d into master Jan 10, 2019
@oakbani oakbani deleted the oakbani/unknown-audience-ids branch January 16, 2019 11:25
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