Skip to content

[AI-FSSDK] (DO NOT REVIEW) [FSSDK-12265] Add experiments field to Holdout data model#436

Open
muzahidul-opti wants to merge 2 commits intomasterfrom
ai/muzahidul-opti/FSSDK-12265
Open

[AI-FSSDK] (DO NOT REVIEW) [FSSDK-12265] Add experiments field to Holdout data model#436
muzahidul-opti wants to merge 2 commits intomasterfrom
ai/muzahidul-opti/FSSDK-12265

Conversation

@muzahidul-opti
Copy link

@muzahidul-opti muzahidul-opti commented Feb 3, 2026

Summary

  • Added Experiments []string field to Holdout struct in both datafile entities and runtime entities
  • Added IsLocal() bool method to Holdout that returns true if the experiments slice is not empty
  • Added experimentHoldoutsMap to DatafileProjectConfig for mapping experiment IDs to holdouts
  • Updated holdout mapper to build experiment-to-holdout mappings
  • Added GetHoldoutsForExperiment(experimentID string) method to retrieve holdouts for a specific experiment
  • Added GetHoldoutList() method to retrieve all holdouts
  • Implemented backward compatibility with omitempty JSON tag for the experiments field
  • Added comprehensive unit tests covering:
    • Experiments field serialization and deserialization
    • IsLocal() method functionality
    • Experiment-to-holdout mapping
    • Multiple experiments per holdout
    • Empty experiments arrays
    • Backward compatibility with datafiles without experiments field

Changes

  • pkg/config/datafileprojectconfig/entities/entities.go: Added Experiments field to datafile Holdout struct
  • pkg/entities/experiment.go: Added Experiments field and IsLocal() method to runtime Holdout struct
  • pkg/config/datafileprojectconfig/mappers/holdout.go: Updated mapper to build experiment-to-holdout mappings
  • pkg/config/datafileprojectconfig/config.go: Added experimentHoldoutsMap, GetHoldoutsForExperiment(), and GetHoldoutList() methods
  • pkg/config/datafileprojectconfig/config_test.go: Added comprehensive unit tests
  • pkg/config/datafileprojectconfig/mappers/holdout_test.go: Added tests for experiment mapping

Test Results

All tests pass successfully:

  • TestHoldout_ExperimentsField ✓
  • TestHoldout_IsLocal ✓
  • TestGetHoldoutsForExperiment ✓
  • TestExperimentHoldoutsMapping_MultipleExperiments ✓
  • TestExperimentHoldoutsMapping_EmptyExperiments ✓
  • TestHoldout_BackwardCompatibility ✓
  • TestHoldout_JSONSerialization ✓
  • TestMapHoldoutsWithExperiments ✓
  • TestMapHoldoutsMultipleExperiments ✓

Jira ticket: FSSDK-12265

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