Skip to content

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.


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
@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.

3 participants