[AI-FSSDK] [FSSDK-12760] add localHoldouts to datafile for backward compatibility#638
Open
jaeopt wants to merge 1 commit into
Open
[AI-FSSDK] [FSSDK-12760] add localHoldouts to datafile for backward compatibility#638jaeopt 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
Adds support for the new top-level
localHoldoutsdatafile section so this SDK can be served the same backward-compatible datafile shape that Python (#517) and Ruby (#400) already consume.Section membership — not
includedRules— is now the sole signal for holdout scope:holdouts→ ALL entries are global. Any strayincludedRuleson these entries is stripped at parse time and ignored.localHoldouts→ ALL entries are local. Entries without a non-emptyincludedRuleslist are invalid and skipped with an error log (no fallback to global application).Old datafiles that emit only
holdoutscontinue to parse unchanged.Changes
Sources/Data Model/Project.swift— decode the new top-levellocalHoldoutsarray; default to[]when absent. Include it inCodingKeysandEquatable.Sources/Data Model/HoldoutConfig.swift— section-aware mapping. Newinit(globalHoldouts:localHoldouts:). Global-section entries getincludedRulesstripped; local-section entries withoutincludedRulesare logged and excluded. Legacyinit(allholdouts:)andallHoldoutssetter are preserved (they partition byincludedRules == niland then apply the same section semantics) so existing tests/fixtures keep working.Sources/Data Model/ProjectConfig.swift— constructHoldoutConfigfrom bothproject.holdoutsandproject.localHoldoutssections.Sources/Data Model/Holdout.swift— docstring onisGlobalclarifies that section membership is the source of truth;HoldoutConfigstripsincludedRulesfromholdouts-section entries so the property stays consistent.Tests
Tests/OptimizelyTests-DataModel/HoldoutConfigTests.swift— new tests for the section-aware semantics: global-sectionincludedRulesare stripped/ignored, local section withoutincludedRulesis excluded, mixed valid/invalid local entries, both-sections partition enforced, backward compat with nolocalHoldoutssection.Tests/OptimizelyTests-DataModel/ProjectTests.swift— new tests forlocalHoldoutsdecoding (missing key defaults to[]; present key decodes alongsideholdouts).Tests/OptimizelyTests-DataModel/ProjectConfigTests.swift— updated existingtestGenerateProjectConfigMapWithHoldoutsto put local holdouts in the newlocalHoldoutssection (sinceincludedRulesonholdouts-section entries is now stripped).Reference PRs
Jira
FSSDK-12760