Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(experiments): Add release mode choice when shipping a variant (#58828)

Juraj Majerikece9c0471a8e
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index bd2d8620a133..df28b4d0b97c 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -300,6 +300,7 @@ export const FEATURE_FLAGS = {
EXPERIMENT_FUNNEL_DWH_SUPPORT: 'experiment-funnel-dwh-support', // owner: @rodrigoi #team-experiments
EXPERIMENT_SESSION_REPLAYS_SKILL: 'experiment-session-replays-skill', // owner: @rodrigoi #team-experiments
EXPERIMENTS_DW_AA_TEST: 'experiments-dw-aa-test', // owner: @rodrigoi #team-experiments
+ EXPERIMENTS_SHIP_VARIANT_RELEASE_MODE: 'experiments-ship-variant-release-mode', // owner: @jurajmajerik #team-experiments
EXPERIMENTS_SHOW_SQL: 'experiments-show-sql', // owner: @jurajmajerik #team-experiments
EXPERIMENTS_SYNC_QUERIES: 'experiments-sync-queries', // owner: @andehen #team-experiments
EXPERIMENTS_TEMPLATES: 'experiments-templates', // owner: @rodrigoi #team-experiments
diff --git a/frontend/src/scenes/experiments/ExperimentView/components.tsx b/frontend/src/scenes/experiments/ExperimentView/components.tsx
index ec5c911542c7..2a629c9b3e5b 100644
--- a/frontend/src/scenes/experiments/ExperimentView/components.tsx
+++ b/frontend/src/scenes/experiments/ExperimentView/components.tsx
@@ -6,9 +6,12 @@ import { TextMorph } from 'torph/react'
import {
IconArchive,
+ IconCheckCircle,
IconCopy,
IconEye,
IconFlask,
+ IconGlobe,
+ IconList,
IconPause,
IconPlay,
IconPlusSmall,
@@ -35,6 +38,7 @@ import { useHogfetti } from 'lib/components/Hogfetti/Hogfetti'
import { InsightLabel } from 'lib/components/InsightLabel'
import { PropertyFilterButton } from 'lib/components/PropertyFilters/components/PropertyFilterButton'
import { superpowersLogic } from 'lib/components/Superpowers/superpowersLogic'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { useOnMountEffect } from 'lib/hooks/useOnMountEffect'
import { usePageVisibility } from 'lib/hooks/usePageVisibility'
import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'
@@ -626,7 +630,10 @@ export function FinishExperimentModal(): JSX.Element {
const { isFinishExperimentModalOpen } = useValues(modalsLogic)
const { aggregationLabel } = useValues(groupsModel)
+ const showReleaseModeChoice = useFeatureFlag('EXPERIMENTS_SHIP_VARIANT_RELEASE_MODE', 'test')
+
const [selectedVariantKey, setSelectedVariantKey] = useState<string | null>()
+ const [releaseToEveryone, setReleaseToEveryone] = useState<boolean>(false)
useEffect(() => {
if (experiment.parameters?.feature_flag_variants?.length > 1) {
@@ -648,10 +655,32 @@ export function FinishExperimentModal(): JSX.Element {
if (isSingleVariantShipped || !selectedVariantKey) {
endExperimentWithoutShipping()
} else {
- finishExperiment({ selectedVariantKey })
+ // Control variant: preserve pre-flag behavior (prepend catch-all release condition).
+ // Test variant: honor the user's radio choice.
+ finishExperiment({
+ selectedVariantKey,
+ releaseToEveryone: showReleaseModeChoice ? releaseToEveryone : true,
+ })
}
}
+ const releaseOptions = [
+ {
+ value: false,
+ icon: <IconList className="text-lg" />,
+ label: 'Roll out to the experiment population',
+ recommended: true,
+ description: `Only ${aggregationTargetName} already in the experiment see the variant. Per-user variant overrides still apply.`,
+ },
+ {
+ value: true,
+ icon: <IconGlobe className="text-lg" />,
+ label: `Roll out to all ${aggregationTargetName}`,
+ recommended: false,
+ description: `All ${aggregationTargetName} see the variant, including those outside the experiment. Per-user variant overrides are bypassed.`,
+ },
+ ] as const
+
return (
<>
<LemonModal
@@ -695,34 +724,95 @@ export function FinishExperimentModal(): JSX.Element {
</LemonBanner>
</div>
) : (
- <div>
- <LemonLabel>Variant to keep</LemonLabel>
- <div className="text-sm text-secondary mb-2">
- The selected variant will be rolled out to <b>100% of {aggregationTargetName}</b>.
+ <>
+ <div>
+ <LemonLabel>Variant to keep</LemonLabel>
+ {!showReleaseModeChoice && (
+ <div className="text-sm text-secondary mb-2">
+ The selected variant will be rolled out to{' '}
+ <b>100% of {aggregationTargetName}</b>.
+ </div>
+ )}
+ <div className="w-1/2 mt-1">
+ <LemonSelect
+ className="w-full"
+ data-attr="metrics-selector"
+ value={selectedVariantKey}
+ placeholder="Select a variant"
+ onChange={(variantKey) => {
+ setSelectedVariantKey(variantKey)
+ }}
+ allowClear={true}
+ options={
+ experiment.feature_flag?.filters.multivariate?.variants?.map(({ key }) => ({
+ value: key,
+ label: (
+ <div className="deprecated-space-x-2 inline-flex">
+ <VariantTag variantKey={key} />
+ </div>
+ ),
+ })) || []
+ }
+ />
+ </div>
</div>
- <div className="w-1/2">
- <LemonSelect
- className="w-full"
- data-attr="metrics-selector"
- value={selectedVariantKey}
- placeholder="Select a variant"
- onChange={(variantKey) => {
- setSelectedVariantKey(variantKey)
- }}
- allowClear={true}
- options={
- experiment.feature_flag?.filters.multivariate?.variants?.map(({ key }) => ({
- value: key,
- label: (
- <div className="deprecated-space-x-2 inline-flex">
- <VariantTag variantKey={key} />
+ {showReleaseModeChoice && selectedVariantKey && (
+ <div className="flex flex-col gap-2">
+ <LemonLabel>How to release this variant</LemonLabel>
+ <div
+ className="grid grid-cols-1 md:grid-cols-2 gap-3"
+ role="radiogroup"
+ aria-label="How to release this variant"
+ data-attr="ship-variant-release-mode"
+ >
+ {releaseOptions.map((option) => {
+ const isSelected = releaseToEveryone === option.value
+ return (
+ <div
+ key={String(option.value)}
+ role="radio"
+ aria-checked={isSelected}
+ tabIndex={0}
+ className={`rounded p-3 cursor-pointer transition-colors ${
+ isSelected
+ ? 'bg-accent-highlight-light border-2 border-accent'
+ : 'border bg-surface-primary border-primary hover:bg-fill-button-tertiary-hover'
+ }`}
+ onClick={() => setReleaseToEveryone(option.value)}
+ onKeyDown={(e) => {
+ if (e.key === 'Enter' || e.key === ' ') {
+ e.preventDefault()
+ setReleaseToEveryone(option.value)
+ }
+ }}
+ data-attr={`ship-variant-release-mode-${
+ option.value ? 'everyone' : 'population'
+ }`}
+ >
+ <div className="flex flex-col gap-1">
+ <div className="flex items-center gap-2">
+ {option.icon}
+ <span className="font-medium flex-1">
+ {option.label}
+ {option.recommended && (
+ <span className="text-secondary text-xs font-normal ml-1">
+ (recommended)
+ </span>
+ )}
+ </span>
+ {isSelected && (
+ <IconCheckCircle className="text-accent text-base" />
+ )}
+ </div>
+ <span className="text-xs text-muted">{option.description}</span>
+ </div>
</div>
- ),
- })) || []
- }
- />
- </div>
- </div>
+ )
+ })}
+ </div>
+ </div>
+ )}
+ </>
)}
<ConclusionForm />
{!isSingleVariantShipped && (
diff --git a/frontend/src/scenes/experiments/experimentLogic.test.ts b/frontend/src/scenes/experiments/experimentLogic.test.ts
index bdee7b887af5..4d1c4315b69d 100644
--- a/frontend/src/scenes/experiments/experimentLogic.test.ts
+++ b/frontend/src/scenes/experiments/experimentLogic.test.ts
@@ -1164,7 +1164,7 @@ describe('experimentLogic', () => {
expect(keyed.values.experiment.status).toBe('running')
await expectLogic(keyed, () => {
- keyed.actions.finishExperiment({ selectedVariantKey: 'test' })
+ keyed.actions.finishExperiment({ selectedVariantKey: 'test', releaseToEveryone: false })
})
.toDispatchActions(['finishExperiment', 'setExperiment'])
.toFinishAllListeners()
@@ -1173,6 +1173,7 @@ describe('experimentLogic', () => {
expect.stringContaining(`/experiments/${experiment.id}/ship_variant`),
{
variant_key: 'test',
+ release_to_everyone: false,
conclusion: 'won',
conclusion_comment: 'Test variant won clearly',
}
@@ -1200,7 +1201,7 @@ describe('experimentLogic', () => {
logic.actions.setExperiment(experiment)
await expectLogic(logic, () => {
- logic.actions.finishExperiment({ selectedVariantKey: 'test' })
+ logic.actions.finishExperiment({ selectedVariantKey: 'test', releaseToEveryone: false })
}).toFinishAllListeners()
expect(errorMock).toHaveBeenCalledWith('Experiment has not been launched yet.')
@@ -1215,7 +1216,7 @@ describe('experimentLogic', () => {
logic.actions.setExperiment(experiment)
await expectLogic(logic, () => {
- logic.actions.finishExperiment({ selectedVariantKey: 'test' })
+ logic.actions.finishExperiment({ selectedVariantKey: 'test', releaseToEveryone: false })
}).toFinishAllListeners()
expect(errorMock).toHaveBeenCalledWith('Failed to ship variant')
@@ -1238,7 +1239,7 @@ describe('experimentLogic', () => {
logic.actions.setExperiment(expWithFlag)
await expectLogic(logic, () => {
- logic.actions.finishExperiment({ selectedVariantKey: 'test' })
+ logic.actions.finishExperiment({ selectedVariantKey: 'test', releaseToEveryone: false })
}).toFinishAllListeners()
// Should show approval required toast with change request ID
diff --git a/frontend/src/scenes/experiments/experimentLogic.tsx b/frontend/src/scenes/experiments/experimentLogic.tsx
index 5243ec7196f2..35534960531e 100644
--- a/frontend/src/scenes/experiments/experimentLogic.tsx
+++ b/frontend/src/scenes/experiments/experimentLogic.tsx
@@ -657,7 +657,13 @@ export const experimentLogic = kea<experimentLogicType>([
launchExperiment: true,
endExperiment: true,
endExperimentWithoutShipping: true,
- finishExperiment: ({ selectedVariantKey }: { selectedVariantKey: string }) => ({ selectedVariantKey }),
+ finishExperiment: ({
+ selectedVariantKey,
+ releaseToEveryone,
+ }: {
+ selectedVariantKey: string
+ releaseToEveryone: boolean
+ }) => ({ selectedVariantKey, releaseToEveryone }),
pauseExperiment: true,
resumeExperiment: true,
archiveExperiment: true,
@@ -1684,12 +1690,13 @@ export const experimentLogic = kea<experimentLogicType>([
})
}
},
- finishExperiment: async ({ selectedVariantKey }) => {
+ finishExperiment: async ({ selectedVariantKey, releaseToEveryone }) => {
try {
const response: Experiment = await api.create(
`/api/projects/${values.currentProjectId}/experiments/${values.experimentId}/ship_variant`,
{
variant_key: selectedVariantKey,
+ release_to_everyone: releaseToEveryone,
conclusion: values.experiment.conclusion,
conclusion_comment: values.experiment.conclusion_comment,
}
@@ -1697,7 +1704,11 @@ export const experimentLogic = kea<experimentLogicType>([
actions.setExperiment(response)
refreshTreeItem('experiment', String(values.experimentId))
actions.closeFinishExperimentModal()
- lemonToast.success('Experiment ended. The selected variant has been rolled out to all users.')
+ lemonToast.success(
+ releaseToEveryone
+ ? 'Experiment ended. The selected variant has been rolled out to all users.'
+ : 'Experiment ended. The selected variant has been rolled out to the experiment population.'
+ )
// Trigger Hogfetti celebration with cascading delays
if (values.experiment.conclusion === ExperimentConclusion.Won) {
diff --git a/products/experiments/backend/experiment_service.py b/products/experiments/backend/experiment_service.py
index 5fc7570b5281..d2d692c1ba05 100644
--- a/products/experiments/backend/experiment_service.py
+++ b/products/experiments/backend/experiment_service.py
@@ -1400,15 +1400,20 @@ class ExperimentService:
experiment: Experiment,
variant_key: str,
*,
+ release_to_everyone: bool = False,
conclusion: str | None = None,
conclusion_comment: str | None = None,
request: Any,
) -> Experiment:
- """Ship a variant to 100% of users, optionally ending the experiment.
+ """Ship a variant and (optionally) end the experiment.
- Rewrites the feature flag so the selected variant is served to everyone.
- Existing release conditions (flag groups) are preserved so the change can
- be rolled back by deleting the auto-added release condition in the flag UI.
+ Updates the feature flag so the selected variant gets 100% of the variant
+ distribution. By default (``release_to_everyone=False``) existing release
+ conditions on the flag are preserved untouched — the variant is served
+ only to users who already match them, and any per-user variant overrides
+ continue to apply. Pass ``release_to_everyone=True`` to also prepend a
+ catch-all release condition that rolls the variant out to 100% of users
+ (overrides any existing release conditions and per-user overrides).
Can be called on both running and stopped experiments — supports the
workflow where a user ends an experiment first, then ships the winner
@@ -1435,7 +1440,9 @@ class ExperimentService:
if not any(v["key"] == variant_key for v in variants):
raise ValidationError(f"Variant '{variant_key}' not found on feature flag.")
- new_filters = self._transform_filters_for_winning_variant(flag.filters, variant_key)
+ new_filters = self._transform_filters_for_winning_variant(
+ flag.filters, variant_key, release_to_everyone=release_to_everyone
+ )
# Update the flag through the serializer to preserve the approval
# workflow. If change-request approval is required, this raises
@@ -1469,7 +1476,9 @@ class ExperimentService:
experiment.conclusion_comment = conclusion_comment
experiment.save()
- self._report_experiment_variant_shipped(experiment, variant_key=variant_key, request=request)
+ self._report_experiment_variant_shipped(
+ experiment, variant_key=variant_key, release_to_everyone=release_to_everyone, request=request
+ )
if was_running:
self._report_experiment_ended(experiment, request=request)
@@ -1479,13 +1488,31 @@ class ExperimentService:
def _transform_filters_for_winning_variant(
current_filters: dict,
variant_key: str,
+ *,
+ release_to_everyone: bool = False,
) -> dict:
- """Port of frontend transformFiltersForWinningVariant().
+ """Rewrite flag filters so the selected variant gets 100% of the variant distribution.
- Rewrites flag filters so that the selected variant gets 100% rollout
- and all others get 0%. Prepends a catch-all release condition and
- preserves existing release conditions (flag groups) for rollback.
+ When ``release_to_everyone`` is False (default), existing release conditions on
+ the flag are preserved untouched: the variant is served only to users who
+ already match them, and any per-user variant overrides keep applying.
+
+ When ``release_to_everyone`` is True, a catch-all release condition is prepended
+ that rolls the variant out to 100% of users — note that under top-down
+ first-match evaluation this overrides any existing release conditions and
+ per-user variant overrides below it.
"""
+ groups = list(current_filters.get("groups", []))
+ if release_to_everyone:
+ groups = [
+ {
+ "properties": [],
+ "rollout_percentage": 100,
+ "description": "Added automatically when the experiment was ended to keep only one variant.",
+ },
+ *groups,
+ ]
+
return {
"aggregation_group_type_index": current_filters.get("aggregation_group_type_index"),
"payloads": current_filters.get("payloads", {}),
@@ -1499,14 +1526,7 @@ class ExperimentService:
for v in current_filters.get("multivariate", {}).get("variants", [])
],
},
- "groups": [
- {
- "properties": [],
- "rollout_percentage": 100,
- "description": "Added automatically when the experiment was ended to keep only one variant.",
- },
- *(current_filters.get("groups", [])),
- ],
+ "groups": groups,
}
def _report_experiment_variant_shipped(
@@ -1514,6 +1534,7 @@ class ExperimentService:
experiment: Experiment,
*,
variant_key: str,
+ release_to_everyone: bool = False,
request: Any | None = None,
) -> None:
if request is None:
@@ -1521,6 +1542,7 @@ class ExperimentService:
metadata = experiment.get_analytics_metadata()
metadata["variant_key"] = variant_key
+ metadata["release_to_everyone"] = release_to_everyone
metadata["parameters"] = experiment.parameters
report_user_action(
diff --git a/products/experiments/backend/presentation/serializers.py b/products/experiments/backend/presentation/serializers.py
index 7a02cde0350f..11cdb9fadaf1 100644
--- a/products/experiments/backend/presentation/serializers.py
+++ b/products/experiments/backend/presentation/serializers.py
@@ -480,7 +480,16 @@ class EndExperimentSerializer(serializers.Serializer):
class ShipVariantSerializer(EndExperimentSerializer):
- variant_key = serializers.CharField(help_text="The key of the variant to ship to 100% of users.")
+ variant_key = serializers.CharField(help_text="The key of the variant to ship.")
+ release_to_everyone = serializers.BooleanField(
+ default=False,
+ help_text=(
+ "If true, prepend a release condition to the feature flag that rolls the variant out to 100% of users, "
+ "overriding any existing release conditions on the flag. If false (default), only update the variant "
+ "distribution — existing release conditions are preserved and the variant is served only to users who "
+ "already match them."
+ ),
+ )
class CopyExperimentToProjectSerializer(serializers.Serializer):
diff --git a/products/experiments/backend/presentation/views.py b/products/experiments/backend/presentation/views.py
index ce95faaf0b42..c9765a6af317 100644
--- a/products/experiments/backend/presentation/views.py
+++ b/products/experiments/backend/presentation/views.py
@@ -287,11 +287,14 @@ class EnterpriseExperimentsViewSet(
@action(methods=["POST"], detail=True, url_path="ship_variant", required_scopes=["experiment:write"])
def ship_variant(self, request: Request, *args: Any, **kwargs: Any) -> Response:
"""
- Ship a variant to 100% of users and (optionally) end the experiment.
+ Ship a variant and (optionally) end the experiment.
- Rewrites the feature flag so that the selected variant is served to everyone.
- Existing release conditions (flag groups) are preserved so the change can be
- rolled back by deleting the auto-added release condition in the feature flag UI.
+ Updates the feature flag so the selected variant gets 100% of the variant
+ distribution. By default, existing release conditions on the flag are preserved
+ untouched — the variant is served only to users who already match them. Pass
+ ``release_to_everyone: true`` to also prepend a catch-all release condition
+ that rolls the variant out to 100% of users (overrides any existing release
+ conditions on the flag).
Can be called on both running and stopped experiments. If the experiment is
still running, it will also be ended (end_date set and status marked as stopped).
@@ -312,6 +315,7 @@ class EnterpriseExperimentsViewSet(
shipped_experiment = service.ship_variant(
experiment,
variant_key=request_serializer.validated_data["variant_key"],
+ release_to_everyone=request_serializer.validated_data["release_to_everyone"],
conclusion=request_serializer.validated_data.get("conclusion"),
conclusion_comment=request_serializer.validated_data.get("conclusion_comment"),
request=request,
diff --git a/products/experiments/backend/test/test_experiment_service.py b/products/experiments/backend/test/test_experiment_service.py
index 79be16162864..5bc8c99af649 100644
--- a/products/experiments/backend/test/test_experiment_service.py
+++ b/products/experiments/backend/test/test_experiment_service.py
@@ -2549,7 +2549,7 @@ class TestExperimentService(APIBaseTest):
# Ship variant
# ------------------------------------------------------------------
- def test_ship_variant_running_experiment(self):
+ def test_ship_variant_running_experiment_default_preserves_groups(self):
experiment = self._create_running_experiment(name="Ship Running", feature_flag_key="ship-running-flag")
assert experiment.is_running
@@ -2567,18 +2567,113 @@ class TestExperimentService(APIBaseTest):
assert shipped.end_date is not None
assert shipped.conclusion == "won"
- # Verify flag filter transformation
+ # Verify variant distribution flipped
variants = shipped.feature_flag.filters["multivariate"]["variants"]
assert any(v["key"] == "test" and v["rollout_percentage"] == 100 for v in variants)
assert any(v["key"] == "control" and v["rollout_percentage"] == 0 for v in variants)
- # Verify catch-all group prepended and original groups preserved
+ # Default mode: existing groups preserved untouched, no catch-all prepended
+ assert shipped.feature_flag.filters["groups"] == original_groups
+
+ def test_ship_variant_running_experiment_release_to_everyone_prepends_catch_all(self):
+ experiment = self._create_running_experiment(
+ name="Ship Running Everyone", feature_flag_key="ship-running-everyone-flag"
+ )
+
+ assert experiment.is_running
+ original_groups = experiment.feature_flag.filters.get("groups", [])
+
+ shipped = self._service().ship_variant(
+ experiment,
+ variant_key="test",
+ release_to_everyone=True,
+ conclusion="won",
+ request=self._make_request(),
+ )
+
+ shipped.refresh_from_db()
+ shipped.feature_flag.refresh_from_db()
+
+ assert shipped.is_stopped
+ assert shipped.conclusion == "won"
+
+ variants = shipped.feature_flag.filters["multivariate"]["variants"]
+ assert any(v["key"] == "test" and v["rollout_percentage"] == 100 for v in variants)
+ assert any(v["key"] == "control" and v["rollout_percentage"] == 0 for v in variants)
+
+ # release_to_everyone: catch-all prepended; original groups preserved after it
groups = shipped.feature_flag.filters["groups"]
assert groups[0]["properties"] == []
assert groups[0]["rollout_percentage"] == 100
assert "Added automatically" in groups[0].get("description", "")
assert groups[1:] == original_groups
+ def test_ship_variant_default_preserves_scoped_release_condition(self):
+ experiment = self._create_running_experiment(name="Ship Scoped", feature_flag_key="ship-scoped-flag")
+
+ # Replace flag groups with a scoped release condition (e.g. only EU users)
+ flag = experiment.feature_flag
+ scoped_group = {
+ "properties": [{"key": "country", "value": "EU", "operator": "exact", "type": "person"}],
+ "rollout_percentage": 100,
+ }
+ updated_filters = {**flag.filters, "groups": [scoped_group]}
+ serializer = FeatureFlagSerializer(
+ flag,
+ data={"filters": updated_filters},
+ partial=True,
+ context={
+ "request": self._make_request(),
+ "team_id": self.team.id,
+ "project_id": self.team.project_id,
+ },
+ )
+ serializer.is_valid(raise_exception=True)
+ serializer.save()
+ flag.refresh_from_db()
+ original_groups = flag.filters["groups"]
+
+ shipped = self._service().ship_variant(experiment, variant_key="test", request=self._make_request())
+ shipped.feature_flag.refresh_from_db()
+
+ # Scoping is preserved exactly — no catch-all destroys it
+ assert shipped.feature_flag.filters["groups"] == original_groups
+
+ def test_ship_variant_default_preserves_variant_override(self):
+ experiment = self._create_running_experiment(name="Ship Override", feature_flag_key="ship-override-flag")
+
+ # Add a release condition with a variant override (force a cohort to "control")
+ flag = experiment.feature_flag
+ override_group = {
+ "properties": [{"key": "email", "value": "[email protected]", "operator": "exact", "type": "person"}],
+ "rollout_percentage": 100,
+ "variant": "control",
+ }
+ existing_groups = flag.filters.get("groups", [])
+ updated_filters = {**flag.filters, "groups": [override_group, *existing_groups]}
+ serializer = FeatureFlagSerializer(
+ flag,
+ data={"filters": updated_filters},
+ partial=True,
+ context={
+ "request": self._make_request(),
+ "team_id": self.team.id,
+ "project_id": self.team.project_id,
+ },
+ )
+ serializer.is_valid(raise_exception=True)
+ serializer.save()
+ flag.refresh_from_db()
+ original_groups = flag.filters["groups"]
+
+ # Ship "test" without release_to_everyone — the QA override to "control" must survive
+ shipped = self._service().ship_variant(experiment, variant_key="test", request=self._make_request())
+ shipped.feature_flag.refresh_from_db()
+
+ groups = shipped.feature_flag.filters["groups"]
+ assert groups == original_groups
+ assert groups[0]["variant"] == "control"
+
def test_ship_variant_already_stopped_experiment(self):
experiment = self._create_ended_experiment(name="Ship Stopped", feature_flag_key="ship-stopped-flag")
@@ -2694,11 +2789,28 @@ class TestExperimentService(APIBaseTest):
assert "experiment completed" in event_names
assert "experiment stopped" in event_names
- # Verify variant_key in shipped event metadata
+ # Verify variant_key and release_to_everyone in shipped event metadata
shipped_call = next(
call for call in mock_report_user_action.call_args_list if call.args[1] == "experiment variant shipped"
)
assert shipped_call.args[2]["variant_key"] == "test"
+ # Default behavior: release_to_everyone is False
+ assert shipped_call.args[2]["release_to_everyone"] is False
+
+ @patch("products.experiments.backend.experiment_service.report_user_action")
+ def test_ship_variant_release_to_everyone_recorded_in_analytics(self, mock_report_user_action):
+ experiment = self._create_running_experiment(
+ name="Ship Analytics Everyone", feature_flag_key="ship-analytics-everyone-flag"
+ )
+
+ self._service().ship_variant(
+ experiment, variant_key="test", release_to_everyone=True, request=self._make_request()
+ )
+
+ shipped_call = next(
+ call for call in mock_report_user_action.call_args_list if call.args[1] == "experiment variant shipped"
+ )
+ assert shipped_call.args[2]["release_to_everyone"] is True
@patch("products.experiments.backend.experiment_service.report_user_action")
def test_ship_variant_stopped_reports_only_shipped_event(self, mock_report_user_action):
@@ -2718,7 +2830,7 @@ class TestExperimentService(APIBaseTest):
# Transform filters for winning variant
# ------------------------------------------------------------------
- def test_transform_filters_for_winning_variant(self):
+ def test_transform_filters_default_preserves_groups(self):
current_filters = {
"groups": [{"properties": [], "rollout_percentage": 100}],
"payloads": {},
@@ -2733,6 +2845,33 @@ class TestExperimentService(APIBaseTest):
result = ExperimentService._transform_filters_for_winning_variant(current_filters, "test")
+ # Variant distribution flipped
+ assert result["multivariate"]["variants"] == [
+ {"key": "control", "name": "Control Group", "rollout_percentage": 0},
+ {"key": "test", "name": "Test Variant", "rollout_percentage": 100},
+ ]
+ # Groups preserved exactly — no catch-all prepended in default mode
+ assert result["groups"] == current_filters["groups"]
+ assert result["payloads"] == {}
+ assert result["aggregation_group_type_index"] is None
+
+ def test_transform_filters_release_to_everyone_prepends_catch_all(self):
+ current_filters = {
+ "groups": [{"properties": [], "rollout_percentage": 100}],
+ "payloads": {},
+ "multivariate": {
+ "variants": [
+ {"key": "control", "name": "Control Group", "rollout_percentage": 50},
+ {"key": "test", "name": "Test Variant", "rollout_percentage": 50},
+ ]
+ },
+ "aggregation_group_type_index": None,
+ }
+
+ result = ExperimentService._transform_filters_for_winning_variant(
+ current_filters, "test", release_to_everyone=True
+ )
+
assert result["multivariate"]["variants"] == [
{"key": "control", "name": "Control Group", "rollout_percentage": 0},
{"key": "test", "name": "Test Variant", "rollout_percentage": 100},
@@ -2746,6 +2885,27 @@ class TestExperimentService(APIBaseTest):
assert result["payloads"] == {}
assert result["aggregation_group_type_index"] is None
+ def test_transform_filters_default_does_not_mutate_input(self):
+ """Defensive: ensure the function returns a new groups list without mutating caller's filters."""
+ original_groups = [{"properties": [], "rollout_percentage": 50}]
+ current_filters = {
+ "groups": original_groups,
+ "multivariate": {
+ "variants": [
+ {"key": "control", "rollout_percentage": 50},
+ {"key": "test", "rollout_percentage": 50},
+ ]
+ },
+ }
+
+ result = ExperimentService._transform_filters_for_winning_variant(current_filters, "test")
+
+ # Caller's list reference is untouched
+ assert current_filters["groups"] is original_groups
+ # Result's groups equals original by value but is a distinct list object
+ assert result["groups"] == original_groups
+ assert result["groups"] is not original_groups
+
def test_transform_filters_multiple_variants_with_payloads(self):
current_filters = {
"groups": [{"properties": [], "rollout_percentage": 100}],
@@ -2766,7 +2926,9 @@ class TestExperimentService(APIBaseTest):
"aggregation_group_type_index": 1,
}
- result = ExperimentService._transform_filters_for_winning_variant(current_filters, "control")
+ result = ExperimentService._transform_filters_for_winning_variant(
+ current_filters, "control", release_to_everyone=True
+ )
assert result["multivariate"]["variants"] == [
{"key": "control", "name": "This is control", "rollout_percentage": 100},
diff --git a/products/experiments/backend/test/test_presentation_api.py b/products/experiments/backend/test/test_presentation_api.py
index c37f6889c438..ca74db4de32b 100644
--- a/products/experiments/backend/test/test_presentation_api.py
+++ b/products/experiments/backend/test/test_presentation_api.py
@@ -4351,9 +4351,10 @@ class TestExperimentCRUD(APILicensedTest):
)
self.assertEqual(end_response.status_code, status.HTTP_400_BAD_REQUEST)
- def test_ship_variant_endpoint(self):
+ def test_ship_variant_endpoint_default_preserves_groups(self):
data = self._create_running_experiment(name="Ship Endpoint", flag_key="ship-endpoint-flag")
experiment_id = data["id"]
+ original_groups = data["feature_flag"]["filters"].get("groups", [])
ship_response = self.client.post(
f"/api/projects/{self.team.id}/experiments/{experiment_id}/ship_variant/",
@@ -4366,7 +4367,7 @@ class TestExperimentCRUD(APILicensedTest):
self.assertEqual(ship_response.json()["conclusion"], "won")
self.assertEqual(ship_response.json()["conclusion_comment"], "Test won")
- # Verify flag filters were rewritten
+ # Variant distribution was flipped
flag_filters = ship_response.json()["feature_flag"]["filters"]
variants = flag_filters["multivariate"]["variants"]
test_variant = next(v for v in variants if v["key"] == "test")
@@ -4374,9 +4375,29 @@ class TestExperimentCRUD(APILicensedTest):
self.assertEqual(test_variant["rollout_percentage"], 100)
self.assertEqual(control_variant["rollout_percentage"], 0)
- # Verify catch-all group prepended
+ # Default behavior: existing groups preserved, no catch-all prepended
+ self.assertEqual(flag_filters["groups"], original_groups)
+
+ def test_ship_variant_endpoint_release_to_everyone_prepends_catch_all(self):
+ data = self._create_running_experiment(name="Ship Everyone", flag_key="ship-everyone-flag")
+ experiment_id = data["id"]
+
+ ship_response = self.client.post(
+ f"/api/projects/{self.team.id}/experiments/{experiment_id}/ship_variant/",
+ {"variant_key": "test", "release_to_everyone": True, "conclusion": "won"},
+ format="json",
+ )
+ self.assertEqual(ship_response.status_code, status.HTTP_200_OK)
+
+ flag_filters = ship_response.json()["feature_flag"]["filters"]
+ variants = flag_filters["multivariate"]["variants"]
+ test_variant = next(v for v in variants if v["key"] == "test")
+ self.assertEqual(test_variant["rollout_percentage"], 100)
+
+ # release_to_everyone: catch-all prepended
self.assertEqual(flag_filters["groups"][0]["rollout_percentage"], 100)
self.assertEqual(flag_filters["groups"][0]["properties"], [])
+ self.assertIn("Added automatically", flag_filters["groups"][0].get("description", ""))
def test_ship_variant_on_stopped_experiment(self):
data = self._create_running_experiment(name="Ship Stopped Endpoint", flag_key="ship-stopped-endpoint-flag")
diff --git a/products/experiments/frontend/generated/api.schemas.ts b/products/experiments/frontend/generated/api.schemas.ts
index 90864f220089..6e6a465a4e72 100644
--- a/products/experiments/frontend/generated/api.schemas.ts
+++ b/products/experiments/frontend/generated/api.schemas.ts
@@ -615,8 +615,10 @@ export interface ShipVariantApi {
* @nullable
*/
conclusion_comment?: string | null
- /** The key of the variant to ship to 100% of users. */
+ /** The key of the variant to ship. */
variant_key: string
+ /** If true, prepend a release condition to the feature flag that rolls the variant out to 100% of users, overriding any existing release conditions on the flag. If false (default), only update the variant distribution — existing release conditions are preserved and the variant is served only to users who already match them. */
+ release_to_everyone?: boolean
}
export type ExperimentHoldoutsListParams = {
diff --git a/products/experiments/frontend/generated/api.ts b/products/experiments/frontend/generated/api.ts
index ab250c042f5e..87b8dd3a5843 100644
--- a/products/experiments/frontend/generated/api.ts
+++ b/products/experiments/frontend/generated/api.ts
@@ -657,11 +657,14 @@ export const getExperimentsShipVariantCreateUrl = (projectId: string, id: number
}
/**
- * Ship a variant to 100% of users and (optionally) end the experiment.
-
-Rewrites the feature flag so that the selected variant is served to everyone.
-Existing release conditions (flag groups) are preserved so the change can be
-rolled back by deleting the auto-added release condition in the feature flag UI.
+ * Ship a variant and (optionally) end the experiment.
+
+Updates the feature flag so the selected variant gets 100% of the variant
+distribution. By default, existing release conditions on the flag are preserved
+untouched — the variant is served only to users who already match them. Pass
+``release_to_everyone: true`` to also prepend a catch-all release condition
+that rolls the variant out to 100% of users (overrides any existing release
+conditions on the flag).
Can be called on both running and stopped experiments. If the experiment is
still running, it will also be ended (end_date set and status marked as stopped).
diff --git a/products/experiments/frontend/generated/api.zod.ts b/products/experiments/frontend/generated/api.zod.ts
index 1c048a499708..c5b3d3e1b887 100644
--- a/products/experiments/frontend/generated/api.zod.ts
+++ b/products/experiments/frontend/generated/api.zod.ts
@@ -226,11 +226,14 @@ export const ExperimentsRecalculateTimeseriesCreateBody = /* @__PURE__ */ zod
.describe('Deep\/recursive schema (opaque in Zod — use TypeScript types for full shape)')
/**
- * Ship a variant to 100% of users and (optionally) end the experiment.
+ * Ship a variant and (optionally) end the experiment.
-Rewrites the feature flag so that the selected variant is served to everyone.
-Existing release conditions (flag groups) are preserved so the change can be
-rolled back by deleting the auto-added release condition in the feature flag UI.
+Updates the feature flag so the selected variant gets 100% of the variant
+distribution. By default, existing release conditions on the flag are preserved
+untouched — the variant is served only to users who already match them. Pass
+``release_to_everyone: true`` to also prepend a catch-all release condition
+that rolls the variant out to 100% of users (overrides any existing release
+conditions on the flag).
Can be called on both running and stopped experiments. If the experiment is
still running, it will also be ended (end_date set and status marked as stopped).
@@ -244,6 +247,8 @@ the change request is approved and the user retries.
Returns 400 if the experiment is in draft state, the variant_key is not found
on the flag, or the experiment has no linked feature flag.
*/
+export const experimentsShipVariantCreateBodyReleaseToEveryoneDefault = false
+
export const ExperimentsShipVariantCreateBody = /* @__PURE__ */ zod.object({
conclusion: zod
.union([
@@ -259,5 +264,11 @@ export const ExperimentsShipVariantCreateBody = /* @__PURE__ */ zod.object({
'The conclusion of the experiment.\n\n\* `won` - won\n\* `lost` - lost\n\* `inconclusive` - inconclusive\n\* `stopped_early` - stopped_early\n\* `invalid` - invalid'
),
conclusion_comment: zod.string().nullish().describe('Optional comment about the experiment conclusion.'),
- variant_key: zod.string().describe('The key of the variant to ship to 100% of users.'),
+ variant_key: zod.string().describe('The key of the variant to ship.'),
+ release_to_everyone: zod
+ .boolean()
+ .default(experimentsShipVariantCreateBodyReleaseToEveryoneDefault)
+ .describe(
+ 'If true, prepend a release condition to the feature flag that rolls the variant out to 100% of users, overriding any existing release conditions on the flag. If false (default), only update the variant distribution — existing release conditions are preserved and the variant is served only to users who already match them.'
+ ),
})
diff --git a/products/experiments/mcp/tools.yaml b/products/experiments/mcp/tools.yaml
index ae783cae3997..dd37f5fd19ac 100644
--- a/products/experiments/mcp/tools.yaml
+++ b/products/experiments/mcp/tools.yaml
@@ -532,9 +532,23 @@ tools:
user's reference first. Load the managing-experiment-lifecycle skill for preconditions and side effects.
- REQUIRES EXPLICIT USER CONFIRMATION BEFORE CALLING. This permanently rewrites the feature flag for 100% of
- users and cannot be undone via the API. Even when the user has asked you to ship a specific variant, ask
- them to confirm with the variant key and target experiment before invoking this tool.
+ REQUIRES EXPLICIT USER CONFIRMATION BEFORE CALLING. This permanently rewrites the linked feature flag and
+ cannot be undone via the API. Two release modes — confirm which one the user wants before invoking:
+
+
+ - Default (release_to_everyone=false): updates only the variant distribution so the selected variant gets
+ 100%. Existing release conditions and per-user variant overrides on the flag are preserved untouched — the
+ variant is served only to users who already match them.
+
+
+ - release_to_everyone=true: in addition to flipping the variant distribution, prepends a catch-all release
+ condition that rolls the variant out to 100% of users. This OVERRIDES any existing release conditions and
+ per-user variant overrides on the flag. Only use this when the user explicitly wants to release beyond the
+ experiment's existing population.
+
+
+ Even when the user has asked you to ship a specific variant, ask them to confirm with the variant key,
+ target experiment, and release mode before invoking this tool.
Ship a variant to 100% of users by rewriting the feature flag. Requires variant_key — the key of the variant
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index 76c1cf2da6a3..97f4431a816b 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -1671,7 +1671,7 @@
}
},
"experiment-ship-variant": {
- "description": "Requires an experiment ID. If you don't have the ID, load the finding-experiments skill to resolve the user's reference first. Load the managing-experiment-lifecycle skill for preconditions and side effects.\n\nREQUIRES EXPLICIT USER CONFIRMATION BEFORE CALLING. This permanently rewrites the feature flag for 100% of users and cannot be undone via the API. Even when the user has asked you to ship a specific variant, ask them to confirm with the variant key and target experiment before invoking this tool.\n\nShip a variant to 100% of users by rewriting the feature flag. Requires variant_key — the key of the variant to ship (e.g. \"test\" or \"control\"). The flag is rewritten so the selected variant gets 100% rollout via a new catch-all release group prepended to existing groups (preserved for rollback).\n\nCan be called on both running and stopped experiments. If the experiment is still running, it is also ended (end_date set, status becomes stopped). If already stopped, only the flag is rewritten — supports the \"end first, ship later\" workflow.\n\nOptionally provide conclusion (\"won\", \"lost\", \"inconclusive\", \"stopped_early\", \"invalid\") and conclusion_comment.\n\nReturns 400 if: experiment is in draft (\"Experiment has not been launched yet.\"), variant_key not found on the flag, or no linked feature flag. Returns 409 if an approval policy requires review before the flag change takes effect — includes a change_request_id in the response.",
+ "description": "Requires an experiment ID. If you don't have the ID, load the finding-experiments skill to resolve the user's reference first. Load the managing-experiment-lifecycle skill for preconditions and side effects.\n\nREQUIRES EXPLICIT USER CONFIRMATION BEFORE CALLING. This permanently rewrites the linked feature flag and cannot be undone via the API. Two release modes — confirm which one the user wants before invoking:\n\n- Default (release_to_everyone=false): updates only the variant distribution so the selected variant gets 100%. Existing release conditions and per-user variant overrides on the flag are preserved untouched — the variant is served only to users who already match them.\n\n- release_to_everyone=true: in addition to flipping the variant distribution, prepends a catch-all release condition that rolls the variant out to 100% of users. This OVERRIDES any existing release conditions and per-user variant overrides on the flag. Only use this when the user explicitly wants to release beyond the experiment's existing population.\n\nEven when the user has asked you to ship a specific variant, ask them to confirm with the variant key, target experiment, and release mode before invoking this tool.\n\nShip a variant to 100% of users by rewriting the feature flag. Requires variant_key — the key of the variant to ship (e.g. \"test\" or \"control\"). The flag is rewritten so the selected variant gets 100% rollout via a new catch-all release group prepended to existing groups (preserved for rollback).\n\nCan be called on both running and stopped experiments. If the experiment is still running, it is also ended (end_date set, status becomes stopped). If already stopped, only the flag is rewritten — supports the \"end first, ship later\" workflow.\n\nOptionally provide conclusion (\"won\", \"lost\", \"inconclusive\", \"stopped_early\", \"invalid\") and conclusion_comment.\n\nReturns 400 if: experiment is in draft (\"Experiment has not been launched yet.\"), variant_key not found on the flag, or no linked feature flag. Returns 409 if an approval policy requires review before the flag change takes effect — includes a change_request_id in the response.",
"category": "Experiments",
"feature": "experiments",
"summary": "Ship experiment variant",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 93453a19c26a..6789f6480e06 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -1896,7 +1896,7 @@
}
},
"experiment-ship-variant": {
- "description": "Requires an experiment ID. If you don't have the ID, load the finding-experiments skill to resolve the user's reference first. Load the managing-experiment-lifecycle skill for preconditions and side effects.\n\nREQUIRES EXPLICIT USER CONFIRMATION BEFORE CALLING. This permanently rewrites the feature flag for 100% of users and cannot be undone via the API. Even when the user has asked you to ship a specific variant, ask them to confirm with the variant key and target experiment before invoking this tool.\n\nShip a variant to 100% of users by rewriting the feature flag. Requires variant_key — the key of the variant to ship (e.g. \"test\" or \"control\"). The flag is rewritten so the selected variant gets 100% rollout via a new catch-all release group prepended to existing groups (preserved for rollback).\n\nCan be called on both running and stopped experiments. If the experiment is still running, it is also ended (end_date set, status becomes stopped). If already stopped, only the flag is rewritten — supports the \"end first, ship later\" workflow.\n\nOptionally provide conclusion (\"won\", \"lost\", \"inconclusive\", \"stopped_early\", \"invalid\") and conclusion_comment.\n\nReturns 400 if: experiment is in draft (\"Experiment has not been launched yet.\"), variant_key not found on the flag, or no linked feature flag. Returns 409 if an approval policy requires review before the flag change takes effect — includes a change_request_id in the response.",
+ "description": "Requires an experiment ID. If you don't have the ID, load the finding-experiments skill to resolve the user's reference first. Load the managing-experiment-lifecycle skill for preconditions and side effects.\n\nREQUIRES EXPLICIT USER CONFIRMATION BEFORE CALLING. This permanently rewrites the linked feature flag and cannot be undone via the API. Two release modes — confirm which one the user wants before invoking:\n\n- Default (release_to_everyone=false): updates only the variant distribution so the selected variant gets 100%. Existing release conditions and per-user variant overrides on the flag are preserved untouched — the variant is served only to users who already match them.\n\n- release_to_everyone=true: in addition to flipping the variant distribution, prepends a catch-all release condition that rolls the variant out to 100% of users. This OVERRIDES any existing release conditions and per-user variant overrides on the flag. Only use this when the user explicitly wants to release beyond the experiment's existing population.\n\nEven when the user has asked you to ship a specific variant, ask them to confirm with the variant key, target experiment, and release mode before invoking this tool.\n\nShip a variant to 100% of users by rewriting the feature flag. Requires variant_key — the key of the variant to ship (e.g. \"test\" or \"control\"). The flag is rewritten so the selected variant gets 100% rollout via a new catch-all release group prepended to existing groups (preserved for rollback).\n\nCan be called on both running and stopped experiments. If the experiment is still running, it is also ended (end_date set, status becomes stopped). If already stopped, only the flag is rewritten — supports the \"end first, ship later\" workflow.\n\nOptionally provide conclusion (\"won\", \"lost\", \"inconclusive\", \"stopped_early\", \"invalid\") and conclusion_comment.\n\nReturns 400 if: experiment is in draft (\"Experiment has not been launched yet.\"), variant_key not found on the flag, or no linked feature flag. Returns 409 if an approval policy requires review before the flag change takes effect — includes a change_request_id in the response.",
"category": "Experiments",
"feature": "experiments",
"summary": "Ship experiment variant",
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 243ce7de5a1f..aac348d285cc 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -34015,8 +34015,10 @@ export namespace Schemas {
* @nullable
*/
conclusion_comment?: string | null;
- /** The key of the variant to ship to 100% of users. */
+ /** The key of the variant to ship. */
variant_key: string;
+ /** If true, prepend a release condition to the feature flag that rolls the variant out to 100% of users, overriding any existing release conditions on the flag. If false (default), only update the variant distribution — existing release conditions are preserved and the variant is served only to users who already match them. */
+ release_to_everyone?: boolean;
}
export interface _User {
diff --git a/services/mcp/src/generated/experiments/api.ts b/services/mcp/src/generated/experiments/api.ts
index 261135faa2c1..de592052aa05 100644
--- a/services/mcp/src/generated/experiments/api.ts
+++ b/services/mcp/src/generated/experiments/api.ts
@@ -5420,11 +5420,14 @@ export const ExperimentsResumeCreateParams = /* @__PURE__ */ zod.object({
})
/**
- * Ship a variant to 100% of users and (optionally) end the experiment.
+ * Ship a variant and (optionally) end the experiment.
-Rewrites the feature flag so that the selected variant is served to everyone.
-Existing release conditions (flag groups) are preserved so the change can be
-rolled back by deleting the auto-added release condition in the feature flag UI.
+Updates the feature flag so the selected variant gets 100% of the variant
+distribution. By default, existing release conditions on the flag are preserved
+untouched — the variant is served only to users who already match them. Pass
+``release_to_everyone: true`` to also prepend a catch-all release condition
+that rolls the variant out to 100% of users (overrides any existing release
+conditions on the flag).
Can be called on both running and stopped experiments. If the experiment is
still running, it will also be ended (end_date set and status marked as stopped).
@@ -5447,6 +5450,8 @@ export const ExperimentsShipVariantCreateParams = /* @__PURE__ */ zod.object({
),
})
+export const experimentsShipVariantCreateBodyReleaseToEveryoneDefault = false
+
export const ExperimentsShipVariantCreateBody = /* @__PURE__ */ zod.object({
conclusion: zod
.union([
@@ -5462,7 +5467,13 @@ export const ExperimentsShipVariantCreateBody = /* @__PURE__ */ zod.object({
'The conclusion of the experiment.\n\n* `won` - won\n* `lost` - lost\n* `inconclusive` - inconclusive\n* `stopped_early` - stopped_early\n* `invalid` - invalid'
),
conclusion_comment: zod.string().nullish().describe('Optional comment about the experiment conclusion.'),
- variant_key: zod.string().describe('The key of the variant to ship to 100% of users.'),
+ variant_key: zod.string().describe('The key of the variant to ship.'),
+ release_to_everyone: zod
+ .boolean()
+ .default(experimentsShipVariantCreateBodyReleaseToEveryoneDefault)
+ .describe(
+ 'If true, prepend a release condition to the feature flag that rolls the variant out to 100% of users, overriding any existing release conditions on the flag. If false (default), only update the variant distribution — existing release conditions are preserved and the variant is served only to users who already match them.'
+ ),
})
/**
diff --git a/services/mcp/src/tools/generated/experiments.ts b/services/mcp/src/tools/generated/experiments.ts
index f266b6d88675..017a66c952cd 100644
--- a/services/mcp/src/tools/generated/experiments.ts
+++ b/services/mcp/src/tools/generated/experiments.ts
@@ -562,6 +562,9 @@ const experimentShipVariant = (): ToolBase<typeof ExperimentShipVariantSchema, W
if (params.variant_key !== undefined) {
body['variant_key'] = params.variant_key
}
+ if (params.release_to_everyone !== undefined) {
+ body['release_to_everyone'] = params.release_to_everyone
+ }
const result = await context.api.request<Schemas.Experiment>({
method: 'POST',
path: `/api/projects/${encodeURIComponent(String(projectId))}/experiments/${encodeURIComponent(String(params.id))}/ship_variant/`,
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/common/experiment-ship-variant.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/common/experiment-ship-variant.json
index 0841970d4311..c1f6059c5ec6 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/common/experiment-ship-variant.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/common/experiment-ship-variant.json
@@ -29,8 +29,13 @@
"description": "A unique integer value identifying this experiment.",
"type": "number"
},
+ "release_to_everyone": {
+ "default": false,
+ "description": "If true, prepend a release condition to the feature flag that rolls the variant out to 100% of users, overriding any existing release conditions on the flag. If false (default), only update the variant distribution — existing release conditions are preserved and the variant is served only to users who already match them.",
+ "type": "boolean"
+ },
"variant_key": {
- "description": "The key of the variant to ship to 100% of users.",
+ "description": "The key of the variant to ship.",
"type": "string"
}
},