[AI-FSSDK] [FSSDK-12369] Add local holdouts support with includedRules field#1150
Open
Mat001 wants to merge 1 commit into
Open
[AI-FSSDK] [FSSDK-12369] Add local holdouts support with includedRules field#1150Mat001 wants to merge 1 commit into
Mat001 wants to merge 1 commit into
Conversation
…s field - Add optional includedRules field to Holdout interface (null/undefined = global, array = local) - Add globalHoldouts and ruleHoldoutsMap to ProjectConfig type - Update parseHoldoutsConfig to separate global vs local holdouts based on includedRules - Add getHoldoutsForRule() helper exported from project_config - Update decision_service to use globalHoldouts at flag level (replaces configObj.holdouts) - Add local holdout checks in getVariationFromExperimentRule (per experiment rule) - Add local holdout checks in getVariationFromDeliveryRule (per delivery/rollout rule) - Add 6 new tests in project_config.spec.ts covering global/local classification and backward compat Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
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 JavaScript SDK, allowing holdouts to target specific rules within a flag via an
includedRulesfield.Jira Ticket: FSSDK-12369
Changes
Type Definitions
shared_types.ts: Added optionalincludedRules?: string[] | nulltoHoldoutinterface. Null/undefined = global holdout (applies to all rules); array = local holdout (targets specific rule IDs).Configuration
project_config/project_config.ts:globalHoldouts: Holdout[]andruleHoldoutsMap: { [ruleId: string]: Holdout[] }toProjectConfigtypeparseHoldoutsConfigto classify holdouts as global or local based onincludedRulesgetHoldoutsForRule(projectConfig, ruleId)exported helper functionDecision Logic
core/decision_service/index.ts:getHoldoutsForRulefrom project_configconfigObj.globalHoldoutsinstead ofconfigObj.holdoutsgetVariationFromExperimentRule(after forced decisions, before regular bucketing)getVariationFromDeliveryRule(after forced decisions, before audience/bucketing)Tests
project_config/project_config.spec.ts: Added 6 new tests covering:includedRules)includedRulesarray)includedRulesarray = local, targets no rulesgetHoldoutsForRulehelper functionincludedRulesfield)Decision Flow
Backward Compatibility
Old datafiles without
includedRuleshaveundefinedfor this field, which equalsnullin the== nullcheck → treated as global holdout → behavior unchanged.🤖 Generated with Claude Code