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

[FSSDK-9781] warn on duplicate experiment key #343

Merged
merged 3 commits into from
Dec 8, 2023

Conversation

andrewleap-optimizely
Copy link
Contributor

@andrewleap-optimizely andrewleap-optimizely commented Dec 7, 2023

Summary

  • Ensure newest duplicate experiment key takes precedence (current behavior)
  • log a warning when a duplicate experiment key is found

Test plan

  • added test for dupe experiment

Ticket

FSSDK-9781

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.

Looks good. A clarification.

@@ -91,6 +92,7 @@ def audiences_map

def experiments_map
experiments_id_map.values.reduce({}) do |experiments_key_map, experiment|
@logger.log(Logger::WARN, "Duplicate experiment keys found in datafile: #{experiment['key']}") if experiments_key_map.key? experiment['key']
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good. A question is the order in datafile is managed in experiment_id_map. Just for consistency, we're supposed to return the last experiment in the datafile.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea Ruby iterates over hash values in insertion order, so the last instance of an experiment key will take precedence.

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

@andrewleap-optimizely andrewleap-optimizely merged commit 1333d60 into master Dec 8, 2023
9 checks passed
@andrewleap-optimizely andrewleap-optimizely deleted the aleap/warn_duplicate_experiments branch December 8, 2023 16:55
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.

2 participants