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.

@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 Jul 14, 2026 11:14am
flagsmith-frontend-preview Ignored Ignored Preview Jul 14, 2026 11:14am
flagsmith-frontend-staging Ignored Ignored Preview Jul 14, 2026 11:14am

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.57%. Comparing base (62a8143) to head (cf19595).
⚠️ Report is 1 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.63%   98.57%   -0.07%     
==========================================
  Files        1497     1497              
  Lines       59261    59276      +15     
==========================================
- Hits        58455    58434      -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
…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.
@gagantrivedi gagantrivedi force-pushed the feat/experiment-rollout-default-control-allocation branch from 8275f6d to cf19595 Compare July 14, 2026 11:14
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Jul 14, 2026
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 2f52a8c7-5e9a-4fb9-95ca-6eed4d2f2953

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

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