[AI-FSSDK] [FSSDK-12369] Add local holdouts support with includedRules field#397
Open
Mat001 wants to merge 2 commits into
Open
[AI-FSSDK] [FSSDK-12369] Add local holdouts support with includedRules field#397Mat001 wants to merge 2 commits into
Mat001 wants to merge 2 commits into
Conversation
…s field - Add global_holdouts and rule_holdouts_map to DatafileProjectConfig initialization - Classify holdouts as global (includedRules nil) or local (includedRules array) during config parsing - Add get_global_holdouts and get_holdouts_for_rule methods to DatafileProjectConfig - Update get_decision_for_flag to use get_global_holdouts instead of holdout_id_map.values - Add local holdout checks in get_variation_from_experiment_rule (after forced decisions) - Add local holdout checks in get_variation_from_delivery_rule (after forced decisions) - Add CONFIG_BODY_WITH_LOCAL_HOLDOUTS test fixture with mixed global and local holdouts - Add local_holdouts_spec.rb with 10 tests covering config classification and helper methods Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove duplicate get_global_holdouts def (attr_reader already exists) - Use Style/Next (next unless) in local holdout loops - Fix Layout/SpaceInsideHashLiteralBraces in spec Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds local holdouts support to the Ruby SDK, allowing holdouts to target specific rules within a flag via an
includedRulesfield.Jira Ticket: FSSDK-12369
Changes
Configuration (
lib/optimizely/config/datafile_project_config.rb)@global_holdouts(Array) and@rule_holdouts_map(Hash) instance variablesglobal_holdoutsandrule_holdouts_maptoattr_readerincludedRulesabsent/nil) or local (includedRulesis an array), populating the respective data structuresget_global_holdoutsmethod: returns all global holdouts (nilincludedRules)get_holdouts_for_rule(rule_id)method: returns local holdouts targeting a specific ruleDecision Logic (
lib/optimizely/decision_service.rb)get_decision_for_flagto useget_global_holdoutsinstead ofholdout_id_map.valuesfor flag-level holdout evaluationget_variation_from_experiment_rule(after forced decisions, before regular bucketing)get_variation_from_delivery_rule(after forced decisions, before audience/bucketing evaluation)Tests
spec/local_holdouts_spec.rb(new): 10 tests covering:includedRulesfield treated as global)rule_holdouts_mappopulationget_global_holdoutsandget_holdouts_for_rulehelper methodsincludedRulesarray, no global holdouts)spec/spec_params.rb: AddedCONFIG_BODY_WITH_LOCAL_HOLDOUTSfixture with both global and local holdoutsDecision Flow
Backward Compatibility
Old datafiles without
includedRuleskey: Ruby JSON parsing returnsnilfor missing keys → treated as global holdout → behavior unchanged.🤖 Generated with Claude Code