[AI-FSSDK] [FSSDK-12760] add localHoldouts to datafile for backward compatibility#412
Open
jaeopt wants to merge 1 commit into
Open
[AI-FSSDK] [FSSDK-12760] add localHoldouts to datafile for backward compatibility#412jaeopt wants to merge 1 commit into
jaeopt wants to merge 1 commit into
Conversation
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
Emit local holdouts under a new top-level
localHoldoutsdatafile section, separate from the existingholdoutssection. Theholdoutssection now carries ONLY global holdouts; older Gen 1/Gen 2 SDKs ignore the unknownlocalHoldoutskey, so a single datafile artifact serves every SDK version without misapplying local holdouts as global.Section membership is the sole signal for scope:
holdouts→ ALL entries are global. AnyincludedRuleson entries here is stripped at parse time and ignored.localHoldouts→ ALL entries are local (rule-scoped viaincludedRules). Entries missingincludedRulesare logged and excluded from evaluation.Changes
OptimizelySDK/ProjectConfig.cs: AddedHoldout[] LocalHoldouts { get; set; }to the interface and updated theHoldoutsdocstring to note section-based scoping.OptimizelySDK/Config/DatafileProjectConfig.cs:[JsonProperty("localHoldouts")] public Holdout[] LocalHoldouts { get; set; }deserialized from the new datafile key.LocalHoldoutsto an empty array when absent (backward-compat).HoldoutsandLocalHoldoutsso the decision service can resolve local holdouts' variations.BuildCombinedHoldouts()helper: stripsIncludedRulesfrom global-section entries (section membership is the sole signal), validateslocalHoldoutsentries (missingIncludedRules→ error log + skip, no fallback to global), and passes a combined, validated array toHoldoutConfig.GetGlobalHoldouts()/GetHoldoutsForRule()docstrings to reflect section-based contract.OptimizelySDK/Entity/Holdout.cs: UpdatedIncludedRulesandIsGlobaldocstrings to note that section membership (not this field alone) is the source of truth; the property remains consistent because parsing strips the field on global-section entries.OptimizelySDK.Tests/TestData/HoldoutTestData.json: Added adatafileWithLocalHoldoutsSectionfixture with both global and local entries, an entry with strayincludedRulesin the global section (to verify stripping), and an invalid local entry missingincludedRules(to verify error log + exclusion).OptimizelySDK.Tests/LocalHoldoutsSectionTest.cs(new): Dedicated[TestFixture]covering: top-levelLocalHoldoutsexposure, rule-map registration, exclusion from globals, id-map retrieval across sections, variation-map population for local holdouts, stripping of strayincludedRuleson global entries, validation/logging of missingincludedRules, backward compatibility with datafiles lacking the section, datafiles missing both sections, mixed section partitioning, and the valid-but-emptyincludedRulesedge case.OptimizelySDK.Tests/OptimizelySDK.Tests.csproj: Registered the new test file (legacy MSBuild project requires explicit<Compile Include>).Backward Compatibility
localHoldoutskey parse exactly as before —LocalHoldoutsdefaults to[], every entry inholdoutsis treated as global, no errors, no log noise.Holdout.IsGlobalremains correct becauseDatafileProjectConfig.BuildCombinedHoldouts()stripsIncludedRulesfrom global-section entries at parse time.TestForcedDecisionBeats100PercentLocalHoldoutstill applies.Reference Implementations
Same backward-compat shape applied across SDKs:
Jira Ticket
FSSDK-12760