Skip to content

: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.

feat(cdp): add the legacy_destination hog function type (#97409)

Ben White8a7d5fd82dc7
diff --git a/frontend/src/types.ts b/frontend/src/types.ts
index 050d98b2ef3a..75dead41c856 100644
--- a/frontend/src/types.ts
+++ b/frontend/src/types.ts
@@ -7426,6 +7426,7 @@ export type HogFunctionTypeType =
| 'site_app'
| 'transformation'
| 'transformation_log'
+ | 'legacy_destination'
export type HogFunctionType = {
id: string
diff --git a/nodejs/src/cdp/consumers/cdp-legacy-event.consumer.test.ts b/nodejs/src/cdp/consumers/cdp-legacy-event.consumer.test.ts
index be50eb1acc61..7146216ec594 100644
--- a/nodejs/src/cdp/consumers/cdp-legacy-event.consumer.test.ts
+++ b/nodejs/src/cdp/consumers/cdp-legacy-event.consumer.test.ts
@@ -1,6 +1,7 @@
import { mockFetch } from '~/tests/helpers/mocks/request.mock'
import { DateTime } from 'luxon'
+import { register } from 'prom-client'
import { closeHub, createHub } from '~/common/utils/db/hub'
import { PostgresUse } from '~/common/utils/db/postgres'
@@ -9,7 +10,7 @@ import { forSnapshot } from '~/tests/helpers/snapshots'
import { createTestTeamFixture } from '~/tests/helpers/sql'
import { Hub, Team } from '../../types'
-import { createHogExecutionGlobals } from '../_tests/fixtures'
+import { createHogExecutionGlobals, insertHogFunction } from '../_tests/fixtures'
import { DESTINATION_PLUGINS_BY_ID } from '../legacy-plugins'
import { LegacyPluginExecutorService } from '../services/legacy-plugin-executor.service'
import { HogFunctionInvocationGlobals } from '../types'
@@ -317,7 +318,7 @@ describe('CdpLegacyEventsConsumer', () => {
expect(invocations).toBeTruthy()
expect(invocations.length).toBeGreaterThan(0)
- expect(invocations[0].hogFunction.template_id).toBe('plugin-customerio-plugin')
+ expect(invocations[0].invocation.hogFunction.template_id).toBe('plugin-customerio-plugin')
// Check that the loader was called and cached
const cachedConfigs = consumer['pluginConfigsLoader'].getCache()[team.id.toString()]
@@ -366,7 +367,7 @@ describe('CdpLegacyEventsConsumer', () => {
expect(invocations.length).toBeGreaterThan(0)
// Check that the attachment was loaded into inputs
- const hogFunction = invocations[0].hogFunction
+ const hogFunction = invocations[0].invocation.hogFunction
expect(hogFunction.inputs).toBeTruthy()
expect(hogFunction.inputs?.mappings).toBeTruthy()
expect(hogFunction.inputs?.mappings?.value).toEqual({
@@ -408,7 +409,7 @@ describe('CdpLegacyEventsConsumer', () => {
expect(invocations).toBeTruthy()
expect(invocations.length).toBeGreaterThan(0)
- const hogFunctionInvocation = invocations[0]
+ const hogFunctionInvocation = invocations[0].invocation
expect(hogFunctionInvocation.hogFunction.template_id).toBe('plugin-customerio-plugin')
// Verify the invocation structure is correct by executing it manually
@@ -480,7 +481,7 @@ describe('CdpLegacyEventsConsumer', () => {
expect(invocations.length).toBeGreaterThan(0)
// Verify that the inputs contain the actual object, not "[object Object]"
- const inputs = invocations[0].state.globals.inputs as Record<string, any>
+ const inputs = invocations[0].invocation.state.globals.inputs as Record<string, any>
expect(inputs.complexMapping).toBeDefined()
expect(typeof inputs.complexMapping).not.toBe('string')
@@ -525,6 +526,114 @@ describe('CdpLegacyEventsConsumer', () => {
})
})
+ describe('migrated legacy_destination hog functions', () => {
+ const migrate = async (overrides: Record<string, any> = {}) =>
+ insertHogFunction(hub.postgres, team.id, {
+ type: 'legacy_destination',
+ template_id: 'plugin-customerio-plugin',
+ name: 'Migrated Customer.io',
+ enabled: true,
+ inputs: {
+ customerioSiteId: { value: '1234567890' },
+ customerioToken: { value: 'cio-token' },
+ },
+ ...overrides,
+ })
+
+ it('runs the migrated hog function instead of the plugin config it replaces', async () => {
+ const migrated = await migrate()
+
+ const invocations = await consumer['getLegacyPluginHogFunctionInvocations'](invocation)
+
+ expect(invocations).toHaveLength(1)
+ expect(invocations[0].invocation.hogFunction.id).toBe(migrated.id)
+ expect(invocations[0].pluginConfigId).toBeNull()
+ })
+
+ it('still runs a plugin config whose template has not been migrated', async () => {
+ await migrate({ template_id: 'plugin-hubspot-plugin' })
+
+ const invocations = await consumer['getLegacyPluginHogFunctionInvocations'](invocation)
+ const templateIds = invocations.map((x) => x.invocation.hogFunction.template_id)
+
+ expect(templateIds).toEqual(expect.arrayContaining(['plugin-customerio-plugin', 'plugin-hubspot-plugin']))
+ expect(templateIds).toHaveLength(2)
+ })
+
+ it('invokes the underlying processor exactly once when both representations exist', async () => {
+ await migrate()
+ const onEvent = jest.spyOn(customerIoPlugin, 'onEvent')
+
+ await consumer.processEvent(invocation)
+
+ expect(onEvent).toHaveBeenCalledTimes(1)
+ })
+
+ it('does not run a disabled migrated hog function, and does not let it suppress the plugin config', async () => {
+ await migrate({ enabled: false })
+
+ const invocations = await consumer['getLegacyPluginHogFunctionInvocations'](invocation)
+
+ expect(invocations).toHaveLength(1)
+ expect(invocations[0].pluginConfigId).toBe(pluginConfig.id)
+ })
+
+ it('passes secrets that live in encrypted_inputs to the processor', async () => {
+ await migrate({
+ inputs: { customerioSiteId: { value: '1234567890' } },
+ encrypted_inputs: hub.encryptedFields.encrypt(
+ JSON.stringify({ customerioToken: { value: 'cio-token' } })
+ ) as any,
+ })
+
+ const invocations = await consumer['getLegacyPluginHogFunctionInvocations'](invocation)
+
+ expect(invocations[0].invocation.state.globals.inputs).toMatchObject({
+ customerioSiteId: '1234567890',
+ customerioToken: 'cio-token',
+ })
+ })
+
+ it('runs one of two migrated rows sharing a template, not both', async () => {
+ await migrate()
+ await migrate()
+
+ const invocations = await consumer['getLegacyPluginHogFunctionInvocations'](invocation)
+
+ expect(invocations).toHaveLength(1)
+ })
+
+ it('labels the execution with which representation ran it', async () => {
+ const metricName = 'cdp_legacy_event_consumer_execution_result_total'
+ register.getSingleMetric(metricName)?.reset()
+
+ await consumer.processEvent(invocation)
+
+ await migrate()
+ // A fresh consumer stands in for the reload that pubsub triggers in production, which
+ // invalidates the hog function manager's caches as well as this consumer's own
+ const migratedConsumer = new CdpLegacyEventsConsumer(hub, createCdpConsumerDeps(hub))
+ await migratedConsumer.processEvent(invocation)
+
+ const metric = (await register.getMetricsAsJSON()).find((m) => m.name === metricName) as any
+ const sources = metric.values.map((v: any) => v.labels.source)
+
+ expect(sources).toEqual(['plugin_config', 'hog_function'])
+ })
+
+ it('reports the migrated row against its own hog function id rather than the plugin config', async () => {
+ const migrated = await migrate()
+ const queueAppMetric = jest.spyOn(consumer['hogFunctionMonitoringService'], 'queueAppMetric')
+
+ await consumer.processEvent(invocation)
+
+ expect(queueAppMetric).toHaveBeenCalledWith(
+ expect.objectContaining({ app_source_id: migrated.id, team_id: team.id }),
+ 'hog_function'
+ )
+ })
+ })
+
describe('shutdown behavior', () => {
it('should flush invocation results when stopping', async () => {
const flushSpy = jest.spyOn(consumer['invocationResultsService'], 'flush')
diff --git a/nodejs/src/cdp/consumers/cdp-legacy-event.consumer.ts b/nodejs/src/cdp/consumers/cdp-legacy-event.consumer.ts
index fe18ee9a0b14..3a60aeebe766 100644
--- a/nodejs/src/cdp/consumers/cdp-legacy-event.consumer.ts
+++ b/nodejs/src/cdp/consumers/cdp-legacy-event.consumer.ts
@@ -45,14 +45,17 @@ export type LightweightPluginConfig = {
}
type PluginConfigHogFunction = {
- pluginConfigId: number
+ /** Null once the plugin config has been migrated and the hog function row is the source of truth */
+ pluginConfigId: number | null
hogFunction: HogFunctionType
}
const legacyPluginExecutionResultCounter = new Counter({
name: 'cdp_legacy_event_consumer_execution_result_total',
help: 'The number of times we have executed a legacy plugin',
- labelNames: ['result', 'template_id'],
+ // `source` says which representation the consumer picked, so a migration can be watched as the
+ // share moving from plugin_config to hog_function while result stays where it was
+ labelNames: ['result', 'template_id', 'source'],
})
export type CdpLegacyEventsConsumerConfig = CdpConsumerBaseConfig &
@@ -93,6 +96,13 @@ export class CdpLegacyEventsConsumer extends CdpConsumerBase<CdpLegacyEventsCons
refreshBackgroundAgeMs: 300000, // 5 minutes
bufferMs: 10, // 10ms buffer for batching
})
+
+ // This loader caches the combined plugin-config and migrated-function view, so the manager
+ // invalidating its own copy is not enough: enabling or deleting a migrated row has to change
+ // which of the two runs straight away, not at the next refresh.
+ deps.pubSub.on<{ teamId: number }>('reload-hog-functions', ({ teamId }) => {
+ this.pluginConfigsLoader.markForRefresh(teamId.toString())
+ })
}
private async loadAndBuildHogFunctions(teamIds: string[]): Promise<Record<string, PluginConfigHogFunction[]>> {
@@ -212,6 +222,46 @@ export class CdpLegacyEventsConsumer extends CdpConsumerBase<CdpLegacyEventsCons
}
}
+ return this.preferMigratedHogFunctions(results, await this.loadMigratedHogFunctions(teamIds))
+ }
+
+ private async loadMigratedHogFunctions(teamIds: string[]): Promise<Record<string, HogFunctionType[]>> {
+ const byTeam = await this.hogFunctionManager.getHogFunctionsForTeams(
+ teamIds.map((id) => parseInt(id)),
+ ['legacy_destination']
+ )
+
+ return Object.fromEntries(Object.entries(byTeam).map(([teamId, fns]) => [teamId, fns]))
+ }
+
+ // Both representations would run the same processor. Production has at most one enabled onEvent
+ // plugin config per team and plugin, so the template id identifies the pair and the migrated row wins.
+ private preferMigratedHogFunctions(
+ fromPluginConfigs: Record<string, PluginConfigHogFunction[]>,
+ fromHogFunctions: Record<string, HogFunctionType[]>
+ ): Record<string, PluginConfigHogFunction[]> {
+ const results: Record<string, PluginConfigHogFunction[]> = {}
+
+ for (const [teamId, pluginConfigFns] of Object.entries(fromPluginConfigs)) {
+ // Nothing in the database stops two migrated rows sharing a template, and running both
+ // would send every event twice. Keep the oldest and ignore the rest.
+ const byTemplate = new Map<string, HogFunctionType>()
+ for (const fn of [...(fromHogFunctions[teamId] ?? [])].sort((a, b) => a.id.localeCompare(b.id))) {
+ const templateId = fn.template_id ?? ''
+ if (!byTemplate.has(templateId)) {
+ byTemplate.set(templateId, fn)
+ }
+ }
+
+ const migrated = [...byTemplate.values()]
+ const migratedTemplateIds = new Set(migrated.map((fn) => fn.template_id))
+
+ results[teamId] = [
+ ...pluginConfigFns.filter((x) => !migratedTemplateIds.has(x.hogFunction.template_id)),
+ ...migrated.map((hogFunction) => ({ pluginConfigId: null, hogFunction })),
+ ]
+ }
+
return results
}
@@ -281,29 +331,31 @@ export class CdpLegacyEventsConsumer extends CdpConsumerBase<CdpLegacyEventsCons
const invocations = await this.getLegacyPluginHogFunctionInvocations(invocation)
const results = await Promise.all(
- invocations.map(async (invocation) => this.legacyPluginExecutor.execute(invocation))
+ invocations.map(async ({ invocation, pluginConfigId }) =>
+ this.legacyPluginExecutor.execute(invocation).then((result) => ({ result, pluginConfigId }))
+ )
)
- for (const result of results) {
- const pluginConfigId = parseInt(result.invocation.hogFunction.id.replace('legacy-', ''))
+ for (const { result, pluginConfigId } of results) {
const error = result.error
legacyPluginExecutionResultCounter
.labels({
result: error ? 'error' : 'success',
template_id: result.invocation.hogFunction.template_id,
+ source: pluginConfigId !== null ? 'plugin_config' : 'hog_function',
})
.inc()
this.hogFunctionMonitoringService.queueAppMetric(
{
team_id: event.teamId,
- app_source_id: String(pluginConfigId),
+ app_source_id: pluginConfigId !== null ? String(pluginConfigId) : result.invocation.hogFunction.id,
metric_kind: error ? 'failure' : 'success',
metric_name: error ? 'failed' : 'succeeded',
count: 1,
},
- 'legacy_plugin'
+ pluginConfigId !== null ? 'legacy_plugin' : 'hog_function'
)
}
}
@@ -358,16 +410,17 @@ export class CdpLegacyEventsConsumer extends CdpConsumerBase<CdpLegacyEventsCons
private async getLegacyPluginHogFunctionInvocations(
invocation: HogFunctionInvocationGlobals
- ): Promise<CyclotronJobInvocationHogFunction[]> {
+ ): Promise<{ invocation: CyclotronJobInvocationHogFunction; pluginConfigId: number | null }[]> {
const pluginConfigHogFunctions = await this.pluginConfigsLoader.get(invocation.project.id.toString())
if (!pluginConfigHogFunctions) {
return []
}
- return pluginConfigHogFunctions.map(({ hogFunction }) => {
- // Plugin configs are always static { value: any } so we can just convert to a record of strings
- const inputs = Object.entries(hogFunction.inputs || {}).reduce(
+ return pluginConfigHogFunctions.map(({ hogFunction, pluginConfigId }) => {
+ // Plugin configs are always static { value: any } so we can just convert to a record of strings.
+ // A migrated row keeps its secrets in encrypted_inputs, which the manager decrypts separately.
+ const inputs = Object.entries({ ...hogFunction.inputs, ...hogFunction.encrypted_inputs }).reduce(
(acc, [key, value]) => {
acc[key] = value?.value
return acc
@@ -375,13 +428,16 @@ export class CdpLegacyEventsConsumer extends CdpConsumerBase<CdpLegacyEventsCons
{} as Record<string, string>
)
- return createInvocation(
- {
- ...invocation,
- inputs,
- },
- hogFunction
- )
+ return {
+ pluginConfigId,
+ invocation: createInvocation(
+ {
+ ...invocation,
+ inputs,
+ },
+ hogFunction
+ ),
+ }
})
}
diff --git a/nodejs/src/cdp/types.ts b/nodejs/src/cdp/types.ts
index c419830cd541..64cae2d74da5 100644
--- a/nodejs/src/cdp/types.ts
+++ b/nodejs/src/cdp/types.ts
@@ -565,6 +565,7 @@ export type HogFunctionTypeType =
| 'source_webhook'
| 'warehouse_source_webhook'
| 'site_destination'
+ | 'legacy_destination'
// Function types a cyclotron worker actually executes, so a rerun can safely re-enqueue
// the stored invocation onto the cyclotron hog queue and have it run. Every other type
diff --git a/posthog/cdp/legacy_destination_migration.py b/posthog/cdp/legacy_destination_migration.py
new file mode 100644
index 000000000000..76df3e071589
--- /dev/null
+++ b/posthog/cdp/legacy_destination_migration.py
@@ -0,0 +1,231 @@
+import json
+from collections.abc import Mapping
+from dataclasses import field
+from typing import Any
+
+from posthog.dataclasses import frozen
+
+from products.cdp.backend.models.hog_function_template import HogFunctionTemplate
+from products.cdp.backend.models.hog_functions.hog_function import HogFunction, HogFunctionType
+from products.cdp.backend.models.plugin import PluginAttachment, PluginConfig
+
+# Migrating one of these without its numeric plugin config id would reset its PluginStorage state
+STORAGE_BACKED_PLUGIN_IDS = {"first-time-event-tracker"}
+
+PLUGIN_ID_OVERRIDES = {
+ "semver-flattener": "semver-flattener-plugin",
+ "user-agent": "user-agent-plugin",
+}
+
+
+@frozen
+class MigrationResult:
+ created: list[int] = field(default_factory=list)
+ skipped: dict[int, str] = field(default_factory=dict)
+ dropped_inputs: dict[int, list[str]] = field(default_factory=dict)
+
+
+@frozen
+class _BuildOutcome:
+ hog_function: HogFunction | None = None
+ skip_reason: str | None = None
+ dropped_inputs: list[str] = field(default_factory=list)
+
+
+def plugin_id_from_url(url: str) -> str:
+ plugin_id = url.replace("inline://", "").replace("https://github.com/PostHog/", "")
+ return PLUGIN_ID_OVERRIDES.get(plugin_id, plugin_id)
+
+
+def _as_consumer_value(value: Any) -> str:
+ """Mirror how CdpLegacyEventsConsumer builds inputs from a plugin config, so a migrated row hands
+ the processor exactly what it gets today. See `value?.toString() ?? ''` in that consumer."""
+ if value is None:
+ return ""
+ if isinstance(value, bool):
+ return "true" if value else "false"
+ return value if isinstance(value, str) else json.dumps(value, separators=(",", ":"))
+
+
+def build_inputs(plugin_config: Mapping[str, Any], plugin_id: str) -> dict[str, Any]:
+ inputs: dict[str, Any] = {
+ key: {"value": _as_consumer_value(value)} for key, value in plugin_config["config"].items()
+ }
+
+ if plugin_id in STORAGE_BACKED_PLUGIN_IDS:
+ inputs["legacy_plugin_config_id"] = {"value": str(plugin_config["id"])}
+
+ # The consumer only folds attachments in when the config is non-empty. That drops the credential
+ # for a config that carries nothing else, so migrate the attachment either way.
+ for attachment in PluginAttachment.objects.filter(plugin_config_id=plugin_config["id"]):
+ contents: Any = attachment.parse_contents()
+ try:
+ contents = json.loads(contents)
+ except Exception:
+ pass
+ if contents:
+ inputs[attachment.key] = {"value": contents}
+
+ return inputs
+
+
+def _build_hog_function(plugin_config: Mapping[str, Any], drop_unmapped_inputs: bool) -> _BuildOutcome:
+ url: str = plugin_config["plugin__url"] or ""
+
+ if not url:
+ return _BuildOutcome(skip_reason="plugin has no url")
+
+ plugin_id = plugin_id_from_url(url)
+ template = HogFunctionTemplate.get_template(f"plugin-{plugin_id}")
+
+ if not template:
+ return _BuildOutcome(skip_reason=f"no bundled template for plugin-{plugin_id}")
+
+ team_id = plugin_config["team_id"]
+
+ # The consumer dedupes a plugin config against a migrated hog function by template id, so a second
+ # row for the same pair would leave the outcome dependent on load order.
+ if HogFunction.objects.filter(
+ team_id=team_id,
+ type=HogFunctionType.LEGACY_DESTINATION,
+ template_id=template.template_id,
+ deleted=False,
+ ).exists():
+ return _BuildOutcome(skip_reason="already migrated")
+
+ inputs = build_inputs(plugin_config, plugin_id)
+
+ # A required input with nothing behind it saves cleanly and then fails at runtime with no credentials
+ missing = sorted(
+ entry["key"]
+ for entry in template.inputs_schema or []
+ if entry.get("required") and not inputs.get(entry["key"], {}).get("value")
+ )
+ if missing:
+ return _BuildOutcome(skip_reason=f"required inputs with no value: {', '.join(missing)}")
+
+ # HogFunction.save() drops any key the template schema does not declare, without a trace
+ schema_keys = {entry["key"] for entry in template.inputs_schema or []}
+ unmapped = sorted(set(inputs) - schema_keys)
+ if unmapped and not drop_unmapped_inputs:
+ return _BuildOutcome(skip_reason=f"inputs not in the template schema: {', '.join(unmapped)}")
+
+ for key in unmapped:
+ del inputs[key]
+
+ return _BuildOutcome(
+ dropped_inputs=unmapped,
+ hog_function=HogFunction(
+ team_id=team_id,
+ type=HogFunctionType.LEGACY_DESTINATION,
+ template_id=template.template_id,
+ name=plugin_config["plugin__name"],
+ description=template.description or "",
+ icon_url=template.icon_url,
+ hog="",
+ bytecode=[],
+ inputs_schema=template.inputs_schema,
+ inputs=inputs,
+ filters=None,
+ enabled=True,
+ deleted=False,
+ ),
+ )
+
+
+def migrate_legacy_destinations(
+ *,
+ dry_run: bool = True,
+ team_ids: list[int] | None = None,
+ plugin_config_ids: list[int] | None = None,
+ drop_unmapped_inputs: bool = True,
+ batch_size: int = 100,
+ limit: int | None = None,
+) -> MigrationResult:
+ """Move enabled onEvent plugin configs onto legacy_destination hog functions running the same bundled code.
+
+ The plugin config is left enabled. The consumer prefers the hog function for a matching template, so
+ rolling back means deleting the hog function rather than restoring the plugin config.
+
+ Inputs the template schema does not declare are dropped, and every one is reported, because no
+ bundled processor reads them. Pass drop_unmapped_inputs=False to refuse those configs instead.
+ """
+ candidates = (
+ PluginConfig.objects.values("id")
+ .filter(enabled=True, deleted=False, plugin__capabilities__methods__contains=["onEvent"])
+ .order_by("id")
+ )
+
+ if team_ids:
+ candidates = candidates.filter(team_id__in=team_ids)
+ if plugin_config_ids:
+ candidates = candidates.filter(id__in=plugin_config_ids)
+ if limit:
+ candidates = candidates[:limit]
+
+ candidate_ids = [row["id"] for row in candidates]
+ created: list[int] = []
+ skipped: dict[int, str] = {}
+ dropped_inputs: dict[int, list[str]] = {}
+
+ for start in range(0, len(candidate_ids), batch_size):
+ # nosemgrep: idor-lookup-without-team (internal migration; ids come from the team-scoped query above)
+ batch = PluginConfig.objects.values("id", "config", "team_id", "plugin__name", "plugin__url").filter(
+ id__in=candidate_ids[start : start + batch_size]
+ )
+
+ for row in batch:
+ outcome = _build_hog_function(row, drop_unmapped_inputs)
+
+ if outcome.hog_function is None:
+ skipped[row["id"]] = outcome.skip_reason or "unknown"
+ continue
+
+ if outcome.dropped_inputs:
+ dropped_inputs[row["id"]] = outcome.dropped_inputs
+
+ if not dry_run:
+ # Saved one at a time rather than bulk, so each row fires the worker reload signal
+ outcome.hog_function.save()
+
+ created.append(row["id"])
+
+ return MigrationResult(created=created, skipped=skipped, dropped_inputs=dropped_inputs)
+
+
+def disable_migrated_plugin_configs(
+ *,
+ dry_run: bool = True,
+ team_ids: list[int] | None = None,
+) -> list[int]:
+ """Disable each enabled onEvent plugin config that a migrated hog function already covers.
+
+ Run this only once the migrated rows are known good. Until then the plugin config stays enabled
+ as the rollback: the consumer prefers the hog function, so only one of the pair ever runs, and
+ deleting the hog function hands the work straight back.
+
+ A config is left alone unless an enabled legacy_destination exists for its team and template.
+ """
+ candidates = PluginConfig.objects.filter(
+ enabled=True, deleted=False, plugin__capabilities__methods__contains=["onEvent"]
+ )
+ if team_ids:
+ candidates = candidates.filter(team_id__in=team_ids)
+
+ covered_pairs = set(
+ HogFunction.objects.filter(type=HogFunctionType.LEGACY_DESTINATION, enabled=True, deleted=False).values_list(
+ "team_id", "template_id"
+ )
+ )
+
+ to_disable = [
+ row["id"]
+ for row in candidates.values("id", "team_id", "plugin__url")
+ if (row["team_id"], f"plugin-{plugin_id_from_url(row['plugin__url'] or '')}") in covered_pairs
+ ]
+
+ if to_disable and not dry_run:
+ # nosemgrep: idor-lookup-without-team (internal migration; ids come from the team-scoped query above)
+ PluginConfig.objects.filter(id__in=to_disable).update(enabled=False)
+
+ return to_disable
diff --git a/posthog/cdp/test/test_legacy_destination_migration.py b/posthog/cdp/test/test_legacy_destination_migration.py
new file mode 100644
index 000000000000..c48526061989
--- /dev/null
+++ b/posthog/cdp/test/test_legacy_destination_migration.py
@@ -0,0 +1,223 @@
+from posthog.test.base import BaseTest
+
+from posthog.cdp.legacy_destination_migration import disable_migrated_plugin_configs, migrate_legacy_destinations
+
+from products.cdp.backend.models.hog_function_template import HogFunctionTemplate
+from products.cdp.backend.models.hog_functions.hog_function import HogFunction, HogFunctionType
+from products.cdp.backend.models.plugin import Plugin, PluginAttachment, PluginConfig
+
+
+class TestLegacyDestinationMigration(BaseTest):
+ def setUp(self):
+ super().setUp()
+ self.template = HogFunctionTemplate.objects.create(
+ template_id="plugin-customerio-plugin",
+ sha="1",
+ name="Customer.io",
+ description="Legacy Customer.io",
+ code="",
+ inputs_schema=[
+ {"key": "customerioSiteId", "type": "string"},
+ {"key": "mappings", "type": "json"},
+ ],
+ type="legacy_destination",
+ )
+
+ def _plugin(self, url="https://github.com/PostHog/customerio-plugin", methods=None):
+ plugin, _ = Plugin.objects.get_or_create(
+ url=url,
+ defaults={
+ "organization": self.organization,
+ "name": "Customer.io",
+ "plugin_type": "custom",
+ },
+ )
+ plugin.capabilities = {"methods": methods if methods is not None else ["onEvent"]}
+ plugin.save()
+ return plugin
+
+ def _migrate(self, dry_run=False, drop_unmapped_inputs=True):
+ return migrate_legacy_destinations(
+ dry_run=dry_run, team_ids=[self.team.id], drop_unmapped_inputs=drop_unmapped_inputs
+ )
+
+ def _hog_functions(self):
+ return HogFunction.objects.filter(team=self.team, type=HogFunctionType.LEGACY_DESTINATION)
+
+ def _plugin_config(self, plugin=None, config=None, **kwargs):
+ return PluginConfig.objects.create(
+ **{
+ "team": self.team,
+ "plugin": plugin or self._plugin(),
+ "enabled": True,
+ "order": 0,
+ "config": config if config is not None else {"customerioSiteId": "site-1"},
+ **kwargs,
+ }
+ )
+
+ def test_creates_one_enabled_hog_function_carrying_the_config(self):
+ plugin_config = self._plugin_config()
+
+ result = self._migrate()
+
+ assert result.created == [plugin_config.id]
+ hog_function = self._hog_functions().get()
+ assert hog_function.template_id == "plugin-customerio-plugin"
+ assert hog_function.enabled is True
+ assert hog_function.inputs["customerioSiteId"] == {"value": "site-1"}
+
+ def test_dry_run_reports_without_writing(self):
+ plugin_config = self._plugin_config()
+
+ result = self._migrate(dry_run=True)
+
+ assert result.created == [plugin_config.id]
+ assert not self._hog_functions().exists()
+
+ def test_rerunning_does_not_create_a_second_row_for_the_same_template(self):
+ self._plugin_config()
+
+ self._migrate()
+ second = self._migrate()
+
+ assert second.created == []
+ assert list(second.skipped.values()) == ["already migrated"]
+ assert self._hog_functions().count() == 1
+
+ def test_leaves_the_plugin_config_enabled_so_rollback_is_deleting_the_hog_function(self):
+ plugin_config = self._plugin_config()
+
+ self._migrate()
+
+ plugin_config.refresh_from_db()
+ assert plugin_config.enabled is True
+
+ def test_skips_plugins_without_a_bundled_template(self):
+ plugin_config = self._plugin_config(plugin=self._plugin(url="https://github.com/PostHog/not-bundled"))
+
+ result = self._migrate()
+
+ assert result.created == []
+ assert result.skipped == {plugin_config.id: "no bundled template for plugin-not-bundled"}
+
+ def test_ignores_configs_that_the_legacy_consumer_never_runs(self):
+ self._plugin_config(plugin=self._plugin(url="https://github.com/PostHog/geoip", methods=["processEvent"]))
+ self._plugin_config(enabled=False)
+ self._plugin_config(deleted=True)
+
+ result = self._migrate()
+
+ assert result.created == []
+ assert not self._hog_functions().exists()
+
+ def test_carries_the_plugin_config_id_only_for_storage_backed_plugins(self):
+ HogFunctionTemplate.objects.create(
+ template_id="plugin-first-time-event-tracker",
+ sha="1",
+ name="First time event tracker",
+ code="",
+ inputs_schema=[
+ {"key": "events", "type": "string"},
+ {"key": "legacy_plugin_config_id", "type": "string"},
+ ],
+ type="legacy_destination",
+ )
+ storage_backed = self._plugin_config(
+ plugin=self._plugin(url="https://github.com/PostHog/first-time-event-tracker"),
+ config={"events": "$pageview"},
+ )
+ self._plugin_config()
+
+ self._migrate()
+
+ tracker = self._hog_functions().get(template_id="plugin-first-time-event-tracker")
+ assert tracker.inputs["legacy_plugin_config_id"] == {"value": str(storage_backed.id)}
+ customerio = self._hog_functions().get(template_id="plugin-customerio-plugin")
+ assert "legacy_plugin_config_id" not in customerio.inputs
+
+ def test_refuses_a_config_whose_inputs_the_template_schema_does_not_cover(self):
+ plugin_config = self._plugin_config(config={"customerioSiteId": "site-1", "removedOption": "x"})
+
+ result = self._migrate(drop_unmapped_inputs=False)
+
+ assert result.created == []
+ assert result.skipped == {plugin_config.id: "inputs not in the template schema: removedOption"}
+ assert not self._hog_functions().exists()
+
+ def test_drops_unmapped_inputs_by_default_and_reports_what_went(self):
+ plugin_config = self._plugin_config(config={"customerioSiteId": "site-1", "removedOption": "x"})
+
+ result = self._migrate()
+
+ assert result.created == [plugin_config.id]
+ assert result.dropped_inputs == {plugin_config.id: ["removedOption"]}
+ hog_function = self._hog_functions().get()
+ assert hog_function.inputs["customerioSiteId"] == {"value": "site-1"}
+ assert "removedOption" not in hog_function.inputs
+
+ def test_moves_attachments_into_inputs(self):
+ plugin_config = self._plugin_config()
+ PluginAttachment.objects.create(
+ team=self.team,
+ plugin_config=plugin_config,
+ key="mappings",
+ content_type="application/json",
+ file_name="mappings.json",
+ file_size=2,
+ contents=b'{"a": 1}',
+ )
+
+ self._migrate()
+
+ hog_function = self._hog_functions().get(template_id="plugin-customerio-plugin")
+ assert hog_function.inputs["mappings"] == {"value": {"a": 1}}
+
+ def test_limits_to_the_requested_team(self):
+ self._plugin_config()
+
+ result = migrate_legacy_destinations(dry_run=False, team_ids=[self.team.id + 1])
+
+ assert result.created == []
+
+
+class TestDisableMigratedPluginConfigs(TestLegacyDestinationMigration):
+ def _disable(self, dry_run=False):
+ return disable_migrated_plugin_configs(dry_run=dry_run, team_ids=[self.team.id])
+
+ def test_disables_only_a_config_a_migrated_hog_function_covers(self):
+ covered = self._plugin_config()
+ uncovered = self._plugin_config(plugin=self._plugin(url="https://github.com/PostHog/not-bundled"))
+
+ self._migrate()
+ disabled = self._disable()
+
+ assert disabled == [covered.id]
+ covered.refresh_from_db()
+ uncovered.refresh_from_db()
+ assert covered.enabled is False
+ assert uncovered.enabled is True
+
+ def test_leaves_everything_enabled_before_the_migration_runs(self):
+ plugin_config = self._plugin_config()
+
+ assert self._disable() == []
+ plugin_config.refresh_from_db()
+ assert plugin_config.enabled is True
+
+ def test_dry_run_reports_without_disabling(self):
+ plugin_config = self._plugin_config()
+ self._migrate()
+
+ assert self._disable(dry_run=True) == [plugin_config.id]
+ plugin_config.refresh_from_db()
+ assert plugin_config.enabled is True
+
+ def test_ignores_a_migrated_row_that_is_disabled(self):
+ plugin_config = self._plugin_config()
+ self._migrate()
+ self._hog_functions().update(enabled=False)
+
+ assert self._disable() == []
+ plugin_config.refresh_from_db()
+ assert plugin_config.enabled is True
diff --git a/posthog/management/commands/migrate_legacy_destinations_to_hog_functions.py b/posthog/management/commands/migrate_legacy_destinations_to_hog_functions.py
new file mode 100644
index 000000000000..0fe4de4b4e38
--- /dev/null
+++ b/posthog/management/commands/migrate_legacy_destinations_to_hog_functions.py
@@ -0,0 +1,57 @@
+from typing import Any
+
+from django.core.management.base import BaseCommand
+
+from posthog.cdp.legacy_destination_migration import disable_migrated_plugin_configs, migrate_legacy_destinations
+
+
+def _int_list(value: str | None) -> list[int] | None:
+ return [int(part) for part in value.split(",")] if value else None
+
+
+class Command(BaseCommand):
+ help = "Migrate enabled onEvent plugin configs to legacy_destination hog functions"
+
+ def add_arguments(self, parser: Any) -> None:
+ parser.add_argument("--dry-run", action="store_true", help="Report what would be migrated, and change nothing")
+ parser.add_argument("--team-ids", type=str, help="Comma separated team ids to limit the migration to")
+ parser.add_argument("--plugin-config-ids", type=str, help="Comma separated plugin config ids to migrate")
+ parser.add_argument(
+ "--strict-inputs",
+ action="store_true",
+ help="Skip a config carrying inputs the template schema does not declare, rather than dropping them",
+ )
+ parser.add_argument(
+ "--disable-migrated",
+ action="store_true",
+ help="Disable plugin configs a migrated hog function already covers, instead of migrating",
+ )
+ parser.add_argument("--batch-size", type=int, default=100, help="Plugin configs to load per batch")
+ parser.add_argument("--limit", type=int, default=None, help="Stop after this many plugin configs")
+
+ def handle(self, *args: Any, **options: Any) -> None:
+ if options["disable_migrated"]:
+ disabled = disable_migrated_plugin_configs(
+ dry_run=options["dry_run"], team_ids=_int_list(options["team_ids"])
+ )
+ prefix = "Would disable" if options["dry_run"] else "Disabled"
+ self.stdout.write(f"{prefix} {len(disabled)} plugin config(s) already covered by a hog function")
+ return
+
+ result = migrate_legacy_destinations(
+ dry_run=options["dry_run"],
+ team_ids=_int_list(options["team_ids"]),
+ plugin_config_ids=_int_list(options["plugin_config_ids"]),
+ drop_unmapped_inputs=not options["strict_inputs"],
+ batch_size=options["batch_size"],
+ limit=options["limit"],
+ )
+
+ prefix = "Would migrate" if options["dry_run"] else "Migrated"
+ self.stdout.write(f"{prefix} {len(result.created)} plugin config(s), skipped {len(result.skipped)}")
+
+ for plugin_config_id, reason in result.skipped.items():
+ self.stdout.write(f" skipped {plugin_config_id}: {reason}")
+
+ for plugin_config_id, keys in result.dropped_inputs.items():
+ self.stdout.write(f" dropped inputs on {plugin_config_id}: {', '.join(keys)}")
diff --git a/products/cdp/backend/api/hog_function.py b/products/cdp/backend/api/hog_function.py
index 022ed056a035..d6c918ac6265 100644
--- a/products/cdp/backend/api/hog_function.py
+++ b/products/cdp/backend/api/hog_function.py
@@ -594,18 +594,27 @@ class HogFunctionSerializer(HogFunctionMinimalSerializer):
return super().to_internal_value(data)
+ # A legacy destination is only ever written by the plugin config migration. One created here would
+ # supersede the plugin config it shares a template with, silently replacing it.
+ UNCREATABLE_TYPE_ERRORS = {
+ HogFunctionType.WAREHOUSE_SOURCE_WEBHOOK.value: "Cannot create or modify warehouse source webhook functions via this API.",
+ HogFunctionType.LEGACY_DESTINATION.value: "Cannot create legacy destination functions via this API.",
+ }
+ # A migrated legacy destination stays editable, so a person can disable one that misbehaves
+ UNEDITABLE_TYPES = {HogFunctionType.WAREHOUSE_SOURCE_WEBHOOK.value}
+
def validate_type(self, value):
- if value == HogFunctionType.WAREHOUSE_SOURCE_WEBHOOK.value:
- raise serializers.ValidationError(
- "Cannot create or modify warehouse source webhook functions via this API."
- )
+ is_create = bool(self.context.get("view")) and self.context["view"].action == "create"
+ instance = cast(Optional[HogFunction], self.context.get("instance", self.instance))
+ changing_type = instance is not None and instance.type != value
+
+ if value in self.UNCREATABLE_TYPE_ERRORS and (is_create or changing_type or value in self.UNEDITABLE_TYPES):
+ raise serializers.ValidationError(self.UNCREATABLE_TYPE_ERRORS[value])
- # Ensure it is only set when creating a new function
- if self.context.get("view") and self.context["view"].action == "create":
+ if is_create:
return value
- instance = cast(Optional[HogFunction], self.context.get("instance", self.instance))
- if instance and instance.type != value:
+ if changing_type:
raise serializers.ValidationError("Cannot modify the type of an existing function")
return value
diff --git a/products/cdp/backend/api/test/test_hog_function.py b/products/cdp/backend/api/test/test_hog_function.py
index 579897839639..dd3a499a3ddf 100644
--- a/products/cdp/backend/api/test/test_hog_function.py
+++ b/products/cdp/backend/api/test/test_hog_function.py
@@ -1856,6 +1856,51 @@ class TestHogFunctionAPI(ClickhouseTestMixin, APIBaseTest, QueryMatchingTest):
"type": "validation_error",
}
+ def test_cannot_create_legacy_destination_via_api(self):
+ response = self.client.post(
+ f"/api/projects/{self.team.id}/hog_functions/",
+ data={
+ **EXAMPLE_FULL,
+ "type": "legacy_destination",
+ },
+ )
+ assert response.status_code == status.HTTP_400_BAD_REQUEST, response.json()
+ assert response.json() == {
+ "attr": "type",
+ "detail": "Cannot create legacy destination functions via this API.",
+ "code": "invalid_input",
+ "type": "validation_error",
+ }
+
+ def test_can_disable_a_migrated_legacy_destination(self):
+ # The serializer resolves template_id on update, so the row has to exist
+ HogFunctionTemplate.objects.create(
+ template_id="plugin-customerio-plugin",
+ sha="1",
+ name="Customer.io",
+ code="",
+ inputs_schema=[{"key": "customerioSiteId", "type": "string"}],
+ type="legacy_destination",
+ )
+ hog_function = HogFunction.objects.create(
+ team=self.team,
+ name="Migrated",
+ type="legacy_destination",
+ template_id="plugin-customerio-plugin",
+ enabled=True,
+ inputs_schema=[{"key": "customerioSiteId", "type": "string"}],
+ inputs={"customerioSiteId": {"value": "site-1"}},
+ )
+
+ response = self.client.patch(
+ f"/api/projects/{self.team.id}/hog_functions/{hog_function.id}/",
+ data={"enabled": False},
+ )
+
+ assert response.status_code == status.HTTP_200_OK, response.json()
+ hog_function.refresh_from_db()
+ assert hog_function.enabled is False
+
def test_transpiled_field_not_populated_for_other_types(self):
response = self.client.post(
f"/api/projects/{self.team.id}/hog_functions/",
diff --git a/products/cdp/backend/models/hog_functions/hog_function.py b/products/cdp/backend/models/hog_functions/hog_function.py
index a6f24ee32e9e..e387c116d782 100644
--- a/products/cdp/backend/models/hog_functions/hog_function.py
+++ b/products/cdp/backend/models/hog_functions/hog_function.py
@@ -62,6 +62,8 @@ class HogFunctionType(models.TextChoices):
SITE_APP = "site_app"
TRANSFORMATION = "transformation"
TRANSFORMATION_LOG = "transformation_log"
+ # Run inline by CdpLegacyEventsConsumer, never by a cyclotron worker
+ LEGACY_DESTINATION = "legacy_destination"
TYPES_THAT_RELOAD_PLUGIN_SERVER = (
@@ -71,6 +73,7 @@ TYPES_THAT_RELOAD_PLUGIN_SERVER = (
HogFunctionType.INTERNAL_DESTINATION,
HogFunctionType.SOURCE_WEBHOOK,
HogFunctionType.WAREHOUSE_SOURCE_WEBHOOK,
+ HogFunctionType.LEGACY_DESTINATION,
)
TYPES_WITH_TRANSPILED_FILTERS = (HogFunctionType.SITE_DESTINATION, HogFunctionType.SITE_APP)
TYPES_WITH_JAVASCRIPT_SOURCE = (HogFunctionType.SITE_DESTINATION, HogFunctionType.SITE_APP)
diff --git a/products/cdp/frontend/generated/api.schemas.ts b/products/cdp/frontend/generated/api.schemas.ts
index 6d23103258b4..b15cd7a8553a 100644
--- a/products/cdp/frontend/generated/api.schemas.ts
+++ b/products/cdp/frontend/generated/api.schemas.ts
@@ -249,6 +249,7 @@ export type HogFunctionApiInputs = { [key: string]: InputsItemApi }
* * `site_app` - Site App
* * `transformation` - Transformation
* * `transformation_log` - Transformation Log
+ * * `legacy_destination` - Legacy Destination
*/
export type HogFunctionTypeEnumApi = (typeof HogFunctionTypeEnumApi)[keyof typeof HogFunctionTypeEnumApi]
@@ -261,6 +262,7 @@ export const HogFunctionTypeEnumApi = {
SiteApp: 'site_app',
Transformation: 'transformation',
TransformationLog: 'transformation_log',
+ LegacyDestination: 'legacy_destination',
} as const
/**
@@ -411,7 +413,8 @@ export interface HogFunctionApi {
* * `warehouse_source_webhook` - Warehouse Source Webhook
* * `site_app` - Site App
* * `transformation` - Transformation
- * * `transformation_log` - Transformation Log */
+ * * `transformation_log` - Transformation Log
+ * * `legacy_destination` - Legacy Destination */
type?: HogFunctionTypeEnumApi | null
/**
* Display name for the function.
@@ -500,7 +503,8 @@ export interface PatchedHogFunctionApi {
* * `warehouse_source_webhook` - Warehouse Source Webhook
* * `site_app` - Site App
* * `transformation` - Transformation
- * * `transformation_log` - Transformation Log */
+ * * `transformation_log` - Transformation Log
+ * * `legacy_destination` - Legacy Destination */
type?: HogFunctionTypeEnumApi | null
/**
* Display name for the function.
diff --git a/products/cdp/frontend/generated/api.zod.ts b/products/cdp/frontend/generated/api.zod.ts
index d39b9f9a0500..730e424c7e2b 100644
--- a/products/cdp/frontend/generated/api.zod.ts
+++ b/products/cdp/frontend/generated/api.zod.ts
@@ -40,15 +40,16 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({
'site_app',
'transformation',
'transformation_log',
+ 'legacy_destination',
])
.describe(
- '\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log'
+ '\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log\n\* `legacy_destination` - Legacy Destination'
),
zod.null(),
])
.optional()
.describe(
- 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.\n\n\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log'
+ 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.\n\n\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log\n\* `legacy_destination` - Legacy Destination'
),
name: zod.string().max(hogFunctionsCreateBodyNameMax).nullish().describe('Display name for the function.'),
description: zod.string().optional().describe('Human-readable description of what this function does.'),
@@ -313,15 +314,16 @@ export const HogFunctionsUpdateBody = /* @__PURE__ */ zod.object({
'site_app',
'transformation',
'transformation_log',
+ 'legacy_destination',
])
.describe(
- '\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log'
+ '\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log\n\* `legacy_destination` - Legacy Destination'
),
zod.null(),
])
.optional()
.describe(
- 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.\n\n\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log'
+ 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.\n\n\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log\n\* `legacy_destination` - Legacy Destination'
),
name: zod.string().max(hogFunctionsUpdateBodyNameMax).nullish().describe('Display name for the function.'),
description: zod.string().optional().describe('Human-readable description of what this function does.'),
@@ -586,15 +588,16 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({
'site_app',
'transformation',
'transformation_log',
+ 'legacy_destination',
])
.describe(
- '\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log'
+ '\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log\n\* `legacy_destination` - Legacy Destination'
),
zod.null(),
])
.optional()
.describe(
- 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.\n\n\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log'
+ 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.\n\n\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log\n\* `legacy_destination` - Legacy Destination'
),
name: zod.string().max(hogFunctionsPartialUpdateBodyNameMax).nullish().describe('Display name for the function.'),
description: zod.string().optional().describe('Human-readable description of what this function does.'),
@@ -859,15 +862,16 @@ export const HogFunctionsEnableBackfillsCreateBody = /* @__PURE__ */ zod.object(
'site_app',
'transformation',
'transformation_log',
+ 'legacy_destination',
])
.describe(
- '\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log'
+ '\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log\n\* `legacy_destination` - Legacy Destination'
),
zod.null(),
])
.optional()
.describe(
- 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.\n\n\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log'
+ 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.\n\n\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log\n\* `legacy_destination` - Legacy Destination'
),
name: zod
.string()
@@ -1164,15 +1168,16 @@ export const HogFunctionsInvocationsCreateBody = /* @__PURE__ */ zod.object({
'site_app',
'transformation',
'transformation_log',
+ 'legacy_destination',
])
.describe(
- '\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log'
+ '\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log\n\* `legacy_destination` - Legacy Destination'
),
zod.null(),
])
.optional()
.describe(
- 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.\n\n\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log'
+ 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.\n\n\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log\n\* `legacy_destination` - Legacy Destination'
),
name: zod
.string()
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 73743c9a4745..92590d2d82c0 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -44220,6 +44220,7 @@ export namespace Schemas {
* * `site_app` - Site App
* * `transformation` - Transformation
* * `transformation_log` - Transformation Log
+ * * `legacy_destination` - Legacy Destination
*/
export type HogFunctionTypeEnum = typeof HogFunctionTypeEnum[keyof typeof HogFunctionTypeEnum];
@@ -44233,6 +44234,7 @@ export namespace Schemas {
SiteApp: 'site_app',
Transformation: 'transformation',
TransformationLog: 'transformation_log',
+ LegacyDestination: 'legacy_destination',
} as const;
/**
@@ -44444,7 +44446,8 @@ export namespace Schemas {
* * `warehouse_source_webhook` - Warehouse Source Webhook
* * `site_app` - Site App
* * `transformation` - Transformation
- * * `transformation_log` - Transformation Log */
+ * * `transformation_log` - Transformation Log
+ * * `legacy_destination` - Legacy Destination */
type?: HogFunctionTypeEnum | null;
/**
* Display name for the function.
@@ -65569,7 +65572,8 @@ export namespace Schemas {
* * `warehouse_source_webhook` - Warehouse Source Webhook
* * `site_app` - Site App
* * `transformation` - Transformation
- * * `transformation_log` - Transformation Log */
+ * * `transformation_log` - Transformation Log
+ * * `legacy_destination` - Legacy Destination */
type?: HogFunctionTypeEnum | null;
/**
* Display name for the function.
diff --git a/services/mcp/src/generated/cdp_functions/api.ts b/services/mcp/src/generated/cdp_functions/api.ts
index 54c63c8a0d34..278d168bdc55 100644
--- a/services/mcp/src/generated/cdp_functions/api.ts
+++ b/services/mcp/src/generated/cdp_functions/api.ts
@@ -66,15 +66,16 @@ export const HogFunctionsCreateBody = () => zod.object({
'site_app',
'transformation',
'transformation_log',
+ 'legacy_destination',
])
.describe(
- '\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log'
+ '\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log\n\* `legacy_destination` - Legacy Destination'
),
zod.null(),
])
.optional()
.describe(
- 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.\n\n\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log'
+ 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.\n\n\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log\n\* `legacy_destination` - Legacy Destination'
),
name: zod.string().max(hogFunctionsCreateBodyNameMax).nullish().describe('Display name for the function.'),
description: zod.string().optional().describe('Human-readable description of what this function does.'),
@@ -329,15 +330,16 @@ export const HogFunctionsPartialUpdateBody = () => zod.object({
'site_app',
'transformation',
'transformation_log',
+ 'legacy_destination',
])
.describe(
- '\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log'
+ '\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log\n\* `legacy_destination` - Legacy Destination'
),
zod.null(),
])
.optional()
.describe(
- 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.\n\n\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log'
+ 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.\n\n\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log\n\* `legacy_destination` - Legacy Destination'
),
name: zod.string().max(hogFunctionsPartialUpdateBodyNameMax).nullish().describe('Display name for the function.'),
description: zod.string().optional().describe('Human-readable description of what this function does.'),
@@ -632,15 +634,16 @@ export const HogFunctionsInvocationsCreateBody = () => zod.object({
'site_app',
'transformation',
'transformation_log',
+ 'legacy_destination',
])
.describe(
- '\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log'
+ '\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log\n\* `legacy_destination` - Legacy Destination'
),
zod.null(),
])
.optional()
.describe(
- 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.\n\n\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log'
+ 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.\n\n\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log\n\* `legacy_destination` - Legacy Destination'
),
name: zod
.string()
diff --git a/services/mcp/src/generated/error_tracking_alerts/api.ts b/services/mcp/src/generated/error_tracking_alerts/api.ts
index cca42c3d830c..93b5e68e9015 100644
--- a/services/mcp/src/generated/error_tracking_alerts/api.ts
+++ b/services/mcp/src/generated/error_tracking_alerts/api.ts
@@ -66,15 +66,16 @@ export const HogFunctionsCreateBody = () => zod.object({
'site_app',
'transformation',
'transformation_log',
+ 'legacy_destination',
])
.describe(
- '\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log'
+ '\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log\n\* `legacy_destination` - Legacy Destination'
),
zod.null(),
])
.optional()
.describe(
- 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.\n\n\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log'
+ 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.\n\n\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log\n\* `legacy_destination` - Legacy Destination'
),
name: zod.string().max(hogFunctionsCreateBodyNameMax).nullish().describe('Display name for the function.'),
description: zod.string().optional().describe('Human-readable description of what this function does.'),
@@ -320,15 +321,16 @@ export const HogFunctionsPartialUpdateBody = () => zod.object({
'site_app',
'transformation',
'transformation_log',
+ 'legacy_destination',
])
.describe(
- '\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log'
+ '\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log\n\* `legacy_destination` - Legacy Destination'
),
zod.null(),
])
.optional()
.describe(
- 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.\n\n\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log'
+ 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.\n\n\* `destination` - Destination\n\* `site_destination` - Site Destination\n\* `internal_destination` - Internal Destination\n\* `source_webhook` - Source Webhook\n\* `warehouse_source_webhook` - Warehouse Source Webhook\n\* `site_app` - Site App\n\* `transformation` - Transformation\n\* `transformation_log` - Transformation Log\n\* `legacy_destination` - Legacy Destination'
),
name: zod.string().max(hogFunctionsPartialUpdateBodyNameMax).nullish().describe('Display name for the function.'),
description: zod.string().optional().describe('Human-readable description of what this function does.'),
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-create.json
index 76cf4e6da735..6b0fdbb3951e 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
@@ -457,7 +457,7 @@
"type": {
"anyOf": [
{
- "description": "* `destination` - Destination\n* `site_destination` - Site Destination\n* `internal_destination` - Internal Destination\n* `source_webhook` - Source Webhook\n* `warehouse_source_webhook` - Warehouse Source Webhook\n* `site_app` - Site App\n* `transformation` - Transformation\n* `transformation_log` - Transformation Log",
+ "description": "* `destination` - Destination\n* `site_destination` - Site Destination\n* `internal_destination` - Internal Destination\n* `source_webhook` - Source Webhook\n* `warehouse_source_webhook` - Warehouse Source Webhook\n* `site_app` - Site App\n* `transformation` - Transformation\n* `transformation_log` - Transformation Log\n* `legacy_destination` - Legacy Destination",
"enum": [
"destination",
"site_destination",
@@ -466,7 +466,8 @@
"warehouse_source_webhook",
"site_app",
"transformation",
- "transformation_log"
+ "transformation_log",
+ "legacy_destination"
],
"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.json
index aa258f41fd2e..ef026aef19b2 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
@@ -837,7 +837,7 @@
"type": {
"anyOf": [
{
- "description": "* `destination` - Destination\n* `site_destination` - Site Destination\n* `internal_destination` - Internal Destination\n* `source_webhook` - Source Webhook\n* `warehouse_source_webhook` - Warehouse Source Webhook\n* `site_app` - Site App\n* `transformation` - Transformation\n* `transformation_log` - Transformation Log",
+ "description": "* `destination` - Destination\n* `site_destination` - Site Destination\n* `internal_destination` - Internal Destination\n* `source_webhook` - Source Webhook\n* `warehouse_source_webhook` - Warehouse Source Webhook\n* `site_app` - Site App\n* `transformation` - Transformation\n* `transformation_log` - Transformation Log\n* `legacy_destination` - Legacy Destination",
"enum": [
"destination",
"site_destination",
@@ -846,7 +846,8 @@
"warehouse_source_webhook",
"site_app",
"transformation",
- "transformation_log"
+ "transformation_log",
+ "legacy_destination"
],
"type": "string"
},
@@ -854,7 +855,7 @@
"type": "null"
}
],
- "description": "Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.\n\n* `destination` - Destination\n* `site_destination` - Site Destination\n* `internal_destination` - Internal Destination\n* `source_webhook` - Source Webhook\n* `warehouse_source_webhook` - Warehouse Source Webhook\n* `site_app` - Site App\n* `transformation` - Transformation\n* `transformation_log` - Transformation Log"
+ "description": "Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.\n\n* `destination` - Destination\n* `site_destination` - Site Destination\n* `internal_destination` - Internal Destination\n* `source_webhook` - Source Webhook\n* `warehouse_source_webhook` - Warehouse Source Webhook\n* `site_app` - Site App\n* `transformation` - Transformation\n* `transformation_log` - Transformation Log\n* `legacy_destination` - Legacy Destination"
},
"updated_at": {
"format": "date-time",
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.json
index 6844283583e8..431d4976882f 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
@@ -467,7 +467,7 @@
"type": {
"anyOf": [
{
- "description": "* `destination` - Destination\n* `site_destination` - Site Destination\n* `internal_destination` - Internal Destination\n* `source_webhook` - Source Webhook\n* `warehouse_source_webhook` - Warehouse Source Webhook\n* `site_app` - Site App\n* `transformation` - Transformation\n* `transformation_log` - Transformation Log",
+ "description": "* `destination` - Destination\n* `site_destination` - Site Destination\n* `internal_destination` - Internal Destination\n* `source_webhook` - Source Webhook\n* `warehouse_source_webhook` - Warehouse Source Webhook\n* `site_app` - Site App\n* `transformation` - Transformation\n* `transformation_log` - Transformation Log\n* `legacy_destination` - Legacy Destination",
"enum": [
"destination",
"site_destination",
@@ -476,7 +476,8 @@
"warehouse_source_webhook",
"site_app",
"transformation",
- "transformation_log"
+ "transformation_log",
+ "legacy_destination"
],
"type": "string"
},
@@ -484,7 +485,7 @@
"type": "null"
}
],
- "description": "Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.\n\n* `destination` - Destination\n* `site_destination` - Site Destination\n* `internal_destination` - Internal Destination\n* `source_webhook` - Source Webhook\n* `warehouse_source_webhook` - Warehouse Source Webhook\n* `site_app` - Site App\n* `transformation` - Transformation\n* `transformation_log` - Transformation Log"
+ "description": "Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.\n\n* `destination` - Destination\n* `site_destination` - Site Destination\n* `internal_destination` - Internal Destination\n* `source_webhook` - Source Webhook\n* `warehouse_source_webhook` - Warehouse Source Webhook\n* `site_app` - Site App\n* `transformation` - Transformation\n* `transformation_log` - Transformation Log\n* `legacy_destination` - Legacy Destination"
}
},
"required": ["id"],
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.json
index 290ee3e7e6ce..2ae366f1831c 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
@@ -457,7 +457,7 @@
"type": {
"anyOf": [
{
- "description": "* `destination` - Destination\n* `site_destination` - Site Destination\n* `internal_destination` - Internal Destination\n* `source_webhook` - Source Webhook\n* `warehouse_source_webhook` - Warehouse Source Webhook\n* `site_app` - Site App\n* `transformation` - Transformation\n* `transformation_log` - Transformation Log",
+ "description": "* `destination` - Destination\n* `site_destination` - Site Destination\n* `internal_destination` - Internal Destination\n* `source_webhook` - Source Webhook\n* `warehouse_source_webhook` - Warehouse Source Webhook\n* `site_app` - Site App\n* `transformation` - Transformation\n* `transformation_log` - Transformation Log\n* `legacy_destination` - Legacy Destination",
"enum": [
"destination",
"site_destination",
@@ -466,7 +466,8 @@
"warehouse_source_webhook",
"site_app",
"transformation",
- "transformation_log"
+ "transformation_log",
+ "legacy_destination"
],
"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.json
index c80cb7797aaf..11419da65800 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
@@ -467,7 +467,7 @@
"type": {
"anyOf": [
{
- "description": "* `destination` - Destination\n* `site_destination` - Site Destination\n* `internal_destination` - Internal Destination\n* `source_webhook` - Source Webhook\n* `warehouse_source_webhook` - Warehouse Source Webhook\n* `site_app` - Site App\n* `transformation` - Transformation\n* `transformation_log` - Transformation Log",
+ "description": "* `destination` - Destination\n* `site_destination` - Site Destination\n* `internal_destination` - Internal Destination\n* `source_webhook` - Source Webhook\n* `warehouse_source_webhook` - Warehouse Source Webhook\n* `site_app` - Site App\n* `transformation` - Transformation\n* `transformation_log` - Transformation Log\n* `legacy_destination` - Legacy Destination",
"enum": [
"destination",
"site_destination",
@@ -476,7 +476,8 @@
"warehouse_source_webhook",
"site_app",
"transformation",
- "transformation_log"
+ "transformation_log",
+ "legacy_destination"
],
"type": "string"
},
@@ -484,7 +485,7 @@
"type": "null"
}
],
- "description": "Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.\n\n* `destination` - Destination\n* `site_destination` - Site Destination\n* `internal_destination` - Internal Destination\n* `source_webhook` - Source Webhook\n* `warehouse_source_webhook` - Warehouse Source Webhook\n* `site_app` - Site App\n* `transformation` - Transformation\n* `transformation_log` - Transformation Log"
+ "description": "Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.\n\n* `destination` - Destination\n* `site_destination` - Site Destination\n* `internal_destination` - Internal Destination\n* `source_webhook` - Source Webhook\n* `warehouse_source_webhook` - Warehouse Source Webhook\n* `site_app` - Site App\n* `transformation` - Transformation\n* `transformation_log` - Transformation Log\n* `legacy_destination` - Legacy Destination"
}
},
"required": ["id"],