: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(data-warehouse): run destinations and workflows on materialized view rows (#84416)
Tom Owers3194f717c966
diff --git a/nodejs/src/cdp/consumers/cdp-cyclotron-worker-hogflow.consumer.ts b/nodejs/src/cdp/consumers/cdp-cyclotron-worker-hogflow.consumer.tsindex 9748bd1c341f..4a7b30ce3665 100644--- a/nodejs/src/cdp/consumers/cdp-cyclotron-worker-hogflow.consumer.ts+++ b/nodejs/src/cdp/consumers/cdp-cyclotron-worker-hogflow.consumer.ts@@ -5,6 +5,7 @@ import { instrumented } from '~/common/tracing/tracing-utils'import { logger } from '~/common/utils/logger'import { PluginsServerConfig } from '~/types'+import { isRowScopedTrigger } from '../schema/hogflow'import { JobQueue } from '../services/job-queue/job-queue.interface'import { CyclotronJobInvocation, CyclotronJobInvocationHogFlow, CyclotronJobInvocationResult } from '../types'import { convertToHogFunctionFilterGlobal } from '../utils/hog-function-filtering'@@ -119,7 +120,7 @@ export class CdpCyclotronWorkerHogFlow extends CdpCyclotronWorker {// and person-dependent steps no-op for these flows. Explicitly skip the person lookup// rather than relying on event.distinct_id being empty so future changes to the// synthetic event shape don't accidentally re-enable the lookup.- const isWarehouseRow = hogFlow.trigger?.type === 'data-warehouse-table'+ const isWarehouseRow = isRowScopedTrigger(hogFlow.trigger)// Account-audience batch invocations carry the account's group key as// event.distinct_id; resolving it as a person distinct_id would attach an// unrelated person to the run. Accounts have no person — skip the lookup.diff --git a/nodejs/src/cdp/consumers/cdp-data-warehouse-events.consumer.test.ts b/nodejs/src/cdp/consumers/cdp-data-warehouse-events.consumer.test.tsindex 39e3b158d51f..f96b598cc76d 100644--- a/nodejs/src/cdp/consumers/cdp-data-warehouse-events.consumer.test.ts+++ b/nodejs/src/cdp/consumers/cdp-data-warehouse-events.consumer.test.ts@@ -28,11 +28,13 @@ describe('CdpDatawarehouseEventsConsumer', () => {const createDataWarehouseEvent = (teamId: number,properties: Record<string, any> = {},- tableName?: string+ tableName?: string,+ tableType?: 'source' | 'view'): CdpDataWarehouseEvent => {return {team_id: teamId,table_name: tableName,+ table_type: tableType,event_id: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee',properties: {column1: 'value1',@@ -404,12 +406,16 @@ describe('CdpDatawarehouseEventsConsumer', () => {})describe('hog flow invocations', () => {- const buildDataWarehouseHogFlow = (teamId: number, tableName: string): HogFlow =>+ const buildDataWarehouseHogFlow = (+ teamId: number,+ tableName: string,+ triggerType: 'data-warehouse-table' | 'data-warehouse-view' = 'data-warehouse-table'+ ): HogFlow =>new FixtureHogFlowBuilder().withTeamId(teamId).withSimpleWorkflow({trigger: {- type: 'data-warehouse-table',+ type: triggerType,table_name: tableName,// Always-true bytecode (return true)filters: { properties: [], bytecode: ['_h', 29] } as any,@@ -456,6 +462,39 @@ describe('CdpDatawarehouseEventsConsumer', () => {expect(globals[0].event?.event).toBe('$warehouse_source_row')expect(globals[0].event?.properties?.$source_table).toBe('postgres.table_1')})++ it('should build a hog flow invocation for a materialized view row', async () => {+ const hogFlow = await insertHogFlow(+ buildDataWarehouseHogFlow(team.id, 'daily_revenue', 'data-warehouse-view')+ )++ const event = createDataWarehouseEvent(team.id, {}, 'daily_revenue', 'view')+ const globals = await processor._parseKafkaBatch([createKafkaMessage(event)])+ expect(globals[0].event?.event).toBe('$warehouse_view_row')++ const { invocations } = await processor.processBatch(globals)++ const hogFlowInvocations = invocations.filter((i: any) => i.hogFlow)+ expect(hogFlowInvocations).toHaveLength(1)+ expect(hogFlowInvocations[0].functionId).toBe(hogFlow.id)+ })++ it.each([+ ['view', 'data-warehouse-table'],+ ['source', 'data-warehouse-view'],+ ] as const)(+ 'should not invoke a %s row against a %s trigger of the same name',+ async (tableType, triggerType) => {+ await insertHogFlow(buildDataWarehouseHogFlow(team.id, 'same_name', triggerType))++ const event = createDataWarehouseEvent(team.id, {}, 'same_name', tableType)+ const globals = await processor._parseKafkaBatch([createKafkaMessage(event)])++ const { invocations } = await processor.processBatch(globals)++ expect(invocations.filter((i: any) => i.hogFlow)).toHaveLength(0)+ }+ )})describe('quota limiting', () => {diff --git a/nodejs/src/cdp/consumers/cdp-data-warehouse-events.consumer.ts b/nodejs/src/cdp/consumers/cdp-data-warehouse-events.consumer.tsindex 104e9b09bdb7..e043ee9a518a 100644--- a/nodejs/src/cdp/consumers/cdp-data-warehouse-events.consumer.ts+++ b/nodejs/src/cdp/consumers/cdp-data-warehouse-events.consumer.ts@@ -25,6 +25,20 @@ import { counterParseError } from './metrics'// Acts as the "this globals object originated from a synced warehouse row" discriminator.export const WAREHOUSE_SOURCE_ROW_EVENT = '$warehouse_source_row'+// The same, for a row a materialized view run added or updated. Kept distinct from the source-table+// name so a run's origin is legible in logs and test payloads without decoding the trigger config.+export const WAREHOUSE_VIEW_ROW_EVENT = '$warehouse_view_row'++// Filter source / trigger type each kind of warehouse row matches against.+const TRIGGER_TYPE_BY_TABLE_TYPE = {+ source: 'data-warehouse-table',+ view: 'data-warehouse-view',+} as const++type WarehouseTableType = keyof typeof TRIGGER_TYPE_BY_TABLE_TYPE++const WAREHOUSE_TRIGGER_TYPES = new Set<string>(Object.values(TRIGGER_TYPE_BY_TABLE_TYPE))+// Special property on the synthetic event holding the dot-notated source table name.// Used by the pipeline's eligibility predicate to match warehouse-table HogFlow triggers// against the row's source table without adding a top-level field to globals.@@ -89,20 +103,23 @@ export class CdpDatawarehouseEventsConsumer extends CdpConsumerBase {const [hogInvocations, hogflowInvocations] = await Promise.all([this.hogFunctionPipeline.buildInvocations(invocationGlobals, {hogTypes: this.hogTypes,- filterFn: (fn) => (fn.filters?.source ?? 'events') === 'data-warehouse-table',+ filterFn: (fn) => WAREHOUSE_TRIGGER_TYPES.has(fn.filters?.source ?? 'events'),// Destinations pick their tables in `filters.data_warehouse`, which never reaches the// filter bytecode, so without this every warehouse-triggered destination in the team// ran for every table's rows.invocationFilterFn: (fn, globals) =>+ fn.filters?.source === triggerTypeOf(globals) &&matchesSubscribedTable(fn.filters?.data_warehouse, sourceTableOf(globals)),}),// Source-compatibility matching lives in the consumer rather than the executor — the// consumer knows it's serving warehouse rows, so it filters flows to only those whose- // trigger.table_name matches the row's $source_table property. The executor then just+ // trigger matches the row's kind and $source_table property. The executor then just// evaluates filter bytecode on the matched flows.this.hogFlowPipeline.buildInvocations(invocationGlobals, {eligibilityFn: (flow, globals) =>- flow.trigger.type === 'data-warehouse-table' && flow.trigger.table_name === sourceTableOf(globals),+ (flow.trigger.type === 'data-warehouse-table' || flow.trigger.type === 'data-warehouse-view') &&+ flow.trigger.type === triggerTypeOf(globals) &&+ flow.trigger.table_name === sourceTableOf(globals),}),])@@ -198,6 +215,16 @@ export class CdpDatawarehouseEventsConsumer extends CdpConsumerBase {}}+/**+ * Which trigger a row's globals can match. The synthetic event name is the discriminator, so the+ * row's own properties stay exactly what the warehouse produced.+ */+function triggerTypeOf(globals: HogFunctionInvocationGlobals): string {+ return globals.event?.event === WAREHOUSE_VIEW_ROW_EVENT+ ? TRIGGER_TYPE_BY_TABLE_TYPE.view+ : TRIGGER_TYPE_BY_TABLE_TYPE.source+}+function sourceTableOf(globals: HogFunctionInvocationGlobals): string {const table = globals.event?.properties?.[DWH_SOURCE_TABLE_PROPERTY]return typeof table === 'string' ? table : ''@@ -229,9 +256,12 @@ function convertDataWarehouseEventToHogFunctionInvocationGlobals(// The synthetic event carries:// - the producer's deterministic per-row id (CDPProducer._build_event_id) as the uuid, so// billing dedup (keyed on event.uuid) counts each row distinctly and stably across re-runs- // - `$warehouse_source_row` as the event name so downstream code can identify warehouse-row globals- // - the dot-notated source table name on `properties.$source_table` so consumers can match- // warehouse-table HogFlow triggers without a new top-level field on globals+ // - `$warehouse_source_row` or `$warehouse_view_row` as the event name, which both identifies+ // warehouse-row globals and says which trigger kind they can match+ // - the source table name on `properties.$source_table` so consumers can match warehouse+ // triggers without a new top-level field on globals+ const tableType: WarehouseTableType = event.table_type ?? 'source'+return {project: {id: team.id,@@ -240,7 +270,7 @@ function convertDataWarehouseEventToHogFunctionInvocationGlobals(},event: {uuid: event.event_id,- event: WAREHOUSE_SOURCE_ROW_EVENT,+ event: tableType === 'view' ? WAREHOUSE_VIEW_ROW_EVENT : WAREHOUSE_SOURCE_ROW_EVENT,elements_chain: '', // Not applicable but left here for compatibilitydistinct_id: 'data-warehouse-table-distinct-id-do-not-use',properties: {diff --git a/nodejs/src/cdp/schema.ts b/nodejs/src/cdp/schema.tsindex c154a34f51b0..06704912e8f8 100644--- a/nodejs/src/cdp/schema.ts+++ b/nodejs/src/cdp/schema.ts@@ -28,10 +28,13 @@ export type CdpInternalEvent = z.infer<typeof CdpInternalEventSchema>export const CdpDataWarehouseEventSchema = z.object({team_id: z.number(),- // Dot-notated table name the row was synced into. Optional for backwards compatibility with- // messages produced before the producer started including it.+ // Dot-notated table name the row was synced into, or a materialized view's own name. Optional+ // for backwards compatibility with messages produced before the producer started including it.table_name: z.string().optional(),- // Deterministic id, unique per row per external data job run (see CDPProducer._build_event_id)+ // Which kind of warehouse table the row came from. Absent means a source-synced table, which is+ // all the producer emitted before materialized views could trigger.+ table_type: z.enum(['source', 'view']).optional(),+ // Deterministic id, unique per row (see CDPProducer._build_event_id)event_id: z.string(),properties: z.record(z.string(), z.any()),})diff --git a/nodejs/src/cdp/schema/hogflow.ts b/nodejs/src/cdp/schema/hogflow.tsindex e1e6f1a4f99a..8ea308bb5ae6 100644--- a/nodejs/src/cdp/schema/hogflow.ts+++ b/nodejs/src/cdp/schema/hogflow.ts@@ -94,6 +94,17 @@ const HogFlowTriggerSchema = z.discriminatedUnion('type', [properties: z.array(z.any()).optional(),}),}),+ z.object({+ type: z.literal('data-warehouse-view'),+ // The materialized view's own name, which is also the name it is queryable by in HogQL.+ table_name: z.string(),+ filters: z.object({+ // Row-property filters only - warehouse-triggered workflows are person-less ("row-scoped")+ properties: z.array(z.any()).optional(),+ }),+ // Optional row column used as the masking / dedup key in place of distinct_id+ key_property: z.string().optional(),+ }),])export const HogFlowActionSchema = z.discriminatedUnion('type', [@@ -307,6 +318,16 @@ export const HogFlowSchema = z.object({updated_at: z.union([z.number(), z.string(), z.date()]).optional(),})+export type RowScopedTrigger = Extract<HogFlow['trigger'], { type: 'data-warehouse-table' | 'data-warehouse-view' }>++/**+ * A warehouse-row trigger produces one run per row, with the row's columns under+ * `event.properties` and no person attached.+ */+export function isRowScopedTrigger(trigger: HogFlow['trigger']): trigger is RowScopedTrigger {+ return trigger?.type === 'data-warehouse-table' || trigger?.type === 'data-warehouse-view'+}+// NOTE: these are purposefully exported as interfaces to support kea typegenexport interface HogFlow extends z.infer<typeof HogFlowSchema> {}export type HogFlowAction = z.infer<typeof HogFlowActionSchema> & Record<string, unknown>diff --git a/nodejs/src/cdp/services/hogflows/hogflow-executor.service.ts b/nodejs/src/cdp/services/hogflows/hogflow-executor.service.tsindex 2d64613d2518..203afb37c817 100644--- a/nodejs/src/cdp/services/hogflows/hogflow-executor.service.ts+++ b/nodejs/src/cdp/services/hogflows/hogflow-executor.service.ts@@ -2,7 +2,7 @@ import { get } from 'lodash'import { DateTime } from 'luxon'import { Counter } from 'prom-client'-import { HogFlow, HogFlowAction } from '~/cdp/schema/hogflow'+import { HogFlow, HogFlowAction, isRowScopedTrigger } from '~/cdp/schema/hogflow'import { logger } from '~/common/utils/logger'import { UUIDT } from '~/common/utils/utils'@@ -177,11 +177,7 @@ export class HogFlowExecutorService {const trigger = hogFlow.trigger// Defensive: only the trigger types that carry `filters` make it through eligibility.- if (- trigger.type !== 'event' &&- trigger.type !== 'data-warehouse-table' &&- trigger.type !== 'slack-message'- ) {+ if (trigger.type !== 'event' && trigger.type !== 'slack-message' && !isRowScopedTrigger(trigger)) {continue}diff --git a/nodejs/src/cdp/types.ts b/nodejs/src/cdp/types.tsindex 31d18aa99871..9a4993028a7a 100644--- a/nodejs/src/cdp/types.ts+++ b/nodejs/src/cdp/types.ts@@ -49,7 +49,7 @@ export type HogFunctionFilterDataWarehouse = {}export interface HogFunctionFilters {- source?: 'events' | 'person-updates' | 'data-warehouse-table' // Special case to identify what kind of thing this filters on+ source?: 'events' | 'person-updates' | 'data-warehouse-table' | 'data-warehouse-view' // Special case to identify what kind of thing this filters onevents?: HogFunctionFilterEvent[]actions?: HogFunctionFilterAction[]// Warehouse tables this function is subscribed to. Never compiled into bytecode, so thediff --git a/posthog/cdp/validation.py b/posthog/cdp/validation.pyindex 49bc8764d0f8..054c2b5df606 100644--- a/posthog/cdp/validation.py+++ b/posthog/cdp/validation.py@@ -806,9 +806,14 @@ class InputsSerializer(serializers.DictField):# Unlike standard dict validation we are iterating the schema - not the inputs+# Filter sources whose rows come from the warehouse rather than from events: one invocation per+# row, with the row under `event.properties` and no person attached.+DATA_WAREHOUSE_SOURCES = ("data-warehouse-table", "data-warehouse-view")++class HogFunctionFiltersSerializer(serializers.Serializer):source = serializers.ChoiceField(- choices=["events", "person-updates", "data-warehouse-table"], required=False, default="events"+ choices=["events", "person-updates", *DATA_WAREHOUSE_SOURCES], required=False, default="events") # type: ignoreactions = serializers.ListField(child=serializers.DictField(), required=False)events = serializers.ListField(child=serializers.DictField(), required=False)@@ -856,8 +861,8 @@ class HogFunctionFiltersSerializer(serializers.Serializer):data.pop("actions", None)data.pop("data_warehouse", None)- if data.get("source") == "data-warehouse-table":- # Don't allow events or actions for data-warehouse-table+ if data.get("source") in DATA_WAREHOUSE_SOURCES:+ # Don't allow events or actions for warehouse sourcesdata.pop("events", None)data.pop("actions", None)diff --git a/posthog/temporal/data_modeling/__init__.py b/posthog/temporal/data_modeling/__init__.pyindex f0859c7cffb6..c8b172fe80bf 100644--- a/posthog/temporal/data_modeling/__init__.py+++ b/posthog/temporal/data_modeling/__init__.py@@ -1,5 +1,6 @@from posthog.temporal.data_modeling.activities import (check_duckgres_shadow_enabled_activity,+ clear_cdp_staging_activity,create_data_modeling_job_activity,enrich_view_semantics_activity,fail_materialization_activity,@@ -41,6 +42,7 @@ SEMANTIC_ENRICHMENT_WORKFLOWS = [EnrichViewSemanticsWorkflow]SEMANTIC_ENRICHMENT_ACTIVITIES = [enrich_view_semantics_activity]ACTIVITIES = [check_duckgres_shadow_enabled_activity,+ clear_cdp_staging_activity,create_data_modeling_job_activity,record_skipped_data_modeling_jobs_activity,get_dag_structure_activity,diff --git a/posthog/temporal/data_modeling/activities/__init__.py b/posthog/temporal/data_modeling/activities/__init__.pyindex 3294b3a12dcd..4a2ca1ce92d0 100644--- a/posthog/temporal/data_modeling/activities/__init__.py+++ b/posthog/temporal/data_modeling/activities/__init__.py@@ -9,7 +9,13 @@ from .create_data_modeling_job import (from .enrich_view_semantics import EnrichViewSemanticsInputs, enrich_view_semantics_activityfrom .fail_materialization import FailMaterializationInputs, fail_materialization_activityfrom .get_dag_structure import GetDAGStructureInputs, get_dag_structure_activity-from .materialize_view import MaterializeViewInputs, MaterializeViewResult, materialize_view_activity+from .materialize_view import (+ ClearCDPStagingInputs,+ MaterializeViewInputs,+ MaterializeViewResult,+ clear_cdp_staging_activity,+ materialize_view_activity,+)from .materialize_view_duckgres import (DuckgresShadowInputs,DuckgresShadowResult,@@ -39,6 +45,7 @@ from .succeed_materialization import (__all__ = ["UPSTREAM_NAMES_IN_SKIP_REASON",+ "ClearCDPStagingInputs","CreateDataModelingJobInputs","RecordSkippedDataModelingJobsInputs","SkippedDataModelingNode",@@ -59,6 +66,7 @@ __all__ = ["SucceedMaterializationInputs","SucceedMaterializationResult","check_duckgres_shadow_enabled_activity",+ "clear_cdp_staging_activity","create_data_modeling_job_activity","record_skipped_data_modeling_jobs_activity","enrich_view_semantics_activity",diff --git a/posthog/temporal/data_modeling/activities/materialize_view.py b/posthog/temporal/data_modeling/activities/materialize_view.pyindex e99d092df1cb..a600d48bcf0e 100644--- a/posthog/temporal/data_modeling/activities/materialize_view.py+++ b/posthog/temporal/data_modeling/activities/materialize_view.py@@ -61,6 +61,7 @@ from products.data_quality.backend.facade.contracts import QUALITY_AUDIT_SKIP, Qfrom products.data_warehouse.backend.facade.api import ensure_bucket_exists, get_s3_clientfrom products.endpoints.backend.facade.temporal import prepare_executable_queryfrom products.warehouse_sources.backend.facade.hooks import saved_query_binding+from products.warehouse_sources.backend.facade.pipelines import CDPProducerfrom products.warehouse_sources.backend.facade.temporal import PersonPropertyRowSinkLOGGER = get_logger(__name__)@@ -159,6 +160,54 @@ def _resolve_write_plan(saved_query: DataWarehouseSavedQuery, team_id: int) -> W)+class _CDPRowSink:+ """Stages the rows a run wrote so CDP destinations and workflows subscribed to the view can act+ on them.++ Best effort by design: the materialization is the product and the trigger is not, so a staging+ failure never fails the run. A partial stage is worse than none, though — a subscriber would get+ some of the run's rows and silently miss the rest — so the first failure discards everything+ staged and the run produces nothing.+ """++ def __init__(self, producer: CDPProducer, logger: FilteringBoundLogger) -> None:+ self._producer = producer+ self._logger = logger+ self._chunk = 0+ self.enabled = False++ async def prepare(self) -> None:+ """Resolve the gate once, then clear anything a previous attempt of this activity staged."""+ try:+ self.enabled = await self._producer.should_run()+ if self.enabled:+ await self._producer.clear()+ except Exception as e:+ capture_exception(e)+ await self._logger.awarning(f"Could not prepare CDP row staging; skipping it for this run: {e}")+ self.enabled = False++ async def stage(self, batch: pa.RecordBatch) -> None:+ if not self.enabled or batch.num_rows == 0:+ return++ try:+ await self._producer.stage_chunk(self._chunk, batch)+ self._chunk += 1+ except Exception as e:+ capture_exception(e)+ await self._logger.awarning(f"Failed to stage rows for CDP; discarding this run's staged rows: {e}")+ self.enabled = False+ await self.discard()++ async def discard(self) -> None:+ try:+ await self._producer.clear()+ except Exception as e:+ capture_exception(e)+ await self._logger.awarning(f"Failed to clear staged CDP rows: {e}")++class InvalidNodeTypeException(Exception):"""Exception raised when attempting to materialize an invalid node type."""@@ -198,6 +247,9 @@ class MaterializeViewResult:# what the workflow gates the person-property child on. Defaulted to the skip value so an old# history decodes without it and never fires that child during replay.person_property_sync_enabled: bool = False+ # Whether this run staged rows for a warehouse-view CDP trigger, so the workflow knows to start+ # the producer job. Defaulted so old workflow histories decode without it.+ should_trigger_cdp_producer: bool = Falsedef _build_model_table_uri(team_id: int, saved_query_id_hex: str, normalized_name: str) -> str:@@ -676,6 +728,7 @@ async def _materialize_fully(table_uri: str,storage_options: dict[str, str],logger: FilteringBoundLogger,+ cdp_sink: "_CDPRowSink",person_property_sink: PersonPropertyRowSink | None = None,) -> tuple[int, list[str]]:"""Rebuild the whole table from the query. The only path that creates a Delta table, and the@@ -736,6 +789,9 @@ async def _materialize_fully(schema_mode="merge",storage_options=storage_options,)+ # Staged only once the batch is committed: a run that announces rows it then fails to write+ # cannot take the announcement back.+ await cdp_sink.stage(batch)if plan.config is not None and plan.config.incremental_key in batch.schema.names:watermark = max_of(batch, plan.config.incremental_key, watermark)row_count = row_count + batch.num_rows@@ -772,6 +828,7 @@ async def _materialize_incrementally(table_uri: str,storage_options: dict[str, str],logger: FilteringBoundLogger,+ cdp_sink: "_CDPRowSink",person_property_sink: PersonPropertyRowSink | None = None,) -> tuple[int, list[str]]:"""Upsert only the rows at or after the watermark into the existing table.@@ -824,6 +881,7 @@ async def _materialize_incrementally(commit_metadata={"posthog_job_id": str(objects.job.id)},)await logger.ainfo("Upserted batch into delta table", **upsert_stats_fields(stats))+ await cdp_sink.stage(batch)watermark = max_of(batch, config.incremental_key, watermark)row_count = row_count + batch.num_rows@@ -876,6 +934,40 @@ async def _vacuum(delta_table: deltalake.DeltaTable, logger: FilteringBoundLogge)[email protected](frozen=True, kw_only=True, slots=True)+class ClearCDPStagingInputs:+ team_id: int+ saved_query_id: str+ job_id: str++ @property+ def properties_to_log(self) -> dict[str, typing.Any]:+ return {+ "team_id": self.team_id,+ "saved_query_id": self.saved_query_id,+ "job_id": self.job_id,+ }+++async def clear_cdp_staging_activity(inputs: ClearCDPStagingInputs) -> None:+ """Drop the rows a run staged for CDP but never published.++ The staging prefix is keyed on the job, so the next run's own clear never reaches this one's.+ A run that ends without producing has to clean up after itself or the objects stay forever.+ """+ bind_contextvars(team_id=inputs.team_id)+ logger = LOGGER.bind()++ producer = CDPProducer.for_view(+ team_id=inputs.team_id,+ saved_query_id=inputs.saved_query_id,+ job_id=inputs.job_id,+ logger=logger,+ )+ await producer.clear()++@activity.defnasync def materialize_view_activity(inputs: MaterializeViewInputs) -> MaterializeViewResult:"""Materialize a view by executing its query and writing to delta lake."""@@ -915,30 +1007,64 @@ async def materialize_view_activity(inputs: MaterializeViewInputs) -> Materializ# what sweeps long-abandoned sibling job prefixes.await _clear_person_property_staging(person_property_sink, logger)- async with Heartbeater():- hogql_query = typing.cast(dict, objects.saved_query.query)["query"]-- if plan.incremental:- row_count, file_uris = await _materialize_incrementally(- objects, plan, hogql_query, table_uri, storage_options, logger, person_property_sink- )- else:- row_count, file_uris = await _materialize_fully(- objects, plan, hogql_query, table_uri, storage_options, logger, person_property_sink- )-- await logger.ainfo(f"Materialized node {objects.node.name} with {row_count} rows")- quality_audit = await database_sync_to_async_pool(data_quality_facade.quality_audit_mode)(- inputs.team_id, str(objects.saved_query.id)- )- return MaterializeViewResult(- node_id=objects.node.id,- node_name=objects.node.name,- row_count=row_count,- table_uri=table_uri,- file_uris=file_uris,- saved_query_id=str(objects.saved_query.id),- quality_audit=quality_audit,- incremental=plan.incremental,- person_property_sync_enabled=person_property_sink is not None,+ cdp_sink = _CDPRowSink(+ CDPProducer.for_view(+ team_id=inputs.team_id,+ saved_query_id=str(objects.saved_query.id),+ job_id=str(objects.job.id),+ logger=logger,+ ),+ logger,)+ await cdp_sink.prepare()++ # Staged rows are only safe to leave in place once MaterializeViewResult is actually returned:+ # that is the one signal the workflow's own cleanup keys off. Anything that leaves this block+ # early - a write failure, a cancellation mid-write, or a cancellation during the logging,+ # heartbeat teardown, or quality-audit lookup that follow it - must discard what was staged+ # itself, because the workflow will never see a result to clean up after. CancelledError is a+ # BaseException, not an Exception, so it has to be named explicitly to be caught here at all.+ # cdp_sink.discard() only clears a non-empty prefix, so catching it at both this level and the+ # inner write-loop level below is safe to double up on.+ published = False+ try:+ async with Heartbeater():+ hogql_query = typing.cast(dict, objects.saved_query.query)["query"]++ try:+ if plan.incremental:+ row_count, file_uris = await _materialize_incrementally(+ objects, plan, hogql_query, table_uri, storage_options, logger, cdp_sink, person_property_sink+ )+ else:+ row_count, file_uris = await _materialize_fully(+ objects, plan, hogql_query, table_uri, storage_options, logger, cdp_sink, person_property_sink+ )+ except (Exception, asyncio.CancelledError):+ # A retry stages from scratch and a terminal failure produces nothing, so whatever+ # this attempt wrote is only ever waste.+ await cdp_sink.discard()+ raise++ await logger.ainfo(f"Materialized node {objects.node.name} with {row_count} rows")+ quality_audit = await database_sync_to_async_pool(data_quality_facade.quality_audit_mode)(+ inputs.team_id, str(objects.saved_query.id)+ )+ result = MaterializeViewResult(+ node_id=objects.node.id,+ node_name=objects.node.name,+ row_count=row_count,+ table_uri=table_uri,+ file_uris=file_uris,+ saved_query_id=str(objects.saved_query.id),+ quality_audit=quality_audit,+ incremental=plan.incremental,+ person_property_sync_enabled=person_property_sink is not None,+ should_trigger_cdp_producer=cdp_sink.enabled,+ )+ published = True+ return result+ except (Exception, asyncio.CancelledError):+ if not published:+ await cdp_sink.discard()+ raisediff --git a/posthog/temporal/data_modeling/workflows/materialize_view.py b/posthog/temporal/data_modeling/workflows/materialize_view.pyindex 66bcc3fc28ee..2f45c5a0fb5a 100644--- a/posthog/temporal/data_modeling/workflows/materialize_view.py+++ b/posthog/temporal/data_modeling/workflows/materialize_view.py@@ -14,6 +14,7 @@ from temporalio.exceptions import WorkflowAlreadyStartedErrorfrom posthog.exceptions_capture import capture_exceptionfrom posthog.temporal.common.base import PostHogWorkflowfrom posthog.temporal.data_modeling.activities import (+ ClearCDPStagingInputs,CreateDataModelingJobInputs,DuckgresShadowInputs,DuckgresShadowResult,@@ -28,6 +29,7 @@ from posthog.temporal.data_modeling.activities import (SucceedMaterializationInputs,SucceedMaterializationResult,check_duckgres_shadow_enabled_activity,+ clear_cdp_staging_activity,create_data_modeling_job_activity,fail_materialization_activity,materialize_view_activity,@@ -54,6 +56,7 @@ from posthog.temporal.data_modeling.metrics import (get_node_total_storage_mib_metric,)from posthog.temporal.data_modeling.workflows.enrich_view_semantics import EnrichViewSemanticsWorkflow+from posthog.temporal.utils import CDPProducerWorkflowInputsfrom products.data_modeling.backend.facade.models import DataModelingJobEnginefrom products.data_quality.backend.facade.contracts import (@@ -74,6 +77,10 @@ from products.warehouse_sources.backend.facade.hooks import (# warn-mode suite child.QUALITY_AUDIT_PATCH = "data-quality-audit-2026-08"+# Covers the CDP producer child and the staging-cleanup activity. Both are new commands, so a+# history recorded before this deploy has to keep taking the branch that issues neither.+CDP_VIEW_TRIGGER_PATCH = "cdp-data-warehouse-view-trigger-2026-08"+# these indicate problems with the query or data, not transient issuesNON_RETRYABLE_ERRORS = ["CHQueryErrorMemoryLimitExceeded",@@ -229,6 +236,7 @@ class MaterializeViewWorkflow(PostHogWorkflow):maximum_attempts=3,),)+ materialize_result: MaterializeViewResult | None = Nonetry:materialize_result = await temporalio.workflow.execute_activity(materialize_view_activity,@@ -297,6 +305,8 @@ class MaterializeViewWorkflow(PostHogWorkflow):retry_policy=temporalio.common.RetryPolicy(maximum_attempts=3),)get_node_finished_metric("quality_blocked").add(1)+ if temporalio.workflow.patched(CDP_VIEW_TRIGGER_PATCH):+ await self._discard_staged_cdp_rows(inputs, job_id, materialize_result)end_time = temporalio.workflow.now()blocked_duration_seconds = (end_time - start_time).total_seconds()if duckgres_shadow_handle is not None:@@ -358,6 +368,9 @@ class MaterializeViewWorkflow(PostHogWorkflow):# None for in-flight runs on the pre-deploy activity version — treat that as "not needed".await self._maybe_enrich_view_semantics(inputs, succeed_result)+ if temporalio.workflow.patched(CDP_VIEW_TRIGGER_PATCH):+ await self._maybe_produce_cdp_rows(inputs, job_id, materialize_result)+quality_audited = staged_verdict is not Noneif quality_audit == QUALITY_AUDIT_WARN:quality_audited = await self._start_suite_on_published_data(inputs, job_id, materialize_result)@@ -416,6 +429,10 @@ class MaterializeViewWorkflow(PostHogWorkflow):f"MaterializeViewWorkflow failed: {error_message}",extra=inputs.properties_to_log,)+ # A failure after the activity returned (publish, succeed) leaves that run's staged+ # rows behind. The activity cleans up after its own failures itself.+ if materialize_result is not None and temporalio.workflow.patched(CDP_VIEW_TRIGGER_PATCH):+ await self._discard_staged_cdp_rows(inputs, job_id, materialize_result)try:await temporalio.workflow.execute_activity(fail_materialization_activity,@@ -605,6 +622,87 @@ class MaterializeViewWorkflow(PostHogWorkflow):extra={"job_id": job_id, "error": str(e)},)+ async def _maybe_produce_cdp_rows(+ self,+ inputs: MaterializeViewWorkflowInputs,+ job_id: str,+ materialize_result: MaterializeViewResult,+ ) -> None:+ """Hand this run's rows to the CDP producer so subscribed destinations and workflows run.++ Started only after the queryable publish, so a destination that queries the view back sees+ the rows it was told about. Best effort and fully isolated: ABANDON so it never blocks this+ workflow, and every error is swallowed — a trigger that misses a run must not fail the+ materialization behind it.+ """+ if not materialize_result.should_trigger_cdp_producer:+ return++ try:+ await temporalio.workflow.start_child_workflow(+ workflow="dwh-cdp-producer-job",+ arg=dataclasses.asdict(+ CDPProducerWorkflowInputs(+ team_id=inputs.team_id,+ job_id=job_id,+ saved_query_id=materialize_result.saved_query_id,+ )+ ),+ id=f"dwh-cdp-producer-job-{job_id}",+ task_queue=str(settings.DATA_WAREHOUSE_CDP_PRODUCER_TASK_QUEUE),+ parent_close_policy=temporalio.workflow.ParentClosePolicy.ABANDON,+ retry_policy=temporalio.common.RetryPolicy(+ maximum_attempts=3,+ non_retryable_error_types=["NondeterminismError"],+ ),+ )+ except WorkflowAlreadyStartedError:+ # Already running against this job's staged rows, so they are still wanted.+ temporalio.workflow.logger.info(+ "CDP producer job already running, skipping",+ extra={"job_id": job_id},+ )+ except Exception as e:+ capture_exception(e)+ temporalio.workflow.logger.warning(+ "Failed to start the CDP producer job",+ extra={"job_id": job_id, "error": str(e)},+ )+ # Nothing will ever read this job's staged rows now, and its prefix is keyed on the job,+ # so no later run's own clear would reach them.+ await self._discard_staged_cdp_rows(inputs, job_id, materialize_result)++ async def _discard_staged_cdp_rows(+ self,+ inputs: MaterializeViewWorkflowInputs,+ job_id: str,+ materialize_result: MaterializeViewResult,+ ) -> None:+ """Drop rows staged by a run that then never published.++ The staging prefix is keyed on the job, so no later run's own clear will ever reach it.+ """+ if not materialize_result.should_trigger_cdp_producer:+ return++ try:+ await temporalio.workflow.execute_activity(+ clear_cdp_staging_activity,+ ClearCDPStagingInputs(+ team_id=inputs.team_id,+ saved_query_id=materialize_result.saved_query_id,+ job_id=job_id,+ ),+ start_to_close_timeout=dt.timedelta(minutes=5),+ retry_policy=temporalio.common.RetryPolicy(maximum_attempts=3),+ )+ except Exception as e:+ capture_exception(e)+ temporalio.workflow.logger.warning(+ "Failed to clear staged CDP rows",+ extra={"job_id": job_id, "error": str(e)},+ )+async def _maybe_enrich_view_semantics(self,inputs: MaterializeViewWorkflowInputs,diff --git a/posthog/temporal/tests/data_modeling/test_materialize_view_incremental.py b/posthog/temporal/tests/data_modeling/test_materialize_view_incremental.pyindex 300defd74126..51fda7dd96f1 100644--- a/posthog/temporal/tests/data_modeling/test_materialize_view_incremental.py+++ b/posthog/temporal/tests/data_modeling/test_materialize_view_incremental.py@@ -6,6 +6,7 @@ Rust crate — key matching, duplicate rejection, schema handling, column-name cwould assert our idea of deltalite rather than deltalite."""+import asynciofrom collections.abc import Collectionfrom datetime import UTC, datetime, timedeltafrom typing import Any, cast@@ -431,3 +432,168 @@ class TestIncrementalMaterialization:assert windows[0] is None, "the first run is a full refresh with no window"assert windows[1] is not Noneassert windows[1].since == DAY2 - timedelta(seconds=3600)+++class _RecordingProducer:+ """Stands in for CDPProducer, recording what a run handed it."""++ def __init__(+ self, *, gate: bool = True, fail_on_chunk: int | None = None, cancel_on_chunk: int | None = None+ ) -> None:+ self._gate = gate+ self._fail_on_chunk = fail_on_chunk+ self._cancel_on_chunk = cancel_on_chunk+ self.staged: list[tuple[Any, Any]] = []+ self.clears = 0++ async def should_run(self) -> bool:+ return self._gate++ async def clear(self) -> None:+ self.clears += 1+ self.staged.clear()++ async def stage_chunk(self, chunk: int, batch: Any) -> None:+ if chunk == self._fail_on_chunk:+ raise RuntimeError("s3 is having a day")+ if chunk == self._cancel_on_chunk:+ # What a Temporal activity cancellation looks like from inside: the SDK cancels the+ # asyncio task, which raises this at the next await point, here.+ raise asyncio.CancelledError()+ self.staged.append((chunk, batch))++ def staged_rows(self) -> list[tuple[Any, Any]]:+ pairs: list[tuple[Any, Any]] = []+ for _, batch in self.staged:+ value_column = next(name for name in batch.schema.names if name != "day")+ pairs.extend(zip(batch.column("day").to_pylist(), batch.column(value_column).to_pylist()))+ return sorted(pairs, key=lambda pair: (pair[0] is None, pair[0]))+++def _patch_producer(producer: _RecordingProducer):+ return unittest.mock.patch(+ "posthog.temporal.data_modeling.activities.materialize_view.CDPProducer.for_view",+ return_value=producer,+ )++[email protected]("minio_client")+class TestCDPRowStaging:+ """What a run hands to the CDP producer, which is what its subscribed destinations and+ workflows end up running on."""++ async def test_nothing_is_staged_when_nothing_subscribes(+ self, activity_environment, ateam, anode, asaved_query, ajob, bucket_name, adag+ ):+ # The gate is the only thing standing between an unsubscribed view and an S3 write per+ # batch, on every run, forever.+ producer = _RecordingProducer(gate=False)+ await _configure(asaved_query)++ with _settings(bucket_name), _patch_producer(producer):+ result = await _run(activity_environment, ateam, anode, ajob, adag, _batch([DAY1, DAY2], [10, 20]))++ assert producer.staged == []+ assert producer.clears == 0+ assert result.should_trigger_cdp_producer is False++ async def test_a_full_refresh_stages_the_whole_table(+ self, activity_environment, ateam, anode, asaved_query, ajob, bucket_name, adag+ ):+ producer = _RecordingProducer()+ await _configure(asaved_query)++ with _settings(bucket_name), _patch_producer(producer):+ result = await _run(activity_environment, ateam, anode, ajob, adag, _batch([DAY1, DAY2], [10, 20]))++ assert producer.staged_rows() == [(DAY1, 10), (DAY2, 20)]+ assert result.should_trigger_cdp_producer is True++ async def test_an_incremental_run_stages_only_its_window(+ self, activity_environment, ateam, anode, asaved_query, ajob, bucket_name, adag+ ):+ # The point of the whole feature: a destination hears about the rows that changed, not+ # every row the view holds.+ await _configure(asaved_query)++ with _settings(bucket_name):+ seed = _RecordingProducer()+ with _patch_producer(seed):+ await _run(activity_environment, ateam, anode, ajob, adag, _batch([DAY1, DAY2], [10, 20]))++ incremental = _RecordingProducer()+ with _patch_producer(incremental):+ result = await _run(activity_environment, ateam, anode, ajob, adag, _batch([DAY3], [30]))++ assert result.incremental is True+ assert incremental.staged_rows() == [(DAY3, 30)]++ async def test_a_staging_failure_discards_the_run_and_leaves_the_view_materialized(+ self, activity_environment, ateam, anode, asaved_query, ajob, bucket_name, adag+ ):+ # Half a run's rows reaching a destination is worse than none, and the materialization is+ # the product either way.+ producer = _RecordingProducer(fail_on_chunk=1)+ await _configure(asaved_query)++ with _settings(bucket_name), _patch_producer(producer):+ result = await _run(+ activity_environment, ateam, anode, ajob, adag, _batch([DAY1], [10]), _batch([DAY2], [20])+ )++ assert result.row_count == 2+ assert _rows(result.table_uri) == [(DAY1, 10), (DAY2, 20)]+ assert result.should_trigger_cdp_producer is False+ assert producer.staged == []+ assert producer.clears >= 2, "the prefix is cleared at the start of the run and again on failure"++ async def test_a_cancellation_mid_stage_discards_the_run(+ self, activity_environment, ateam, anode, asaved_query, ajob, bucket_name, adag+ ):+ # A Temporal activity cancellation raises asyncio.CancelledError, a BaseException rather than+ # an Exception - the same discard-on-first-failure rule must still run, or a cancelled run+ # after staging began leaks its chunks under a prefix no later run's own clear reaches.+ producer = _RecordingProducer(cancel_on_chunk=1)+ await _configure(asaved_query)++ with _settings(bucket_name), _patch_producer(producer):+ with pytest.raises(asyncio.CancelledError):+ await _run(activity_environment, ateam, anode, ajob, adag, _batch([DAY1], [10]), _batch([DAY2], [20]))++ assert producer.staged == []+ assert producer.clears >= 2, "the prefix is cleared at the start of the run and again on cancellation"++ async def test_a_cancellation_after_the_write_loop_discards_the_run(+ self, activity_environment, ateam, anode, asaved_query, ajob, bucket_name, adag+ ):+ # A cancellation doesn't only land mid-write. The logging, heartbeat teardown, and+ # quality-audit lookup between the last write and the MaterializeViewResult being built are+ # await points too, and the run hasn't handed back a result for the workflow to key its own+ # cleanup off until it actually returns one. This simulates the audit lookup being the point+ # that gets cancelled, after every row has already been staged successfully.+ producer = _RecordingProducer()+ await _configure(asaved_query)++ with _settings(bucket_name), _patch_producer(producer):+ with unittest.mock.patch(+ "posthog.temporal.data_modeling.activities.materialize_view.data_quality_facade.quality_audit_mode",+ side_effect=asyncio.CancelledError(),+ ):+ with pytest.raises(asyncio.CancelledError):+ await _run(activity_environment, ateam, anode, ajob, adag, _batch([DAY1], [10]))++ assert producer.staged == []+ assert producer.clears >= 2, "the prefix is cleared at the start of the run and again on cancellation"++ async def test_a_failed_run_stages_nothing(+ self, activity_environment, ateam, anode, asaved_query, ajob, bucket_name, adag+ ):+ # A run that never lands its rows must not announce them either.+ producer = _RecordingProducer()+ await _configure(asaved_query)++ with _settings(bucket_name), _patch_producer(producer):+ with pytest.raises(IncrementalWriteError):+ await _run(activity_environment, ateam, anode, ajob, adag, _batch([DAY1, DAY1], [10, 11]))++ assert producer.staged == []diff --git a/posthog/temporal/tests/data_modeling/test_materialize_view_workflow.py b/posthog/temporal/tests/data_modeling/test_materialize_view_workflow.pyindex 458fbf09f3ac..bcb4d625aeb4 100644--- a/posthog/temporal/tests/data_modeling/test_materialize_view_workflow.py+++ b/posthog/temporal/tests/data_modeling/test_materialize_view_workflow.py@@ -1,4 +1,5 @@import datetime as dt+import dataclassesfrom contextlib import ExitStackimport pytest@@ -430,3 +431,81 @@ class TestMaybeSyncPersonProperties:patch(f"{WORKFLOW_MODULE}.capture_exception"),):await workflow._maybe_sync_person_properties(_inputs(), result, "job-123")+++class TestCDPProducerHandoff(TestQualityGateBranching):+ """When the workflow hands a run's staged rows to the CDP producer, and when it throws them away."""++ @staticmethod+ def _result(*, should_trigger: bool, quality_audit: QualityAuditMode = "skip") -> MaterializeViewResult:+ result = _materialize_result(quality_audit)+ return dataclasses.replace(result, should_trigger_cdp_producer=should_trigger)++ async def test_the_producer_starts_after_a_successful_publish(self):+ start_child = AsyncMock()+ activity_results = [+ False,+ "job-1",+ self._result(should_trigger=True),+ PrepareQueryableTableResult(storage_delta_mib=None, total_storage_mib=None),+ SucceedMaterializationResult(enrichment_needed=False, saved_query_id="sq-1"),+ ]++ await self._run(activity_results, {"checks_failed_blocking": 0}, start_child=start_child)++ started = [call.kwargs.get("workflow") or call.args[0] for call in start_child.await_args_list]+ assert "dwh-cdp-producer-job" in started++ async def test_no_producer_starts_when_nothing_subscribes(self):+ start_child = AsyncMock()+ activity_results = [+ False,+ "job-1",+ self._result(should_trigger=False),+ PrepareQueryableTableResult(storage_delta_mib=None, total_storage_mib=None),+ SucceedMaterializationResult(enrichment_needed=False, saved_query_id="sq-1"),+ ]++ await self._run(activity_results, {"checks_failed_blocking": 0}, start_child=start_child)++ started = [call.kwargs.get("workflow") or call.args[0] for call in start_child.await_args_list]+ assert "dwh-cdp-producer-job" not in started++ async def test_a_producer_that_fails_to_start_clears_the_staged_rows(self):+ # Nothing will read them now, and the prefix is keyed on this job, so no later run's own+ # clear reaches them.+ start_child = AsyncMock(side_effect=RuntimeError("task queue is gone"))+ activity_results = [+ False,+ "job-1",+ self._result(should_trigger=True),+ PrepareQueryableTableResult(storage_delta_mib=None, total_storage_mib=None),+ SucceedMaterializationResult(enrichment_needed=False, saved_query_id="sq-1"),+ None, # clear_cdp_staging+ ]++ _, execute_activity = await self._run(activity_results, {"checks_failed_blocking": 0}, start_child=start_child)++ started = [call.args[0].__name__ for call in execute_activity.await_args_list]+ assert "clear_cdp_staging_activity" in started++ async def test_a_quality_blocked_run_clears_its_staged_rows_instead_of_producing(self):+ # The rows were never published, and the prefix is keyed on this job, so no later run's own+ # clear will ever reach them.+ start_child = AsyncMock()+ activity_results = [+ False,+ "job-1",+ self._result(should_trigger=True, quality_audit="gate"),+ StageQueryableFilesResult(staged_folder_path="staged_1"),+ None, # quality_block_materialization+ None, # clear_cdp_staging+ ]++ _, execute_activity = await self._run(activity_results, {"checks_failed_blocking": 2}, start_child=start_child)++ started = [call.args[0].__name__ for call in execute_activity.await_args_list]+ assert "clear_cdp_staging_activity" in started+ assert "dwh-cdp-producer-job" not in [+ call.kwargs.get("workflow") or call.args[0] for call in start_child.await_args_list+ ]diff --git a/products/cdp/backend/api/hog_function.py b/products/cdp/backend/api/hog_function.pyindex e83cb8187733..41a21659f6de 100644--- a/products/cdp/backend/api/hog_function.py+++ b/products/cdp/backend/api/hog_function.py@@ -30,6 +30,7 @@ from posthog.cdp.internal_events import is_managed_alert_internal_eventfrom posthog.cdp.services.icons import CDPIconsServicefrom posthog.cdp.site_functions import get_transpiled_functionfrom posthog.cdp.validation import (+ DATA_WAREHOUSE_SOURCES,HogFunctionFiltersSerializer,InputsSchemaItemSerializer,InputsSerializer,@@ -157,6 +158,24 @@ def snapshot_hog_function_content(hog_function: HogFunction) -> dict:return snapshot+def _named_warehouse_tables(entries: Any) -> list[Any]:+ """The warehouse tables a filters blob actually names, ignoring the picker's placeholder row.++ Matches the placeholder rule `HogFunctionFiltersSerializer.validate` applies moments later+ (posthog/cdp/validation.py): it drops any entry named "Select a table" outright, regardless of+ whether that entry also carries a `table_name`. Checking `table_name` alone here would accept+ `{"name": "Select a table", "table_name": "x"}` — the serializer would still strip it a moment+ later, leaving `data_warehouse: []` stored despite this check having passed.+ """+ if not isinstance(entries, list):+ return []+ return [+ entry+ for entry in entries+ if isinstance(entry, dict) and entry.get("table_name") and entry.get("name") != "Select a table"+ ]++def _without(value: Any, keys: tuple[str, ...]) -> Any:return {k: v for k, v in value.items() if k not in keys} if isinstance(value, dict) else value@@ -480,9 +499,22 @@ class HogFunctionSerializer(HogFunctionMinimalSerializer):to_bool(data["enabled"]) if data.get("enabled") is not None else (instance.enabled if instance else False))self.context["function_will_be_enabled"] = False if deleted else enabled- # Warehouse-table sources deliver the synced row under event.properties, so input templates- # may use the `{record.x}` alias — flag it so the inputs serializer rewrites it on compile.- self.context["is_dwh_source"] = data["filters"].get("source") == "data-warehouse-table"+ # Warehouse sources deliver the row under event.properties, so input templates may use the+ # `{record.x}` alias — flag it so the inputs serializer rewrites it on compile.+ self.context["is_dwh_source"] = data["filters"].get("source") in DATA_WAREHOUSE_SOURCES+ # Materialized views are a newer source than warehouse tables, so nothing was saved before+ # the consumer matched on the selected table. That lets us require a selection here, where+ # an empty list still has to mean "every table" for the older source.+ #+ # Counts entries that name a table rather than entries that exist: the filters serializer+ # drops the picker's "Select a table" placeholder, so a placeholder-only list arrives here+ # non-empty and leaves it empty, which the consumer reads as "every view".+ if (+ data["filters"].get("source") == "data-warehouse-view"+ and self.context["function_will_be_enabled"]+ and not _named_warehouse_tables(data["filters"].get("data_warehouse"))+ ):+ raise serializers.ValidationError({"filters": "Select the materialized view to trigger on."})self.context["encrypted_inputs"] = instance.encrypted_inputs if instance else {}template = Nonediff --git a/products/cdp/backend/api/test/test_hog_function.py b/products/cdp/backend/api/test/test_hog_function.pyindex 171a1b12a93a..aeecc1020d6e 100644--- a/products/cdp/backend/api/test/test_hog_function.py+++ b/products/cdp/backend/api/test/test_hog_function.py@@ -1487,6 +1487,81 @@ class TestHogFunctionAPI(ClickhouseTestMixin, APIBaseTest, QueryMatchingTest):response = self.client.get(f"/api/projects/{self.team.id}/hog_functions/?enabled=true,false")assert len(response.json()["results"]) == 2+ def test_a_materialized_view_destination_with_only_the_picker_placeholder(self):+ # The filters serializer drops the "Select a table" placeholder, so a placeholder-only list+ # arrives non-empty and leaves empty. The consumer reads an empty list as "every view", so+ # this has to be rejected rather than silently subscribing to all of them.+ response = self.client.post(+ f"/api/projects/{self.team.id}/hog_functions/",+ data={+ "type": "destination",+ "name": "Fetch URL",+ "hog": "fetch(inputs.url);",+ "enabled": True,+ "inputs": {},+ "filters": {"source": "data-warehouse-view", "data_warehouse": [{"name": "Select a table"}]},+ },+ )+ assert response.status_code == status.HTTP_400_BAD_REQUEST, response.json()++ def test_a_materialized_view_destination_with_a_placeholder_entry_carrying_a_table_name(self):+ # An entry can carry both the picker's placeholder name and a table_name (e.g. a picker that+ # never overwrote its default label). The filters serializer strips it purely by name, so+ # counting it as a real selection here would let it through and then land as `[]`.+ response = self.client.post(+ f"/api/projects/{self.team.id}/hog_functions/",+ data={+ "type": "destination",+ "name": "Fetch URL",+ "hog": "fetch(inputs.url);",+ "enabled": True,+ "inputs": {},+ "filters": {+ "source": "data-warehouse-view",+ "data_warehouse": [{"name": "Select a table", "table_name": "daily_revenue"}],+ },+ },+ )+ assert response.status_code == status.HTTP_400_BAD_REQUEST, response.json()++ @parameterized.expand(+ [+ ("data-warehouse-table", status.HTTP_201_CREATED),+ ("data-warehouse-view", status.HTTP_400_BAD_REQUEST),+ ]+ )+ def test_a_warehouse_source_without_a_table_selection(self, source, expected_status):+ # An empty list still means "every table" for warehouse tables, because destinations were+ # saved that way before the consumer matched on the selection. Materialized views are newer+ # and have no such history, so a missing selection is rejected instead of firing on everything.+ response = self.client.post(+ f"/api/projects/{self.team.id}/hog_functions/",+ data={+ "type": "destination",+ "name": "Fetch URL",+ "hog": "fetch(inputs.url);",+ "enabled": True,+ "inputs": {},+ "filters": {"source": source},+ },+ )+ assert response.status_code == expected_status, response.json()++ def test_a_materialized_view_destination_with_a_view_selected(self):+ response = self.client.post(+ f"/api/projects/{self.team.id}/hog_functions/",+ data={+ "type": "destination",+ "name": "Fetch URL",+ "hog": "fetch(inputs.url);",+ "enabled": True,+ "inputs": {},+ "filters": {"source": "data-warehouse-view", "data_warehouse": [{"table_name": "daily_revenue"}]},+ },+ )+ assert response.status_code == status.HTTP_201_CREATED, response.json()+ assert response.json()["filters"]["source"] == "data-warehouse-view"+@patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)def test_create_hog_function_with_site_app_type(self, mock_transpile_fn):response = self.client.post(diff --git a/products/cdp/frontend/generated/api.schemas.ts b/products/cdp/frontend/generated/api.schemas.tsindex 190d9055cb4e..b8b34f13f7b1 100644--- a/products/cdp/frontend/generated/api.schemas.ts+++ b/products/cdp/frontend/generated/api.schemas.ts@@ -335,6 +335,7 @@ export interface InputsSchemaItemApi {* * `events` - events* * `person-updates` - person-updates* * `data-warehouse-table` - data-warehouse-table+ * * `data-warehouse-view` - data-warehouse-view*/export type HogFunctionFiltersSourceEnumApi =(typeof HogFunctionFiltersSourceEnumApi)[keyof typeof HogFunctionFiltersSourceEnumApi]@@ -343,6 +344,7 @@ export const HogFunctionFiltersSourceEnumApi = {Events: 'events',PersonUpdates: 'person-updates',DataWarehouseTable: 'data-warehouse-table',+ DataWarehouseView: 'data-warehouse-view',} as constexport type HogFunctionFiltersApiActionsItem = { [key: string]: unknown }diff --git a/products/cdp/frontend/generated/api.zod.ts b/products/cdp/frontend/generated/api.zod.tsindex b8769d3cf289..2f78d18e9435 100644--- a/products/cdp/frontend/generated/api.zod.ts+++ b/products/cdp/frontend/generated/api.zod.ts@@ -122,9 +122,9 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({filters: zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view']).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFunctionsCreateBodyFiltersOneSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -232,9 +232,9 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({filters: zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view']).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFunctionsCreateBodyMappingsItemFiltersSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -385,9 +385,9 @@ export const HogFunctionsUpdateBody = /* @__PURE__ */ zod.object({filters: zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view']).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFunctionsUpdateBodyFiltersOneSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -495,9 +495,9 @@ export const HogFunctionsUpdateBody = /* @__PURE__ */ zod.object({filters: zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view']).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFunctionsUpdateBodyMappingsItemFiltersSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -648,9 +648,9 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({filters: zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view']).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFunctionsPartialUpdateBodyFiltersOneSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -758,9 +758,9 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({filters: zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view']).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFunctionsPartialUpdateBodyMappingsItemFiltersSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -915,9 +915,9 @@ export const HogFunctionsEnableBackfillsCreateBody = /* @__PURE__ */ zod.object(filters: zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view']).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFunctionsEnableBackfillsCreateBodyFiltersOneSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -1031,9 +1031,9 @@ export const HogFunctionsEnableBackfillsCreateBody = /* @__PURE__ */ zod.object(filters: zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view']).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFunctionsEnableBackfillsCreateBodyMappingsItemFiltersSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -1263,9 +1263,9 @@ export const HogFunctionsInvocationsCreateBody = /* @__PURE__ */ zod.object({filters: zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view']).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFunctionsInvocationsCreateBodyConfigurationOneFiltersOneSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -1379,9 +1379,9 @@ export const HogFunctionsInvocationsCreateBody = /* @__PURE__ */ zod.object({filters: zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view']).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFunctionsInvocationsCreateBodyConfigurationOneMappingsItemFiltersSourceDefaultdiff --git a/products/data_warehouse/backend/presentation/views/saved_query.py b/products/data_warehouse/backend/presentation/views/saved_query.pyindex 86bd94ebbdeb..bbe5a66646b8 100644--- a/products/data_warehouse/backend/presentation/views/saved_query.py+++ b/products/data_warehouse/backend/presentation/views/saved_query.py@@ -47,7 +47,7 @@ from posthog.rbac.query_access import assert_user_can_read_queryfrom posthog.rbac.user_access_control import UserAccessControl, UserAccessControlSerializerMixinfrom posthog.temporal.common.client import sync_connect-from products.data_modeling.backend.facade.api import MAX_LOOKBACK_SECONDS+from products.data_modeling.backend.facade.api import MAX_LOOKBACK_SECONDS, get_incremental_configfrom products.data_modeling.backend.facade.modeling import DataWarehouseModelPathfrom products.data_modeling.backend.facade.models import (DataModelingJob,@@ -465,6 +465,10 @@ class DataWarehouseSavedQuerySerializerMixin:def get_sync_frequency(self, schema: DataWarehouseSavedQuery):return resolve_sync_frequency(self.root, schema) # type: ignore[attr-defined]+ @extend_schema_field(serializers.BooleanField())+ def get_is_incremental(self, view: DataWarehouseSavedQuery) -> bool:+ return get_incremental_config(view) is not None+@extend_schema_field(serializers.BooleanField())def get_sync_frequency_managed_by_dag(self, view: DataWarehouseSavedQuery) -> bool:return bool(self.context.get("sync_frequency_managed_by_dag", False)) # type: ignore[attr-defined]@@ -538,6 +542,11 @@ class DataWarehouseSavedQueryMinimalSerializer(managed_viewset_kind = serializers.SerializerMethodField(read_only=True)folder_id = serializers.UUIDField(source="folder.id", read_only=True, allow_null=True)folder_name = serializers.CharField(source="folder.name", read_only=True, allow_null=True)+ is_incremental = serializers.SerializerMethodField(+ read_only=True,+ help_text="Whether this view is set up to update incrementally. A run can still rebuild the "+ "whole table, for example on the first run or after the query changes.",+ )class Meta:model = DataWarehouseSavedQuery@@ -558,6 +567,7 @@ class DataWarehouseSavedQueryMinimalSerializer("folder_name","latest_error","is_materialized",+ "is_incremental","origin","is_test","expires_at",diff --git a/products/data_warehouse/frontend/generated/api.schemas.ts b/products/data_warehouse/frontend/generated/api.schemas.tsindex b1b097015902..9323cf692045 100644--- a/products/data_warehouse/frontend/generated/api.schemas.ts+++ b/products/data_warehouse/frontend/generated/api.schemas.ts@@ -1197,6 +1197,8 @@ export interface DataWarehouseSavedQueryMinimalApi {readonly latest_error: string | null/** @nullable */readonly is_materialized: boolean | null+ /** Whether this view is set up to update incrementally. A run can still rebuild the whole table, for example on the first run or after the query changes. */+ readonly is_incremental: boolean/** Where this SavedQuery is created.** * `data_warehouse` - Data Warehousediff --git a/products/workflows/backend/api/hog_flow.py b/products/workflows/backend/api/hog_flow.pyindex 0d27b13c3608..451de810b629 100644--- a/products/workflows/backend/api/hog_flow.py+++ b/products/workflows/backend/api/hog_flow.py@@ -58,6 +58,7 @@ from posthog.auth import InternalAPIAuthenticationfrom posthog.cdp.filters import compile_filters_exprfrom posthog.cdp.flag_gated_templates import FLAG_GATED_TEMPLATE_IDS, gated_template_enabledfrom posthog.cdp.validation import (+ DATA_WAREHOUSE_SOURCES,HogFunctionFiltersSerializer,InputsSchemaItemSerializer,InputsSerializer,@@ -519,6 +520,9 @@ def _first_error_string(detail: Any) -> Optional[str]:# The literal template_id each fixed-template node type requires. A saved library template# (from workflows-list-email-templates) is referenced via config.template_uuid, never here -# putting its UUID in template_id is the dominant authoring mistake on these nodes.+# A trigger config's `type` doubles as its filter source, so the two vocabularies are the same set.+DATA_WAREHOUSE_TRIGGER_TYPES = DATA_WAREHOUSE_SOURCES+_FIXED_TEMPLATE_IDS = {"function_email": "template-email","function_sms": "template-twilio",@@ -1235,12 +1239,14 @@ class HogFlowActionSerializer(serializers.Serializer):filters = data.get("config", {}).get("filters", {})if isinstance(filters, dict):self._reject_behavioral_cohorts_in_audience(filters.get("properties"))- elif data.get("config", {}).get("type") == "data-warehouse-table":+ elif data.get("config", {}).get("type") in DATA_WAREHOUSE_TRIGGER_TYPES:# Warehouse-triggered workflows are person-less ("row-scoped"): one workflow run- # per synced row, filtering only against the row payload. The dot-notated table_name- # must match the format produced by the Python CDPProducer so producer gating and- # trigger config use identical strings.+ # per synced row, filtering only against the row payload. The table_name must match+ # the string the Python CDPProducer emits — dot-notated for a source table, the+ # saved query's own name for a materialized view — so producer gating and trigger+ # config use identical strings.config = data.get("config", {})+ trigger_type = config.get("type")table_name = config.get("table_name")if not is_draft and (not table_name or not isinstance(table_name, str)):raise serializers.ValidationError(@@ -1248,11 +1254,11 @@ class HogFlowActionSerializer(serializers.Serializer):)# Compile the row-property filters to bytecode so the executor can evaluate them.- # We force the data-warehouse-table source so only row properties are considered.+ # We force the warehouse source so only row properties are considered.filters = config.get("filters", {}) or {}if not isinstance(filters, dict):raise serializers.ValidationError({"filters": "Filters must be a dictionary."})- filters["source"] = "data-warehouse-table"+ filters["source"] = trigger_typeserializer = HogFunctionFiltersSerializer(data=filters, context=self.context)if is_draft:if serializer.is_valid():@@ -2106,7 +2112,7 @@ class HogFlowSerializer(HogFlowMinimalSerializer):self.context["is_dwh_source"] = any(isinstance(action, dict)and action.get("type") == "trigger"- and (action.get("config") or {}).get("type") == "data-warehouse-table"+ and (action.get("config") or {}).get("type") in DATA_WAREHOUSE_TRIGGER_TYPESfor action in (actions or []))return super().to_internal_value(data)@@ -2192,12 +2198,12 @@ class HogFlowSerializer(HogFlowMinimalSerializer):data["trigger"] = trigger_actions[0]["config"]- # Some triggers are person-less ("row-scoped"): a synced warehouse row and a Slack poster are- # both things no PostHog person is attached to. Person-dependent steps and person-aware exit- # conditions would silently assume person data, so we block them here — the serializer is the- # source of truth, so the API, MCP, and frontend can't bypass it. We force exit_only_at_end- # since the other exit conditions re-evaluate trigger/conversion filters that may reference- # person properties.+ # Some triggers are person-less ("row-scoped"): a synced warehouse row, a materialized view row,+ # and a Slack poster are all things no PostHog person is attached to. Person-dependent steps and+ # person-aware exit conditions would silently assume person data, so we block them here — the+ # serializer is the source of truth, so the API, MCP, and frontend can't bypass it. We force+ # exit_only_at_end since the other exit conditions re-evaluate trigger/conversion filters that+ # may reference person properties.if data["trigger"].get("type") in ROW_SCOPED_TRIGGER_TYPES:data["exit_condition"] = HogFlow.ExitCondition.ONLY_AT_ENDif not is_draft:diff --git a/products/workflows/backend/api/test/test_hog_flow.py b/products/workflows/backend/api/test/test_hog_flow.pyindex 9a225d542815..52d81edf4569 100644--- a/products/workflows/backend/api/test/test_hog_flow.py+++ b/products/workflows/backend/api/test/test_hog_flow.py@@ -2163,14 +2163,20 @@ class TestHogFlowAPI(APIBaseTest):"type": "validation_error",}- def test_hog_flow_data_warehouse_table_trigger_valid(self):+ @parameterized.expand(+ [+ ("data-warehouse-table", "postgres.table_1"),+ ("data-warehouse-view", "daily_revenue"),+ ]+ )+ def test_hog_flow_data_warehouse_trigger_valid(self, trigger_type, table_name):trigger_action = {"id": "trigger_node","name": "trigger_1","type": "trigger","config": {- "type": "data-warehouse-table",- "table_name": "postgres.table_1",+ "type": trigger_type,+ "table_name": table_name,"filters": {"properties": []},},}@@ -2184,11 +2190,13 @@ class TestHogFlowAPI(APIBaseTest):response = self.client.post(f"/api/projects/{self.team.id}/hog_flows", hog_flow)assert response.status_code == 201, response.json()trigger = response.json()["trigger"]- assert trigger["type"] == "data-warehouse-table"- assert trigger["table_name"] == "postgres.table_1"- # Filters should be compiled to bytecode with the data-warehouse-table source- assert trigger["filters"]["source"] == "data-warehouse-table"+ assert trigger["type"] == trigger_type+ assert trigger["table_name"] == table_name+ # Filters should be compiled to bytecode against the trigger's own warehouse source+ assert trigger["filters"]["source"] == trigger_typeassert "bytecode" in trigger["filters"]+ # Row-scoped runs have no person, so the other exit conditions can't be evaluated.+ assert response.json()["exit_condition"] == "exit_only_at_end"def test_hog_flow_data_warehouse_table_trigger_without_table_name(self):trigger_action = {@@ -2265,18 +2273,24 @@ class TestHogFlowAPI(APIBaseTest):@parameterized.expand([- ("wait_until_condition", {"condition": {"filters": {"properties": []}}, "max_wait_duration": "5m"}),- ("random_cohort_branch", {"cohorts": [{"percentage": 50}]}),+ ("data-warehouse-table", "wait_until_condition"),+ ("data-warehouse-table", "random_cohort_branch"),+ ("data-warehouse-view", "wait_until_condition"),+ ("data-warehouse-view", "random_cohort_branch"),])- def test_hog_flow_data_warehouse_table_trigger_rejects_person_dependent_steps(self, action_type, action_config):+ def test_hog_flow_data_warehouse_trigger_rejects_person_dependent_steps(self, trigger_type, action_type):+ action_config = {+ "wait_until_condition": {"condition": {"filters": {"properties": []}}, "max_wait_duration": "5m"},+ "random_cohort_branch": {"cohorts": [{"percentage": 50}]},+ }[action_type]trigger_action = {"id": "trigger_node","name": "trigger_1","type": "trigger","config": {- "type": "data-warehouse-table",- "table_name": "postgres.table_1",+ "type": trigger_type,+ "table_name": "some_table","filters": {"properties": []},},}diff --git a/products/workflows/backend/models/hog_flow/hog_flow.py b/products/workflows/backend/models/hog_flow/hog_flow.pyindex ab5ba395b5e9..b911b8c937cf 100644--- a/products/workflows/backend/models/hog_flow/hog_flow.py+++ b/products/workflows/backend/models/hog_flow/hog_flow.py@@ -43,7 +43,17 @@ SUPPORTED_ACTION_TYPES: Final[list[str]] = [# kind), so the rejection message can say which mistake was made. Mirrors HogFlowTriggerSchema in# nodejs/src/cdp/schema/hogflow.ts.TRIGGER_TYPES: Final[frozenset[str]] = frozenset(- {"event", "schedule", "manual", "batch", "tracking_pixel", "webhook", "data-warehouse-table", "slack-message"}+ {+ "event",+ "schedule",+ "manual",+ "batch",+ "tracking_pixel",+ "webhook",+ "data-warehouse-table",+ "data-warehouse-view",+ "slack-message",+ })# Billable action types that are subject to rate limiting and quota tracking@@ -68,6 +78,7 @@ PERSON_DEPENDENT_ACTION_TYPES: Final[set[str]] = {# ROW_SCOPED_TRIGGER_TYPES.ROW_SCOPED_TRIGGER_TYPES: Final[set[str]] = {"data-warehouse-table",+ "data-warehouse-view","slack-message",}diff --git a/products/workflows/frontend/generated/api.schemas.ts b/products/workflows/frontend/generated/api.schemas.tsindex bd9c9c4b18b2..255cf9a89547 100644--- a/products/workflows/frontend/generated/api.schemas.ts+++ b/products/workflows/frontend/generated/api.schemas.ts@@ -69,6 +69,7 @@ export const OnErrorEnumApi = {* * `events` - events* * `person-updates` - person-updates* * `data-warehouse-table` - data-warehouse-table+ * * `data-warehouse-view` - data-warehouse-view*/export type HogFunctionFiltersSourceEnumApi =(typeof HogFunctionFiltersSourceEnumApi)[keyof typeof HogFunctionFiltersSourceEnumApi]@@ -77,6 +78,7 @@ export const HogFunctionFiltersSourceEnumApi = {Events: 'events',PersonUpdates: 'person-updates',DataWarehouseTable: 'data-warehouse-table',+ DataWarehouseView: 'data-warehouse-view',} as constexport type HogFunctionFiltersApiActionsItem = { [key: string]: unknown }diff --git a/products/workflows/frontend/generated/api.zod.ts b/products/workflows/frontend/generated/api.zod.tsindex c6e8448990c3..183ca3e18568 100644--- a/products/workflows/frontend/generated/api.zod.ts+++ b/products/workflows/frontend/generated/api.zod.ts@@ -93,9 +93,9 @@ export const HogFlowTemplatesCreateBody = /* @__PURE__ */ zod.union([zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view']).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowTemplatesCreateBodyActionsItemFiltersOneSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -215,9 +215,9 @@ export const HogFlowTemplatesUpdateBody = /* @__PURE__ */ zod.union([zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view']).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowTemplatesUpdateBodyActionsItemFiltersOneSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -343,9 +343,14 @@ export const HogFlowTemplatesPartialUpdateBody = /* @__PURE__ */ zod.union([zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum([+ 'events',+ 'person-updates',+ 'data-warehouse-table',+ 'data-warehouse-view',+ ]).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowTemplatesPartialUpdateBodyActionsItemFiltersOneSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -452,9 +457,14 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zodfilters: zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum([+ 'events',+ 'person-updates',+ 'data-warehouse-table',+ 'data-warehouse-view',+ ]).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowsCreateBodyConversionOneEventsItemFiltersOneSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -556,9 +566,9 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod.union([zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view']).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowsCreateBodyActionsItemFiltersOneSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -609,9 +619,14 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod.union([zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum([+ 'events',+ 'person-updates',+ 'data-warehouse-table',+ 'data-warehouse-view',+ ]).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowsCreateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault@@ -656,9 +671,10 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod'events','person-updates','data-warehouse-table',+ 'data-warehouse-view',]).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowsCreateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault@@ -796,9 +812,14 @@ export const HogFlowsUpdateBody = /* @__PURE__ */ zodfilters: zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum([+ 'events',+ 'person-updates',+ 'data-warehouse-table',+ 'data-warehouse-view',+ ]).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowsUpdateBodyConversionOneEventsItemFiltersOneSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -900,9 +921,9 @@ export const HogFlowsUpdateBody = /* @__PURE__ */ zod.union([zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view']).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowsUpdateBodyActionsItemFiltersOneSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -953,9 +974,14 @@ export const HogFlowsUpdateBody = /* @__PURE__ */ zod.union([zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum([+ 'events',+ 'person-updates',+ 'data-warehouse-table',+ 'data-warehouse-view',+ ]).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowsUpdateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault@@ -1000,9 +1026,10 @@ export const HogFlowsUpdateBody = /* @__PURE__ */ zod'events','person-updates','data-warehouse-table',+ 'data-warehouse-view',]).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowsUpdateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault@@ -1143,9 +1170,14 @@ export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zodfilters: zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum([+ 'events',+ 'person-updates',+ 'data-warehouse-table',+ 'data-warehouse-view',+ ]).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowsPartialUpdateBodyConversionOneEventsItemFiltersOneSourceDefault@@ -1249,9 +1281,9 @@ export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zod.union([zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view']).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowsPartialUpdateBodyActionsItemFiltersOneSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -1302,9 +1334,14 @@ export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zod.union([zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum([+ 'events',+ 'person-updates',+ 'data-warehouse-table',+ 'data-warehouse-view',+ ]).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowsPartialUpdateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault@@ -1349,9 +1386,10 @@ export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zod'events','person-updates','data-warehouse-table',+ 'data-warehouse-view',]).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowsPartialUpdateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault@@ -1734,9 +1772,14 @@ export const HogFlowsInvocationsCreateBody = /* @__PURE__ */ zod.object({filters: zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum([+ 'events',+ 'person-updates',+ 'data-warehouse-table',+ 'data-warehouse-view',+ ]).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowsInvocationsCreateBodyConfigurationOneConversionOneEventsItemFiltersOneSourceDefault@@ -1847,9 +1890,14 @@ export const HogFlowsInvocationsCreateBody = /* @__PURE__ */ zod.object({.union([zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum([+ 'events',+ 'person-updates',+ 'data-warehouse-table',+ 'data-warehouse-view',+ ]).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowsInvocationsCreateBodyConfigurationOneActionsItemFiltersOneSourceDefault@@ -1906,9 +1954,10 @@ export const HogFlowsInvocationsCreateBody = /* @__PURE__ */ zod.object({'events','person-updates','data-warehouse-table',+ 'data-warehouse-view',]).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowsInvocationsCreateBodyConfigurationOneActionsItemConfigTwoConditionFiltersOneSourceDefault@@ -1953,9 +2002,10 @@ export const HogFlowsInvocationsCreateBody = /* @__PURE__ */ zod.object({'events','person-updates','data-warehouse-table',+ 'data-warehouse-view',]).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowsInvocationsCreateBodyConfigurationOneActionsItemConfigTwoEventsItemFiltersOneSourceDefault@@ -2363,9 +2413,14 @@ export const HogFlowsBulkDeleteCreateBody = /* @__PURE__ */ zodfilters: zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum([+ 'events',+ 'person-updates',+ 'data-warehouse-table',+ 'data-warehouse-view',+ ]).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowsBulkDeleteCreateBodyConversionOneEventsItemFiltersOneSourceDefault@@ -2469,9 +2524,9 @@ export const HogFlowsBulkDeleteCreateBody = /* @__PURE__ */ zod.union([zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view']).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowsBulkDeleteCreateBodyActionsItemFiltersOneSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -2522,9 +2577,14 @@ export const HogFlowsBulkDeleteCreateBody = /* @__PURE__ */ zod.union([zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum([+ 'events',+ 'person-updates',+ 'data-warehouse-table',+ 'data-warehouse-view',+ ]).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowsBulkDeleteCreateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault@@ -2569,9 +2629,10 @@ export const HogFlowsBulkDeleteCreateBody = /* @__PURE__ */ zod'events','person-updates','data-warehouse-table',+ 'data-warehouse-view',]).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowsBulkDeleteCreateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefaultdiff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex f07f1c8de7e8..8f2966b8f76b 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -21556,6 +21556,8 @@ export namespace Schemas {readonly latest_error: string | null;/** @nullable */readonly is_materialized: boolean | null;+ /** Whether this view is set up to update incrementally. A run can still rebuild the whole table, for example on the first run or after the query changes. */+ readonly is_incremental: boolean;/** Where this SavedQuery is created.** * `data_warehouse` - Data Warehouse@@ -39931,6 +39933,7 @@ export namespace Schemas {* * `events` - events* * `person-updates` - person-updates* * `data-warehouse-table` - data-warehouse-table+ * * `data-warehouse-view` - data-warehouse-view*/export type HogFunctionFiltersSourceEnum = typeof HogFunctionFiltersSourceEnum[keyof typeof HogFunctionFiltersSourceEnum];@@ -39939,6 +39942,7 @@ export namespace Schemas {Events: 'events',PersonUpdates: 'person-updates',DataWarehouseTable: 'data-warehouse-table',+ DataWarehouseView: 'data-warehouse-view',} as const;export type HogFunctionFiltersActionsItem = { [key: string]: unknown };diff --git a/services/mcp/src/generated/cdp_functions/api.ts b/services/mcp/src/generated/cdp_functions/api.tsindex 379b548f7325..2865ba51d025 100644--- a/services/mcp/src/generated/cdp_functions/api.ts+++ b/services/mcp/src/generated/cdp_functions/api.ts@@ -142,9 +142,9 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({filters: zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view']).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFunctionsCreateBodyFiltersOneSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -240,9 +240,9 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({filters: zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view']).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFunctionsCreateBodyMappingsItemFiltersSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -395,9 +395,9 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({filters: zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view']).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFunctionsPartialUpdateBodyFiltersOneSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -493,9 +493,9 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({filters: zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view']).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFunctionsPartialUpdateBodyMappingsItemFiltersSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -753,9 +753,9 @@ export const HogFunctionsInvocationsCreateBody = /* @__PURE__ */ zod.object({filters: zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view']).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFunctionsInvocationsCreateBodyConfigurationOneFiltersOneSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -869,9 +869,9 @@ export const HogFunctionsInvocationsCreateBody = /* @__PURE__ */ zod.object({filters: zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view']).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFunctionsInvocationsCreateBodyConfigurationOneMappingsItemFiltersSourceDefaultdiff --git a/services/mcp/src/generated/error_tracking_alerts/api.ts b/services/mcp/src/generated/error_tracking_alerts/api.tsindex a62c409785e3..e40cdcc29597 100644--- a/services/mcp/src/generated/error_tracking_alerts/api.ts+++ b/services/mcp/src/generated/error_tracking_alerts/api.ts@@ -142,9 +142,9 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({filters: zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view']).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFunctionsCreateBodyFiltersOneSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -240,9 +240,9 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({filters: zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view']).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFunctionsCreateBodyMappingsItemFiltersSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -386,9 +386,9 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({filters: zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view']).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFunctionsPartialUpdateBodyFiltersOneSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -484,9 +484,9 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({filters: zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view']).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFunctionsPartialUpdateBodyMappingsItemFiltersSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),diff --git a/services/mcp/src/generated/workflows/api.ts b/services/mcp/src/generated/workflows/api.tsindex 654051a85b29..3d087c3e213e 100644--- a/services/mcp/src/generated/workflows/api.ts+++ b/services/mcp/src/generated/workflows/api.ts@@ -108,9 +108,14 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zodfilters: zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum([+ 'events',+ 'person-updates',+ 'data-warehouse-table',+ 'data-warehouse-view',+ ]).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowsCreateBodyConversionOneEventsItemFiltersOneSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -212,9 +217,9 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod.union([zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view']).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowsCreateBodyActionsItemFiltersOneSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),@@ -265,9 +270,14 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod.union([zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum([+ 'events',+ 'person-updates',+ 'data-warehouse-table',+ 'data-warehouse-view',+ ]).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowsCreateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault@@ -312,9 +322,10 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod'events','person-updates','data-warehouse-table',+ 'data-warehouse-view',]).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowsCreateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault@@ -454,9 +465,14 @@ export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zodfilters: zod.object({source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])+ .enum([+ 'events',+ 'person-updates',+ 'data-warehouse-table',+ 'data-warehouse-view',+ ]).describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view').default(hogFlowsPartialUpdateBodyConversionOneEventsItemFiltersOneSourceDefaultdiff --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 1c6feccae2e4..92a0f05691c0 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@@ -70,8 +70,8 @@},"source": {"default": "events",- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table",- "enum": ["events", "person-updates", "data-warehouse-table"],+ "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",+ "enum": ["events", "person-updates", "data-warehouse-table", "data-warehouse-view"],"type": "string"}},@@ -252,8 +252,13 @@},"source": {"default": "events",- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table",- "enum": ["events", "person-updates", "data-warehouse-table"],+ "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",+ "enum": [+ "events",+ "person-updates",+ "data-warehouse-table",+ "data-warehouse-view"+ ],"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 c9b11236d1a1..fb40e9184b2d 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@@ -217,8 +217,8 @@},"source": {"default": "events",- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table",- "enum": ["events", "person-updates", "data-warehouse-table"],+ "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",+ "enum": ["events", "person-updates", "data-warehouse-table", "data-warehouse-view"],"type": "string"},"transpiled": {}@@ -422,8 +422,13 @@},"source": {"default": "events",- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table",- "enum": ["events", "person-updates", "data-warehouse-table"],+ "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",+ "enum": [+ "events",+ "person-updates",+ "data-warehouse-table",+ "data-warehouse-view"+ ],"type": "string"},"transpiled": {}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 df177f9aed88..e29882610ef3 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@@ -76,8 +76,8 @@},"source": {"default": "events",- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table",- "enum": ["events", "person-updates", "data-warehouse-table"],+ "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",+ "enum": ["events", "person-updates", "data-warehouse-table", "data-warehouse-view"],"type": "string"}},@@ -262,8 +262,13 @@},"source": {"default": "events",- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table",- "enum": ["events", "person-updates", "data-warehouse-table"],+ "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",+ "enum": [+ "events",+ "person-updates",+ "data-warehouse-table",+ "data-warehouse-view"+ ],"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 4942bf0c77d8..05f126e5bb5b 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@@ -70,8 +70,8 @@},"source": {"default": "events",- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table",- "enum": ["events", "person-updates", "data-warehouse-table"],+ "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",+ "enum": ["events", "person-updates", "data-warehouse-table", "data-warehouse-view"],"type": "string"}},@@ -252,8 +252,13 @@},"source": {"default": "events",- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table",- "enum": ["events", "person-updates", "data-warehouse-table"],+ "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",+ "enum": [+ "events",+ "person-updates",+ "data-warehouse-table",+ "data-warehouse-view"+ ],"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 df02fbf16f95..f2eebb612a65 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@@ -76,8 +76,8 @@},"source": {"default": "events",- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table",- "enum": ["events", "person-updates", "data-warehouse-table"],+ "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",+ "enum": ["events", "person-updates", "data-warehouse-table", "data-warehouse-view"],"type": "string"}},@@ -262,8 +262,13 @@},"source": {"default": "events",- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table",- "enum": ["events", "person-updates", "data-warehouse-table"],+ "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",+ "enum": [+ "events",+ "person-updates",+ "data-warehouse-table",+ "data-warehouse-view"+ ],"type": "string"}},diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.jsonindex 7c7fe060ab12..4589ae606bea 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.json@@ -75,11 +75,12 @@},"source": {"default": "events",- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table",+ "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view","enum": ["events","person-updates",- "data-warehouse-table"+ "data-warehouse-table",+ "data-warehouse-view"],"type": "string"},@@ -157,11 +158,12 @@},"source": {"default": "events",- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table",+ "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view","enum": ["events","person-updates",- "data-warehouse-table"+ "data-warehouse-table",+ "data-warehouse-view"],"type": "string"},@@ -257,8 +259,13 @@},"source": {"default": "events",- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table",- "enum": ["events", "person-updates", "data-warehouse-table"],+ "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",+ "enum": [+ "events",+ "person-updates",+ "data-warehouse-table",+ "data-warehouse-view"+ ],"type": "string"},"transpiled": {}@@ -387,8 +394,13 @@},"source": {"default": "events",- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table",- "enum": ["events", "person-updates", "data-warehouse-table"],+ "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",+ "enum": [+ "events",+ "person-updates",+ "data-warehouse-table",+ "data-warehouse-view"+ ],"type": "string"},"transpiled": {}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-update.jsonindex 204da23fb654..b74918a6a5c2 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-update.json@@ -64,8 +64,13 @@},"source": {"default": "events",- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table",- "enum": ["events", "person-updates", "data-warehouse-table"],+ "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",+ "enum": [+ "events",+ "person-updates",+ "data-warehouse-table",+ "data-warehouse-view"+ ],"type": "string"},"transpiled": {}