: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(insights): stop AI appending redundant % axis postfix (#61926)
Sam Penningtonf63368721ca7
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.jsonindex 334554bc7711..55fde6da0050 100644--- a/frontend/src/queries/schema.json+++ b/frontend/src/queries/schema.json@@ -4264,7 +4264,7 @@"description": "Formats the trends value axis. Do not use the formatting unless you are absolutely sure that formatting will match the data. `numeric` - no formatting. Prefer this option by default. `duration` - formats the value in seconds to a human-readable duration, e.g., `132` becomes `2 minutes 12 seconds`. Use this option only if you are sure that the values are in seconds. `duration_ms` - formats the value in miliseconds to a human-readable duration, e.g., `1050` becomes `1 second 50 milliseconds`. Use this option only if you are sure that the values are in miliseconds. `percentage` - adds a percentage sign to the value, e.g., `50` becomes `50%`. `percentage_scaled` - formats the value as a percentage scaled to 0-100, e.g., `0.5` becomes `50%`. `currency` - formats the value as a currency, e.g., `1000` becomes `$1,000`."},"aggregationAxisPostfix": {- "description": "Custom postfix to add to the aggregation axis, e.g., ` clicks` to format 5 as `5 clicks`. You may need to add a space before postfix.",+ "description": "Custom postfix to add to the aggregation axis, e.g., ` clicks` to format 5 as `5 clicks`. You may need to add a space before postfix. Never set a postfix that `aggregationAxisFormat` already renders: `percentage` and `percentage_scaled` already append the `%` sign, so a `%` postfix would render values as `50%%`.","type": "string"},"aggregationAxisPrefix": {diff --git a/frontend/src/queries/schema/schema-assistant-queries.ts b/frontend/src/queries/schema/schema-assistant-queries.tsindex eb2400f00340..dd9615cc00fa 100644--- a/frontend/src/queries/schema/schema-assistant-queries.ts+++ b/frontend/src/queries/schema/schema-assistant-queries.ts@@ -509,6 +509,7 @@ export interface AssistantTrendsFilter {/*** Custom postfix to add to the aggregation axis, e.g., ` clicks` to format 5 as `5 clicks`. You may need to add a space before postfix.+ * Never set a postfix that `aggregationAxisFormat` already renders: `percentage` and `percentage_scaled` already append the `%` sign, so a `%` postfix would render values as `50%%`.*/aggregationAxisPostfix?: TrendsFilterLegacy['aggregation_axis_postfix']diff --git a/posthog/schema.py b/posthog/schema.pyindex a98ad266160d..a9f5b95fb5c5 100644--- a/posthog/schema.py+++ b/posthog/schema.py@@ -6694,7 +6694,10 @@ class AssistantTrendsFilter(BaseModel):default=None,description=("Custom postfix to add to the aggregation axis, e.g., ` clicks` to format 5"- " as `5 clicks`. You may need to add a space before postfix."+ " as `5 clicks`. You may need to add a space before postfix. Never set a"+ " postfix that `aggregationAxisFormat` already renders: `percentage` and"+ " `percentage_scaled` already append the `%` sign, so a `%` postfix would"+ " render values as `50%%`."),)aggregationAxisPrefix: str | None = Field(diff --git a/products/product_analytics/skills/formatting-insight-axes/SKILL.md b/products/product_analytics/skills/formatting-insight-axes/SKILL.mdindex ce7b54f02c77..00110abde4bd 100644--- a/products/product_analytics/skills/formatting-insight-axes/SKILL.md+++ b/products/product_analytics/skills/formatting-insight-axes/SKILL.md@@ -48,7 +48,9 @@ Companion fields on `trendsFilter`:- `aggregationAxisPrefix` — literal prefix (e.g. `"$"`) when you need a symbolpinned to a specific currency or unit, regardless of project settings- `aggregationAxisPostfix` — literal suffix; reserve for genuine units the- format can't express (e.g. `" req"`, `" events"`), never for `"mins"` / `"s"`+ format can't express (e.g. `" req"`, `" events"`), never for `"mins"` /+ `"s"` / `"%"` — the percentage formats already append the `%` sign, so a+ `"%"` postfix renders `50%%`- `decimalPlaces` — cap decimals (1 or 2 is usually right for currency / ratios)### Currency — pick `format` or `prefix` carefullydiff --git a/services/mcp/src/tools/generated/query-wrappers.ts b/services/mcp/src/tools/generated/query-wrappers.tsindex 4f8240a24e2b..cd0f2767b258 100644--- a/services/mcp/src/tools/generated/query-wrappers.ts+++ b/services/mcp/src/tools/generated/query-wrappers.ts@@ -478,7 +478,7 @@ const AssistantTrendsFilter = z.object({aggregationAxisPostfix: z.string().describe(- 'Custom postfix to add to the aggregation axis, e.g., ` clicks` to format 5 as `5 clicks`. You may need to add a space before postfix.'+ 'Custom postfix to add to the aggregation axis, e.g., ` clicks` to format 5 as `5 clicks`. You may need to add a space before postfix. Never set a postfix that `aggregationAxisFormat` already renders: `percentage` and `percentage_scaled` already append the `%` sign, so a `%` postfix would render values as `50%%`.').optional(),aggregationAxisPrefix: zdiff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-trends-actors.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-trends-actors.jsonindex 481401e076f0..5f3517d9b43d 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-trends-actors.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-trends-actors.json@@ -3782,7 +3782,7 @@"type": "string"},"aggregationAxisPostfix": {- "description": "Custom postfix to add to the aggregation axis, e.g., ` clicks` to format 5 as `5 clicks`. You may need to add a space before postfix.",+ "description": "Custom postfix to add to the aggregation axis, e.g., ` clicks` to format 5 as `5 clicks`. You may need to add a space before postfix. Never set a postfix that `aggregationAxisFormat` already renders: `percentage` and `percentage_scaled` already append the `%` sign, so a `%` postfix would render values as `50%%`.","type": "string"},"aggregationAxisPrefix": {diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-trends.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-trends.jsonindex 11a2eb918345..0868bc5f566c 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-trends.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-trends.json@@ -3594,7 +3594,7 @@"type": "string"},"aggregationAxisPostfix": {- "description": "Custom postfix to add to the aggregation axis, e.g., ` clicks` to format 5 as `5 clicks`. You may need to add a space before postfix.",+ "description": "Custom postfix to add to the aggregation axis, e.g., ` clicks` to format 5 as `5 clicks`. You may need to add a space before postfix. Never set a postfix that `aggregationAxisFormat` already renders: `percentage` and `percentage_scaled` already append the `%` sign, so a `%` postfix would render values as `50%%`.","type": "string"},"aggregationAxisPrefix": {