: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
feat(customer-analytics): add "update account property" workflow action (#66346)
Arthur Moreira de Deusb24a85a50b38
diff --git a/frontend/src/lib/components/CyclotronJob/CyclotronJobInputs.tsx b/frontend/src/lib/components/CyclotronJob/CyclotronJobInputs.tsxindex 73f2a54c9db0..6a34abb54fb1 100644--- a/frontend/src/lib/components/CyclotronJob/CyclotronJobInputs.tsx+++ b/frontend/src/lib/components/CyclotronJob/CyclotronJobInputs.tsx@@ -698,7 +698,12 @@ function CyclotronJobInputRenderer({if (CustomRenderer) {return (<Suspense>- <CustomRenderer schema={schema} value={input.value} onChange={onValueChange} />+ <CustomRenderer+ schema={schema}+ value={input.value}+ onChange={onValueChange}+ sampleGlobalsWithInputs={sampleGlobalsWithInputs}+ /></Suspense>)}diff --git a/frontend/src/lib/components/CyclotronJob/customInputRenderers.ts b/frontend/src/lib/components/CyclotronJob/customInputRenderers.tsindex 623afec0a784..e936082fde02 100644--- a/frontend/src/lib/components/CyclotronJob/customInputRenderers.ts+++ b/frontend/src/lib/components/CyclotronJob/customInputRenderers.ts@@ -1,11 +1,15 @@import { ComponentType, lazy } from 'react'-import { CyclotronJobInputSchemaType } from '~/types'+import { CyclotronJobInputSchemaType, CyclotronJobInvocationGlobalsWithInputs } from '~/types'export interface CustomInputRendererProps {schema: CyclotronJobInputSchemaTypevalue: anyonChange: (value: any) => void+ // Hog globals, forwarded for renderers whose values are Hog expressions (e.g. the+ // account-properties editor) so they can offer `{event.*}` autocomplete. Optional — most+ // renderers ignore it.+ sampleGlobalsWithInputs?: CyclotronJobInvocationGlobalsWithInputs | null}export const CUSTOM_INPUT_RENDERERS: Record<@@ -21,4 +25,8 @@ export const CUSTOM_INPUT_RENDERERS: Record<posthog_business_hours: lazy(() => import('products/conversations/frontend/components/SlaBusinessHours/CyclotronJobInputBusinessHours')),+ customer_analytics_account_properties: lazy(+ () =>+ import('products/customer_analytics/frontend/components/AccountPropertiesInput/CyclotronJobInputAccountProperties')+ ),}diff --git a/frontend/src/types.ts b/frontend/src/types.tsindex 596eb435aee4..49b35f3a8f5f 100644--- a/frontend/src/types.ts+++ b/frontend/src/types.ts@@ -6895,6 +6895,7 @@ export type CyclotronJobInputSchemaType = {| 'posthog_ticket_tags'| 'posthog_business_hours'| 'non_failure_status_codes'+ | 'customer_analytics_account_properties'key: stringlabel: stringchoices?: { value: string; label: string }[]diff --git a/nodejs/src/cdp/async-functions/customer_analytics.ts b/nodejs/src/cdp/async-functions/customer_analytics.tsindex 23b1d285a72b..a7574dc5ab11 100644--- a/nodejs/src/cdp/async-functions/customer_analytics.ts+++ b/nodejs/src/cdp/async-functions/customer_analytics.ts@@ -114,3 +114,52 @@ registerAsyncFunction('postHogUpdateAccount', {}},})++registerAsyncFunction('postHogSetAccountProperties', {+ execute: async (args, context, result) => {+ const [opts] = args as [Record<string, any> | undefined]+ const externalId = opts?.external_id+ const properties = opts?.properties || {}++ if (!externalId || typeof externalId !== 'string') {+ throw new Error("[HogFunction] - postHogSetAccountProperties call missing 'external_id' property")+ }++ const team = await context.teamManager.getTeam(context.invocation.teamId)+ if (!team) {+ throw new Error(`Team ${context.invocation.teamId} not found`)+ }+ if (!team.secret_api_token) {+ throw new Error(`Team ${context.invocation.teamId} has no secret API token configured`)+ }++ result.invocation.queueParameters = CyclotronInvocationQueueParametersFetchSchema.parse({+ type: 'fetch',+ url: `${context.siteUrl}/api/customer_analytics/external/account/custom_property_values`,+ method: 'PATCH',+ body: JSON.stringify({ external_id: externalId, properties }),+ headers: {+ 'Content-Type': 'application/json',+ Authorization: `Bearer ${team.secret_api_token}`,+ },+ })+ },++ mock: (args, logs) => {+ logs.push({+ level: 'info',+ timestamp: DateTime.now(),+ message: `Async function 'postHogSetAccountProperties' was mocked with arguments:`,+ })+ logs.push({+ level: 'info',+ timestamp: DateTime.now(),+ message: `postHogSetAccountProperties(${JSON.stringify(args[0], null, 2)})`,+ })++ return {+ status: 200,+ body: { ok: true },+ }+ },+})diff --git a/nodejs/src/cdp/schema/cyclotron.ts b/nodejs/src/cdp/schema/cyclotron.tsindex 4cb047e65d70..ab22c02ed39d 100644--- a/nodejs/src/cdp/schema/cyclotron.ts+++ b/nodejs/src/cdp/schema/cyclotron.ts@@ -23,6 +23,7 @@ export const CyclotronJobInputSchemaTypeSchema = z.object({'posthog_assignee','posthog_ticket_tags','posthog_business_hours',+ 'customer_analytics_account_properties',]),key: z.string(),label: z.string(),diff --git a/nodejs/src/cdp/templates/_destinations/posthog_customer_analytics/posthog-update-account-property.template.ts b/nodejs/src/cdp/templates/_destinations/posthog_customer_analytics/posthog-update-account-property.template.tsnew file mode 100644index 000000000000..08b61177e597--- /dev/null+++ b/nodejs/src/cdp/templates/_destinations/posthog_customer_analytics/posthog-update-account-property.template.ts@@ -0,0 +1,52 @@+import { HogFunctionTemplate } from '~/cdp/types'++export const template: HogFunctionTemplate = {+ free: true,+ status: 'hidden',+ type: 'destination',+ id: 'template-posthog-update-account-property',+ name: 'Update account property',+ description: 'Set custom property values on a Customer analytics account.',+ icon_url: '/static/posthog-icon.svg',+ category: ['Custom'],+ code_language: 'hog',+ code: `+if (empty(inputs.external_id)) {+ throw Error('Account external ID is required')+}++let response := postHogSetAccountProperties({+ 'external_id': inputs.external_id,+ 'properties': inputs.properties+})++if (response.status == 404) {+ throw Error(f'Account not found: {inputs.external_id}')+}++if (response.status >= 400) {+ throw Error(f'Failed to update account properties: {response.status}')+}++return response.body+`,+ inputs_schema: [+ {+ key: 'external_id',+ type: 'string',+ label: 'Account external ID',+ secret: false,+ required: true,+ description:+ 'The external ID of the account to update — the group key the account is linked to. Available from trigger event or group properties.',+ },+ {+ key: 'properties',+ type: 'customer_analytics_account_properties',+ label: 'Properties to set',+ secret: false,+ required: true,+ description: 'Custom property values to set on the account.',+ },+ ],+}diff --git a/nodejs/src/cdp/templates/index.ts b/nodejs/src/cdp/templates/index.tsindex 1bd3ddb4265c..a8e9c85e0d07 100644--- a/nodejs/src/cdp/templates/index.ts+++ b/nodejs/src/cdp/templates/index.ts@@ -24,6 +24,7 @@ import { template as posthogUpdatePersonPropertiesTemplate } from './_destinatioimport { template as posthogGetTicketTemplate } from './_destinations/posthog_conversations/posthog-get-ticket.template'import { template as posthogUpdateTicketTemplate } from './_destinations/posthog_conversations/posthog-update-ticket.template'import { template as posthogGetAccountTemplate } from './_destinations/posthog_customer_analytics/posthog-get-account.template'+import { template as posthogUpdateAccountPropertyTemplate } from './_destinations/posthog_customer_analytics/posthog-update-account-property.template'import { template as posthogUpdateAccountTemplate } from './_destinations/posthog_customer_analytics/posthog-update-account.template'import { template as posthogSetHogflowVariableTemplate } from './_destinations/posthog_workflows/posthog-set-variable.template'import { template as redditAdsTemplate } from './_destinations/reddit_ads/reddit.template'@@ -77,6 +78,7 @@ export const HOG_FUNCTION_TEMPLATES_DESTINATIONS: HogFunctionTemplate[] = [posthogUpdateTicketTemplate,posthogGetAccountTemplate,posthogUpdateAccountTemplate,+ posthogUpdateAccountPropertyTemplate,hubspotCompanyTemplate,accoilTemplate,appcuesTemplate,diff --git a/nodejs/src/cdp/types.ts b/nodejs/src/cdp/types.tsindex b2bf3620fb81..885a9c45e43f 100644--- a/nodejs/src/cdp/types.ts+++ b/nodejs/src/cdp/types.ts@@ -400,6 +400,7 @@ export type HogFunctionInputSchemaType = {| 'posthog_ticket_tags'| 'posthog_business_hours'| 'non_failure_status_codes'+ | 'customer_analytics_account_properties'key: stringlabel?: stringchoices?: { value: string; label: string }[]diff --git a/posthog/cdp/test/test_validation.py b/posthog/cdp/test/test_validation.pyindex 9d755d1e80da..657c82b1523b 100644--- a/posthog/cdp/test/test_validation.py+++ b/posthog/cdp/test/test_validation.py@@ -723,6 +723,16 @@ class TestHogFunctionValidation(ClickhouseTestMixin, APIBaseTest, QueryMatchingTassert validated[0]["type"] == "posthog_ticket_tags"assert validated[0]["key"] == "tags"+ def test_customer_analytics_account_properties_compiles_dict_values_to_bytecode(self):+ # Without the opt-in into transpilation, the dict values ship without bytecode and the+ # Node runtime sets the literal placeholder string instead of the interpolated value.+ inputs_schema = [{"key": "properties", "type": "customer_analytics_account_properties", "required": True}]+ inputs = {"properties": {"value": {"Plan tier": "{event.properties.plan}", "MRR": "5000"}}}++ validated = validate_inputs(inputs_schema, inputs)++ assert validated["properties"].get("bytecode") is not None+@parameterized.expand([# Reproduces the original user report: a mixed literal prefix plus a workflow variable.diff --git a/posthog/cdp/validation.py b/posthog/cdp/validation.pyindex 681cf5a8ef67..7a5d66f85a38 100644--- a/posthog/cdp/validation.py+++ b/posthog/cdp/validation.py@@ -39,6 +39,7 @@ register_supported_function("postHogGetTicket")register_supported_function("postHogUpdateTicket")register_supported_function("postHogGetAccount")register_supported_function("postHogUpdateAccount")+register_supported_function("postHogSetAccountProperties")# Globals that the realtime transformer actually populates at runtime.@@ -246,6 +247,7 @@ class InputsSchemaItemSerializer(serializers.Serializer):"posthog_ticket_tags","posthog_business_hours","non_failure_status_codes",+ "customer_analytics_account_properties",])key = serializers.CharField()@@ -323,7 +325,7 @@ class InputsItemSerializer(serializers.Serializer):else:if not isinstance(value, bool):raise serializers.ValidationError({"input": f"Value must be a boolean."})- elif item_type == "dictionary":+ elif item_type in ("dictionary", "customer_analytics_account_properties"):if not isinstance(value, dict):raise serializers.ValidationError({"input": f"Value must be a dictionary."})elif item_type == "integration":@@ -369,6 +371,7 @@ class InputsItemSerializer(serializers.Serializer):"email","native_email","posthog_ticket_tags",+ "customer_analytics_account_properties",] or (item_type == "boolean" and isinstance(value, str))if value_is_transpiled:if item_type in ("email", "native_email") and isinstance(value, dict):diff --git a/products/cdp/frontend/generated/api.schemas.ts b/products/cdp/frontend/generated/api.schemas.tsindex 77c38cbf8e1c..7cf0f2b8dc31 100644--- a/products/cdp/frontend/generated/api.schemas.ts+++ b/products/cdp/frontend/generated/api.schemas.ts@@ -269,6 +269,7 @@ export const HogFunctionTypeEnumApi = {* * `posthog_ticket_tags` - posthog_ticket_tags* * `posthog_business_hours` - posthog_business_hours* * `non_failure_status_codes` - non_failure_status_codes+ * * `customer_analytics_account_properties` - customer_analytics_account_properties*/export type InputsSchemaItemTypeEnumApi = (typeof InputsSchemaItemTypeEnumApi)[keyof typeof InputsSchemaItemTypeEnumApi]@@ -287,6 +288,7 @@ export const InputsSchemaItemTypeEnumApi = {PosthogTicketTags: 'posthog_ticket_tags',PosthogBusinessHours: 'posthog_business_hours',NonFailureStatusCodes: 'non_failure_status_codes',+ CustomerAnalyticsAccountProperties: 'customer_analytics_account_properties',} as constexport type InputsSchemaItemApiChoicesItem = { [key: string]: unknown }diff --git a/products/cdp/frontend/generated/api.zod.ts b/products/cdp/frontend/generated/api.zod.tsindex 85d56a51b0d3..543941b476fc 100644--- a/products/cdp/frontend/generated/api.zod.ts+++ b/products/cdp/frontend/generated/api.zod.ts@@ -76,9 +76,10 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({'posthog_ticket_tags','posthog_business_hours','non_failure_status_codes',+ 'customer_analytics_account_properties',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties'),key: zod.string(),label: zod.string().optional(),@@ -173,9 +174,10 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({'posthog_ticket_tags','posthog_business_hours','non_failure_status_codes',+ 'customer_analytics_account_properties',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties'),key: zod.string(),label: zod.string().optional(),@@ -320,9 +322,10 @@ export const HogFunctionsUpdateBody = /* @__PURE__ */ zod.object({'posthog_ticket_tags','posthog_business_hours','non_failure_status_codes',+ 'customer_analytics_account_properties',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties'),key: zod.string(),label: zod.string().optional(),@@ -417,9 +420,10 @@ export const HogFunctionsUpdateBody = /* @__PURE__ */ zod.object({'posthog_ticket_tags','posthog_business_hours','non_failure_status_codes',+ 'customer_analytics_account_properties',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties'),key: zod.string(),label: zod.string().optional(),@@ -564,9 +568,10 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({'posthog_ticket_tags','posthog_business_hours','non_failure_status_codes',+ 'customer_analytics_account_properties',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties'),key: zod.string(),label: zod.string().optional(),@@ -661,9 +666,10 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({'posthog_ticket_tags','posthog_business_hours','non_failure_status_codes',+ 'customer_analytics_account_properties',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties'),key: zod.string(),label: zod.string().optional(),@@ -812,9 +818,10 @@ export const HogFunctionsEnableBackfillsCreateBody = /* @__PURE__ */ zod.object('posthog_ticket_tags','posthog_business_hours','non_failure_status_codes',+ 'customer_analytics_account_properties',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties'),key: zod.string(),label: zod.string().optional(),@@ -909,9 +916,10 @@ export const HogFunctionsEnableBackfillsCreateBody = /* @__PURE__ */ zod.object('posthog_ticket_tags','posthog_business_hours','non_failure_status_codes',+ 'customer_analytics_account_properties',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties'),key: zod.string(),label: zod.string().optional(),@@ -1130,9 +1138,10 @@ export const HogFunctionsInvocationsCreateBody = /* @__PURE__ */ zod.object({'posthog_ticket_tags','posthog_business_hours','non_failure_status_codes',+ 'customer_analytics_account_properties',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties'),key: zod.string(),label: zod.string().optional(),@@ -1236,9 +1245,10 @@ export const HogFunctionsInvocationsCreateBody = /* @__PURE__ */ zod.object({'posthog_ticket_tags','posthog_business_hours','non_failure_status_codes',+ 'customer_analytics_account_properties',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties'),key: zod.string(),label: zod.string().optional(),diff --git a/products/customer_analytics/backend/facade/api.py b/products/customer_analytics/backend/facade/api.pyindex 8bead7bef273..732f23983a88 100644--- a/products/customer_analytics/backend/facade/api.py+++ b/products/customer_analytics/backend/facade/api.py@@ -54,9 +54,15 @@ from products.notebooks.backend.facade import (# account -> ResourceNotebook -> notebook relation can't cross a data facade. All account-notebook# CRUD goes through `notebooks` (the facade). Tracked by the notebooks legacy-leak interface block.from products.notebooks.backend.models import ResourceNotebook+from products.workflows.backend.services.template_input_usage import get_hog_flows_referencing_template_input_keysfrom . import contracts+# The "Update account property" workflow action (Hog template) stores the custom property values it+# sets keyed by definition id under its ``properties`` input — the link we resolve into references.+_ACCOUNT_PROPERTY_TEMPLATE_ID = "template-posthog-update-account-property"+_ACCOUNT_PROPERTY_INPUT_KEY = "properties"+if TYPE_CHECKING:from posthog.models.user import Userfrom posthog.rbac.user_access_control import UserAccessControl@@ -654,6 +660,7 @@ def delete_customer_profile_config(def _to_custom_property_definition_view(definition: CustomPropertyDefinition,+ references: list[contracts.CustomPropertyReference] | None = None,) -> contracts.CustomPropertyDefinitionView:return contracts.CustomPropertyDefinitionView(id=definition.id,@@ -664,24 +671,68 @@ def _to_custom_property_definition_view(created_at=definition.created_at,created_by=definition.created_by_id,updated_at=definition.updated_at,+ references=references or [],+ )+++def _can_read_workflow_references(user_access_control: "UserAccessControl") -> bool:+ """Whether the caller may see the workflows that reference a custom property.++ ``references`` exposes HogFlow metadata (id, name, status), so it's gated on the caller+ having at least viewer access to the ``hog_flow`` resource — the property-definition API is+ authorized as ``account``, and a caller without workflow read access must not enumerate+ workflows through it. Without RBAC restrictions this resolves to the default (allowed)."""+ return user_access_control.check_access_level_for_resource("hog_flow", "viewer")+++def _custom_property_references_by_definition_id(+ team_id: int, definition_id: str | None = None+) -> dict[str, list[contracts.CustomPropertyReference]]:+ """Map each referenced definition id to the workflows that set it via the "Update account+ property" action. One scan of the team's workflows, matched by definition id. Pass+ ``definition_id`` to scan for just that one definition (the single-definition lookup)."""+ usage = get_hog_flows_referencing_template_input_keys(+ team_id, _ACCOUNT_PROPERTY_TEMPLATE_ID, _ACCOUNT_PROPERTY_INPUT_KEY, only_value_key=definition_id)+ return {+ referenced_id: [+ contracts.CustomPropertyReference(id=ref.id, name=ref.name, status=ref.status, type="workflow")+ for ref in refs+ ]+ for referenced_id, refs in usage.items()+ }def list_custom_property_definitions(- team_id: int, offset: int, limit: int+ team_id: int, offset: int, limit: int, *, user_access_control: "UserAccessControl") -> tuple[list[contracts.CustomPropertyDefinitionView], int]:- """Custom property definitions for the team, ordered by name. Returns ``(page, total_count)``."""+ """Custom property definitions for the team, ordered by name. Returns ``(page, total_count)``.++ ``references`` (the workflows referencing each definition) is included only when the caller can+ read workflows — see ``_can_read_workflow_references``."""queryset = CustomPropertyDefinition.objects.filter(team_id=team_id).order_by("name")total_count = queryset.count()page = queryset[offset : offset + limit]- return [_to_custom_property_definition_view(d) for d in page], total_count+ references = (+ _custom_property_references_by_definition_id(team_id)+ if _can_read_workflow_references(user_access_control)+ else {}+ )+ return [_to_custom_property_definition_view(d, references.get(str(d.id), [])) for d in page], total_count-def get_custom_property_definition(team_id: int, definition_id: str) -> contracts.CustomPropertyDefinitionView | None:+def get_custom_property_definition(+ team_id: int, definition_id: str, *, user_access_control: "UserAccessControl"+) -> contracts.CustomPropertyDefinitionView | None:definition = _get_team_scoped(CustomPropertyDefinition, team_id, definition_id)if definition is None:return None- return _to_custom_property_definition_view(definition)+ references: list[contracts.CustomPropertyReference] = []+ if _can_read_workflow_references(user_access_control):+ references = _custom_property_references_by_definition_id(team_id, definition_id=str(definition.id)).get(+ str(definition.id), []+ )+ return _to_custom_property_definition_view(definition, references)def create_custom_property_definition(diff --git a/products/customer_analytics/backend/facade/contracts.py b/products/customer_analytics/backend/facade/contracts.pyindex c46317d94de6..fb4debfdfa04 100644--- a/products/customer_analytics/backend/facade/contracts.py+++ b/products/customer_analytics/backend/facade/contracts.py@@ -238,6 +238,17 @@ class CustomerProfileConfigView:updated_at: datetime | None = None+@stdlib_dataclass(frozen=True)+class CustomPropertyReference:+ """A place that uses a custom property definition. ``type`` discriminates the kind of+ referrer (``workflow`` for now); ``id``/``name``/``status`` identify the referring entity."""++ id: str+ name: str+ status: str+ type: str = "workflow"++@stdlib_dataclass(frozen=True)class CustomPropertyDefinitionView:"""A team-scoped custom account-property definition as returned by the@@ -245,7 +256,8 @@ class CustomPropertyDefinitionView:Defaults exist so the wrapping serializer can parse partial request bodies (see:class:`AccountView`). ``created_by`` is the creator's user id (or ``None``), matching- the old model serializer's ``PrimaryKeyRelatedField`` output.+ the old model serializer's ``PrimaryKeyRelatedField`` output. ``references`` lists where the+ property is used (workflows), resolved by definition id."""id: UUID | None = None@@ -256,6 +268,7 @@ class CustomPropertyDefinitionView:created_at: datetime | None = Nonecreated_by: int | None = Noneupdated_at: datetime | None = None+ references: list[CustomPropertyReference] = field(default_factory=list)@stdlib_dataclass(frozen=True)diff --git a/products/customer_analytics/backend/presentation/views/serializers.py b/products/customer_analytics/backend/presentation/views/serializers.pyindex 5410ee109397..9d6e197078ce 100644--- a/products/customer_analytics/backend/presentation/views/serializers.py+++ b/products/customer_analytics/backend/presentation/views/serializers.py@@ -34,6 +34,7 @@ from products.customer_analytics.backend.facade.contracts import (CustomerJourneyView,CustomerProfileConfigView,CustomPropertyDefinitionView,+ CustomPropertyReference,)# Scope (value, label) pairs, kept in sync with ``CustomerProfileConfig.Scope``. Declared@@ -265,6 +266,20 @@ class AccountNotebookSerializer(DataclassSerializer):]+class CustomPropertyReferenceSerializer(DataclassSerializer):+ """A place that uses a custom property definition (read-only)."""++ id = serializers.CharField(read_only=True, help_text="Id of the referring entity (e.g. the workflow id).")+ name = serializers.CharField(read_only=True, help_text="Display name of the referring entity.")+ status = serializers.CharField(read_only=True, help_text="Status of the referring entity (e.g. workflow status).")+ type = serializers.CharField(read_only=True, help_text="Kind of reference. Currently always 'workflow'.")++ class Meta:+ dataclass = CustomPropertyReference+ ref_name = "CustomPropertyReference"+ fields = ["id", "name", "status", "type"]++class CustomPropertyDefinitionSerializer(DataclassSerializer):"""A team-scoped definition of a custom account property — the attribute side of the model.@@ -299,6 +314,11 @@ class CustomPropertyDefinitionSerializer(DataclassSerializer):created_at = serializers.DateTimeField(read_only=True)created_by = serializers.IntegerField(read_only=True, allow_null=True)updated_at = serializers.DateTimeField(read_only=True, allow_null=True)+ references = CustomPropertyReferenceSerializer(+ many=True,+ read_only=True,+ help_text="Workflows that use this property, resolved by definition id.",+ )class Meta:dataclass = CustomPropertyDefinitionView@@ -314,6 +334,7 @@ class CustomPropertyDefinitionSerializer(DataclassSerializer):"created_at","created_by","updated_at",+ "references",]diff --git a/products/customer_analytics/backend/presentation/views/views.py b/products/customer_analytics/backend/presentation/views/views.pyindex 6a1a0d7504ae..a6fa3904acd6 100644--- a/products/customer_analytics/backend/presentation/views/views.py+++ b/products/customer_analytics/backend/presentation/views/views.py@@ -199,12 +199,16 @@ class CustomPropertyDefinitionViewSet(def list(self, request: Request, *args, **kwargs) -> Response:return self._paginate_via_facade(request,- lambda offset, limit: api.list_custom_property_definitions(self.team_id, offset=offset, limit=limit),+ lambda offset, limit: api.list_custom_property_definitions(+ self.team_id, offset=offset, limit=limit, user_access_control=self.user_access_control+ ),CustomPropertyDefinitionSerializer,)def retrieve(self, request: Request, *args, **kwargs) -> Response:- definition = api.get_custom_property_definition(self.team_id, self.kwargs["pk"])+ definition = api.get_custom_property_definition(+ self.team_id, self.kwargs["pk"], user_access_control=self.user_access_control+ )if definition is None:return Response({"detail": "Not found."}, status=status.HTTP_404_NOT_FOUND)return Response(CustomPropertyDefinitionSerializer(instance=definition).data)diff --git a/products/customer_analytics/backend/test/test_custom_property_values.py b/products/customer_analytics/backend/test/test_custom_property_values.pyindex 48bbe4c26ccc..b61bd21591a3 100644--- a/products/customer_analytics/backend/test/test_custom_property_values.py+++ b/products/customer_analytics/backend/test/test_custom_property_values.py@@ -3,7 +3,7 @@ from uuid import uuid4import pytestfrom posthog.test.base import BaseTest-from unittest.mock import patch+from unittest.mock import MagicMock, patchfrom django.db import IntegrityErrorfrom django.utils import timezone@@ -11,6 +11,7 @@ from django.utils import timezonefrom parameterized import parameterizedfrom posthog.models import Team+from posthog.models.scoping import team_scopefrom products.customer_analytics.backend.facade import (api as facade,@@ -32,6 +33,7 @@ from products.customer_analytics.backend.models import ()from products.customer_analytics.backend.models.custom_property_value import ACTIVE_VALUE_CONSTRAINT_NAMEfrom products.customer_analytics.backend.test.factories import create_account, create_custom_property_definition+from products.workflows.backend.models import HogFlowLOGIC_MODULE = "products.customer_analytics.backend.logic.custom_property_values"@@ -326,3 +328,85 @@ class TestSetExternalAccountCustomProperties(BaseTest):assert result.error == contracts.ExternalAccountCustomPropertiesError.INVALID_VALUE# The good "Plan" write must roll back with the failed "Seats" write — nothing persists.assert not CustomPropertyValue.objects.for_team(self.team.id).filter(account=self.account).exists()+++class TestCustomPropertyDefinitionReferences(BaseTest):+ def _uac(self, *, can_read_workflows: bool = True) -> MagicMock:+ uac = MagicMock()+ uac.check_access_level_for_resource.return_value = can_read_workflows+ return uac++ def _create_workflow_setting(self, definition_id: str, *, name: str = "Onboarding", status: str = "active"):+ return HogFlow.objects.create(+ team=self.team,+ name=name,+ status=status,+ actions=[+ {+ "type": "function",+ "config": {+ "template_id": "template-posthog-update-account-property",+ "inputs": {"properties": {"value": {definition_id: "{event.properties.x}"}}},+ },+ }+ ],+ )++ def test_list_attaches_workflow_references_matched_by_id(self):+ plan = create_custom_property_definition(team_id=self.team.id, name="Plan")+ create_custom_property_definition(team_id=self.team.id, name="Unused")+ workflow = self._create_workflow_setting(str(plan.id))++ with team_scope(self.team.id):+ page, _ = facade.list_custom_property_definitions(+ self.team.id, offset=0, limit=50, user_access_control=self._uac()+ )+ by_id = {view.id: view for view in page}++ assert [(r.id, r.name, r.status, r.type) for r in by_id[plan.id].references] == [+ (str(workflow.id), "Onboarding", "active", "workflow")+ ]+ # A definition no workflow references carries an empty list.+ unused = next(v for v in page if v.name == "Unused")+ assert unused.references == []++ def test_reference_matches_id_not_name(self):+ # A workflow keyed by a stale/foreign id must not attach to a same-named definition.+ plan = create_custom_property_definition(team_id=self.team.id, name="Plan")+ self._create_workflow_setting(str(uuid4()))++ with team_scope(self.team.id):+ page, _ = facade.list_custom_property_definitions(+ self.team.id, offset=0, limit=50, user_access_control=self._uac()+ )++ assert next(v for v in page if v.id == plan.id).references == []++ def test_get_attaches_workflow_references_for_single_definition(self):+ plan = create_custom_property_definition(team_id=self.team.id, name="Plan")+ workflow = self._create_workflow_setting(str(plan.id))++ with team_scope(self.team.id):+ view = facade.get_custom_property_definition(self.team.id, str(plan.id), user_access_control=self._uac())++ assert view is not None+ assert [(r.id, r.name, r.status, r.type) for r in view.references] == [+ (str(workflow.id), "Onboarding", "active", "workflow")+ ]++ def test_references_hidden_without_workflow_read_access(self):+ # references expose HogFlow metadata, so a caller without hog_flow read access sees none.+ plan = create_custom_property_definition(team_id=self.team.id, name="Plan")+ self._create_workflow_setting(str(plan.id))++ with team_scope(self.team.id):+ page, _ = facade.list_custom_property_definitions(+ self.team.id, offset=0, limit=50, user_access_control=self._uac(can_read_workflows=False)+ )+ view = facade.get_custom_property_definition(+ self.team.id, str(plan.id), user_access_control=self._uac(can_read_workflows=False)+ )++ assert next(v for v in page if v.id == plan.id).references == []+ assert view is not None+ assert view.references == []diff --git a/products/customer_analytics/frontend/components/AccountPropertiesInput/CyclotronJobInputAccountProperties.tsx b/products/customer_analytics/frontend/components/AccountPropertiesInput/CyclotronJobInputAccountProperties.tsxnew file mode 100644index 000000000000..7b766e4ebdb9--- /dev/null+++ b/products/customer_analytics/frontend/components/AccountPropertiesInput/CyclotronJobInputAccountProperties.tsx@@ -0,0 +1,112 @@+import { useValues } from 'kea'+import { useRef, useState } from 'react'++import { IconPlus, IconX } from '@posthog/icons'+import { LemonButton } from '@posthog/lemon-ui'++import type { CustomInputRendererProps } from 'lib/components/CyclotronJob/customInputRenderers'+import { CodeEditorInline } from 'lib/monaco/CodeEditorInline'+import { Combobox, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList } from 'lib/ui/quill'++import type { CustomPropertyDefinitionApi } from 'products/customer_analytics/frontend/generated/api.schemas'++import { accountPropertiesInputLogic } from './accountPropertiesInputLogic'++export default function CyclotronJobInputAccountProperties({+ value,+ onChange,+ sampleGlobalsWithInputs,+}: CustomInputRendererProps): JSX.Element {+ const { definitions, nameById, definitionsLoading } = useValues(accountPropertiesInputLogic)++ // Keys are custom property definition ids (stable across renames); values are Hog expressions.+ const properties: Record<string, string> = value ?? {}+ const entries = Object.entries(properties)+ const selectedIds = new Set(entries.map(([id]) => id))+ const available = definitions.filter((d) => !selectedIds.has(d.id))++ const setProperty = (id: string, hogValue: string): void => onChange({ ...properties, [id]: hogValue })+ const addProperty = (id: string): void => onChange({ ...properties, [id]: '' })+ const removeProperty = (id: string): void => {+ const next = { ...properties }+ delete next[id]+ onChange(next)+ }++ return (+ <div className="flex flex-col gap-2">+ {entries.map(([id, hogValue]) => {+ const label = nameById[id]+ return (+ <div className="flex gap-2 items-center" key={id}>+ <div className="flex-1 min-w-50 font-medium truncate" title={label ?? id}>+ {label ?? <span className="text-secondary italic">Unknown property</span>}+ </div>+ <CodeEditorInline+ className="overflow-hidden flex-2"+ minHeight="37"+ value={hogValue}+ onChange={(val) => setProperty(id, val ?? '')}+ language="hogTemplate"+ globals={sampleGlobalsWithInputs ?? undefined}+ />+ <LemonButton icon={<IconX />} size="small" onClick={() => removeProperty(id)} />+ </div>+ )+ })}+ <AddPropertyDropdown available={available} onSelect={addProperty} loading={definitionsLoading} />+ </div>+ )+}++function AddPropertyDropdown({+ available,+ onSelect,+ loading,+}: {+ available: CustomPropertyDefinitionApi[]+ onSelect: (id: string) => void+ loading: boolean+}): JSX.Element {+ const [open, setOpen] = useState(false)+ const triggerRef = useRef<HTMLButtonElement>(null)++ return (+ <Combobox+ items={available}+ itemToStringValue={(d: CustomPropertyDefinitionApi) => d.name}+ open={open}+ onOpenChange={setOpen}+ value={null}+ onValueChange={(d: CustomPropertyDefinitionApi | null) => {+ if (d) {+ onSelect(d.id)+ }+ setOpen(false)+ }}+ >+ <LemonButton+ ref={triggerRef}+ type="secondary"+ size="small"+ icon={<IconPlus />}+ loading={loading}+ disabledReason={loading ? 'Loading properties…' : undefined}+ onClick={() => setOpen(true)}+ >+ Add property+ </LemonButton>+ <ComboboxContent anchor={triggerRef}>+ <ComboboxInput placeholder="Search properties" showTrigger={false} />+ <ComboboxEmpty>No properties found</ComboboxEmpty>+ <ComboboxList>+ {(d: CustomPropertyDefinitionApi) => (+ <ComboboxItem key={d.id} value={d}>+ {d.name}+ </ComboboxItem>+ )}+ </ComboboxList>+ </ComboboxContent>+ </Combobox>+ )+}diff --git a/products/customer_analytics/frontend/components/AccountPropertiesInput/accountPropertiesInputLogic.ts b/products/customer_analytics/frontend/components/AccountPropertiesInput/accountPropertiesInputLogic.tsnew file mode 100644index 000000000000..e01fcaebcc93--- /dev/null+++ b/products/customer_analytics/frontend/components/AccountPropertiesInput/accountPropertiesInputLogic.ts@@ -0,0 +1,49 @@+import { afterMount, connect, kea, listeners, path, selectors } from 'kea'+import { loaders } from 'kea-loaders'+import posthog from 'posthog-js'++import { projectLogic } from 'scenes/projectLogic'++import { customPropertyDefinitionsList } from 'products/customer_analytics/frontend/generated/api'+import type { CustomPropertyDefinitionApi } from 'products/customer_analytics/frontend/generated/api.schemas'++import type { accountPropertiesInputLogicType } from './accountPropertiesInputLogicType'++export const accountPropertiesInputLogic = kea<accountPropertiesInputLogicType>([+ path([+ 'products',+ 'customer_analytics',+ 'frontend',+ 'components',+ 'AccountPropertiesInput',+ 'accountPropertiesInputLogic',+ ]),+ connect(() => ({+ values: [projectLogic, ['currentProjectId']],+ })),+ loaders(({ values }) => ({+ definitions: [+ [] as CustomPropertyDefinitionApi[],+ {+ loadDefinitions: async (): Promise<CustomPropertyDefinitionApi[]> => {+ const response = await customPropertyDefinitionsList(String(values.currentProjectId))+ return response.results+ },+ },+ ],+ })),+ selectors({+ nameById: [+ (s) => [s.definitions],+ (definitions): Record<string, string> => Object.fromEntries(definitions.map((d) => [d.id, d.name])),+ ],+ }),+ listeners({+ loadDefinitionsFailure: ({ error }) => {+ posthog.captureException(error, { scope: 'accountPropertiesInputLogic.load' })+ },+ }),+ afterMount(({ actions }) => {+ actions.loadDefinitions()+ }),+])diff --git a/products/customer_analytics/frontend/components/Accounts/accountsColumnConfigLogic.test.ts b/products/customer_analytics/frontend/components/Accounts/accountsColumnConfigLogic.test.tsindex 1358171e024f..fa896ff34c29 100644--- a/products/customer_analytics/frontend/components/Accounts/accountsColumnConfigLogic.test.ts+++ b/products/customer_analytics/frontend/components/Accounts/accountsColumnConfigLogic.test.ts@@ -18,6 +18,7 @@ function definition(created_at: '2024-01-01T00:00:00Z',created_by: null,updated_at: null,+ references: [],...overrides,}}diff --git a/products/customer_analytics/frontend/generated/api.schemas.ts b/products/customer_analytics/frontend/generated/api.schemas.tsindex 65eddc7febd7..82a71fc4df68 100644--- a/products/customer_analytics/frontend/generated/api.schemas.ts+++ b/products/customer_analytics/frontend/generated/api.schemas.ts@@ -288,6 +288,20 @@ export const CustomPropertyDisplayTypeEnumApi = {Boolean: 'boolean',} as const+/**+ * A place that uses a custom property definition (read-only).+ */+export interface CustomPropertyReferenceApi {+ /** Id of the referring entity (e.g. the workflow id). */+ readonly id: string+ /** Display name of the referring entity. */+ readonly name: string+ /** Status of the referring entity (e.g. workflow status). */+ readonly status: string+ /** Kind of reference. Currently always 'workflow'. */+ readonly type: string+}+/*** A team-scoped definition of a custom account property — the attribute side of the model.*@@ -324,6 +338,8 @@ export interface CustomPropertyDefinitionApi {readonly created_by: number | null/** @nullable */readonly updated_at: string | null+ /** Workflows that use this property, resolved by definition id. */+ readonly references: readonly CustomPropertyReferenceApi[]}export interface PaginatedCustomPropertyDefinitionListApi {@@ -371,6 +387,8 @@ export interface PatchedCustomPropertyDefinitionApi {readonly created_by?: number | null/** @nullable */readonly updated_at?: string | null+ /** Workflows that use this property, resolved by definition id. */+ readonly references?: readonly CustomPropertyReferenceApi[]}export interface CustomerJourneyApi {diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertiesConfig.tsx b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertiesConfig.tsxindex fdc6ae72d3e3..092fcccb240e 100644--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertiesConfig.tsx+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertiesConfig.tsx@@ -1,14 +1,21 @@import { useActions, useValues } from 'kea'+import { useState } from 'react'-import { IconPencil, IconTrash } from '@posthog/icons'-import { LemonButton, LemonTable, LemonTableColumns } from '@posthog/lemon-ui'+import { IconInfo, IconPencil, IconTrash } from '@posthog/icons'+import { LemonButton, LemonTable, LemonTableColumns, Tooltip } from '@posthog/lemon-ui'import { RestrictionScope, useRestrictedArea } from 'lib/components/RestrictedArea'import { TZLabel } from 'lib/components/TZLabel'import { TeamMembershipLevel } from 'lib/constants'import { LemonDialog } from 'lib/lemon-ui/LemonDialog'+import { Link } from 'lib/lemon-ui/Link'+import { Popover } from 'lib/lemon-ui/Popover'+import { urls } from 'scenes/urls'-import type { CustomPropertyDefinitionApi } from 'products/customer_analytics/frontend/generated/api.schemas'+import type {+ CustomPropertyDefinitionApi,+ CustomPropertyReferenceApi,+} from 'products/customer_analytics/frontend/generated/api.schemas'import { customPropertyDefinitionsLogic } from './customPropertyDefinitionsLogic'import { CustomPropertyModal } from './CustomPropertyModal'@@ -51,6 +58,17 @@ export function CustomPropertiesConfig(): JSX.Element {render: (_, definition) =>definition.description ? definition.description : <span className="text-secondary">—</span>,},+ {+ title: (+ <span className="flex items-center gap-1">+ References+ <Tooltip title="Workflows that set this property using an 'Update account property' action. Click the count to open them.">+ <IconInfo className="text-secondary" />+ </Tooltip>+ </span>+ ),+ render: (_, definition) => <ReferencesCell references={definition.references} />,+ },{title: 'Last updated',render: (_, definition) =>@@ -107,3 +125,35 @@ export function CustomPropertiesConfig(): JSX.Element {</div>)}++function ReferencesCell({ references }: { references: readonly CustomPropertyReferenceApi[] }): JSX.Element {+ const [open, setOpen] = useState(false)++ if (!references.length) {+ return <span className="text-secondary">0</span>+ }++ return (+ <Popover+ visible={open}+ onClickOutside={() => setOpen(false)}+ overlay={+ <div className="flex flex-col gap-1 p-2 max-w-sm">+ <span className="text-xs text-secondary">Used in</span>+ {references.map((reference) => (+ <Link+ key={reference.id}+ to={urls.workflow(reference.id, 'workflow')}+ target="_blank"+ targetBlankIcon+ >+ {reference.name}+ </Link>+ ))}+ </div>+ }+ >+ <Link onClick={() => setOpen((isOpen) => !isOpen)}>{references.length}</Link>+ </Popover>+ )+}diff --git a/products/workflows/backend/services/template_input_usage.py b/products/workflows/backend/services/template_input_usage.pynew file mode 100644index 000000000000..6974bd5d9ae3--- /dev/null+++ b/products/workflows/backend/services/template_input_usage.py@@ -0,0 +1,64 @@+"""Find workflows (HogFlows) that reference a given function-template input by its keys.++Generic, template-agnostic counterpart to ``integration_usage.py``: the caller supplies the+``template_id`` and the dictionary ``input_key`` to inspect, and gets back, per key found, the+workflows that set it. Used (e.g.) to surface which workflows reference a custom property+definition via the "Update account property" action's ``properties`` input.+"""++from dataclasses import dataclass++from products.workflows.backend.models import HogFlow+++@dataclass(frozen=True)+class HogFlowReference:+ id: str+ name: str+ status: str+++def get_hog_flows_referencing_template_input_keys(+ team_id: int, template_id: str, input_key: str, *, only_value_key: str | None = None+) -> dict[str, list[HogFlowReference]]:+ """Map each key present in ``input_key``'s dict (across the team's workflows) to the workflows+ that set it.++ Scans every saved workflow for the team (all statuses), looking at ``function`` actions whose+ ``config.template_id`` matches ``template_id`` and reading the dict stored at+ ``config.inputs[input_key].value``. Keys prefixed with ``$$_`` (templating internals like+ ``$$_extend_object``) are ignored.++ When ``only_value_key`` is given, the scan collects references for just that one key (the+ single-definition lookup path) instead of building the full map.+ """+ references: dict[str, list[HogFlowReference]] = {}+ # Project to only the columns the scanner reads — the rest (trigger, edges, draft, …) are unused.+ for flow in HogFlow.objects.filter(team_id=team_id).only("id", "name", "status", "actions"):+ ref: HogFlowReference | None = None+ for key in _referenced_keys(flow.actions or [], template_id, input_key, only_value_key=only_value_key):+ if ref is None:+ ref = HogFlowReference(id=str(flow.id), name=flow.name or str(flow.id), status=flow.status)+ references.setdefault(key, []).append(ref)+ return references+++def _referenced_keys(+ actions: list[dict], template_id: str, input_key: str, *, only_value_key: str | None = None+) -> set[str]:+ keys: set[str] = set()+ for action in actions:+ if action.get("type") != "function":+ continue+ config = action.get("config") or {}+ if config.get("template_id") != template_id:+ continue+ value = ((config.get("inputs") or {}).get(input_key) or {}).get("value")+ if isinstance(value, dict):+ keys.update(+ key+ for key in value+ if not (isinstance(key, str) and key.startswith("$$_"))+ and (only_value_key is None or key == only_value_key)+ )+ return keysdiff --git a/products/workflows/backend/test/test_template_input_usage.py b/products/workflows/backend/test/test_template_input_usage.pynew file mode 100644index 000000000000..e627b7ca0aa9--- /dev/null+++ b/products/workflows/backend/test/test_template_input_usage.py@@ -0,0 +1,78 @@+from posthog.test.base import BaseTest++from products.workflows.backend.models import HogFlow+from products.workflows.backend.services.template_input_usage import get_hog_flows_referencing_template_input_keys++TEMPLATE_ID = "template-posthog-update-account-property"+++def _account_property_action(properties: dict[str, str]) -> dict:+ return {+ "id": "action_1",+ "type": "function",+ "config": {"template_id": TEMPLATE_ID, "inputs": {"properties": {"value": properties}}},+ }+++class TestTemplateInputUsage(BaseTest):+ def _create_flow(self, *, name: str, status: str, actions: list[dict]) -> HogFlow:+ return HogFlow.objects.create(team=self.team, name=name, status=status, actions=actions)++ def test_maps_each_referenced_key_to_its_workflows_across_statuses(self):+ draft = self._create_flow(+ name="Draft flow", status="draft", actions=[_account_property_action({"def-a": "{x}"})]+ )+ active = self._create_flow(+ name="Active flow", status="active", actions=[_account_property_action({"def-a": "1", "def-b": "2"})]+ )++ usage = get_hog_flows_referencing_template_input_keys(self.team.id, TEMPLATE_ID, "properties")++ assert {ref.id for ref in usage["def-a"]} == {str(draft.id), str(active.id)}+ assert {ref.id for ref in usage["def-b"]} == {str(active.id)}+ assert usage["def-a"][0].name in {"Draft flow", "Active flow"}+ assert usage["def-a"][0].status in {"draft", "active"}++ def test_ignores_other_templates_and_empty_or_internal_keys(self):+ self._create_flow(+ name="Other template",+ status="active",+ actions=[+ {+ "type": "function",+ "config": {"template_id": "template-other", "inputs": {"properties": {"value": {"def-a": "1"}}}},+ }+ ],+ )+ self._create_flow(+ name="Internal + empty",+ status="active",+ actions=[+ _account_property_action({"$$_extend_object": "{event.properties}"}),+ _account_property_action({}),+ ],+ )++ usage = get_hog_flows_referencing_template_input_keys(self.team.id, TEMPLATE_ID, "properties")++ assert usage == {}++ def test_only_value_key_scans_for_a_single_key(self):+ active = self._create_flow(+ name="Active flow", status="active", actions=[_account_property_action({"def-a": "1", "def-b": "2"})]+ )++ usage = get_hog_flows_referencing_template_input_keys(+ self.team.id, TEMPLATE_ID, "properties", only_value_key="def-a"+ )++ assert {ref.id for ref in usage["def-a"]} == {str(active.id)}+ assert "def-b" not in usage++ def test_scopes_to_team(self):+ flow = self._create_flow(name="ours", status="active", actions=[_account_property_action({"def-a": "1"})])+ assert flow # created for self.team++ usage = get_hog_flows_referencing_template_input_keys(self.team.id + 1, TEMPLATE_ID, "properties")++ assert usage == {}diff --git a/products/workflows/frontend/Workflows/hogflows/registry/actions/customer_analytics.ts b/products/workflows/frontend/Workflows/hogflows/registry/actions/customer_analytics.tsindex 0d112f8a84bb..d220d8b32cba 100644--- a/products/workflows/frontend/Workflows/hogflows/registry/actions/customer_analytics.ts+++ b/products/workflows/frontend/Workflows/hogflows/registry/actions/customer_analytics.ts@@ -89,5 +89,13 @@ registerActionNodeCategory({getDefaultInputs: getAccountExternalIdDefaultInputs,output_variable: { key: 'account', result_path: null },},+ {+ type: 'function',+ name: 'Update account property',+ description: 'Set custom property values on a Customer analytics account.',+ config: { template_id: 'template-posthog-update-account-property', inputs: {} },+ getDefaultInputs: getAccountExternalIdDefaultInputs,+ output_variable: { key: 'account', result_path: null },+ },],})diff --git a/products/workflows/frontend/Workflows/hogflows/steps/types.ts b/products/workflows/frontend/Workflows/hogflows/steps/types.tsindex 443358b77edf..96735c5d77a9 100644--- a/products/workflows/frontend/Workflows/hogflows/steps/types.ts+++ b/products/workflows/frontend/Workflows/hogflows/steps/types.ts@@ -74,6 +74,7 @@ export const CyclotronJobInputSchemaTypeSchema = z.object({'posthog_ticket_tags','posthog_business_hours','non_failure_status_codes',+ 'customer_analytics_account_properties',]),key: z.string(),label: z.string(),diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 838973b06abb..3ecb311e2eca 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -14079,6 +14079,20 @@ export namespace Schemas {Boolean: 'boolean',} as const;+ /**+ * A place that uses a custom property definition (read-only).+ */+ export interface CustomPropertyReference {+ /** Id of the referring entity (e.g. the workflow id). */+ readonly id: string;+ /** Display name of the referring entity. */+ readonly name: string;+ /** Status of the referring entity (e.g. workflow status). */+ readonly status: string;+ /** Kind of reference. Currently always 'workflow'. */+ readonly type: string;+ }+/*** A team-scoped definition of a custom account property — the attribute side of the model.*@@ -14115,6 +14129,8 @@ export namespace Schemas {readonly created_by: number | null;/** @nullable */readonly updated_at: string | null;+ /** Workflows that use this property, resolved by definition id. */+ readonly references: readonly CustomPropertyReference[];}/**@@ -25095,6 +25111,7 @@ export namespace Schemas {* * `posthog_ticket_tags` - posthog_ticket_tags* * `posthog_business_hours` - posthog_business_hours* * `non_failure_status_codes` - non_failure_status_codes+ * * `customer_analytics_account_properties` - customer_analytics_account_properties*/export type InputsSchemaItemTypeEnum = typeof InputsSchemaItemTypeEnum[keyof typeof InputsSchemaItemTypeEnum];@@ -25114,6 +25131,7 @@ export namespace Schemas {PosthogTicketTags: 'posthog_ticket_tags',PosthogBusinessHours: 'posthog_business_hours',NonFailureStatusCodes: 'non_failure_status_codes',+ CustomerAnalyticsAccountProperties: 'customer_analytics_account_properties',} as const;export type InputsSchemaItemChoicesItem = { [key: string]: unknown };@@ -36065,6 +36083,8 @@ export namespace Schemas {readonly created_by?: number | null;/** @nullable */readonly updated_at?: string | null;+ /** Workflows that use this property, resolved by definition id. */+ readonly references?: readonly CustomPropertyReference[];}export interface PatchedCustomerJourney {diff --git a/services/mcp/src/generated/cdp_functions/api.ts b/services/mcp/src/generated/cdp_functions/api.tsindex 67831fda594c..d9ae01c531ef 100644--- a/services/mcp/src/generated/cdp_functions/api.ts+++ b/services/mcp/src/generated/cdp_functions/api.ts@@ -101,9 +101,10 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({'posthog_ticket_tags','posthog_business_hours','non_failure_status_codes',+ 'customer_analytics_account_properties',]).describe(- '* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes'+ '* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties'),key: zod.string(),label: zod.string().optional(),@@ -193,9 +194,10 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({'posthog_ticket_tags','posthog_business_hours','non_failure_status_codes',+ 'customer_analytics_account_properties',]).describe(- '* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes'+ '* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties'),key: zod.string(),label: zod.string().optional(),@@ -348,9 +350,10 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({'posthog_ticket_tags','posthog_business_hours','non_failure_status_codes',+ 'customer_analytics_account_properties',]).describe(- '* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes'+ '* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties'),key: zod.string(),label: zod.string().optional(),@@ -440,9 +443,10 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({'posthog_ticket_tags','posthog_business_hours','non_failure_status_codes',+ 'customer_analytics_account_properties',]).describe(- '* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes'+ '* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties'),key: zod.string(),label: zod.string().optional(),@@ -669,9 +673,10 @@ export const HogFunctionsInvocationsCreateBody = /* @__PURE__ */ zod.object({'posthog_ticket_tags','posthog_business_hours','non_failure_status_codes',+ 'customer_analytics_account_properties',]).describe(- '* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes'+ '* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties'),key: zod.string(),label: zod.string().optional(),@@ -775,9 +780,10 @@ export const HogFunctionsInvocationsCreateBody = /* @__PURE__ */ zod.object({'posthog_ticket_tags','posthog_business_hours','non_failure_status_codes',+ 'customer_analytics_account_properties',]).describe(- '* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes'+ '* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties'),key: zod.string(),label: zod.string().optional(),diff --git a/services/mcp/src/generated/error_tracking_alerts/api.ts b/services/mcp/src/generated/error_tracking_alerts/api.tsindex b541a67f70ea..6088fe07b3e1 100644--- a/services/mcp/src/generated/error_tracking_alerts/api.ts+++ b/services/mcp/src/generated/error_tracking_alerts/api.ts@@ -101,9 +101,10 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({'posthog_ticket_tags','posthog_business_hours','non_failure_status_codes',+ 'customer_analytics_account_properties',]).describe(- '* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes'+ '* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties'),key: zod.string(),label: zod.string().optional(),@@ -193,9 +194,10 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({'posthog_ticket_tags','posthog_business_hours','non_failure_status_codes',+ 'customer_analytics_account_properties',]).describe(- '* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes'+ '* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties'),key: zod.string(),label: zod.string().optional(),@@ -339,9 +341,10 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({'posthog_ticket_tags','posthog_business_hours','non_failure_status_codes',+ 'customer_analytics_account_properties',]).describe(- '* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes'+ '* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties'),key: zod.string(),label: zod.string().optional(),@@ -431,9 +434,10 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({'posthog_ticket_tags','posthog_business_hours','non_failure_status_codes',+ 'customer_analytics_account_properties',]).describe(- '* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes'+ '* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties'),key: zod.string(),label: zod.string().optional(),diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-create.jsonindex a8fab38e00b9..7da453ac3fd2 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-create.json@@ -174,7 +174,7 @@]},"type": {- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes",+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties","enum": ["string","number",@@ -189,7 +189,8 @@"posthog_assignee","posthog_ticket_tags","posthog_business_hours",- "non_failure_status_codes"+ "non_failure_status_codes",+ "customer_analytics_account_properties"],"type": "string"}@@ -333,7 +334,7 @@]},"type": {- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes",+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties","enum": ["string","number",@@ -348,7 +349,8 @@"posthog_assignee","posthog_ticket_tags","posthog_business_hours",- "non_failure_status_codes"+ "non_failure_status_codes",+ "customer_analytics_account_properties"],"type": "string"}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-invocations-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-invocations-create.jsonindex 059078085158..069d8afa0aa7 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-invocations-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-invocations-create.json@@ -314,7 +314,7 @@]},"type": {- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes",+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties","enum": ["string","number",@@ -329,7 +329,8 @@"posthog_assignee","posthog_ticket_tags","posthog_business_hours",- "non_failure_status_codes"+ "non_failure_status_codes",+ "customer_analytics_account_properties"],"type": "string"}@@ -493,7 +494,7 @@]},"type": {- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes",+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties","enum": ["string","number",@@ -508,7 +509,8 @@"posthog_assignee","posthog_ticket_tags","posthog_business_hours",- "non_failure_status_codes"+ "non_failure_status_codes",+ "customer_analytics_account_properties"],"type": "string"}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-partial-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-partial-update.jsonindex 78d73fb1f890..af3c7e1882f4 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-partial-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-partial-update.json@@ -178,7 +178,7 @@]},"type": {- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes",+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties","enum": ["string","number",@@ -193,7 +193,8 @@"posthog_assignee","posthog_ticket_tags","posthog_business_hours",- "non_failure_status_codes"+ "non_failure_status_codes",+ "customer_analytics_account_properties"],"type": "string"}@@ -337,7 +338,7 @@]},"type": {- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes",+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties","enum": ["string","number",@@ -352,7 +353,8 @@"posthog_assignee","posthog_ticket_tags","posthog_business_hours",- "non_failure_status_codes"+ "non_failure_status_codes",+ "customer_analytics_account_properties"],"type": "string"}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-create.jsonindex 3194d1db0f05..17c6f4717f2c 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-create.json@@ -174,7 +174,7 @@]},"type": {- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes",+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties","enum": ["string","number",@@ -189,7 +189,8 @@"posthog_assignee","posthog_ticket_tags","posthog_business_hours",- "non_failure_status_codes"+ "non_failure_status_codes",+ "customer_analytics_account_properties"],"type": "string"}@@ -333,7 +334,7 @@]},"type": {- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes",+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties","enum": ["string","number",@@ -348,7 +349,8 @@"posthog_assignee","posthog_ticket_tags","posthog_business_hours",- "non_failure_status_codes"+ "non_failure_status_codes",+ "customer_analytics_account_properties"],"type": "string"}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-partial-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-partial-update.jsonindex 289f57ade3ff..217322a88281 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-partial-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-partial-update.json@@ -178,7 +178,7 @@]},"type": {- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes",+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties","enum": ["string","number",@@ -193,7 +193,8 @@"posthog_assignee","posthog_ticket_tags","posthog_business_hours",- "non_failure_status_codes"+ "non_failure_status_codes",+ "customer_analytics_account_properties"],"type": "string"}@@ -337,7 +338,7 @@]},"type": {- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes",+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties","enum": ["string","number",@@ -352,7 +353,8 @@"posthog_assignee","posthog_ticket_tags","posthog_business_hours",- "non_failure_status_codes"+ "non_failure_status_codes",+ "customer_analytics_account_properties"],"type": "string"}diff --git a/tach.toml b/tach.tomlindex aec210107b3f..3e8468917a0a 100644--- a/tach.toml+++ b/tach.toml@@ -623,6 +623,7 @@ depends_on = ["products.notifications","products.product_analytics","products.warehouse_sources",+ "products.workflows",]layer = "modules"