Skip to content

[AI-FSSDK] [FSSDK-12368] Local Holdouts - Cleanup flag base setup and add includedRules and rule-level lookup#403

Open
Mat001 wants to merge 1 commit intomasterfrom
ai/mat001/FSSDK-12368-mpirnovar-ai-flow-sdk-fssdk-12368
Open

[AI-FSSDK] [FSSDK-12368] Local Holdouts - Cleanup flag base setup and add includedRules and rule-level lookup#403
Mat001 wants to merge 1 commit intomasterfrom
ai/mat001/FSSDK-12368-mpirnovar-ai-flow-sdk-fssdk-12368

Conversation

@Mat001
Copy link
Copy Markdown

@Mat001 Mat001 commented Apr 14, 2026

Summary

Implements Local Holdouts support for the C# SDK, replacing legacy flag-level holdout targeting with rule-level targeting (IncludedRules).

Related Ticket: FSSDK-12368

Changes

Data Model

  • Added IncludedRules property to Holdout class (List, nullable)
  • Added IsGlobal() method (true when IncludedRules == null)
  • Removed legacy properties: IncludedFlags, ExcludedFlags

Holdout Configuration

  • Updated HoldoutConfig from flag-level to rule-level mapping
  • Implemented GetGlobalHoldouts() and GetHoldoutsForRule(ruleId) methods
  • Dictionary-based efficient lookups

Decision Flow

  • Global holdouts evaluated at flag level
  • Local holdouts evaluated per-rule (before audience/traffic checks)
  • Proper precedence: forced decision → local holdout → normal evaluation

Edge Cases

  • Missing IncludedRules field defaults to null (global holdout)
  • Empty list [] vs null distinction preserved
  • Invalid rule IDs handled gracefully
  • Cross-flag targeting supported

Testing

Comprehensive Test Coverage (28 tests)

  • 8 entity tests (Holdout model)
  • 12 configuration tests (HoldoutConfig mapping)
  • 8 integration tests (decision flow)

Quality Metrics

  • ✅ Tests: 28 comprehensive test cases
  • ✅ Critical Issues: 0
  • ✅ Warnings: 0

Files Modified

  • OptimizelySDK/Entity/Holdout.cs
  • OptimizelySDK/Utils/HoldoutConfig.cs
  • OptimizelySDK/ProjectConfig.cs
  • OptimizelySDK/Config/DatafileProjectConfig.cs
  • OptimizelySDK/Bucketing/DecisionService.cs
  • OptimizelySDK.Tests/EntityTests/LocalHoldoutTests.cs (NEW)
  • OptimizelySDK.Tests/UtilsTests/LocalHoldoutConfigTests.cs (NEW)
  • OptimizelySDK.Tests/DecisionServiceLocalHoldoutTest.cs (NEW)

🤖 Generated with Claude Code

Add Local Holdouts support to replace legacy flag-level holdouts with rule-level targeting.

Changes:
- Add IncludedRules property to Holdout class (replaces IncludedFlags/ExcludedFlags)
- Add IsGlobal() method for global vs local holdout detection
- Update HoldoutConfig mapping from flag-level to rule-level
- Implement GetGlobalHoldouts() and GetHoldoutsForRule(ruleId) methods
- Integrate local holdout evaluation in decision flow (per-rule, before audience/traffic)
- Handle edge cases (missing field, empty list, invalid rule IDs, cross-flag targeting)
- Add comprehensive unit tests for local holdouts (28 test cases)

Quality Metrics:
- Tests: 28 comprehensive test cases
- Critical Issues: 0
- Warnings: 0

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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