: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(experiments): accept metric breakdowns in the API metric schema (#113698)
Juraj Majerik27f7c446949f
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.jsonindex 0abf895b60fc..684cadcd3042 100644--- a/frontend/src/queries/schema.json+++ b/frontend/src/queries/schema.json@@ -25341,6 +25341,41 @@"required": ["kind", "source"],"type": "object"},+ "ExperimentApiBreakdown": {+ "anyOf": [+ {+ "$ref": "#/definitions/ExperimentApiPropertyBreakdown"+ },+ {+ "$ref": "#/definitions/ExperimentApiGroupBreakdown"+ }+ ],+ "description": "Slim breakdown entry for experiment API payloads. Narrower than the full Breakdown type: the experiment query only resolves event, person, session and group properties, so the other breakdown types are not accepted here."+ },+ "ExperimentApiBreakdownAttributionType": {+ "description": "'all_events' is excluded: the experiment funnel query rejects it.",+ "enum": ["first_touch", "last_touch", "step"],+ "type": "string"+ },+ "ExperimentApiBreakdownFilter": {+ "additionalProperties": false,+ "description": "Slim breakdown config for experiment API payloads. Only the fields the experiment query runner reads; the full BreakdownFilter's other knobs (breakdown, breakdown_type, attribution, …) are ignored for experiment metrics, so exposing them would only invite no-op input.",+ "properties": {+ "breakdown_limit": {+ "$ref": "#/definitions/integer",+ "description": "Maximum number of breakdown values to compute results for."+ },+ "breakdowns": {+ "description": "Properties to break the metric results down by.",+ "items": {+ "$ref": "#/definitions/ExperimentApiBreakdown"+ },+ "maxItems": 3,+ "type": "array"+ }+ },+ "type": "object"+ },"ExperimentApiEventSource": {"additionalProperties": false,"description": "Slim event/action source for experiment API payloads.",@@ -25435,10 +25470,43 @@},"type": "object"},+ "ExperimentApiGroupBreakdown": {+ "additionalProperties": false,+ "description": "Breakdown by a group property.",+ "properties": {+ "group_type_index": {+ "description": "Which group type the property belongs to.",+ "enum": [0, 1, 2, 3, 4],+ "type": "number"+ },+ "property": {+ "description": "Property name to break down by.",+ "type": "string"+ },+ "type": {+ "const": "group",+ "type": "string"+ }+ },+ "required": ["property", "type", "group_type_index"],+ "type": "object"+ },"ExperimentApiMetric": {"additionalProperties": false,"description": "Experiment metric for API create/update. All metric-type-specific fields are optional; discriminated by metric_type at runtime.","properties": {+ "breakdownAttributionType": {+ "$ref": "#/definitions/ExperimentApiBreakdownAttributionType",+ "description": "For funnel metrics with breakdowns: which step the breakdown value is read from. 'all_events' is not supported for experiment funnels."+ },+ "breakdownAttributionValue": {+ "$ref": "#/definitions/integer",+ "description": "When breakdownAttributionType is 'step', the 0-indexed step to attribute from."+ },+ "breakdownFilter": {+ "$ref": "#/definitions/ExperimentApiBreakdownFilter",+ "description": "Break the metric results down by up to 3 event, person, session or group properties."+ },"completion_event": {"$ref": "#/definitions/ExperimentApiEventSource","description": "For retention metrics: completion event."@@ -25542,6 +25610,26 @@"required": ["kind", "metric_type"],"type": "object"},+ "ExperimentApiPropertyBreakdown": {+ "additionalProperties": false,+ "description": "Breakdown by an event, person or session property.",+ "properties": {+ "property": {+ "description": "Property name to break down by.",+ "type": "string"+ },+ "type": {+ "$ref": "#/definitions/ExperimentApiPropertyBreakdownType",+ "description": "Where the property lives. Defaults to 'event'."+ }+ },+ "required": ["property"],+ "type": "object"+ },+ "ExperimentApiPropertyBreakdownType": {+ "enum": ["event", "person", "session"],+ "type": "string"+ },"ExperimentApiRetentionStart": {"additionalProperties": false,"description": "Slim start source for retention metrics in API payloads. kind stays required so a payload without it fails validation instead of silently becoming an exposure start.",diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.tsindex cfe672729c5d..93ecf31c5e73 100644--- a/frontend/src/queries/schema/schema-general.ts+++ b/frontend/src/queries/schema/schema-general.ts@@ -5769,6 +5769,45 @@ export interface ExperimentApiRetentionStart extends Omit<ExperimentApiEventSourkind: 'EventsNode' | 'ActionsNode' | 'ExperimentExposureNode'}+/** 'all_events' is excluded: the experiment funnel query rejects it. */+export type ExperimentApiBreakdownAttributionType = 'first_touch' | 'last_touch' | 'step'++export type ExperimentApiPropertyBreakdownType = 'event' | 'person' | 'session'++/** Breakdown by an event, person or session property. */+export interface ExperimentApiPropertyBreakdown {+ /** Property name to break down by. */+ property: string+ /** Where the property lives. Defaults to 'event'. */+ type?: ExperimentApiPropertyBreakdownType+}++/** Breakdown by a group property. */+export interface ExperimentApiGroupBreakdown {+ /** Property name to break down by. */+ property: string+ type: 'group'+ /** Which group type the property belongs to. */+ group_type_index: 0 | 1 | 2 | 3 | 4+}++/** Slim breakdown entry for experiment API payloads. Narrower than the full+ * Breakdown type: the experiment query only resolves event, person, session+ * and group properties, so the other breakdown types are not accepted here. */+export type ExperimentApiBreakdown = ExperimentApiPropertyBreakdown | ExperimentApiGroupBreakdown++/** Slim breakdown config for experiment API payloads. Only the fields the+ * experiment query runner reads; the full BreakdownFilter's other knobs+ * (breakdown, breakdown_type, attribution, …) are ignored for experiment+ * metrics, so exposing them would only invite no-op input. */+export interface ExperimentApiBreakdownFilter {+ /** Properties to break the metric results down by.+ * @maxItems 3 */+ breakdowns?: ExperimentApiBreakdown[]+ /** Maximum number of breakdown values to compute results for. */+ breakdown_limit?: integer+}+/** Experiment metric for API create/update. All metric-type-specific* fields are optional; discriminated by metric_type at runtime. */export interface ExperimentApiMetric {@@ -5831,6 +5870,13 @@ export interface ExperimentApiMetric {retention_window_end?: integerretention_window_unit?: FunnelConversionWindowTimeUnitstart_handling?: 'first_seen' | 'last_seen'+ /** Break the metric results down by up to 3 event, person, session or group properties. */+ breakdownFilter?: ExperimentApiBreakdownFilter+ /** For funnel metrics with breakdowns: which step the breakdown value is read from.+ * 'all_events' is not supported for experiment funnels. */+ breakdownAttributionType?: ExperimentApiBreakdownAttributionType+ /** When breakdownAttributionType is 'step', the 0-indexed step to attribute from. */+ breakdownAttributionValue?: integer}export interface ExperimentParameters {diff --git a/posthog/schema.py b/posthog/schema.pyindex f34f853b2380..ceacbcadb9c8 100644--- a/posthog/schema.py+++ b/posthog/schema.py@@ -120,6 +120,8 @@ from posthog.schema_enums import (ErrorTrackingReleasesOrderBy as ErrorTrackingReleasesOrderBy,EvaluationRuntime as EvaluationRuntime,EventMatchScope as EventMatchScope,+ ExperimentApiBreakdownAttributionType as ExperimentApiBreakdownAttributionType,+ ExperimentApiPropertyBreakdownType as ExperimentApiPropertyBreakdownType,ExperimentMetricGoal as ExperimentMetricGoal,ExperimentMetricMathType as ExperimentMetricMathType,ExperimentMetricType as ExperimentMetricType,@@ -143,6 +145,7 @@ from posthog.schema_enums import (GoogleAdsDefaultSources as GoogleAdsDefaultSources,GradientScaleMode as GradientScaleMode,GroupMathType as GroupMathType,+ GroupTypeIndex as GroupTypeIndex,HeatmapSortOrder as HeatmapSortOrder,HedgehogActorAccessoryOption as HedgehogActorAccessoryOption,HedgehogActorColorOption as HedgehogActorColorOption,@@ -1512,6 +1515,15 @@ class EventsQueryPersonColumn(BaseModel):uuid: str+class ExperimentApiGroupBreakdown(BaseModel):+ model_config = ConfigDict(+ extra="forbid",+ )+ group_type_index: GroupTypeIndex = Field(..., description="Which group type the property belongs to.")+ property: str = Field(..., description="Property name to break down by.")+ type: Literal["group"] = "group"++class ExperimentExposureEstimateConfig(BaseModel):model_config = ConfigDict(extra="forbid",@@ -5617,6 +5629,16 @@ class ExperimentApiEventSource(BaseModel):)+class ExperimentApiPropertyBreakdown(BaseModel):+ model_config = ConfigDict(+ extra="forbid",+ )+ property: str = Field(..., description="Property name to break down by.")+ type: ExperimentApiPropertyBreakdownType | None = Field(+ default=None, description="Where the property lives. Defaults to 'event'."+ )++class ExperimentApiRetentionStart(BaseModel):model_config = ConfigDict(extra="forbid",@@ -18364,10 +18386,40 @@ class EventsQueryResponse(BaseModel):)+class ExperimentApiBreakdownFilter(BaseModel):+ model_config = ConfigDict(+ extra="forbid",+ )+ breakdown_limit: int | None = Field(+ default=None,+ description="Maximum number of breakdown values to compute results for.",+ )+ breakdowns: list[ExperimentApiPropertyBreakdown | ExperimentApiGroupBreakdown] | None = Field(+ default=None,+ description="Properties to break the metric results down by.",+ max_length=3,+ )++class ExperimentApiMetric(BaseModel):model_config = ConfigDict(extra="forbid",)+ breakdownAttributionType: ExperimentApiBreakdownAttributionType | None = Field(+ default=None,+ description=(+ "For funnel metrics with breakdowns: which step the breakdown value is read"+ " from. 'all_events' is not supported for experiment funnels."+ ),+ )+ breakdownAttributionValue: int | None = Field(+ default=None,+ description=("When breakdownAttributionType is 'step', the 0-indexed step to attribute from."),+ )+ breakdownFilter: ExperimentApiBreakdownFilter | None = Field(+ default=None,+ description=("Break the metric results down by up to 3 event, person, session or group properties."),+ )completion_event: ExperimentApiEventSource | None = Field(default=None, description="For retention metrics: completion event.")diff --git a/posthog/schema_enums.py b/posthog/schema_enums.pyindex cd39b7f9712d..f27bb2fe85aa 100644--- a/posthog/schema_enums.py+++ b/posthog/schema_enums.py@@ -1356,6 +1356,12 @@ class MultipleVariantHandling(StrEnum):FIRST_SEEN = "first_seen"+class ExperimentApiBreakdownAttributionType(StrEnum):+ FIRST_TOUCH = "first_touch"+ LAST_TOUCH = "last_touch"+ STEP = "step"++class Kind1(StrEnum):EVENTS_NODE = "EventsNode"ACTIONS_NODE = "ActionsNode"@@ -1366,11 +1372,25 @@ class Kind2(StrEnum):ACTIONS_NODE = "ActionsNode"+class GroupTypeIndex(float, Enum):+ NUMBER_0 = 0+ NUMBER_1 = 1+ NUMBER_2 = 2+ NUMBER_3 = 3+ NUMBER_4 = 4++class StartHandling(StrEnum):FIRST_SEEN = "first_seen"LAST_SEEN = "last_seen"+class ExperimentApiPropertyBreakdownType(StrEnum):+ EVENT = "event"+ PERSON = "person"+ SESSION = "session"++class Kind3(StrEnum):EVENTS_NODE = "EventsNode"ACTIONS_NODE = "ActionsNode"diff --git a/products/experiments/frontend/generated/api.schemas.ts b/products/experiments/frontend/generated/api.schemas.tsindex eee4ebe1fe6a..4d322b8ddc71 100644--- a/products/experiments/frontend/generated/api.schemas.ts+++ b/products/experiments/frontend/generated/api.schemas.ts@@ -2094,6 +2094,56 @@ export interface ExperimentApiExposureCriteriaApi {multiple_variant_handling?: MultipleVariantHandlingApi | null}+export type ExperimentApiBreakdownAttributionTypeApi =+ (typeof ExperimentApiBreakdownAttributionTypeApi)[keyof typeof ExperimentApiBreakdownAttributionTypeApi]++export const ExperimentApiBreakdownAttributionTypeApi = {+ FirstTouch: 'first_touch',+ LastTouch: 'last_touch',+ Step: 'step',+} as const++export type ExperimentApiPropertyBreakdownTypeApi =+ (typeof ExperimentApiPropertyBreakdownTypeApi)[keyof typeof ExperimentApiPropertyBreakdownTypeApi]++export const ExperimentApiPropertyBreakdownTypeApi = {+ Event: 'event',+ Person: 'person',+ Session: 'session',+} as const++export interface ExperimentApiPropertyBreakdownApi {+ /** Property name to break down by. */+ property: string+ /** Where the property lives. Defaults to 'event'. */+ type?: ExperimentApiPropertyBreakdownTypeApi | null+}++export type GroupTypeIndexApi = (typeof GroupTypeIndexApi)[keyof typeof GroupTypeIndexApi]++export const GroupTypeIndexApi = {+ Number0: 0,+ Number1: 1,+ Number2: 2,+ Number3: 3,+ Number4: 4,+} as const++export interface ExperimentApiGroupBreakdownApi {+ /** Which group type the property belongs to. */+ group_type_index: GroupTypeIndexApi+ /** Property name to break down by. */+ property: string+ type?: 'group'+}++export interface ExperimentApiBreakdownFilterApi {+ /** Maximum number of breakdown values to compute results for. */+ breakdown_limit?: number | null+ /** Properties to break the metric results down by. */+ breakdowns?: (ExperimentApiPropertyBreakdownApi | ExperimentApiGroupBreakdownApi)[] | null+}+export type Kind1Api = (typeof Kind1Api)[keyof typeof Kind1Api]export const Kind1Api = {@@ -2156,6 +2206,12 @@ export interface ExperimentApiRetentionStartApi {}export interface ExperimentApiMetricApi {+ /** For funnel metrics with breakdowns: which step the breakdown value is read from. 'all_events' is not supported for experiment funnels. */+ breakdownAttributionType?: ExperimentApiBreakdownAttributionTypeApi | null+ /** When breakdownAttributionType is 'step', the 0-indexed step to attribute from. */+ breakdownAttributionValue?: number | null+ /** Break the metric results down by up to 3 event, person, session or group properties. */+ breakdownFilter?: ExperimentApiBreakdownFilterApi | null/** For retention metrics: completion event. */completion_event?: ExperimentApiEventSourceApi | null/** Only count metric events within this many units after the user's first exposure. Requires conversion_window_unit: a window without a unit is ignored and the metric counts events until the experiment ends. Omit both to count until the experiment ends. */diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 2788330cf8d1..50da2fcfe3bb 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -43047,6 +43047,57 @@ export namespace Schemas {multiple_variant_handling?: MultipleVariantHandling | null;}+ export type ExperimentApiBreakdownAttributionType = typeof ExperimentApiBreakdownAttributionType[keyof typeof ExperimentApiBreakdownAttributionType];+++ export const ExperimentApiBreakdownAttributionType = {+ FirstTouch: 'first_touch',+ LastTouch: 'last_touch',+ Step: 'step',+ } as const;++ export type ExperimentApiPropertyBreakdownType = typeof ExperimentApiPropertyBreakdownType[keyof typeof ExperimentApiPropertyBreakdownType];+++ export const ExperimentApiPropertyBreakdownType = {+ Event: 'event',+ Person: 'person',+ Session: 'session',+ } as const;++ export interface ExperimentApiPropertyBreakdown {+ /** Property name to break down by. */+ property: string;+ /** Where the property lives. Defaults to 'event'. */+ type?: ExperimentApiPropertyBreakdownType | null;+ }++ export type GroupTypeIndex = typeof GroupTypeIndex[keyof typeof GroupTypeIndex];+++ export const GroupTypeIndex = {+ Number0: 0,+ Number1: 1,+ Number2: 2,+ Number3: 3,+ Number4: 4,+ } as const;++ export interface ExperimentApiGroupBreakdown {+ /** Which group type the property belongs to. */+ group_type_index: GroupTypeIndex;+ /** Property name to break down by. */+ property: string;+ type?: 'group';+ }++ export interface ExperimentApiBreakdownFilter {+ /** Maximum number of breakdown values to compute results for. */+ breakdown_limit?: number | null;+ /** Properties to break the metric results down by. */+ breakdowns?: (ExperimentApiPropertyBreakdown | ExperimentApiGroupBreakdown)[] | null;+ }+export type Kind1 = typeof Kind1[keyof typeof Kind1];@@ -43112,6 +43163,12 @@ export namespace Schemas {}export interface ExperimentApiMetric {+ /** For funnel metrics with breakdowns: which step the breakdown value is read from. 'all_events' is not supported for experiment funnels. */+ breakdownAttributionType?: ExperimentApiBreakdownAttributionType | null;+ /** When breakdownAttributionType is 'step', the 0-indexed step to attribute from. */+ breakdownAttributionValue?: number | null;+ /** Break the metric results down by up to 3 event, person, session or group properties. */+ breakdownFilter?: ExperimentApiBreakdownFilter | null;/** For retention metrics: completion event. */completion_event?: ExperimentApiEventSource | null;/** Only count metric events within this many units after the user's first exposure. Requires conversion_window_unit: a window without a unit is ignored and the metric counts events until the experiment ends. Omit both to count until the experiment ends. */diff --git a/services/mcp/src/generated/experiments/api.ts b/services/mcp/src/generated/experiments/api.tsindex 02fe3ac58fe1..8baa9bd4b99d 100644--- a/services/mcp/src/generated/experiments/api.ts+++ b/services/mcp/src/generated/experiments/api.ts@@ -881,6 +881,9 @@ export const experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesexport const experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwofourEventFiltersOneItemFourTypeDefault = `feature`export const experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwofourEventFiltersOneItemFiveTypeDefault = `hogql`export const experimentsCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwofourTypeDefault = `behavioral`+export const experimentsCreateBodyMetricsOneItemBreakdownFilterOneBreakdownsOneItemTwoTypeDefault = `group`+export const experimentsCreateBodyMetricsOneItemBreakdownFilterOneBreakdownsOneMax = 3+export const experimentsCreateBodyMetricsOneItemCompletionEventOnePropertiesOneItemOperatorDefault = `exact`export const experimentsCreateBodyMetricsOneItemCompletionEventOnePropertiesOneItemTypeDefault = `event`export const experimentsCreateBodyMetricsOneItemDenominatorOnePropertiesOneItemOperatorDefault = `exact`@@ -912,6 +915,9 @@ export const experimentsCreateBodyMetricsOneItemStartEventOnePropertiesOneItemTyexport const experimentsCreateBodyMetricsOneItemUpperBoundPercentileOneMin = 0export const experimentsCreateBodyMetricsOneItemUpperBoundPercentileOneMax = 1+export const experimentsCreateBodyMetricsSecondaryOneItemBreakdownFilterOneBreakdownsOneItemTwoTypeDefault = `group`+export const experimentsCreateBodyMetricsSecondaryOneItemBreakdownFilterOneBreakdownsOneMax = 3+export const experimentsCreateBodyMetricsSecondaryOneItemCompletionEventOnePropertiesOneItemOperatorDefault = `exact`export const experimentsCreateBodyMetricsSecondaryOneItemCompletionEventOnePropertiesOneItemTypeDefault = `event`export const experimentsCreateBodyMetricsSecondaryOneItemDenominatorOnePropertiesOneItemOperatorDefault = `exact`@@ -4606,6 +4612,81 @@ export const ExperimentsCreateBody = () => zodzod.array(zod.object({+ breakdownAttributionType: zod+ .union([zod.enum(['first_touch', 'last_touch', 'step']), zod.null()])+ .optional()+ .describe(+ "For funnel metrics with breakdowns: which step the breakdown value is read from. 'all_events' is not supported for experiment funnels."+ ),+ breakdownAttributionValue: zod+ .union([zod.number(), zod.null()])+ .optional()+ .describe(+ "When breakdownAttributionType is 'step', the 0-indexed step to attribute from."+ ),+ breakdownFilter: zod+ .union([+ zod.object({+ breakdown_limit: zod+ .union([zod.number(), zod.null()])+ .optional()+ .describe('Maximum number of breakdown values to compute results for.'),+ breakdowns: zod+ .union([+ zod+ .array(+ zod.union([+ zod.object({+ property: zod+ .string()+ .describe('Property name to break down by.'),+ type: zod+ .union([+ zod.enum(['event', 'person', 'session']),+ zod.null(),+ ])+ .optional()+ .describe(+ "Where the property lives. Defaults to 'event'."+ ),+ }),+ zod.object({+ group_type_index: zod+ .union([+ zod.literal(0),+ zod.literal(1),+ zod.literal(2),+ zod.literal(3),+ zod.literal(4),+ ])+ .describe(+ 'Which group type the property belongs to.'+ ),+ property: zod+ .string()+ .describe('Property name to break down by.'),+ type: zod+ .literal('group')+ .default(+ experimentsCreateBodyMetricsOneItemBreakdownFilterOneBreakdownsOneItemTwoTypeDefault+ ),+ }),+ ])+ )+ .max(+ experimentsCreateBodyMetricsOneItemBreakdownFilterOneBreakdownsOneMax+ ),+ zod.null(),+ ])+ .optional()+ .describe('Properties to break the metric results down by.'),+ }),+ zod.null(),+ ])+ .optional()+ .describe(+ 'Break the metric results down by up to 3 event, person, session or group properties.'+ ),completion_event: zod.union([zod.object({@@ -5648,6 +5729,81 @@ export const ExperimentsCreateBody = () => zodzod.array(zod.object({+ breakdownAttributionType: zod+ .union([zod.enum(['first_touch', 'last_touch', 'step']), zod.null()])+ .optional()+ .describe(+ "For funnel metrics with breakdowns: which step the breakdown value is read from. 'all_events' is not supported for experiment funnels."+ ),+ breakdownAttributionValue: zod+ .union([zod.number(), zod.null()])+ .optional()+ .describe(+ "When breakdownAttributionType is 'step', the 0-indexed step to attribute from."+ ),+ breakdownFilter: zod+ .union([+ zod.object({+ breakdown_limit: zod+ .union([zod.number(), zod.null()])+ .optional()+ .describe('Maximum number of breakdown values to compute results for.'),+ breakdowns: zod+ .union([+ zod+ .array(+ zod.union([+ zod.object({+ property: zod+ .string()+ .describe('Property name to break down by.'),+ type: zod+ .union([+ zod.enum(['event', 'person', 'session']),+ zod.null(),+ ])+ .optional()+ .describe(+ "Where the property lives. Defaults to 'event'."+ ),+ }),+ zod.object({+ group_type_index: zod+ .union([+ zod.literal(0),+ zod.literal(1),+ zod.literal(2),+ zod.literal(3),+ zod.literal(4),+ ])+ .describe(+ 'Which group type the property belongs to.'+ ),+ property: zod+ .string()+ .describe('Property name to break down by.'),+ type: zod+ .literal('group')+ .default(+ experimentsCreateBodyMetricsSecondaryOneItemBreakdownFilterOneBreakdownsOneItemTwoTypeDefault+ ),+ }),+ ])+ )+ .max(+ experimentsCreateBodyMetricsSecondaryOneItemBreakdownFilterOneBreakdownsOneMax+ ),+ zod.null(),+ ])+ .optional()+ .describe('Properties to break the metric results down by.'),+ }),+ zod.null(),+ ])+ .optional()+ .describe(+ 'Break the metric results down by up to 3 event, person, session or group properties.'+ ),completion_event: zod.union([zod.object({@@ -6856,6 +7012,9 @@ export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOneProexport const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwofourEventFiltersOneItemFourTypeDefault = `feature`export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwofourEventFiltersOneItemFiveTypeDefault = `hogql`export const experimentsPartialUpdateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwofourTypeDefault = `behavioral`+export const experimentsPartialUpdateBodyMetricsOneItemBreakdownFilterOneBreakdownsOneItemTwoTypeDefault = `group`+export const experimentsPartialUpdateBodyMetricsOneItemBreakdownFilterOneBreakdownsOneMax = 3+export const experimentsPartialUpdateBodyMetricsOneItemCompletionEventOnePropertiesOneItemOperatorDefault = `exact`export const experimentsPartialUpdateBodyMetricsOneItemCompletionEventOnePropertiesOneItemTypeDefault = `event`export const experimentsPartialUpdateBodyMetricsOneItemDenominatorOnePropertiesOneItemOperatorDefault = `exact`@@ -6887,6 +7046,9 @@ export const experimentsPartialUpdateBodyMetricsOneItemStartEventOnePropertiesOnexport const experimentsPartialUpdateBodyMetricsOneItemUpperBoundPercentileOneMin = 0export const experimentsPartialUpdateBodyMetricsOneItemUpperBoundPercentileOneMax = 1+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemBreakdownFilterOneBreakdownsOneItemTwoTypeDefault = `group`+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemBreakdownFilterOneBreakdownsOneMax = 3+export const experimentsPartialUpdateBodyMetricsSecondaryOneItemCompletionEventOnePropertiesOneItemOperatorDefault = `exact`export const experimentsPartialUpdateBodyMetricsSecondaryOneItemCompletionEventOnePropertiesOneItemTypeDefault = `event`export const experimentsPartialUpdateBodyMetricsSecondaryOneItemDenominatorOnePropertiesOneItemOperatorDefault = `exact`@@ -10579,6 +10741,81 @@ export const ExperimentsPartialUpdateBody = () => zodzod.array(zod.object({+ breakdownAttributionType: zod+ .union([zod.enum(['first_touch', 'last_touch', 'step']), zod.null()])+ .optional()+ .describe(+ "For funnel metrics with breakdowns: which step the breakdown value is read from. 'all_events' is not supported for experiment funnels."+ ),+ breakdownAttributionValue: zod+ .union([zod.number(), zod.null()])+ .optional()+ .describe(+ "When breakdownAttributionType is 'step', the 0-indexed step to attribute from."+ ),+ breakdownFilter: zod+ .union([+ zod.object({+ breakdown_limit: zod+ .union([zod.number(), zod.null()])+ .optional()+ .describe('Maximum number of breakdown values to compute results for.'),+ breakdowns: zod+ .union([+ zod+ .array(+ zod.union([+ zod.object({+ property: zod+ .string()+ .describe('Property name to break down by.'),+ type: zod+ .union([+ zod.enum(['event', 'person', 'session']),+ zod.null(),+ ])+ .optional()+ .describe(+ "Where the property lives. Defaults to 'event'."+ ),+ }),+ zod.object({+ group_type_index: zod+ .union([+ zod.literal(0),+ zod.literal(1),+ zod.literal(2),+ zod.literal(3),+ zod.literal(4),+ ])+ .describe(+ 'Which group type the property belongs to.'+ ),+ property: zod+ .string()+ .describe('Property name to break down by.'),+ type: zod+ .literal('group')+ .default(+ experimentsPartialUpdateBodyMetricsOneItemBreakdownFilterOneBreakdownsOneItemTwoTypeDefault+ ),+ }),+ ])+ )+ .max(+ experimentsPartialUpdateBodyMetricsOneItemBreakdownFilterOneBreakdownsOneMax+ ),+ zod.null(),+ ])+ .optional()+ .describe('Properties to break the metric results down by.'),+ }),+ zod.null(),+ ])+ .optional()+ .describe(+ 'Break the metric results down by up to 3 event, person, session or group properties.'+ ),completion_event: zod.union([zod.object({@@ -11621,6 +11858,81 @@ export const ExperimentsPartialUpdateBody = () => zodzod.array(zod.object({+ breakdownAttributionType: zod+ .union([zod.enum(['first_touch', 'last_touch', 'step']), zod.null()])+ .optional()+ .describe(+ "For funnel metrics with breakdowns: which step the breakdown value is read from. 'all_events' is not supported for experiment funnels."+ ),+ breakdownAttributionValue: zod+ .union([zod.number(), zod.null()])+ .optional()+ .describe(+ "When breakdownAttributionType is 'step', the 0-indexed step to attribute from."+ ),+ breakdownFilter: zod+ .union([+ zod.object({+ breakdown_limit: zod+ .union([zod.number(), zod.null()])+ .optional()+ .describe('Maximum number of breakdown values to compute results for.'),+ breakdowns: zod+ .union([+ zod+ .array(+ zod.union([+ zod.object({+ property: zod+ .string()+ .describe('Property name to break down by.'),+ type: zod+ .union([+ zod.enum(['event', 'person', 'session']),+ zod.null(),+ ])+ .optional()+ .describe(+ "Where the property lives. Defaults to 'event'."+ ),+ }),+ zod.object({+ group_type_index: zod+ .union([+ zod.literal(0),+ zod.literal(1),+ zod.literal(2),+ zod.literal(3),+ zod.literal(4),+ ])+ .describe(+ 'Which group type the property belongs to.'+ ),+ property: zod+ .string()+ .describe('Property name to break down by.'),+ type: zod+ .literal('group')+ .default(+ experimentsPartialUpdateBodyMetricsSecondaryOneItemBreakdownFilterOneBreakdownsOneItemTwoTypeDefault+ ),+ }),+ ])+ )+ .max(+ experimentsPartialUpdateBodyMetricsSecondaryOneItemBreakdownFilterOneBreakdownsOneMax+ ),+ zod.null(),+ ])+ .optional()+ .describe('Properties to break the metric results down by.'),+ }),+ zod.null(),+ ])+ .optional()+ .describe(+ 'Break the metric results down by up to 3 event, person, session or group properties.'+ ),completion_event: zod.union([zod.object({@@ -12910,6 +13222,9 @@ export const experimentsDuplicateCreateBodyExposureCriteriaOneExposureConfigOnePexport const experimentsDuplicateCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwofourEventFiltersOneItemFourTypeDefault = `feature`export const experimentsDuplicateCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwofourEventFiltersOneItemFiveTypeDefault = `hogql`export const experimentsDuplicateCreateBodyExposureCriteriaOneExposureConfigOnePropertiesItemTwofourTypeDefault = `behavioral`+export const experimentsDuplicateCreateBodyMetricsOneItemBreakdownFilterOneBreakdownsOneItemTwoTypeDefault = `group`+export const experimentsDuplicateCreateBodyMetricsOneItemBreakdownFilterOneBreakdownsOneMax = 3+export const experimentsDuplicateCreateBodyMetricsOneItemCompletionEventOnePropertiesOneItemOperatorDefault = `exact`export const experimentsDuplicateCreateBodyMetricsOneItemCompletionEventOnePropertiesOneItemTypeDefault = `event`export const experimentsDuplicateCreateBodyMetricsOneItemDenominatorOnePropertiesOneItemOperatorDefault = `exact`@@ -12941,6 +13256,9 @@ export const experimentsDuplicateCreateBodyMetricsOneItemStartEventOnePropertiesexport const experimentsDuplicateCreateBodyMetricsOneItemUpperBoundPercentileOneMin = 0export const experimentsDuplicateCreateBodyMetricsOneItemUpperBoundPercentileOneMax = 1+export const experimentsDuplicateCreateBodyMetricsSecondaryOneItemBreakdownFilterOneBreakdownsOneItemTwoTypeDefault = `group`+export const experimentsDuplicateCreateBodyMetricsSecondaryOneItemBreakdownFilterOneBreakdownsOneMax = 3+export const experimentsDuplicateCreateBodyMetricsSecondaryOneItemCompletionEventOnePropertiesOneItemOperatorDefault = `exact`export const experimentsDuplicateCreateBodyMetricsSecondaryOneItemCompletionEventOnePropertiesOneItemTypeDefault = `event`export const experimentsDuplicateCreateBodyMetricsSecondaryOneItemDenominatorOnePropertiesOneItemOperatorDefault = `exact`@@ -16531,6 +16849,81 @@ export const ExperimentsDuplicateCreateBody = () => zodzod.array(zod.object({+ breakdownAttributionType: zod+ .union([zod.enum(['first_touch', 'last_touch', 'step']), zod.null()])+ .optional()+ .describe(+ "For funnel metrics with breakdowns: which step the breakdown value is read from. 'all_events' is not supported for experiment funnels."+ ),+ breakdownAttributionValue: zod+ .union([zod.number(), zod.null()])+ .optional()+ .describe(+ "When breakdownAttributionType is 'step', the 0-indexed step to attribute from."+ ),+ breakdownFilter: zod+ .union([+ zod.object({+ breakdown_limit: zod+ .union([zod.number(), zod.null()])+ .optional()+ .describe('Maximum number of breakdown values to compute results for.'),+ breakdowns: zod+ .union([+ zod+ .array(+ zod.union([+ zod.object({+ property: zod+ .string()+ .describe('Property name to break down by.'),+ type: zod+ .union([+ zod.enum(['event', 'person', 'session']),+ zod.null(),+ ])+ .optional()+ .describe(+ "Where the property lives. Defaults to 'event'."+ ),+ }),+ zod.object({+ group_type_index: zod+ .union([+ zod.literal(0),+ zod.literal(1),+ zod.literal(2),+ zod.literal(3),+ zod.literal(4),+ ])+ .describe(+ 'Which group type the property belongs to.'+ ),+ property: zod+ .string()+ .describe('Property name to break down by.'),+ type: zod+ .literal('group')+ .default(+ experimentsDuplicateCreateBodyMetricsOneItemBreakdownFilterOneBreakdownsOneItemTwoTypeDefault+ ),+ }),+ ])+ )+ .max(+ experimentsDuplicateCreateBodyMetricsOneItemBreakdownFilterOneBreakdownsOneMax+ ),+ zod.null(),+ ])+ .optional()+ .describe('Properties to break the metric results down by.'),+ }),+ zod.null(),+ ])+ .optional()+ .describe(+ 'Break the metric results down by up to 3 event, person, session or group properties.'+ ),completion_event: zod.union([zod.object({@@ -17573,6 +17966,81 @@ export const ExperimentsDuplicateCreateBody = () => zodzod.array(zod.object({+ breakdownAttributionType: zod+ .union([zod.enum(['first_touch', 'last_touch', 'step']), zod.null()])+ .optional()+ .describe(+ "For funnel metrics with breakdowns: which step the breakdown value is read from. 'all_events' is not supported for experiment funnels."+ ),+ breakdownAttributionValue: zod+ .union([zod.number(), zod.null()])+ .optional()+ .describe(+ "When breakdownAttributionType is 'step', the 0-indexed step to attribute from."+ ),+ breakdownFilter: zod+ .union([+ zod.object({+ breakdown_limit: zod+ .union([zod.number(), zod.null()])+ .optional()+ .describe('Maximum number of breakdown values to compute results for.'),+ breakdowns: zod+ .union([+ zod+ .array(+ zod.union([+ zod.object({+ property: zod+ .string()+ .describe('Property name to break down by.'),+ type: zod+ .union([+ zod.enum(['event', 'person', 'session']),+ zod.null(),+ ])+ .optional()+ .describe(+ "Where the property lives. Defaults to 'event'."+ ),+ }),+ zod.object({+ group_type_index: zod+ .union([+ zod.literal(0),+ zod.literal(1),+ zod.literal(2),+ zod.literal(3),+ zod.literal(4),+ ])+ .describe(+ 'Which group type the property belongs to.'+ ),+ property: zod+ .string()+ .describe('Property name to break down by.'),+ type: zod+ .literal('group')+ .default(+ experimentsDuplicateCreateBodyMetricsSecondaryOneItemBreakdownFilterOneBreakdownsOneItemTwoTypeDefault+ ),+ }),+ ])+ )+ .max(+ experimentsDuplicateCreateBodyMetricsSecondaryOneItemBreakdownFilterOneBreakdownsOneMax+ ),+ zod.null(),+ ])+ .optional()+ .describe('Properties to break the metric results down by.'),+ }),+ zod.null(),+ ])+ .optional()+ .describe(+ 'Break the metric results down by up to 3 event, person, session or group properties.'+ ),completion_event: zod.union([zod.object({diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-update.jsonindex 201d88683607..42abe4fdf513 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-update.json@@ -5884,6 +5884,135 @@"description": "List wrapper for OpenAPI schema generation — the field stores an array of metrics.","items": {"properties": {+ "breakdownAttributionType": {+ "anyOf": [+ {+ "enum": ["first_touch", "last_touch", "step"],+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "description": "For funnel metrics with breakdowns: which step the breakdown value is read from. 'all_events' is not supported for experiment funnels."+ },+ "breakdownAttributionValue": {+ "anyOf": [+ {+ "type": "number"+ },+ {+ "type": "null"+ }+ ],+ "description": "When breakdownAttributionType is 'step', the 0-indexed step to attribute from."+ },+ "breakdownFilter": {+ "anyOf": [+ {+ "properties": {+ "breakdown_limit": {+ "anyOf": [+ {+ "type": "number"+ },+ {+ "type": "null"+ }+ ],+ "description": "Maximum number of breakdown values to compute results for."+ },+ "breakdowns": {+ "anyOf": [+ {+ "items": {+ "anyOf": [+ {+ "properties": {+ "property": {+ "description": "Property name to break down by.",+ "type": "string"+ },+ "type": {+ "anyOf": [+ {+ "enum": [+ "event",+ "person",+ "session"+ ],+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "description": "Where the property lives. Defaults to 'event'."+ }+ },+ "required": ["property"],+ "type": "object"+ },+ {+ "properties": {+ "group_type_index": {+ "anyOf": [+ {+ "const": 0,+ "type": "number"+ },+ {+ "const": 1,+ "type": "number"+ },+ {+ "const": 2,+ "type": "number"+ },+ {+ "const": 3,+ "type": "number"+ },+ {+ "const": 4,+ "type": "number"+ }+ ],+ "description": "Which group type the property belongs to."+ },+ "property": {+ "description": "Property name to break down by.",+ "type": "string"+ },+ "type": {+ "const": "group",+ "default": "group",+ "type": "string"+ }+ },+ "required": ["group_type_index", "property"],+ "type": "object"+ }+ ]+ },+ "maxItems": 3,+ "type": "array"+ },+ {+ "type": "null"+ }+ ],+ "description": "Properties to break the metric results down by."+ }+ },+ "type": "object"+ },+ {+ "type": "null"+ }+ ],+ "description": "Break the metric results down by up to 3 event, person, session or group properties."+ },"completion_event": {"anyOf": [{@@ -7582,6 +7711,135 @@"description": "List wrapper for OpenAPI schema generation — the field stores an array of metrics.","items": {"properties": {+ "breakdownAttributionType": {+ "anyOf": [+ {+ "enum": ["first_touch", "last_touch", "step"],+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "description": "For funnel metrics with breakdowns: which step the breakdown value is read from. 'all_events' is not supported for experiment funnels."+ },+ "breakdownAttributionValue": {+ "anyOf": [+ {+ "type": "number"+ },+ {+ "type": "null"+ }+ ],+ "description": "When breakdownAttributionType is 'step', the 0-indexed step to attribute from."+ },+ "breakdownFilter": {+ "anyOf": [+ {+ "properties": {+ "breakdown_limit": {+ "anyOf": [+ {+ "type": "number"+ },+ {+ "type": "null"+ }+ ],+ "description": "Maximum number of breakdown values to compute results for."+ },+ "breakdowns": {+ "anyOf": [+ {+ "items": {+ "anyOf": [+ {+ "properties": {+ "property": {+ "description": "Property name to break down by.",+ "type": "string"+ },+ "type": {+ "anyOf": [+ {+ "enum": [+ "event",+ "person",+ "session"+ ],+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "description": "Where the property lives. Defaults to 'event'."+ }+ },+ "required": ["property"],+ "type": "object"+ },+ {+ "properties": {+ "group_type_index": {+ "anyOf": [+ {+ "const": 0,+ "type": "number"+ },+ {+ "const": 1,+ "type": "number"+ },+ {+ "const": 2,+ "type": "number"+ },+ {+ "const": 3,+ "type": "number"+ },+ {+ "const": 4,+ "type": "number"+ }+ ],+ "description": "Which group type the property belongs to."+ },+ "property": {+ "description": "Property name to break down by.",+ "type": "string"+ },+ "type": {+ "const": "group",+ "default": "group",+ "type": "string"+ }+ },+ "required": ["group_type_index", "property"],+ "type": "object"+ }+ ]+ },+ "maxItems": 3,+ "type": "array"+ },+ {+ "type": "null"+ }+ ],+ "description": "Properties to break the metric results down by."+ }+ },+ "type": "object"+ },+ {+ "type": "null"+ }+ ],+ "description": "Break the metric results down by up to 3 event, person, session or group properties."+ },"completion_event": {"anyOf": [{