Skip to content

Conversation

@Mat001
Copy link
Contributor

@Mat001 Mat001 commented Oct 10, 2025

Per jira ticket:

  • Add a new method named getVariationFromHoldout and implement holdout evaluation logic.
  • Update the getVariationForFeatureExperiment method to incorporate holdout evaluation logic.

Changes:

  1. pkg/entities/experiment.go - Added Holdout entity
  2. pkg/config/interface.go - Added GetHoldoutsForFlag interface method
  3. pkg/config/datafileprojectconfig/config.go - Implemented stub
  4. pkg/decision/entities.go - Added Holdout source constant
  5. pkg/decision/holdout_service.go - NEW holdout service implementation
  6. pkg/decision/composite_feature_service.go - Integrated holdout service
  7. pkg/decision/composite_feature_service_test.go - Updated test expectations
  8. pkg/decision/evaluator/audience_evaluator_test.go - Added mock method
  9. pkg/cmab/service_test.go - Added mock method

Jira ticket:
https://optimizely-ext.atlassian.net/browse/FSSDK-11552

@Mat001 Mat001 self-assigned this Oct 10, 2025
Copy link

@prisma-cloud-devsecops prisma-cloud-devsecops bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prisma Cloud has found errors in this PR ⬇️

Mat001 and others added 3 commits November 13, 2025 14:15
- Changed loop from 'for _, holdout := range holdouts' to 'for i := range holdouts'
- Created proper pointer 'holdout := &holdouts[i]' to avoid address-of-iteration-variable issue
- This fixes the security warning where all iterations would point to the same memory location
- All tests passing

Resolves Prisma Cloud security scan: Incorrect access of indexable resource
- Implemented holdout parsing from datafile with global/specific/exclusion logic
- Added MapHoldouts() to process holdout relationships with feature flags
- Implemented GetHoldoutsForFlag() to retrieve applicable holdouts per flag
- Fixed bucketer initialization to use pointer (interface value)
- Created comprehensive unit tests for HoldoutService (11 test cases)
- Added integration test with real bucketer and evaluator
- Added GetHoldoutsForFlag() mock method to helpers_test.go

All tests passing (decision and config packages)

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

Co-Authored-By: Claude <[email protected]>
@Mat001 Mat001 marked this pull request as ready for review November 13, 2025 22:51
- Added 3 unit tests for GetHoldoutsForFlag() in config_test.go
- Created holdout_test.go with 7 comprehensive mapper tests:
  - Empty holdouts
  - Global holdouts with exclusions
  - Specific holdouts with inclusions
  - Non-running holdouts filtering
  - Mixed global and specific holdouts
  - Audience conditions mapping
  - Variations and traffic allocation mapping
- Fixed govet shadow linting error in holdout_service.go line 105

All tests passing. Improves code coverage for new holdout functionality.

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

Co-Authored-By: Claude <[email protected]>
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