Skip to content

Conversation

@Mat001
Copy link
Contributor

@Mat001 Mat001 commented Dec 12, 2025

Add pti config changes to go-sdk required to support holdouts in agent:

  • Added Holdouts field to OptimizelyConfig struct - exposes holdouts as a top-level array in the config API response
  • Added OptimizelyHoldout type with ID, Key, Audiences, and VariationsMap fields - matches the structure of experiments/features
  • Added GetHoldoutList() and GetHoldoutsForFlag(featureKey) methods to ProjectConfig interface - allows querying holdouts from the datafile

Implementation Details:

  • Holdouts are parsed from the datafile and converted to the OptimizelyConfig format with serialized audience conditions
  • Each holdout includes an "off" variation (with featureEnabled: false) representing the control group
  • Properly marshals to JSON with "holdouts" field for Agent's /v1/config endpoint

https://optimizely-ext.atlassian.net/browse/FSSDK-11559

@Mat001 Mat001 changed the title Mpirnovar fix activate endpoint holdouts [FSSDK-] Mpirnovar fix activate endpoint holdouts Dec 12, 2025
@Mat001 Mat001 changed the title [FSSDK-] Mpirnovar fix activate endpoint holdouts [FSSDK-11559] Mpirnovar fix activate endpoint holdouts Dec 12, 2025
This change exposes holdouts in the OptimizelyConfig API, allowing
clients to retrieve holdout information via the config endpoint.

Changes:
- Added OptimizelyHoldout type with id, key, audiences, and variationsMap
- Added Holdouts field to OptimizelyConfig struct
- Added GetHoldoutList() method to ProjectConfig interface
- Implemented getHoldouts() helper to convert holdout entities to OptimizelyHoldouts
- Populated holdouts in NewOptimizelyConfig constructor

This enables Agent and other clients to expose holdout configuration
through their /config endpoints.
@Mat001 Mat001 force-pushed the mpirnovar-fix-activate-endpoint-holdouts branch from 2d2cab3 to 0cff19a Compare December 12, 2025 22:36
This test verifies that:
- Holdouts field is present in OptimizelyConfig
- Holdouts field is initialized as empty array when no holdouts exist
- Holdouts field correctly marshals to JSON
@Mat001 Mat001 force-pushed the mpirnovar-fix-activate-endpoint-holdouts branch from e999974 to def69a1 Compare December 12, 2025 22:41
Mat001 and others added 2 commits December 12, 2025 14:45
Updated all MockProjectConfig implementations to include the GetHoldoutList()
method required by the config.ProjectConfig interface:

- pkg/cmab/service_test.go: Added GetHoldoutList() to MockProjectConfig
- pkg/decision/evaluator/audience_evaluator_test.go: Added GetHoldoutList() to MockProjectConfig
- pkg/client/fixtures_test.go: Added GetHoldoutList() and GetHoldoutsForFlag() to MockProjectConfig
- pkg/config/static_manager_test.go: Updated test assertion to expect empty Holdouts array instead of nil

This fixes compilation errors in CMAB and audience evaluator tests where the
mock implementations were missing the new interface method.
The Holdouts field was not part of the original TDD requirements and is not
present in JavaScript or C# SDKs. This field was causing FSC test failures.

Agent doesn't need holdouts exposed in OptimizelyConfig because:
- Decision logic (GetHoldoutsForFlag, GetHoldoutList) works internally
- Agent's /v1/decide endpoint uses go-sdk's decision service which already
  handles holdouts from v2.3.0
- OptimizelyConfig is metadata, not for decision-making

Changes:
- Removed Holdouts field from OptimizelyConfig struct
- Removed OptimizelyHoldout type
- Removed getHoldouts() and getHoldoutAudiences() helper functions
- Removed holdout-specific tests (TestOptlyConfigIncludesHoldouts,
  TestOptlyConfigWithHoldouts)
- Updated TestStaticGetOptimizelyConfig to not expect Holdouts field

The ProjectConfig interface methods (GetHoldoutList, GetHoldoutsForFlag)
remain as they are required by TDD for internal decision logic.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@Mat001
Copy link
Contributor Author

Mat001 commented Dec 13, 2025

PR no longer relevant.

@Mat001 Mat001 closed this Dec 13, 2025
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.

2 participants