[AI-FSSDK] [FSSDK-12760] add localHoldouts to datafile for backward compatibility#1157
Open
jaeopt wants to merge 4 commits into
Open
[AI-FSSDK] [FSSDK-12760] add localHoldouts to datafile for backward compatibility#1157jaeopt wants to merge 4 commits into
jaeopt wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new top-level localHoldouts datafile section to clearly separate global vs rule-scoped holdouts, ensuring older SDKs ignore local holdouts safely while Gen 3+ uses section membership as the sole scope signal.
Changes:
- Update holdout parsing to partition by
holdouts(global) vslocalHoldouts(local), stripincludedRulesfrom global entries, and log/skip invalid local entries. - Extend
ProjectConfigwithlocalHoldoutsand a rule→holdouts lookup map, threading an optional logger for parse-time diagnostics. - Update and expand unit tests to cover backward compatibility, partitioning behavior, mutation regression, and invalid local entry handling.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/shared_types.ts | Updates holdout docstrings to reflect section-driven scope semantics. |
| lib/project_config/project_config.ts | Implements two-section holdout parsing, adds localHoldouts, and threads logger for diagnostics. |
| lib/project_config/project_config.spec.ts | Migrates/extends tests for two-section holdouts behavior and error logging. |
| lib/message/error_message.ts | Adds a new error message for invalid localHoldouts entries. |
| lib/core/decision_service/index.spec.ts | Updates test helper to emit local holdouts under localHoldouts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+429
to
+431
| // const global: Holdout[] = []; | ||
| const ruleHoldoutsMap: { [ruleId: string]: Holdout[] } = {}; | ||
| const holdoutIdMap: { [id: string]: Holdout } = {}; |
| }; | ||
| projectConfig.holdoutIdMap = holdoutIdMap; | ||
| projectConfig.ruleHoldoutsMap = ruleHoldoutsMap; | ||
| } |
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
Adds support for a new top-level
localHoldoutsdatafile section so older SDKversions (Gen 1 / Gen 2) ignore local holdouts safely instead of misapplying
them as global holdouts. Section membership in
holdoutsvslocalHoldoutsisnow the sole signal for holdout scope.
holdoutsare always global;includedRuleson these entries isstripped at parse time so scope is unambiguous.
localHoldoutsare always local (rule-scoped viaincludedRules);entries missing or with empty
includedRulesare invalid, logged at ERROR,and excluded from evaluation (no fallback to global).
localHoldoutssection continue towork unchanged.
Changes
lib/project_config/project_config.tsProjectConfig.localHoldouts: Holdout[]added (defaults to[]).createMutationSafeDatafileCopyshallow-copies entries in both holdoutsections so per-entry mutations (e.g. stripping
includedRules) don't bleedinto the caller's datafile.
parseHoldoutsConfigrewritten to partition by section membership; threadsan optional
LoggerFacadefor invalid-entry diagnostics.createProjectConfigandtryCreatingProjectConfigthread the loggerthrough so parse-time errors are surfaced.
HoldoutConfig,getGlobalHoldouts,getHoldoutsForRuleupdated — section membership is the sole signal.
lib/shared_types.ts— docstrings onHoldout.includedRulesandHoldout.isGlobalupdated to reflect section-driven scope.lib/project_config/project_config.spec.ts— existing FSSDK-12369 testsmigrated to the two-section layout; new FSSDK-12760 suite covers
localHoldoutsparsing, backward compat, strip-and-ignore for global-sectionincludedRules, caller-mutation regression, both-sections partitioning,invalid-entry logging (missing / null / empty), and variation map coverage.
lib/core/decision_service/index.spec.ts—makeLocalHoldoutDatafilehelper updated to emit local holdouts in the
localHoldoutssection.Reference implementations
Jira
FSSDK-12760