Skip to content

[AI-FSSDK] [FSSDK-12760] add localHoldouts to datafile for backward compatibility#638

Open
jaeopt wants to merge 1 commit into
masterfrom
ai/jaeopt/FSSDK-12760-local-datafile
Open

[AI-FSSDK] [FSSDK-12760] add localHoldouts to datafile for backward compatibility#638
jaeopt wants to merge 1 commit into
masterfrom
ai/jaeopt/FSSDK-12760-local-datafile

Conversation

@jaeopt

@jaeopt jaeopt commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds support for the new top-level localHoldouts datafile 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 stray includedRules on these entries is stripped at parse time and ignored.
  • localHoldouts → ALL entries are local. Entries without a non-empty includedRules list are invalid and skipped with an error log (no fallback to global application).

Old datafiles that emit only holdouts continue to parse unchanged.

Changes

  • Sources/Data Model/Project.swift — decode the new top-level localHoldouts array; default to [] when absent. Include it in CodingKeys and Equatable.
  • Sources/Data Model/HoldoutConfig.swift — section-aware mapping. New init(globalHoldouts:localHoldouts:). Global-section entries get includedRules stripped; local-section entries without includedRules are logged and excluded. Legacy init(allholdouts:) and allHoldouts setter are preserved (they partition by includedRules == nil and then apply the same section semantics) so existing tests/fixtures keep working.
  • Sources/Data Model/ProjectConfig.swift — construct HoldoutConfig from both project.holdouts and project.localHoldouts sections.
  • Sources/Data Model/Holdout.swift — docstring on isGlobal clarifies that section membership is the source of truth; HoldoutConfig strips includedRules from holdouts-section entries so the property stays consistent.

Tests

  • Tests/OptimizelyTests-DataModel/HoldoutConfigTests.swift — new tests for the section-aware semantics: global-section includedRules are stripped/ignored, local section without includedRules is excluded, mixed valid/invalid local entries, both-sections partition enforced, backward compat with no localHoldouts section.
  • Tests/OptimizelyTests-DataModel/ProjectTests.swift — new tests for localHoldouts decoding (missing key defaults to []; present key decodes alongside holdouts).
  • Tests/OptimizelyTests-DataModel/ProjectConfigTests.swift — updated existing testGenerateProjectConfigMapWithHoldouts to put local holdouts in the new localHoldouts section (since includedRules on holdouts-section entries is now stripped).

Reference PRs

Jira

FSSDK-12760

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant