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.

refactor(experiments): remove running-time dual-write to parameters (#65512)

Anders283903c25d10
diff --git a/products/experiments/backend/experiment_service.py b/products/experiments/backend/experiment_service.py
index 1da1825b7716..3b2ccd0e798f 100644
--- a/products/experiments/backend/experiment_service.py
+++ b/products/experiments/backend/experiment_service.py
@@ -290,25 +290,6 @@ class ExperimentService:
if exposure_estimate_config is not None and not isinstance(exposure_estimate_config, dict):
raise ValidationError("exposure_estimate_config must be an object")
- @staticmethod
- def _running_time_calculation_from_parameters(parameters: dict | None) -> dict:
- return {
- key: (parameters or {})[key]
- for key in ExperimentService.RUNNING_TIME_CALCULATION_KEYS
- if key in (parameters or {})
- }
-
- @staticmethod
- def _merge_running_time_calculation_into_parameters(parameters: dict | None, calculation: dict | None) -> dict:
- """Replace the legacy calculator keys in `parameters` with the canonical calculation values."""
- merged = {
- key: value
- for key, value in (parameters or {}).items()
- if key not in ExperimentService.RUNNING_TIME_CALCULATION_KEYS
- }
- merged.update(calculation or {})
- return merged
-
EXPOSURE_CONFIG_KINDS = ("ExperimentEventExposureConfig", "ActionsNode")
EXPOSURE_CONFIG_HINT = (
@@ -810,14 +791,9 @@ class ExperimentService:
self.validate_variant_percentages(parameters)
self.validate_running_time_calculation(running_time_calculation)
self.validate_excluded_variants(excluded_variants)
- # Dual-write during the parameters deprecation window: running_time_calculation is
- # canonical, but the legacy calculator keys in `parameters` stay in sync for old readers.
- if running_time_calculation is not None:
- parameters = self._merge_running_time_calculation_into_parameters(parameters, running_time_calculation)
- else:
- running_time_calculation = self._running_time_calculation_from_parameters(parameters)
- # Same dual-write for excluded_variants: the canonical column wins over legacy
- # `parameters` when supplied; otherwise derive the column from `parameters`.
+ running_time_calculation = running_time_calculation or {}
+ # Dual-write for excluded_variants during the parameters deprecation window: the canonical
+ # column wins over legacy `parameters` when supplied; otherwise derive the column from `parameters`.
if excluded_variants is not None:
parameters = self._merge_excluded_variants_into_parameters(parameters, excluded_variants)
else:
@@ -2272,25 +2248,9 @@ class ExperimentService:
feature_flag.active = True
feature_flag.save()
- # --- running-time calculation dual-write ----------------------------
- # During the parameters deprecation window, keep running_time_calculation and
- # the legacy calculator keys in `parameters` in sync. `parameters` is replaced
- # wholesale on update, so derive the counterpart from whichever side this
- # update carries (running_time_calculation wins when both are sent).
- if "running_time_calculation" in update_data:
- update_data["parameters"] = self._merge_running_time_calculation_into_parameters(
- update_data.get("parameters", experiment.parameters),
- update_data["running_time_calculation"],
- )
- elif "parameters" in update_data:
- update_data["running_time_calculation"] = self._running_time_calculation_from_parameters(
- update_data["parameters"]
- )
-
# --- excluded_variants dual-write -----------------------------------
- # Mirror the canonical excluded_variants column into legacy `parameters`. Runs after the
- # running-time block so it reads the already-merged `parameters` (they touch disjoint
- # keys). The column wins when both are sent.
+ # Mirror the canonical excluded_variants column into legacy `parameters`.
+ # The column wins when both are sent.
if "excluded_variants" in update_data:
update_data["parameters"] = self._merge_excluded_variants_into_parameters(
update_data.get("parameters", experiment.parameters),
@@ -2482,6 +2442,7 @@ class ExperimentService:
description=source_experiment.description or "",
type=source_experiment.type or "product",
parameters=parameters,
+ running_time_calculation=deepcopy(source_experiment.running_time_calculation),
filters=source_experiment.filters,
metrics=cloned_metrics,
metrics_secondary=cloned_metrics_secondary,
diff --git a/products/experiments/backend/max_tools.py b/products/experiments/backend/max_tools.py
index a06751c6b235..d3c2a13d25a4 100644
--- a/products/experiments/backend/max_tools.py
+++ b/products/experiments/backend/max_tools.py
@@ -169,6 +169,8 @@ class CreateExperimentTool(MaxTool):
type=type,
parameters={
"feature_flag_variants": feature_flag_variants,
+ },
+ running_time_calculation={
"minimum_detectable_effect": 30,
},
event_source=EventSource.POSTHOG_AI,
diff --git a/products/experiments/backend/presentation/serializers.py b/products/experiments/backend/presentation/serializers.py
index 24ccb6eb6879..b02a44d49d45 100644
--- a/products/experiments/backend/presentation/serializers.py
+++ b/products/experiments/backend/presentation/serializers.py
@@ -152,15 +152,11 @@ class ExperimentBaseSerializer(UserAccessControlSerializerMixin, serializers.Mod
allow_null=True,
help_text=(
"Experiment parameters JSON. Supported keys include "
- "`feature_flag_variants`, `rollout_percentage`, `minimum_detectable_effect`, "
- "`recommended_running_time`, `recommended_sample_size`, "
+ "`feature_flag_variants`, `rollout_percentage`, "
"`custom_exposure_filter`, `excluded_variants` "
"(list of variant keys to drop from statistical analysis; "
"the baseline variant and holdout pseudo-variants cannot be excluded), "
- "and `variant_notes` (free-text notes per variant, keyed by variant key). "
- "The running-time calculator keys (`minimum_detectable_effect`, "
- "`recommended_running_time`, `recommended_sample_size`, `exposure_estimate_config`) "
- "are deprecated here — prefer `running_time_calculation`."
+ "and `variant_notes` (free-text notes per variant, keyed by variant key)."
),
)
running_time_calculation = ExperimentRunningTimeCalculationField(
@@ -169,8 +165,7 @@ class ExperimentBaseSerializer(UserAccessControlSerializerMixin, serializers.Mod
help_text=(
"Running-time calculator state: `minimum_detectable_effect`, `recommended_running_time`, "
"`recommended_sample_size`, and `exposure_estimate_config`. Canonical home for these keys, "
- "which historically lived in `parameters`; values are kept in sync with `parameters` "
- "during the deprecation window."
+ "which historically lived in `parameters`."
),
)
excluded_variants = serializers.ListField(
diff --git a/products/experiments/backend/test/test_max_tools.py b/products/experiments/backend/test/test_max_tools.py
index f455288f28ac..0d2e4966a614 100644
--- a/products/experiments/backend/test/test_max_tools.py
+++ b/products/experiments/backend/test/test_max_tools.py
@@ -212,7 +212,8 @@ class TestCreateExperimentTool(APIBaseTest):
{"key": "control", "name": "Control", "rollout_percentage": 50},
{"key": "test", "name": "Test", "rollout_percentage": 50},
]
- assert experiment.parameters["minimum_detectable_effect"] == 30
+ assert "minimum_detectable_effect" not in experiment.parameters
+ assert experiment.running_time_calculation == {"minimum_detectable_effect": 30}
assert experiment.metrics == []
assert experiment.metrics_secondary == []
diff --git a/products/experiments/backend/test/test_presentation_api.py b/products/experiments/backend/test/test_presentation_api.py
index 7546298d2cbf..5b0ca026ea38 100644
--- a/products/experiments/backend/test/test_presentation_api.py
+++ b/products/experiments/backend/test/test_presentation_api.py
@@ -7110,7 +7110,7 @@ class TestExperimentRunningTimeCalculation(APILicensedTest):
self.assertEqual(response.status_code, status.HTTP_201_CREATED, response.json())
return response.json()
- def test_create_with_legacy_parameters_populates_running_time_calculation(self):
+ def test_create_with_legacy_parameters_does_not_populate_running_time_calculation(self):
created = self._create_experiment(
parameters={
"minimum_detectable_effect": 25,
@@ -7120,19 +7120,13 @@ class TestExperimentRunningTimeCalculation(APILicensedTest):
}
)
- expected = {
- "minimum_detectable_effect": 25,
- "recommended_running_time": 14,
- "recommended_sample_size": 5000,
- "exposure_estimate_config": self.EXPOSURE_ESTIMATE_CONFIG,
- }
- self.assertEqual(created["running_time_calculation"], expected)
- self.assertEqual(created["parameters"]["minimum_detectable_effect"], 25)
+ # Legacy calculator keys in `parameters` are no longer mirrored into the canonical field.
+ self.assertEqual(created["running_time_calculation"], {})
experiment = Experiment.objects.get(pk=created["id"])
- self.assertEqual(experiment.running_time_calculation, expected)
+ self.assertEqual(experiment.running_time_calculation, {})
- def test_create_with_running_time_calculation_mirrors_into_parameters(self):
+ def test_create_with_running_time_calculation_does_not_touch_parameters(self):
created = self._create_experiment(
running_time_calculation={
"minimum_detectable_effect": 20,
@@ -7144,22 +7138,23 @@ class TestExperimentRunningTimeCalculation(APILicensedTest):
created["running_time_calculation"],
{"minimum_detectable_effect": 20, "exposure_estimate_config": self.EXPOSURE_ESTIMATE_CONFIG},
)
- self.assertEqual(created["parameters"]["minimum_detectable_effect"], 20)
- self.assertEqual(created["parameters"]["exposure_estimate_config"], self.EXPOSURE_ESTIMATE_CONFIG)
+ self.assertNotIn("minimum_detectable_effect", created["parameters"] or {})
+ self.assertNotIn("exposure_estimate_config", created["parameters"] or {})
experiment = Experiment.objects.get(pk=created["id"])
- assert experiment.parameters is not None
- self.assertEqual(experiment.parameters["minimum_detectable_effect"], 20)
+ self.assertEqual(
+ experiment.running_time_calculation,
+ {"minimum_detectable_effect": 20, "exposure_estimate_config": self.EXPOSURE_ESTIMATE_CONFIG},
+ )
+ self.assertNotIn("minimum_detectable_effect", experiment.parameters or {})
- def test_update_running_time_calculation_merges_into_parameters(self):
+ def test_update_running_time_calculation_does_not_touch_parameters(self):
created = self._create_experiment(
parameters={
"feature_flag_variants": [
{"key": "control", "rollout_percentage": 50},
{"key": "test", "rollout_percentage": 50},
],
- "minimum_detectable_effect": 25,
- "recommended_sample_size": 5000,
}
)
@@ -7174,12 +7169,11 @@ class TestExperimentRunningTimeCalculation(APILicensedTest):
experiment.running_time_calculation,
{"minimum_detectable_effect": 10, "recommended_running_time": 7},
)
- # Other parameters keys survive; calculator keys are replaced wholesale
+ # `parameters` is untouched: variants survive and no calculator keys leak in.
assert experiment.parameters is not None
self.assertEqual(len(experiment.parameters["feature_flag_variants"]), 2)
- self.assertEqual(experiment.parameters["minimum_detectable_effect"], 10)
- self.assertEqual(experiment.parameters["recommended_running_time"], 7)
- self.assertNotIn("recommended_sample_size", experiment.parameters)
+ self.assertNotIn("minimum_detectable_effect", experiment.parameters)
+ self.assertNotIn("recommended_running_time", experiment.parameters)
def test_update_running_time_calculation_does_not_touch_feature_flag(self):
variants = [
@@ -7200,8 +7194,10 @@ class TestExperimentRunningTimeCalculation(APILicensedTest):
flag.refresh_from_db()
self.assertEqual(len(flag.filters["multivariate"]["variants"]), 3)
- def test_update_parameters_derives_running_time_calculation(self):
- created = self._create_experiment()
+ def test_update_parameters_does_not_touch_running_time_calculation(self):
+ created = self._create_experiment(
+ running_time_calculation={"minimum_detectable_effect": 15},
+ )
response = self.client.patch(
f"/api/projects/{self.team.id}/experiments/{created['id']}/",
@@ -7210,21 +7206,10 @@ class TestExperimentRunningTimeCalculation(APILicensedTest):
self.assertEqual(response.status_code, status.HTTP_200_OK, response.json())
experiment = Experiment.objects.get(pk=created["id"])
- self.assertEqual(
- experiment.running_time_calculation,
- {"minimum_detectable_effect": 30, "recommended_sample_size": 1000},
- )
-
- # parameters replaces wholesale, so dropping the keys clears the canonical field too
- response = self.client.patch(
- f"/api/projects/{self.team.id}/experiments/{created['id']}/",
- {"parameters": {}},
- )
- self.assertEqual(response.status_code, status.HTTP_200_OK, response.json())
- experiment.refresh_from_db()
- self.assertEqual(experiment.running_time_calculation, {})
+ # The canonical field is independent of legacy `parameters` calculator keys.
+ self.assertEqual(experiment.running_time_calculation, {"minimum_detectable_effect": 15})
- def test_running_time_calculation_wins_when_both_sent(self):
+ def test_running_time_calculation_and_parameters_are_independent(self):
created = self._create_experiment()
response = self.client.patch(
@@ -7237,9 +7222,10 @@ class TestExperimentRunningTimeCalculation(APILicensedTest):
self.assertEqual(response.status_code, status.HTTP_200_OK, response.json())
experiment = Experiment.objects.get(pk=created["id"])
+ # Each side is stored exactly as sent — no cross-write between them.
self.assertEqual(experiment.running_time_calculation, {"minimum_detectable_effect": 11})
assert experiment.parameters is not None
- self.assertEqual(experiment.parameters["minimum_detectable_effect"], 11)
+ self.assertEqual(experiment.parameters["minimum_detectable_effect"], 99)
@parameterized.expand(
[
diff --git a/products/experiments/frontend/generated/api.schemas.ts b/products/experiments/frontend/generated/api.schemas.ts
index a2cb91f7ef95..7326b64ed8e4 100644
--- a/products/experiments/frontend/generated/api.schemas.ts
+++ b/products/experiments/frontend/generated/api.schemas.ts
@@ -382,9 +382,9 @@ export interface ExperimentBasicApi {
readonly holdout: ExperimentHoldoutApi
/** @nullable */
readonly exposure_cohort: number | null
- /** Experiment parameters JSON. Supported keys include `feature_flag_variants`, `rollout_percentage`, `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, `custom_exposure_filter`, `excluded_variants` (list of variant keys to drop from statistical analysis; the baseline variant and holdout pseudo-variants cannot be excluded), and `variant_notes` (free-text notes per variant, keyed by variant key). The running-time calculator keys (`minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, `exposure_estimate_config`) are deprecated here — prefer `running_time_calculation`. */
+ /** Experiment parameters JSON. Supported keys include `feature_flag_variants`, `rollout_percentage`, `custom_exposure_filter`, `excluded_variants` (list of variant keys to drop from statistical analysis; the baseline variant and holdout pseudo-variants cannot be excluded), and `variant_notes` (free-text notes per variant, keyed by variant key). */
parameters?: ExperimentParametersApi | null
- /** Running-time calculator state: `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, and `exposure_estimate_config`. Canonical home for these keys, which historically lived in `parameters`; values are kept in sync with `parameters` during the deprecation window. */
+ /** Running-time calculator state: `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, and `exposure_estimate_config`. Canonical home for these keys, which historically lived in `parameters`. */
running_time_calculation?: ExperimentRunningTimeCalculationApi | null
/**
* Variant keys to exclude from metric result calculations. Excluded variants are still served to users but omitted from statistical analysis. The baseline variant and holdout pseudo-variants cannot be excluded. Canonical home for what historically lived in `parameters.excluded_variants`; kept in sync with `parameters` during the deprecation window.
@@ -692,9 +692,9 @@ export interface ExperimentApi {
holdout_id?: number | null
/** @nullable */
readonly exposure_cohort: number | null
- /** Experiment parameters JSON. Supported keys include `feature_flag_variants`, `rollout_percentage`, `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, `custom_exposure_filter`, `excluded_variants` (list of variant keys to drop from statistical analysis; the baseline variant and holdout pseudo-variants cannot be excluded), and `variant_notes` (free-text notes per variant, keyed by variant key). The running-time calculator keys (`minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, `exposure_estimate_config`) are deprecated here — prefer `running_time_calculation`. */
+ /** Experiment parameters JSON. Supported keys include `feature_flag_variants`, `rollout_percentage`, `custom_exposure_filter`, `excluded_variants` (list of variant keys to drop from statistical analysis; the baseline variant and holdout pseudo-variants cannot be excluded), and `variant_notes` (free-text notes per variant, keyed by variant key). */
parameters?: ExperimentParametersApi | null
- /** Running-time calculator state: `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, and `exposure_estimate_config`. Canonical home for these keys, which historically lived in `parameters`; values are kept in sync with `parameters` during the deprecation window. */
+ /** Running-time calculator state: `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, and `exposure_estimate_config`. Canonical home for these keys, which historically lived in `parameters`. */
running_time_calculation?: ExperimentRunningTimeCalculationApi | null
/**
* Variant keys to exclude from metric result calculations. Excluded variants are still served to users but omitted from statistical analysis. The baseline variant and holdout pseudo-variants cannot be excluded. Canonical home for what historically lived in `parameters.excluded_variants`; kept in sync with `parameters` during the deprecation window.
@@ -798,9 +798,9 @@ export interface PatchedExperimentApi {
holdout_id?: number | null
/** @nullable */
readonly exposure_cohort?: number | null
- /** Experiment parameters JSON. Supported keys include `feature_flag_variants`, `rollout_percentage`, `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, `custom_exposure_filter`, `excluded_variants` (list of variant keys to drop from statistical analysis; the baseline variant and holdout pseudo-variants cannot be excluded), and `variant_notes` (free-text notes per variant, keyed by variant key). The running-time calculator keys (`minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, `exposure_estimate_config`) are deprecated here — prefer `running_time_calculation`. */
+ /** Experiment parameters JSON. Supported keys include `feature_flag_variants`, `rollout_percentage`, `custom_exposure_filter`, `excluded_variants` (list of variant keys to drop from statistical analysis; the baseline variant and holdout pseudo-variants cannot be excluded), and `variant_notes` (free-text notes per variant, keyed by variant key). */
parameters?: ExperimentParametersApi | null
- /** Running-time calculator state: `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, and `exposure_estimate_config`. Canonical home for these keys, which historically lived in `parameters`; values are kept in sync with `parameters` during the deprecation window. */
+ /** Running-time calculator state: `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, and `exposure_estimate_config`. Canonical home for these keys, which historically lived in `parameters`. */
running_time_calculation?: ExperimentRunningTimeCalculationApi | null
/**
* Variant keys to exclude from metric result calculations. Excluded variants are still served to users but omitted from statistical analysis. The baseline variant and holdout pseudo-variants cannot be excluded. Canonical home for what historically lived in `parameters.excluded_variants`; kept in sync with `parameters` during the deprecation window.
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 2824903a1e99..aa5edc5fc741 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -20958,9 +20958,9 @@ export namespace Schemas {
holdout_id?: number | null;
/** @nullable */
readonly exposure_cohort: number | null;
- /** Experiment parameters JSON. Supported keys include `feature_flag_variants`, `rollout_percentage`, `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, `custom_exposure_filter`, `excluded_variants` (list of variant keys to drop from statistical analysis; the baseline variant and holdout pseudo-variants cannot be excluded), and `variant_notes` (free-text notes per variant, keyed by variant key). The running-time calculator keys (`minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, `exposure_estimate_config`) are deprecated here — prefer `running_time_calculation`. */
+ /** Experiment parameters JSON. Supported keys include `feature_flag_variants`, `rollout_percentage`, `custom_exposure_filter`, `excluded_variants` (list of variant keys to drop from statistical analysis; the baseline variant and holdout pseudo-variants cannot be excluded), and `variant_notes` (free-text notes per variant, keyed by variant key). */
parameters?: ExperimentParameters | null;
- /** Running-time calculator state: `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, and `exposure_estimate_config`. Canonical home for these keys, which historically lived in `parameters`; values are kept in sync with `parameters` during the deprecation window. */
+ /** Running-time calculator state: `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, and `exposure_estimate_config`. Canonical home for these keys, which historically lived in `parameters`. */
running_time_calculation?: ExperimentRunningTimeCalculation | null;
/**
* Variant keys to exclude from metric result calculations. Excluded variants are still served to users but omitted from statistical analysis. The baseline variant and holdout pseudo-variants cannot be excluded. Canonical home for what historically lived in `parameters.excluded_variants`; kept in sync with `parameters` during the deprecation window.
@@ -21067,9 +21067,9 @@ export namespace Schemas {
readonly holdout: ExperimentHoldout;
/** @nullable */
readonly exposure_cohort: number | null;
- /** Experiment parameters JSON. Supported keys include `feature_flag_variants`, `rollout_percentage`, `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, `custom_exposure_filter`, `excluded_variants` (list of variant keys to drop from statistical analysis; the baseline variant and holdout pseudo-variants cannot be excluded), and `variant_notes` (free-text notes per variant, keyed by variant key). The running-time calculator keys (`minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, `exposure_estimate_config`) are deprecated here — prefer `running_time_calculation`. */
+ /** Experiment parameters JSON. Supported keys include `feature_flag_variants`, `rollout_percentage`, `custom_exposure_filter`, `excluded_variants` (list of variant keys to drop from statistical analysis; the baseline variant and holdout pseudo-variants cannot be excluded), and `variant_notes` (free-text notes per variant, keyed by variant key). */
parameters?: ExperimentParameters | null;
- /** Running-time calculator state: `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, and `exposure_estimate_config`. Canonical home for these keys, which historically lived in `parameters`; values are kept in sync with `parameters` during the deprecation window. */
+ /** Running-time calculator state: `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, and `exposure_estimate_config`. Canonical home for these keys, which historically lived in `parameters`. */
running_time_calculation?: ExperimentRunningTimeCalculation | null;
/**
* Variant keys to exclude from metric result calculations. Excluded variants are still served to users but omitted from statistical analysis. The baseline variant and holdout pseudo-variants cannot be excluded. Canonical home for what historically lived in `parameters.excluded_variants`; kept in sync with `parameters` during the deprecation window.
@@ -36430,9 +36430,9 @@ export namespace Schemas {
holdout_id?: number | null;
/** @nullable */
readonly exposure_cohort?: number | null;
- /** Experiment parameters JSON. Supported keys include `feature_flag_variants`, `rollout_percentage`, `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, `custom_exposure_filter`, `excluded_variants` (list of variant keys to drop from statistical analysis; the baseline variant and holdout pseudo-variants cannot be excluded), and `variant_notes` (free-text notes per variant, keyed by variant key). The running-time calculator keys (`minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, `exposure_estimate_config`) are deprecated here — prefer `running_time_calculation`. */
+ /** Experiment parameters JSON. Supported keys include `feature_flag_variants`, `rollout_percentage`, `custom_exposure_filter`, `excluded_variants` (list of variant keys to drop from statistical analysis; the baseline variant and holdout pseudo-variants cannot be excluded), and `variant_notes` (free-text notes per variant, keyed by variant key). */
parameters?: ExperimentParameters | null;
- /** Running-time calculator state: `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, and `exposure_estimate_config`. Canonical home for these keys, which historically lived in `parameters`; values are kept in sync with `parameters` during the deprecation window. */
+ /** Running-time calculator state: `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, and `exposure_estimate_config`. Canonical home for these keys, which historically lived in `parameters`. */
running_time_calculation?: ExperimentRunningTimeCalculation | null;
/**
* Variant keys to exclude from metric result calculations. Excluded variants are still served to users but omitted from statistical analysis. The baseline variant and holdout pseudo-variants cannot be excluded. Canonical home for what historically lived in `parameters.excluded_variants`; kept in sync with `parameters` during the deprecation window.
diff --git a/services/mcp/src/generated/experiments/api.ts b/services/mcp/src/generated/experiments/api.ts
index 6978105ea7a5..29b1dbd3f1d9 100644
--- a/services/mcp/src/generated/experiments/api.ts
+++ b/services/mcp/src/generated/experiments/api.ts
@@ -317,7 +317,7 @@ export const ExperimentsCreateBody = /* @__PURE__ */ zod
])
.optional()
.describe(
- 'Experiment parameters JSON. Supported keys include `feature_flag_variants`, `rollout_percentage`, `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, `custom_exposure_filter`, `excluded_variants` (list of variant keys to drop from statistical analysis; the baseline variant and holdout pseudo-variants cannot be excluded), and `variant_notes` (free-text notes per variant, keyed by variant key). The running-time calculator keys (`minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, `exposure_estimate_config`) are deprecated here — prefer `running_time_calculation`.'
+ 'Experiment parameters JSON. Supported keys include `feature_flag_variants`, `rollout_percentage`, `custom_exposure_filter`, `excluded_variants` (list of variant keys to drop from statistical analysis; the baseline variant and holdout pseudo-variants cannot be excluded), and `variant_notes` (free-text notes per variant, keyed by variant key).'
),
running_time_calculation: zod
.union([
@@ -374,7 +374,7 @@ export const ExperimentsCreateBody = /* @__PURE__ */ zod
])
.optional()
.describe(
- 'Running-time calculator state: `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, and `exposure_estimate_config`. Canonical home for these keys, which historically lived in `parameters`; values are kept in sync with `parameters` during the deprecation window.'
+ 'Running-time calculator state: `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, and `exposure_estimate_config`. Canonical home for these keys, which historically lived in `parameters`.'
),
excluded_variants: zod
.array(zod.string())
@@ -2705,7 +2705,7 @@ export const ExperimentsPartialUpdateBody = /* @__PURE__ */ zod
])
.optional()
.describe(
- 'Experiment parameters JSON. Supported keys include `feature_flag_variants`, `rollout_percentage`, `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, `custom_exposure_filter`, `excluded_variants` (list of variant keys to drop from statistical analysis; the baseline variant and holdout pseudo-variants cannot be excluded), and `variant_notes` (free-text notes per variant, keyed by variant key). The running-time calculator keys (`minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, `exposure_estimate_config`) are deprecated here — prefer `running_time_calculation`.'
+ 'Experiment parameters JSON. Supported keys include `feature_flag_variants`, `rollout_percentage`, `custom_exposure_filter`, `excluded_variants` (list of variant keys to drop from statistical analysis; the baseline variant and holdout pseudo-variants cannot be excluded), and `variant_notes` (free-text notes per variant, keyed by variant key).'
),
running_time_calculation: zod
.union([
@@ -2762,7 +2762,7 @@ export const ExperimentsPartialUpdateBody = /* @__PURE__ */ zod
])
.optional()
.describe(
- 'Running-time calculator state: `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, and `exposure_estimate_config`. Canonical home for these keys, which historically lived in `parameters`; values are kept in sync with `parameters` during the deprecation window.'
+ 'Running-time calculator state: `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, and `exposure_estimate_config`. Canonical home for these keys, which historically lived in `parameters`.'
),
excluded_variants: zod
.array(zod.string())
@@ -5152,7 +5152,7 @@ export const ExperimentsDuplicateCreateBody = /* @__PURE__ */ zod
])
.optional()
.describe(
- 'Experiment parameters JSON. Supported keys include `feature_flag_variants`, `rollout_percentage`, `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, `custom_exposure_filter`, `excluded_variants` (list of variant keys to drop from statistical analysis; the baseline variant and holdout pseudo-variants cannot be excluded), and `variant_notes` (free-text notes per variant, keyed by variant key). The running-time calculator keys (`minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, `exposure_estimate_config`) are deprecated here — prefer `running_time_calculation`.'
+ 'Experiment parameters JSON. Supported keys include `feature_flag_variants`, `rollout_percentage`, `custom_exposure_filter`, `excluded_variants` (list of variant keys to drop from statistical analysis; the baseline variant and holdout pseudo-variants cannot be excluded), and `variant_notes` (free-text notes per variant, keyed by variant key).'
),
running_time_calculation: zod
.union([
@@ -5209,7 +5209,7 @@ export const ExperimentsDuplicateCreateBody = /* @__PURE__ */ zod
])
.optional()
.describe(
- 'Running-time calculator state: `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, and `exposure_estimate_config`. Canonical home for these keys, which historically lived in `parameters`; values are kept in sync with `parameters` during the deprecation window.'
+ 'Running-time calculator state: `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, and `exposure_estimate_config`. Canonical home for these keys, which historically lived in `parameters`.'
),
excluded_variants: zod
.array(zod.string())
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-update.json
index c9c331f4a42a..1afdc5279736 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-update.json
@@ -3659,7 +3659,7 @@
"type": "null"
}
],
- "description": "Experiment parameters JSON. Supported keys include `feature_flag_variants`, `rollout_percentage`, `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, `custom_exposure_filter`, `excluded_variants` (list of variant keys to drop from statistical analysis; the baseline variant and holdout pseudo-variants cannot be excluded), and `variant_notes` (free-text notes per variant, keyed by variant key). The running-time calculator keys (`minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, `exposure_estimate_config`) are deprecated here — prefer `running_time_calculation`."
+ "description": "Experiment parameters JSON. Supported keys include `feature_flag_variants`, `rollout_percentage`, `custom_exposure_filter`, `excluded_variants` (list of variant keys to drop from statistical analysis; the baseline variant and holdout pseudo-variants cannot be excluded), and `variant_notes` (free-text notes per variant, keyed by variant key)."
},
"running_time_calculation": {
"anyOf": [