: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): unify custom property creation with data warehouse sync config (#67905)
Arthur Moreira de Deus797dcea74fbf
diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertyModal.tsx b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertyModal.tsxindex 35c73a1735ea..db34405ef09e 100644--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertyModal.tsx+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertyModal.tsx@@ -1,19 +1,48 @@import { useActions, useValues } from 'kea'import { Form } from 'kea-forms'-import { LemonButton, LemonInput, LemonModal, LemonSelect, LemonSwitch, LemonTextArea } from '@posthog/lemon-ui'+import {+ LemonBanner,+ LemonButton,+ LemonInput,+ LemonModal,+ LemonSearchableSelect,+ LemonSelect,+ LemonSwitch,+ LemonTextArea,+} from '@posthog/lemon-ui'import { LemonField } from 'lib/lemon-ui/LemonField'+import { LemonSegmentedButton } from 'lib/lemon-ui/LemonSegmentedButton'-import { customPropertyDefinitionsLogic } from './customPropertyDefinitionsLogic'+import { CustomPropertySourceMode, customPropertyDefinitionsLogic } from './customPropertyDefinitionsLogic'import { DISPLAY_TYPE_OPTIONS, isNumericDisplayType } from './customPropertyTypes'+const SOURCE_MODE_OPTIONS: { value: CustomPropertySourceMode; label: string }[] = [+ { value: 'manual', label: 'Manual' },+ { value: 'data_warehouse', label: 'Data warehouse' },+]+export function CustomPropertyModal(): JSX.Element {- const { modalVisible, editingDefinition, customPropertyForm, isCustomPropertyFormSubmitting } =- useValues(customPropertyDefinitionsLogic)- const { closeModal, submitCustomPropertyForm } = useActions(customPropertyDefinitionsLogic)+ const {+ modalVisible,+ editingDefinition,+ customPropertyForm,+ isCustomPropertyFormSubmitting,+ materializedViews,+ selectedSourceColumns,+ savedQueriesLoading,+ } = useValues(customPropertyDefinitionsLogic)+ const { closeModal, submitCustomPropertyForm, setCustomPropertyFormValue } =+ useActions(customPropertyDefinitionsLogic)const showBigNumberSwitch = isNumericDisplayType(customPropertyForm.displayType)+ const { sourceMode } = customPropertyForm+ const hasExistingSource = !!editingDefinition?.source+ const noViews = !savedQueriesLoading && materializedViews.length === 0++ const submitDisabledReason =+ sourceMode === 'data_warehouse' && noViews ? 'No materialized views are available' : undefinedreturn (<LemonModal@@ -29,6 +58,7 @@ export function CustomPropertyModal(): JSX.Element {type="primary"onClick={submitCustomPropertyForm}loading={isCustomPropertyFormSubmitting}+ disabledReason={submitDisabledReason}>{editingDefinition ? 'Save' : 'Create'}</LemonButton>@@ -62,6 +92,108 @@ export function CustomPropertyModal(): JSX.Element {)}</LemonField>)}+ <LemonField name="sourceMode" label="Source">+ {({ value, onChange }) => (+ <LemonSegmentedButton+ value={value}+ onChange={onChange}+ options={SOURCE_MODE_OPTIONS}+ fullWidth+ />+ )}+ </LemonField>+ {hasExistingSource && sourceMode !== 'data_warehouse' && (+ <LemonBanner type="warning">+ Saving will remove this property's data warehouse sync. Values already synced will stay, but+ they'll stop updating automatically.+ </LemonBanner>+ )}+ {sourceMode === 'data_warehouse' &&+ (noViews ? (+ <LemonBanner type="info">+ No materialized views found. Create and materialize a view in the data warehouse first, then+ it can feed this property.+ </LemonBanner>+ ) : (+ <>+ <LemonField+ name="savedQuery"+ label="View"+ help="Values are pulled from this materialized view on each materialization, matched to accounts by external ID."+ >+ {({ value, onChange }) => (+ <LemonSearchableSelect+ value={value}+ onChange={(newValue) => {+ onChange(newValue)+ // Columns are view-specific, so a view change invalidates the picks.+ setCustomPropertyFormValue('sourceColumn', null)+ setCustomPropertyFormValue('keyColumn', null)+ }}+ options={materializedViews.map((view) => ({+ value: view.id,+ label: view.name,+ }))}+ loading={savedQueriesLoading}+ disabledReason={+ hasExistingSource ? 'The view is fixed once a sync is created' : undefined+ }+ placeholder="Select a materialized view"+ fullWidth+ />+ )}+ </LemonField>+ <LemonField+ name="sourceColumn"+ label="Value column"+ help="The column whose value is written to this property."+ >+ {({ value, onChange }) => (+ <LemonSearchableSelect+ value={value}+ onChange={onChange}+ options={selectedSourceColumns.map((column) => ({+ value: column,+ label: column,+ }))}+ loading={savedQueriesLoading}+ disabledReason={+ !customPropertyForm.savedQuery ? 'Select a view first' : undefined+ }+ placeholder="Column to read the value from"+ fullWidth+ />+ )}+ </LemonField>+ <LemonField+ name="keyColumn"+ label="Key column"+ help="The column matched against each account's external ID."+ >+ {({ value, onChange }) => (+ <LemonSearchableSelect+ value={value}+ onChange={onChange}+ options={selectedSourceColumns.map((column) => ({+ value: column,+ label: column,+ }))}+ loading={savedQueriesLoading}+ disabledReason={+ !customPropertyForm.savedQuery ? 'Select a view first' : undefined+ }+ placeholder="Column matching the account external ID"+ fullWidth+ />+ )}+ </LemonField>+ <LemonField name="isEnabled">+ {({ value, onChange }) => (+ <LemonSwitch checked={value} onChange={onChange} label="Sync enabled" bordered />+ )}+ </LemonField>+ </>+ ))}</Form></LemonModal>)diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertySourceModal.tsx b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertySourceModal.tsxindex 2cff11e58d89..c441112528e3 100644--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertySourceModal.tsx+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertySourceModal.tsx@@ -14,7 +14,7 @@ export function CustomPropertySourceModal(): JSX.Element {customPropertySourceForm,isCustomPropertySourceFormSubmitting,materializedViews,- selectedSourceColumns,+ sourceModalColumns,savedQueriesLoading,definitionsLoading,} = useValues(customPropertyDefinitionsLogic)@@ -99,7 +99,7 @@ export function CustomPropertySourceModal(): JSX.Element {<LemonSearchableSelectvalue={value}onChange={onChange}- options={selectedSourceColumns.map((column) => ({ value: column, label: column }))}+ options={sourceModalColumns.map((column) => ({ value: column, label: column }))}loading={savedQueriesLoading}disabledReason={!customPropertySourceForm.savedQuery ? 'Select a view first' : undefined@@ -118,7 +118,7 @@ export function CustomPropertySourceModal(): JSX.Element {<LemonSearchableSelectvalue={value}onChange={onChange}- options={selectedSourceColumns.map((column) => ({ value: column, label: column }))}+ options={sourceModalColumns.map((column) => ({ value: column, label: column }))}loading={savedQueriesLoading}disabledReason={!customPropertySourceForm.savedQuery ? 'Select a view first' : undefineddiff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/customPropertyDefinitionsLogic.test.ts b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/customPropertyDefinitionsLogic.test.tsindex 848fcc64e3ea..f43a38cd04c1 100644--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/customPropertyDefinitionsLogic.test.ts+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/customPropertyDefinitionsLogic.test.ts@@ -45,6 +45,7 @@ const buildDefinition = (overrides: Partial<CustomPropertyDefinitionApi> = {}):display_type: 'currency',is_big_number: true,source: null,+ references: [],created_at: '2026-01-01T00:00:00Z',created_by: 1,updated_at: '2026-01-01T00:00:00Z',@@ -65,7 +66,10 @@ const defaultMocks = (): Parameters<typeof useMocks>[0] => ({[DEFINITIONS_URL]: { count: 1, results: [buildDefinition()] },[SAVED_QUERIES_URL]: { count: 1, results: [buildView()] },},- post: { [DEFINITIONS_URL]: buildDefinition({ id: 'def-2' }), [SOURCES_URL]: buildSource() },+ post: {+ [DEFINITIONS_URL]: buildDefinition({ id: 'def-2' }),+ [SOURCES_URL]: buildSource(),+ },patch: { [DEFINITION_URL]: buildDefinition(), [SOURCE_URL]: buildSource() },delete: { [DEFINITION_URL]: {}, [SOURCE_URL]: {} },})@@ -96,11 +100,13 @@ describe('customPropertyDefinitionsLogic', () => {.toMatchValues({ definitions: [expect.objectContaining({ id: 'def-1', name: 'ARR' })] })})- it('hydrates the form when editing a definition', async () => {+ it('hydrates the form, including the source fields, when editing a synced definition', async () => {useMocks(defaultMocks())mountLogic()- const definition = buildDefinition()- await expectLogic(logic, () => logic.actions.openEditModal(definition)).toFinishAllListeners()+ const definition = buildDefinition({ source: buildSource() })+ await expectLogic(logic, () => logic.actions.openEditModal(definition))+ .toDispatchActions(['loadSavedQueries', 'loadSavedQueriesSuccess'])+ .toFinishAllListeners()expect(logic.values.modalVisible).toBe(true)expect(logic.values.editingDefinition).toEqual(definition)@@ -109,9 +115,21 @@ describe('customPropertyDefinitionsLogic', () => {description: '',displayType: 'currency',isBigNumber: true,+ sourceMode: 'data_warehouse',+ savedQuery: 'view-1',+ sourceColumn: 'mrr',+ keyColumn: 'org_id',+ isEnabled: true,})})+ it('derives the manual source mode when editing a definition without a source', async () => {+ useMocks(defaultMocks())+ mountLogic()+ await expectLogic(logic, () => logic.actions.openEditModal(buildDefinition())).toFinishAllListeners()+ expect(logic.values.customPropertyForm.sourceMode).toBe('manual')+ })+it('creates a definition, reloads, and closes the modal', async () => {useMocks(defaultMocks())mountLogic()@@ -136,6 +154,7 @@ describe('customPropertyDefinitionsLogic', () => {useMocks({...defaultMocks(),patch: {+ ...defaultMocks().patch,[DEFINITION_URL]: async ({ request }) => {patchedBody = (await request.json()) as Record<string, any>return buildDefinition()@@ -181,7 +200,96 @@ describe('customPropertyDefinitionsLogic', () => {.toMatchValues({ definitions: [] })})- it('loads warehouse views and hydrates the form when configuring an existing source', async () => {+ it('exposes the selected view columns for the pickers', async () => {+ useMocks(defaultMocks())+ mountLogic()+ await expectLogic(logic, () => logic.actions.openCreateModal()).toDispatchActions(['loadSavedQueriesSuccess'])+ logic.actions.setCustomPropertyFormValue('savedQuery', 'view-1')+ expect(logic.values.selectedSourceColumns).toEqual(['org_id', 'mrr'])+ })++ it('creates the definition and then its source when saving in data warehouse mode', async () => {+ let sourceBody: Record<string, any> | null = null+ useMocks({+ ...defaultMocks(),+ post: {+ ...defaultMocks().post,+ [SOURCES_URL]: async ({ request }) => {+ sourceBody = (await request.json()) as Record<string, any>+ return buildSource()+ },+ },+ })+ mountLogic()+ logic.actions.openCreateModal()+ logic.actions.setCustomPropertyFormValues({+ name: 'MRR',+ sourceMode: 'data_warehouse',+ savedQuery: 'view-1',+ sourceColumn: 'mrr',+ keyColumn: 'org_id',+ isEnabled: true,+ })++ await expectLogic(logic, () => logic.actions.submitCustomPropertyForm()).toDispatchActions([+ 'setEditingDefinition',+ 'submitCustomPropertyFormSuccess',+ ])+ // The source must be attached to the definition id returned by the create call.+ expect(sourceBody).toEqual({+ definition: 'def-2',+ saved_query: 'view-1',+ source_column: 'mrr',+ key_column: 'org_id',+ is_enabled: true,+ })+ })++ it('updates an existing source via PATCH without the create-only fields', async () => {+ let patchedBody: Record<string, any> | null = null+ useMocks({+ ...defaultMocks(),+ patch: {+ ...defaultMocks().patch,+ [SOURCE_URL]: async ({ request }) => {+ patchedBody = (await request.json()) as Record<string, any>+ return buildSource()+ },+ },+ })+ mountLogic()+ logic.actions.openEditModal(buildDefinition({ source: buildSource() }))+ logic.actions.setCustomPropertyFormValue('isEnabled', false)++ await expectLogic(logic, () => logic.actions.submitCustomPropertyForm()).toDispatchActions([+ 'submitCustomPropertyFormSuccess',+ ])+ expect(patchedBody).toEqual({ source_column: 'mrr', key_column: 'org_id', is_enabled: false })+ })++ it('deletes the source when saving after switching away from data warehouse mode', async () => {+ let sourceDeleted = false+ useMocks({+ ...defaultMocks(),+ delete: {+ ...defaultMocks().delete,+ [SOURCE_URL]: () => {+ sourceDeleted = true+ return [204, null]+ },+ },+ })+ mountLogic()+ logic.actions.openEditModal(buildDefinition({ source: buildSource() }))+ logic.actions.setCustomPropertyFormValue('sourceMode', 'manual')++ await expectLogic(logic, () => logic.actions.submitCustomPropertyForm()).toDispatchActions([+ 'submitCustomPropertyFormSuccess',+ ])+ expect(sourceDeleted).toBe(true)+ })++ it('hydrates the source modal form when configuring an existing source', async () => {useMocks(defaultMocks())mountLogic()await expectLogic(logic, () => logic.actions.openSourceModal(buildDefinition({ source: buildSource() })))@@ -197,17 +305,17 @@ describe('customPropertyDefinitionsLogic', () => {})})- it('exposes the selected view columns for the pickers', async () => {+ it('exposes the selected view columns for the source modal pickers', async () => {useMocks(defaultMocks())mountLogic()await expectLogic(logic, () => logic.actions.openSourceModal(buildDefinition())).toDispatchActions(['loadSavedQueriesSuccess',])logic.actions.setCustomPropertySourceFormValue('savedQuery', 'view-1')- expect(logic.values.selectedSourceColumns).toEqual(['org_id', 'mrr'])+ expect(logic.values.sourceModalColumns).toEqual(['org_id', 'mrr'])})- it('creates a source for a definition without one', async () => {+ it('creates a source from the source modal', async () => {let postedBody: Record<string, any> | null = nulluseMocks({...defaultMocks(),@@ -242,7 +350,7 @@ describe('customPropertyDefinitionsLogic', () => {})})- it('updates an existing source via PATCH without the create-only fields', async () => {+ it('updates an existing source from the source modal without the create-only fields', async () => {let patchedBody: Record<string, any> | null = nulluseMocks({...defaultMocks(),@@ -264,7 +372,7 @@ describe('customPropertyDefinitionsLogic', () => {expect(patchedBody).toEqual({ source_column: 'mrr', key_column: 'org_id', is_enabled: false })})- it('removes a source and closes the modal', async () => {+ it('removes a source and closes the source modal', async () => {useMocks(defaultMocks())mountLogic()const definition = buildDefinition({ source: buildSource() })diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/customPropertyDefinitionsLogic.ts b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/customPropertyDefinitionsLogic.tsindex 97c872158f26..6774bb53d7b5 100644--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/customPropertyDefinitionsLogic.ts+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/customPropertyDefinitionsLogic.ts@@ -26,11 +26,18 @@ import type {import type { customPropertyDefinitionsLogicType } from './customPropertyDefinitionsLogicType'import { isNumericDisplayType } from './customPropertyTypes'+export type CustomPropertySourceMode = 'manual' | 'data_warehouse'+export interface CustomPropertyFormValues {name: stringdescription: stringdisplayType: CustomPropertyDisplayTypeEnumApiisBigNumber: boolean+ sourceMode: CustomPropertySourceMode+ savedQuery: string | null+ sourceColumn: string | null+ keyColumn: string | null+ isEnabled: boolean}const DEFAULT_FORM_VALUES: CustomPropertyFormValues = {@@ -38,6 +45,11 @@ const DEFAULT_FORM_VALUES: CustomPropertyFormValues = {description: '',displayType: 'text',isBigNumber: false,+ sourceMode: 'manual',+ savedQuery: null,+ sourceColumn: null,+ keyColumn: null,+ isEnabled: true,}export interface CustomPropertySourceFormValues {@@ -54,6 +66,32 @@ const DEFAULT_SOURCE_FORM_VALUES: CustomPropertySourceFormValues = {isEnabled: true,}+const serializeDefinition = ({+ name,+ description,+ displayType,+ isBigNumber,+}: CustomPropertyFormValues): {+ name: string+ description: string | null+ display_type: CustomPropertyDisplayTypeEnumApi+ is_big_number: boolean+} => ({+ name: name.trim(),+ description: description?.trim() || null,+ display_type: displayType,+ // The switch is hidden for non-numeric types, so never send a stale flag for them.+ is_big_number: isNumericDisplayType(displayType) ? isBigNumber : false,+})++const handleNameConflict = (error: unknown, setManualErrors: (errors: { name: string }) => void): boolean => {+ if ((error as { status?: number })?.status !== 409) {+ return false+ }+ setManualErrors({ name: 'A custom property with this name already exists.' })+ return true+}+export const customPropertyDefinitionsLogic = kea<customPropertyDefinitionsLogicType>([path(['products',@@ -71,6 +109,7 @@ export const customPropertyDefinitionsLogic = kea<customPropertyDefinitionsLogicopenCreateModal: true,openEditModal: (definition: CustomPropertyDefinitionApi) => ({ definition }),closeModal: true,+ setEditingDefinition: (definition: CustomPropertyDefinitionApi) => ({ definition }),openSourceModal: (definition: CustomPropertyDefinitionApi) => ({ definition }),closeSourceModal: true,}),@@ -88,6 +127,7 @@ export const customPropertyDefinitionsLogic = kea<customPropertyDefinitionsLogic{openCreateModal: () => null,openEditModal: (_, { definition }) => definition,+ setEditingDefinition: (_, { definition }) => definition,closeModal: () => null,},],@@ -142,25 +182,53 @@ export const customPropertyDefinitionsLogic = kea<customPropertyDefinitionsLogic},],})),- forms(({ values }) => ({+ forms(({ actions, values }) => ({customPropertyForm: {defaults: DEFAULT_FORM_VALUES,- errors: ({ name }: CustomPropertyFormValues) => ({+ errors: ({ name, sourceMode, savedQuery, sourceColumn, keyColumn }: CustomPropertyFormValues) => ({name: !name?.trim() ? 'Name is required' : undefined,+ savedQuery: sourceMode === 'data_warehouse' && !savedQuery ? 'Select a view' : undefined,+ sourceColumn: sourceMode === 'data_warehouse' && !sourceColumn ? 'Select the value column' : undefined,+ keyColumn: sourceMode === 'data_warehouse' && !keyColumn ? 'Select the key column' : undefined,}),- submit: async ({ name, description, displayType, isBigNumber }: CustomPropertyFormValues) => {- const body = {- name: name.trim(),- description: description?.trim() || null,- display_type: displayType,- // The switch is hidden for non-numeric types, so never send a stale flag for them.- is_big_number: isNumericDisplayType(displayType) ? isBigNumber : false,- }+ submit: async (formValues: CustomPropertyFormValues) => {+ const projectId = String(values.currentProjectId)const editing = values.editingDefinition+ const body = serializeDefinition(formValues)+ let definition: CustomPropertyDefinitionApiif (editing) {- await customPropertyDefinitionsPartialUpdate(String(values.currentProjectId), editing.id, body)+ definition = await customPropertyDefinitionsPartialUpdate(projectId, editing.id, body)} else {- await customPropertyDefinitionsCreate(String(values.currentProjectId), body)+ definition = await customPropertyDefinitionsCreate(projectId, body)+ // Switch to edit mode right away so a failed source step below retries as an+ // update instead of re-creating the definition (409).+ actions.setEditingDefinition(definition)+ }+ try {+ const { sourceMode, savedQuery, sourceColumn, keyColumn, isEnabled } = formValues+ const existingSource = editing?.source ?? null+ if (sourceMode === 'data_warehouse' && savedQuery && sourceColumn && keyColumn) {+ if (existingSource) {+ // saved_query is create-only — only the mutable fields are sent on update.+ await customPropertySourcesPartialUpdate(projectId, existingSource.id, {+ source_column: sourceColumn,+ key_column: keyColumn,+ is_enabled: isEnabled,+ })+ } else {+ await customPropertySourcesCreate(projectId, {+ definition: definition.id,+ saved_query: savedQuery,+ source_column: sourceColumn,+ key_column: keyColumn,+ is_enabled: isEnabled,+ })+ }+ } else if (sourceMode !== 'data_warehouse' && existingSource) {+ await customPropertySourcesDestroy(projectId, existingSource.id)+ }+ } catch (error) {+ throw Object.assign(error as Error, { sourceStep: true })}},},@@ -202,6 +270,13 @@ export const customPropertyDefinitionsLogic = kea<customPropertyDefinitionsLogicsavedQueries.filter((query) => query.is_materialized),],selectedSourceColumns: [+ (s) => [s.savedQueries, s.customPropertyForm],+ (savedQueries: DataWarehouseSavedQuery[], form: CustomPropertyFormValues): string[] => {+ const view = savedQueries.find((query) => query.id === form.savedQuery)+ return (view?.columns ?? []).map((column) => column.name)+ },+ ],+ sourceModalColumns: [(s) => [s.savedQueries, s.customPropertySourceForm],(savedQueries: DataWarehouseSavedQuery[], form: CustomPropertySourceFormValues): string[] => {const view = savedQueries.find((query) => query.id === form.savedQuery)@@ -212,28 +287,40 @@ export const customPropertyDefinitionsLogic = kea<customPropertyDefinitionsLogiclisteners(({ actions, values }) => ({openCreateModal: () => {actions.resetCustomPropertyForm()+ actions.loadSavedQueries()},openEditModal: ({ definition }) => {+ actions.loadSavedQueries()actions.setCustomPropertyFormValues({name: definition.name,description: definition.description ?? '',displayType: definition.display_type,isBigNumber: definition.is_big_number ?? false,+ sourceMode: definition.source ? 'data_warehouse' : 'manual',+ savedQuery: definition.source?.saved_query ?? null,+ sourceColumn: definition.source?.source_column ?? null,+ keyColumn: definition.source?.key_column ?? null,+ isEnabled: definition.source?.is_enabled ?? true,})},submitCustomPropertyFormSuccess: () => {- lemonToast.success(values.editingDefinition ? 'Custom property updated' : 'Custom property created')+ lemonToast.success('Custom property saved')actions.loadDefinitions()actions.closeModal()},submitCustomPropertyFormFailure: ({ error }) => {- posthog.captureException(error, { scope: 'customPropertyDefinitionsLogic.submit' })- if ((error as { status?: number })?.status === 409) {- actions.setCustomPropertyFormManualErrors({- name: 'A custom property with this name already exists.',- })+ if ((error as { sourceStep?: boolean })?.sourceStep) {+ posthog.captureException(error, { scope: 'customPropertyDefinitionsLogic.submit' })+ // The definition was saved — refresh the table and keep the modal open for a retry.+ actions.loadDefinitions()+ lemonToast.error('Property saved, but the sync configuration failed. Fix it and save again.')return}+ // A name conflict is expected validation feedback, not an exception worth capturing.+ if (handleNameConflict(error, actions.setCustomPropertyFormManualErrors)) {+ return+ }+ posthog.captureException(error, { scope: 'customPropertyDefinitionsLogic.submit' })lemonToast.error('Failed to save custom property')},deleteDefinitionSuccess: () => {