Skip to content

feat(experimentation): default to control when rollout segment is created#7905

Draft
gagantrivedi wants to merge 1 commit into
mainfrom
feat/experiment-rollout-default-control-allocation
Draft

feat(experimentation): default to control when rollout segment is created#7905
gagantrivedi wants to merge 1 commit into
mainfrom
feat/experiment-rollout-default-control-allocation

Conversation

@gagantrivedi

Copy link
Copy Markdown
Member

Thanks for submitting a PR! Please check the boxes below:

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Contributes to experiment rollout work.

Warning

WIP / draft.

When a feature is first added to an experiment's rollout — i.e. the moment the rollout system segment is created — we now zero every variant's allocation on the feature's environment-default feature state. Control is the implicit unallocated remainder, so this gives control 100% of out-of-rollout traffic while the experiment runs.

  • The rollout segment override is unchanged: it keeps the experiment's own split (spec.multivariate_values).
  • This only runs when the rollout segment is first created. Tuning the rollout of a running/paused experiment leaves the default allocations alone, so a later manual edit to the default survives.
  • Reuses the version-aware update_flag path (v1/v2) rather than mutating allocations in place.

How did you test this code?

Added unit tests (make test):

  • Service (test_services.py):
    • test_apply_experiment_rollout__first_rollout__zeroes_default_allocations — default allocations zeroed, override split preserved.
    • test_apply_experiment_rollout__existing_segment__leaves_default_allocations — a later manual edit to the default survives a rollout update.
  • View (test_experiment_views.py):
    • test_post__with_experiment_rollout__zeroes_default_allocations — end-to-end create-with-rollout zeroes the default and preserves the override split (both user and master_api_key).

mypy, ruff, and flagsmith-lint-tests all clean.

…ated

When a feature is first added to an experiment's rollout, zero every
variant's allocation on the feature's environment-default feature state
so control (the unallocated remainder) receives 100% of out-of-rollout
traffic. The rollout segment override keeps the experiment's own split.

This only runs when the rollout segment is first created; tuning the
rollout of a running experiment leaves the default allocations alone.
@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Jun 30, 2026 5:17am
flagsmith-frontend-preview Ignored Ignored Preview Jun 30, 2026 5:17am
flagsmith-frontend-staging Ignored Ignored Preview Jun 30, 2026 5:17am

Request Review

@github-actions github-actions Bot added api Issue related to the REST API feature New feature or request labels Jun 29, 2026
@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.77778% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 98.56%. Comparing base (1d1cc9c) to head (8275f6d).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
api/experimentation/services.py 93.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7905      +/-   ##
==========================================
- Coverage   98.62%   98.56%   -0.07%     
==========================================
  Files        1488     1488              
  Lines       58543    58558      +15     
==========================================
- Hits        57737    57716      -21     
- Misses        806      842      +36     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Jun 30, 2026
@gagantrivedi gagantrivedi force-pushed the feat/experiment-rollout-default-control-allocation branch from 8451662 to 8275f6d Compare June 30, 2026 05:20
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Issue related to the REST API feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant