[AI-FSSDK] [FSSDK-12760] add localHoldouts to datafile for backward compatibility#633
Merged
Merged
Conversation
Contributor
Author
|
I reviewed and it looks good to me. |
There was a problem hiding this comment.
Pull request overview
Adds backward-compatible support for a new top-level localHoldouts datafile section so Gen 3 SDKs can scope holdouts by datafile section, while older SDKs safely ignore the new section.
Changes:
- Introduces a section-aware
HoldoutConfig(List holdouts, List localHoldouts)constructor and keeps the legacy single-list constructor as deprecated. - Updates all parsers (Gson/Jackson/org.json/json-simple) to read optional
localHoldoutsand pass it through toDatafileProjectConfig. - Updates test fixtures and adds section-aware unit tests to validate global vs. local behavior.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| core-api/src/test/resources/config/holdouts-project-config.json | Moves the local holdout entry into the new top-level localHoldouts section for parser/test coverage. |
| core-api/src/test/java/com/optimizely/ab/config/HoldoutConfigTest.java | Adds tests covering section-aware routing, stripping includedRules for global-section entries, and local-section validation. |
| core-api/src/main/java/com/optimizely/ab/config/parser/JsonSimpleConfigParser.java | Parses optional localHoldouts array and passes it into the v4 config constructor. |
| core-api/src/main/java/com/optimizely/ab/config/parser/JsonConfigParser.java | Parses optional localHoldouts array and passes it into the v4 config constructor. |
| core-api/src/main/java/com/optimizely/ab/config/parser/DatafileJacksonDeserializer.java | Deserializes optional localHoldouts and passes it through to DatafileProjectConfig. |
| core-api/src/main/java/com/optimizely/ab/config/parser/DatafileGsonDeserializer.java | Deserializes optional localHoldouts and passes it through to DatafileProjectConfig. |
| core-api/src/main/java/com/optimizely/ab/config/HoldoutConfig.java | Implements section-aware mapping and preserves legacy includedRules-based behavior via deprecated constructor. |
| core-api/src/main/java/com/optimizely/ab/config/Holdout.java | Updates documentation to clarify that section membership controls scope (with includedRules used for local targeting). |
| core-api/src/main/java/com/optimizely/ab/config/DatafileProjectConfig.java | Adds a 21-arg v4 constructor and partitions legacy mixed holdouts lists for backward compatibility. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…Rules behavior Copilot review flagged that the Javadoc/comments claimed empty includedRules on localHoldouts was skipped with an error, but the implementation treats empty as valid-but-inert (only null is skipped). Also clarified that includedRules stripping for global entries happens while building the mapping, not "at parse time". Co-Authored-By: Claude Opus 4.7 <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
Adds support for the new top-level
localHoldoutsdatafile section so older SDKs (Gen 1/Gen 2) that don't understand local holdouts safely ignore them while Gen 3 SDKs scope holdouts by section membership.Changes
HoldoutConfig— section-aware constructor(globalHoldouts, localHoldouts). Entries inholdoutsare global (anyincludedRulesis stripped); entries inlocalHoldoutsmust carryincludedRules(null/missing → log error + skip; empty list → valid but inert). Legacy single-list constructor preserved as deprecated.DatafileProjectConfig— new 21-arg v4 constructor acceptinglocalHoldoutsseparately. Legacy 20-arg constructor auto-partitions a mixed list by entity-levelincludedRulesfor backward compatibility with existing callers.localHoldoutsarray and pass it through alongsideholdouts.Holdout— docstring updates clarifying that scope comes from the datafile section, notincludedRules.HoldoutConfigTest(8 added, 25 total) plus moved the existing local-holdout entry inholdouts-project-config.jsoninto the newlocalHoldoutssection. All existing parser/DecisionService/UserContext tests continue to pass unchanged.Jira ticket
FSSDK-12760
Reference PRs
Test plan
./gradlew :core-api:test— all suites pass (HoldoutConfigTest: 25/25; all 4 parser tests pass; DecisionServiceTest and OptimizelyUserContextTest pass)./gradlew test— all modules pass