: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(cdp): add transformation_log hog function type (#67608)
Daniel Viscaea8ff88f2d4c
diff --git a/frontend/src/types.ts b/frontend/src/types.tsindex 27dddc958f5a..63c3ff224519 100644--- a/frontend/src/types.ts+++ b/frontend/src/types.ts@@ -7189,6 +7189,7 @@ export type HogFunctionTypeType =| 'site_destination'| 'site_app'| 'transformation'+ | 'transformation_log'export type HogFunctionType = {id: string@@ -7351,6 +7352,21 @@ export type CyclotronJobInvocationGlobals = {headers: Record<string, string>ip?: string}+ // Only applies to log transformations (see buildLogRecordGlobals)+ record?: {+ body: string | null+ attributes: Record<string, string>+ resource_attributes: Record<string, string>+ severity_text: string | null+ severity_number: number | null+ service_name: string | null+ instrumentation_scope: string | null+ event_name: string | null+ timestamp: number | null+ observed_timestamp: number | null+ trace_id: string | null+ span_id: string | null+ }// For HogFlows, workflow-level variablesvariables?: Record<string, any>}diff --git a/nodejs/src/cdp/types.ts b/nodejs/src/cdp/types.tsindex a2fcef7b0d1b..4146e054fd2b 100644--- a/nodejs/src/cdp/types.ts+++ b/nodejs/src/cdp/types.ts@@ -229,6 +229,7 @@ export type MinimalAppMetric = {| 'fetch'| 'billable_invocation'| 'dropped'+ | 'budget_skipped'| 'email_queued'| 'email_sent'| 'email_delivered'@@ -461,6 +462,7 @@ export type HogFunctionInputSchemaType = {export type HogFunctionTypeType =| 'destination'| 'transformation'+ | 'transformation_log'| 'internal_destination'| 'source_webhook'| 'warehouse_source_webhook'diff --git a/posthog/cdp/templates/hog_function_template.py b/posthog/cdp/templates/hog_function_template.pyindex 5c8cc3dc2dc8..83f7d267bc27 100644--- a/posthog/cdp/templates/hog_function_template.py+++ b/posthog/cdp/templates/hog_function_template.py@@ -29,6 +29,7 @@ HogFunctionTemplateType = Literal["warehouse_source_webhook","site_app","transformation",+ "transformation_log",]diff --git a/posthog/cdp/validation.py b/posthog/cdp/validation.pyindex 4a56b3128831..84f63a07f2fd 100644--- a/posthog/cdp/validation.py+++ b/posthog/cdp/validation.py@@ -10,6 +10,7 @@ from rest_framework.exceptions import ValidationErrorfrom posthog.hogql import astfrom posthog.hogql.compiler.bytecode import create_bytecodefrom posthog.hogql.compiler.javascript import JavaScriptCompiler+from posthog.hogql.context import HogQLContextfrom posthog.hogql.parser import parse_program, parse_string_templatefrom posthog.hogql.visitor import TraversingVisitor@@ -47,6 +48,10 @@ register_supported_function("postHogSetAccountProperties")# (nodejs/src/cdp/hog-transformations/hog-transformer.service.ts).TRANSFORMATION_AVAILABLE_GLOBALS = {"project", "event", "inputs"}+# Globals available to log transformations, which run per log record in the logs+# ingestion pipeline and see a log record instead of an event.+TRANSFORMATION_LOG_AVAILABLE_GLOBALS = {"project", "record", "inputs"}+# Helper functions that the transformer exposes via getTransformationFunctions# (nodejs/src/cdp/hog-transformations/transformation-functions.ts). These resolve# via GET_GLOBAL when referenced as a closure rather than called inline.@@ -82,9 +87,19 @@ class TransformationGlobalsValidator(TraversingVisitor):invalid_globals: set[str]- def __init__(self):+ def __init__(+ self,+ available_globals: Optional[set[str]] = None,+ runtime_functions: Optional[set[str]] = None,+ ):super().__init__()self.invalid_globals = set()+ self._available_globals = (+ available_globals if available_globals is not None else TRANSFORMATION_AVAILABLE_GLOBALS+ )+ self._runtime_functions = (+ runtime_functions if runtime_functions is not None else TRANSFORMATION_RUNTIME_FUNCTIONS+ )def visit_field(self, node: ast.Field):super().visit_field(node)@@ -92,8 +107,8 @@ class TransformationGlobalsValidator(TraversingVisitor):returnroot = str(node.chain[0])if (- root in TRANSFORMATION_AVAILABLE_GLOBALS- or root in TRANSFORMATION_RUNTIME_FUNCTIONS+ root in self._available_globals+ or root in self._runtime_functionsor root in CORE_SUPPORTED_FUNCTIONSor root in PRODUCT_ASYNC_FUNCTIONSor root in STL@@ -103,6 +118,39 @@ class TransformationGlobalsValidator(TraversingVisitor):self.invalid_globals.add(root)+class DeclaredNamesCollector(TraversingVisitor):+ """Collect every identifier a hog program declares (variables, functions, params,+ loop vars, lambda args) so program-level global validation can ignore them.+ Deliberately flat rather than scope-precise: a false negative just defers the+ error to runtime, while a false positive would reject valid code.+ """++ names: set[str]++ def __init__(self):+ super().__init__()+ self.names = set()++ def visit_variable_declaration(self, node: ast.VariableDeclaration):+ self.names.add(node.name)+ super().visit_variable_declaration(node)++ def visit_function(self, node: ast.Function):+ self.names.add(node.name)+ self.names.update(node.params)+ super().visit_function(node)++ def visit_lambda(self, node: ast.Lambda):+ self.names.update(node.args)+ super().visit_lambda(node)++ def visit_for_in_statement(self, node: ast.ForInStatement):+ if node.keyVar:+ self.names.add(node.keyVar)+ self.names.add(node.valueVar)+ super().visit_for_in_statement(node)++class HyphenatedPropertyDetector(TraversingVisitor):errors: list[str]@@ -190,6 +238,18 @@ def generate_template_bytecode(f"Variable not available in transformations: {names}. "f"Transformations only have access to project, event, and inputs.")+ elif function_type == "transformation_log":+ log_validator = TransformationGlobalsValidator(+ available_globals=TRANSFORMATION_LOG_AVAILABLE_GLOBALS,+ runtime_functions=set(),+ )+ log_validator.visit(node)+ if log_validator.invalid_globals:+ names = ", ".join(sorted(log_validator.invalid_globals))+ raise Exception(+ f"Variable not available in log transformations: {names}. "+ f"Log transformations only have access to project, record, and inputs."+ )return create_bytecode(node).bytecodeelse:return obj@@ -537,6 +597,21 @@ class HogFunctionFiltersSerializer(serializers.Serializer):# Ensure data is initialized as an empty dict if it's Nonedata = data or {}+ if function_type == "transformation_log":+ # Filter bytecode is compiled against event-shaped globals, which log records+ # don't have — silently accepting filters would mis-evaluate at ingestion time.+ # Log transformations express conditions in Hog code instead.+ disallowed = [+ key+ for key in ("events", "actions", "properties", "data_warehouse", "filter_test_accounts")+ if data.get(key)+ ]+ if disallowed:+ raise serializers.ValidationError(+ f"Filters are not supported for log transformations (got: {', '.join(disallowed)}). "+ "Use conditions in the Hog code instead."+ )+if data.get("source") == "events":# Don't allow events or actions for person-updatesdata.pop("data_warehouse", None)@@ -646,13 +721,47 @@ def compile_hog(# CORE_SUPPORTED_FUNCTIONS (fetch, postHogCapture) and PRODUCT_ASYNC_FUNCTIONS.# Stated explicitly so a future refactor can't silently widen the surface.supported_functions = set()+ elif hog_type == "transformation_log":+ # Log transformations run synchronously per log record in the logs ingestion+ # hot path — no async functions (fetch, postHogCapture) can ever be allowed.+ # Stated explicitly so a future refactor can't silently widen the surface.+ supported_functions = set()- return create_bytecode(+ # Validate the code body's globals like input templates are: without this,+ # code referencing `event`/`person` compiles fine and only fails per record+ # at ingestion time. Declared locals are excluded from the check.+ declared = DeclaredNamesCollector()+ declared.visit(program)+ body_validator = TransformationGlobalsValidator(+ available_globals=TRANSFORMATION_LOG_AVAILABLE_GLOBALS | declared.names,+ runtime_functions=set(),+ )+ body_validator.visit(program)+ if body_validator.invalid_globals:+ names = ", ".join(sorted(body_validator.invalid_globals))+ raise serializers.ValidationError(+ {+ "hog": f"Variable not available in log transformations: {names}. "+ f"Log transformations only have access to project, record, and inputs."+ }+ )++ context = HogQLContext(team_id=None)+ bytecode = create_bytecode(program,supported_functions=supported_functions,in_repl=in_repl,null_safe_comparisons=null_safe_comparisons,+ context=context,).bytecode++ # The compiler only records unknown-function calls as context errors; the call still+ # compiles and fails at runtime. Log transformations run in a synchronous VM with no+ # async functions registered, so surface the error at save time instead.+ if hog_type == "transformation_log" and context.errors:+ raise serializers.ValidationError({"hog": context.errors[0].message})++ return bytecodeexcept serializers.ValidationError:raiseexcept Exception as e:diff --git a/products/cdp/backend/api/hog_function.py b/products/cdp/backend/api/hog_function.pyindex b623d8a9abe2..725dcfadfc3c 100644--- a/products/cdp/backend/api/hog_function.py+++ b/products/cdp/backend/api/hog_function.py@@ -50,6 +50,7 @@ from products.cdp.backend.api.hog_function_template import HogFunctionTemplateSefrom products.cdp.backend.models.hog_function_template import HogFunctionTemplatefrom products.cdp.backend.models.hog_functions.hog_function import (TYPES_THAT_CAN_RERUN,+ TYPES_WITH_EXECUTION_ORDER,TYPES_WITH_JAVASCRIPT_SOURCE,HogFunction,HogFunctionState,@@ -62,6 +63,19 @@ from products.cdp.backend.models.plugin import TranspilerErrorMAX_HOG_CODE_SIZE_BYTES = 100 * 1024# Maximum number of transformation functions per teamMAX_TRANSFORMATIONS_PER_TEAM = 20+# Log transformations execute per log record; volume is orders of magnitude higher than+# events, so the enabled cap starts much lower.+MAX_LOG_TRANSFORMATIONS_PER_TEAM = 5++# Per-type caps on *enabled* functions of types that run in the ingestion hot path+MAX_ENABLED_FUNCTIONS_PER_TEAM_BY_TYPE = {+ HogFunctionType.TRANSFORMATION: MAX_TRANSFORMATIONS_PER_TEAM,+ HogFunctionType.TRANSFORMATION_LOG: MAX_LOG_TRANSFORMATIONS_PER_TEAM,+}++# Gates creation of log transformations while the feature rolls out; sync with+# FEATURE_FLAGS.LOGS_TRANSFORMATIONS on the frontend+LOGS_TRANSFORMATIONS_FEATURE_FLAG = "logs-transformations"logger = structlog.get_logger(__name__)tracer = trace.get_tracer(__name__)@@ -131,7 +145,7 @@ class HogFunctionSerializer(HogFunctionMinimalSerializer):choices=HogFunctionType.choices,required=False,allow_null=True,- help_text="Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, or transformation.",+ help_text="Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.",)inputs_schema = serializers.ListField(child=InputsSchemaItemSerializer(required=True),@@ -333,22 +347,46 @@ class HogFunctionSerializer(HogFunctionMinimalSerializer):self._validate_hidden_template_not_enabled(attrs, bool(is_create))+ # Existing functions keep working (and can be updated/disabled) if the flag is+ # later turned off; only creation is gated.+ if is_create and hog_type == HogFunctionType.TRANSFORMATION_LOG:+ if not posthoganalytics.feature_enabled(+ LOGS_TRANSFORMATIONS_FEATURE_FLAG,+ str(team.uuid),+ groups={"organization": str(team.organization.id)},+ group_properties={+ "organization": {+ "id": str(team.organization.id),+ "created_at": team.organization.created_at,+ }+ },+ send_feature_flag_events=False,+ ):+ raise serializers.ValidationError({"type": "Log transformations are not enabled for this team."})+# Check for transformation limit per team when the function will be enabled# We allow unlimited creation of disabled transformations as they don't run during ingestion- if hog_type == "transformation" and attrs.get("enabled", False):- # Don't apply the limit for updates where the function was already enabled- apply_limit = is_create or (isinstance(self.instance, HogFunction) and not self.instance.enabled)+ enabled_cap = MAX_ENABLED_FUNCTIONS_PER_TEAM_BY_TYPE.get(hog_type)+ if enabled_cap is not None:+ # The cap covers the effective post-update state: restoring a soft-deleted+ # enabled function ({"deleted": false} with no "enabled" key) re-enters the+ # running set just like flipping enabled on, and must not bypass the limit.+ instance = self.instance if isinstance(self.instance, HogFunction) else None+ will_be_enabled = attrs.get("enabled", instance.enabled if instance else False)+ will_be_deleted = attrs.get("deleted", instance.deleted if instance else False)+ was_active = instance is not None and instance.enabled and not instance.deleted+ apply_limit = will_be_enabled and not will_be_deleted and not was_activeif apply_limit:- # Count enabled and non-deleted transformations+ # Count enabled and non-deleted functions of the same typetransformation_count = HogFunction.objects.filter(- team=team, type="transformation", deleted=False, enabled=True+ team=team, type=hog_type, deleted=False, enabled=True).count()- if transformation_count >= MAX_TRANSFORMATIONS_PER_TEAM:+ if transformation_count >= enabled_cap:raise serializers.ValidationError({- "type": f"Maximum of {MAX_TRANSFORMATIONS_PER_TEAM} enabled transformation functions allowed per team. Please contact support if you need this limit increased, or disable some existing transformations."+ "type": f"Maximum of {enabled_cap} enabled {humanize_hog_function_type(hog_type)} functions allowed per team. Please contact support if you need this limit increased, or disable some existing ones."})@@ -425,14 +463,14 @@ class HogFunctionSerializer(HogFunctionMinimalSerializer):raise serializers.ValidationError({"template_id": f"No template found for id '{template_id}'"})validated_data["hog_function_template"] = db_template- # Handle execution_order for transformation type- if validated_data.get("type") == "transformation":+ # Handle execution_order for types that run sequentially during ingestion+ if validated_data.get("type") in TYPES_WITH_EXECUTION_ORDER:requested_order = validated_data.get("execution_order")# For transformations, we need to determine the execution_orderif requested_order is None:# If no order specified, add at the end- highest_order = self._get_highest_execution_order(validated_data["team"].id)+ highest_order = self._get_highest_execution_order(validated_data["team"].id, validated_data["type"])validated_data["execution_order"] = highest_order + 1# Create the function with the execution_order@@ -441,10 +479,10 @@ class HogFunctionSerializer(HogFunctionMinimalSerializer):# For non-transformation types, just create normallyreturn super().create(validated_data=validated_data)- def _get_highest_execution_order(self, team_id: int) -> int:- """Get the highest execution_order for transformations in a team."""+ def _get_highest_execution_order(self, team_id: int, hog_type: str) -> int:+ """Get the highest execution_order among functions of the same type in a team."""highest_order = (- HogFunction.objects.filter(team_id=team_id, type="transformation", deleted=False)+ HogFunction.objects.filter(team_id=team_id, type=hog_type, deleted=False).order_by("-execution_order").values_list("execution_order", flat=True).first()@@ -453,7 +491,7 @@ class HogFunctionSerializer(HogFunctionMinimalSerializer):def update(self, instance: HogFunction, validated_data: dict, *args, **kwargs) -> HogFunction:# Handle undeletion or re-enabling by placing at the end when needed- if instance.type == "transformation" and (+ if instance.type in TYPES_WITH_EXECUTION_ORDER and ((instance.deleted and validated_data.get("deleted") is False)or (not instance.enabled@@ -461,7 +499,7 @@ class HogFunctionSerializer(HogFunctionMinimalSerializer):and "execution_order" not in validated_data)):- highest_order = self._get_highest_execution_order(instance.team_id)+ highest_order = self._get_highest_execution_order(instance.team_id, instance.type)validated_data["execution_order"] = highest_order + 1# Standard update@@ -787,7 +825,7 @@ class HogFunctionViewSet(functions = {str(f.id): ffor f in HogFunction.objects.filter(- id__in=function_ids, team=team, type="transformation", deleted=False+ id__in=function_ids, team=team, type__in=TYPES_WITH_EXECUTION_ORDER, deleted=False)}@@ -796,6 +834,12 @@ class HogFunctionViewSet(if missing_ids:raise exceptions.ValidationError(f"HogFunction with id {missing_ids.pop()} does not exist")+ # execution_order is scoped per type, so one rearrange request must stay within one type+ types = {f.type for f in functions.values()}+ if len(types) > 1:+ raise exceptions.ValidationError("Cannot rearrange functions of different types in one request")+ hog_type = types.pop()+# Update orders and create activity logsfrom django.contrib.auth.models import AnonymousUserfrom django.utils import timezone@@ -837,7 +881,7 @@ class HogFunctionViewSet(function.save(update_fields=["execution_order", "updated_at"])# Get final ordered list in a single query- transformations = HogFunction.objects.filter(team=team, type="transformation", deleted=False).order_by(+ transformations = HogFunction.objects.filter(team=team, type=hog_type, deleted=False).order_by("execution_order")diff --git a/products/cdp/backend/api/test/test_hog_function.py b/products/cdp/backend/api/test/test_hog_function.pyindex 55b5df024351..85f4c3e1917d 100644--- a/products/cdp/backend/api/test/test_hog_function.py+++ b/products/cdp/backend/api/test/test_hog_function.py@@ -15,7 +15,11 @@ from posthog.cdp.templates.hog_function_template import sync_template_to_dbfrom posthog.cdp.templates.slack.template_slack import template as template_slackfrom products.actions.backend.models.action import Action-from products.cdp.backend.api.hog_function import MAX_HOG_CODE_SIZE_BYTES, MAX_TRANSFORMATIONS_PER_TEAM+from products.cdp.backend.api.hog_function import (+ MAX_HOG_CODE_SIZE_BYTES,+ MAX_LOG_TRANSFORMATIONS_PER_TEAM,+ MAX_TRANSFORMATIONS_PER_TEAM,+)from products.cdp.backend.api.test.test_hog_function_templates import MOCK_NODE_TEMPLATESfrom products.cdp.backend.models.hog_function_template import HogFunctionTemplatefrom products.cdp.backend.models.hog_functions.hog_function import DEFAULT_STATE, HogFunction, HogFunctionState@@ -2741,3 +2745,222 @@ class TestHogFunctionAPI(ClickhouseTestMixin, APIBaseTest, QueryMatchingTest):assert response.status_code == status.HTTP_400_BAD_REQUESTassert response.json()["error"] == "Backfills are only supported for event-sourced destinations."+++class TestLogTransformationAPI(ClickhouseTestMixin, APIBaseTest, QueryMatchingTest):+ def setUp(self):+ super().setUp()+ patcher = patch("posthoganalytics.feature_enabled", return_value=True)+ self.mock_feature_enabled = patcher.start()+ self.addCleanup(patcher.stop)++ def _create_log_transformation(self, **kwargs):+ data = {+ "name": "Log transformation",+ "type": "transformation_log",+ "hog": "return record",+ "enabled": False,+ **kwargs,+ }+ return self.client.post(f"/api/projects/{self.team.id}/hog_functions/", data=data)++ def test_create_log_transformation(self):+ response = self._create_log_transformation()+ assert response.status_code == status.HTTP_201_CREATED, response.json()+ assert response.json()["type"] == "transformation_log"+ assert response.json()["execution_order"] == 1+ assert self.mock_feature_enabled.call_args[0][0] == "logs-transformations"++ def test_creation_blocked_without_feature_flag(self):+ self.mock_feature_enabled.return_value = False++ response = self._create_log_transformation()+ assert response.status_code == status.HTTP_400_BAD_REQUEST+ assert "Log transformations are not enabled for this team" in response.json()["detail"]++ # The flag does not gate other types+ response = self.client.post(+ f"/api/projects/{self.team.id}/hog_functions/",+ data={+ "name": "Event transformation",+ "type": "transformation",+ "hog": "return event",+ "enabled": False,+ },+ )+ assert response.status_code == status.HTTP_201_CREATED, response.json()++ def test_updates_allowed_when_feature_flag_is_off(self):+ function_id = self._create_log_transformation().json()["id"]++ self.mock_feature_enabled.return_value = False+ response = self.client.patch(+ f"/api/projects/{self.team.id}/hog_functions/{function_id}/",+ data={"name": "Renamed while flag off"},+ )+ assert response.status_code == status.HTTP_200_OK, response.json()++ def test_execution_order_is_scoped_per_type(self):+ event_response = self.client.post(+ f"/api/projects/{self.team.id}/hog_functions/",+ data={+ "name": "Event transformation",+ "type": "transformation",+ "hog": "return event",+ "enabled": False,+ },+ )+ assert event_response.status_code == status.HTTP_201_CREATED, event_response.json()+ assert event_response.json()["execution_order"] == 1++ # The first log transformation starts its own ordering rather than continuing+ # the event transformations' sequence+ log_response = self._create_log_transformation()+ assert log_response.status_code == status.HTTP_201_CREATED, log_response.json()+ assert log_response.json()["execution_order"] == 1++ second_log_response = self._create_log_transformation(name="Second log transformation")+ assert second_log_response.status_code == status.HTTP_201_CREATED+ assert second_log_response.json()["execution_order"] == 2++ def test_limits_enabled_log_transformations_per_team(self):+ for i in range(MAX_LOG_TRANSFORMATIONS_PER_TEAM):+ response = self._create_log_transformation(name=f"Enabled log transformation {i}", enabled=True)+ assert response.status_code == status.HTTP_201_CREATED, response.json()++ response = self._create_log_transformation(name="One too many", enabled=True)+ assert response.status_code == status.HTTP_400_BAD_REQUEST+ assert (+ f"Maximum of {MAX_LOG_TRANSFORMATIONS_PER_TEAM} enabled transformation log functions"+ in response.json()["detail"]+ )++ # Disabled ones can still be created at the limit+ response = self._create_log_transformation(name="Disabled is fine", enabled=False)+ assert response.status_code == status.HTTP_201_CREATED++ def test_restoring_deleted_enabled_log_transformation_counts_against_cap(self):+ # Archiving an enabled function keeps enabled=True on the row; restoring it+ # with {"deleted": false} must re-enter the cap check, or archive-and-replace+ # cycles run double the allowed transformations.+ first = self._create_log_transformation(name="Original", enabled=True)+ assert first.status_code == status.HTTP_201_CREATED+ first_id = first.json()["id"]++ delete_response = self.client.patch(+ f"/api/projects/{self.team.id}/hog_functions/{first_id}/", data={"deleted": True}+ )+ assert delete_response.status_code == status.HTTP_200_OK++ for i in range(MAX_LOG_TRANSFORMATIONS_PER_TEAM):+ response = self._create_log_transformation(name=f"Replacement {i}", enabled=True)+ assert response.status_code == status.HTTP_201_CREATED, response.json()++ restore_response = self.client.patch(+ f"/api/projects/{self.team.id}/hog_functions/{first_id}/", data={"deleted": False}+ )+ assert restore_response.status_code == status.HTTP_400_BAD_REQUEST+ assert (+ f"Maximum of {MAX_LOG_TRANSFORMATIONS_PER_TEAM} enabled transformation log functions"+ in restore_response.json()["detail"]+ )++ # Under the cap, restore works: free a slot, then the restore succeeds.+ disable_response = self.client.patch(+ f"/api/projects/{self.team.id}/hog_functions/{first_id}/", data={"deleted": False, "enabled": False}+ )+ assert disable_response.status_code == status.HTTP_200_OK++ # The cap is per type: enabled event transformations are not blocked by it+ response = self.client.post(+ f"/api/projects/{self.team.id}/hog_functions/",+ data={+ "name": "Event transformation",+ "type": "transformation",+ "hog": "return event",+ "enabled": True,+ },+ )+ assert response.status_code == status.HTTP_201_CREATED, response.json()++ @parameterized.expand(+ [+ ("with_event_filter", {"events": [{"id": "$pageview", "type": "events", "order": 0}]}, 400),+ ("empty", {}, 201),+ ]+ )+ def test_filters_rejected_unless_empty(self, _name, filters, expected_status):+ response = self._create_log_transformation(filters=filters)+ assert response.status_code == expected_status, response.json()++ @parameterized.expand(+ [+ ("fetch", "fetch('https://example.com')\nreturn record"),+ ("postHogCapture", "postHogCapture({})\nreturn record"),+ ("event_global", "return event"),+ ("person_global", "let e := person.properties.email\nreturn record"),+ ]+ )+ def test_rejects_async_functions_and_unavailable_globals_in_hog_code(self, _name, hog):+ response = self._create_log_transformation(hog=hog)+ assert response.status_code == status.HTTP_400_BAD_REQUEST, response.json()++ def test_allows_locals_loops_and_lambdas_in_hog_code(self):+ response = self._create_log_transformation(+ hog=(+ "fun redact(value) { return replaceAll(value, 'x', 'y') }\n"+ "let rec := record\n"+ "for (let key, value in rec.attributes) {\n"+ " rec.attributes[key] := redact(value)\n"+ "}\n"+ "let mapped := arrayMap(x -> x, [1, 2])\n"+ "return rec"+ )+ )+ assert response.status_code == status.HTTP_201_CREATED, response.json()++ def test_rejects_inputs_referencing_event_globals(self):+ response = self._create_log_transformation(+ inputs_schema=[{"key": "eid", "type": "string", "required": False}],+ inputs={"eid": {"value": "event = {event.uuid}"}},+ )+ assert response.status_code == status.HTTP_400_BAD_REQUEST, response.json()+ assert "Variable not available in log transformations: event" in response.json()["detail"]++ def test_allows_inputs_referencing_record_globals(self):+ response = self._create_log_transformation(+ inputs_schema=[{"key": "svc", "type": "string", "required": False}],+ inputs={"svc": {"value": "service = {record.service_name}"}},+ )+ assert response.status_code == status.HTTP_201_CREATED, response.json()++ def test_rearrange_log_transformations(self):+ first = self._create_log_transformation(name="A", enabled=True).json()+ second = self._create_log_transformation(name="B", enabled=True).json()++ response = self.client.patch(+ f"/api/projects/{self.team.id}/hog_functions/rearrange/",+ data={"orders": {first["id"]: 2, second["id"]: 1}},+ )++ assert response.status_code == status.HTTP_200_OK, response.json()+ results = response.json()+ assert [f["id"] for f in results] == [second["id"], first["id"]]+ assert [f["execution_order"] for f in results] == [1, 2]++ def test_rearrange_rejects_mixed_types(self):+ log_function = self._create_log_transformation(name="A", enabled=True).json()+ event_response = self.client.post(+ f"/api/projects/{self.team.id}/hog_functions/",+ data={"name": "Event transformation", "type": "transformation", "hog": "return event"},+ )+ assert event_response.status_code == status.HTTP_201_CREATED, event_response.json()+ event_function = event_response.json()++ response = self.client.patch(+ f"/api/projects/{self.team.id}/hog_functions/rearrange/",+ data={"orders": {log_function["id"]: 1, event_function["id"]: 2}},+ )++ assert response.status_code == status.HTTP_400_BAD_REQUEST+ assert "different types" in response.json()["detail"]diff --git a/products/cdp/backend/models/hog_functions/hog_function.py b/products/cdp/backend/models/hog_functions/hog_function.pyindex 40c8b80799dd..4f5003389fdc 100644--- a/products/cdp/backend/models/hog_functions/hog_function.py+++ b/products/cdp/backend/models/hog_functions/hog_function.py@@ -60,17 +60,21 @@ class HogFunctionType(models.TextChoices):WAREHOUSE_SOURCE_WEBHOOK = "warehouse_source_webhook"SITE_APP = "site_app"TRANSFORMATION = "transformation"+ TRANSFORMATION_LOG = "transformation_log"TYPES_THAT_RELOAD_PLUGIN_SERVER = (HogFunctionType.DESTINATION,HogFunctionType.TRANSFORMATION,+ HogFunctionType.TRANSFORMATION_LOG,HogFunctionType.INTERNAL_DESTINATION,HogFunctionType.SOURCE_WEBHOOK,HogFunctionType.WAREHOUSE_SOURCE_WEBHOOK,)TYPES_WITH_TRANSPILED_FILTERS = (HogFunctionType.SITE_DESTINATION, HogFunctionType.SITE_APP)TYPES_WITH_JAVASCRIPT_SOURCE = (HogFunctionType.SITE_DESTINATION, HogFunctionType.SITE_APP)+# Types that run sequentially during ingestion and are ordered by execution_order+TYPES_WITH_EXECUTION_ORDER = (HogFunctionType.TRANSFORMATION, HogFunctionType.TRANSFORMATION_LOG)# Function types a cyclotron worker actually executes, so a "rerun" — which re-enqueues# the stored invocation onto the cyclotron hog queue — can run to completion. Every other@@ -155,6 +159,9 @@ class HogFunction(FileSystemSyncMixin, UUIDTModel):elif self.type == HogFunctionType.TRANSFORMATION:folder = "Unfiled/Transformations"href = f"/pipeline/transformations/hog-{self.pk}/configuration"+ elif self.type == HogFunctionType.TRANSFORMATION_LOG:+ folder = "Unfiled/Transformations"+ href = f"/functions/{self.pk}/configuration"elif self.type == HogFunctionType.SOURCE_WEBHOOK:folder = "Unfiled/Sources"href = f"/functions/{self.pk}/configuration"diff --git a/products/cdp/frontend/generated/api.schemas.ts b/products/cdp/frontend/generated/api.schemas.tsindex 5ff63ef05ef7..39f40149ab2e 100644--- a/products/cdp/frontend/generated/api.schemas.ts+++ b/products/cdp/frontend/generated/api.schemas.ts@@ -241,6 +241,7 @@ export type HogFunctionApiInputs = { [key: string]: InputsItemApi }* * `warehouse_source_webhook` - Warehouse Source Webhook* * `site_app` - Site App* * `transformation` - Transformation+ * * `transformation_log` - Transformation Log*/export type HogFunctionTypeEnumApi = (typeof HogFunctionTypeEnumApi)[keyof typeof HogFunctionTypeEnumApi]@@ -252,6 +253,7 @@ export const HogFunctionTypeEnumApi = {WarehouseSourceWebhook: 'warehouse_source_webhook',SiteApp: 'site_app',Transformation: 'transformation',+ TransformationLog: 'transformation_log',} as const/**@@ -379,7 +381,7 @@ export interface MappingsApi {export interface HogFunctionApi {readonly id: string- /** Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, or transformation.+ /** Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.** * `destination` - Destination* * `site_destination` - Site Destination@@ -387,7 +389,8 @@ export interface HogFunctionApi {* * `source_webhook` - Source Webhook* * `warehouse_source_webhook` - Warehouse Source Webhook* * `site_app` - Site App- * * `transformation` - Transformation */+ * * `transformation` - Transformation+ * * `transformation_log` - Transformation Log */type?: HogFunctionTypeEnumApi | null/*** Display name for the function.@@ -456,7 +459,7 @@ export type PatchedHogFunctionApiInputs = { [key: string]: InputsItemApi }export interface PatchedHogFunctionApi {readonly id?: string- /** Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, or transformation.+ /** Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.** * `destination` - Destination* * `site_destination` - Site Destination@@ -464,7 +467,8 @@ export interface PatchedHogFunctionApi {* * `source_webhook` - Source Webhook* * `warehouse_source_webhook` - Warehouse Source Webhook* * `site_app` - Site App- * * `transformation` - Transformation */+ * * `transformation` - Transformation+ * * `transformation_log` - Transformation Log */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.tsindex 31813e48a831..f257be15c815 100644--- a/products/cdp/frontend/generated/api.zod.ts+++ b/products/cdp/frontend/generated/api.zod.ts@@ -39,15 +39,16 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({'warehouse_source_webhook','site_app','transformation',+ 'transformation_log',]).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'+ '\* `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'),zod.null(),]).optional().describe(- 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, or transformation.\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'+ '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'),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.'),@@ -289,15 +290,16 @@ export const HogFunctionsUpdateBody = /* @__PURE__ */ zod.object({'warehouse_source_webhook','site_app','transformation',+ 'transformation_log',]).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'+ '\* `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'),zod.null(),]).optional().describe(- 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, or transformation.\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'+ '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'),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.'),@@ -539,15 +541,16 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({'warehouse_source_webhook','site_app','transformation',+ 'transformation_log',]).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'+ '\* `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'),zod.null(),]).optional().describe(- 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, or transformation.\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'+ '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'),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.'),@@ -789,15 +792,16 @@ export const HogFunctionsEnableBackfillsCreateBody = /* @__PURE__ */ zod.object('warehouse_source_webhook','site_app','transformation',+ 'transformation_log',]).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'+ '\* `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'),zod.null(),]).optional().describe(- 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, or transformation.\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'+ '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'),name: zod.string()@@ -1070,15 +1074,16 @@ export const HogFunctionsInvocationsCreateBody = /* @__PURE__ */ zod.object({'warehouse_source_webhook','site_app','transformation',+ 'transformation_log',]).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'+ '\* `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'),zod.null(),]).optional().describe(- 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, or transformation.\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'+ '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'),name: zod.string()diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 9452cc446d96..be4c4dcba733 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -33761,6 +33761,7 @@ export namespace Schemas {* * `warehouse_source_webhook` - Warehouse Source Webhook* * `site_app` - Site App* * `transformation` - Transformation+ * * `transformation_log` - Transformation Log*/export type HogFunctionTypeEnum = typeof HogFunctionTypeEnum[keyof typeof HogFunctionTypeEnum];@@ -33773,6 +33774,7 @@ export namespace Schemas {WarehouseSourceWebhook: 'warehouse_source_webhook',SiteApp: 'site_app',Transformation: 'transformation',+ TransformationLog: 'transformation_log',} as const;/**@@ -33965,7 +33967,7 @@ export namespace Schemas {export interface HogFunction {readonly id: string;- /** Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, or transformation.+ /** Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.** * `destination` - Destination* * `site_destination` - Site Destination@@ -33973,7 +33975,8 @@ export namespace Schemas {* * `source_webhook` - Source Webhook* * `warehouse_source_webhook` - Warehouse Source Webhook* * `site_app` - Site App- * * `transformation` - Transformation */+ * * `transformation` - Transformation+ * * `transformation_log` - Transformation Log */type?: HogFunctionTypeEnum | null;/*** Display name for the function.@@ -50163,7 +50166,7 @@ export namespace Schemas {export interface PatchedHogFunction {readonly id?: string;- /** Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, or transformation.+ /** Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, transformation, or transformation_log.** * `destination` - Destination* * `site_destination` - Site Destination@@ -50171,7 +50174,8 @@ export namespace Schemas {* * `source_webhook` - Source Webhook* * `warehouse_source_webhook` - Warehouse Source Webhook* * `site_app` - Site App- * * `transformation` - Transformation */+ * * `transformation` - Transformation+ * * `transformation_log` - Transformation Log */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.tsindex 065dc9a5a80b..be90abf7ab37 100644--- a/services/mcp/src/generated/cdp_functions/api.ts+++ b/services/mcp/src/generated/cdp_functions/api.ts@@ -65,15 +65,16 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({'warehouse_source_webhook','site_app','transformation',+ 'transformation_log',]).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'+ '\* `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'),zod.null(),]).optional().describe(- 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, or transformation.\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'+ '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'),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.'),@@ -318,15 +319,16 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({'warehouse_source_webhook','site_app','transformation',+ 'transformation_log',]).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'+ '\* `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'),zod.null(),]).optional().describe(- 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, or transformation.\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'+ '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'),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.'),@@ -595,15 +597,16 @@ export const HogFunctionsInvocationsCreateBody = /* @__PURE__ */ zod.object({'warehouse_source_webhook','site_app','transformation',+ 'transformation_log',]).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'+ '\* `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'),zod.null(),]).optional().describe(- 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, or transformation.\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'+ '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'),name: zod.string()diff --git a/services/mcp/src/generated/error_tracking_alerts/api.ts b/services/mcp/src/generated/error_tracking_alerts/api.tsindex c700632fedfd..7e89df8416bf 100644--- a/services/mcp/src/generated/error_tracking_alerts/api.ts+++ b/services/mcp/src/generated/error_tracking_alerts/api.ts@@ -65,15 +65,16 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({'warehouse_source_webhook','site_app','transformation',+ 'transformation_log',]).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'+ '\* `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'),zod.null(),]).optional().describe(- 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, or transformation.\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'+ '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'),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.'),@@ -309,15 +310,16 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({'warehouse_source_webhook','site_app','transformation',+ 'transformation_log',]).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'+ '\* `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'),zod.null(),]).optional().describe(- 'Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, or transformation.\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'+ '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'),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.jsonindex 0a9d4d70cb1b..4ae398758423 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@@ -443,7 +443,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",+ "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","enum": ["destination","site_destination",@@ -451,7 +451,8 @@"source_webhook","warehouse_source_webhook","site_app",- "transformation"+ "transformation",+ "transformation_log"],"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 8cb169d4f26a..b351512e3790 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@@ -792,7 +792,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",+ "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","enum": ["destination","site_destination",@@ -800,7 +800,8 @@"source_webhook","warehouse_source_webhook","site_app",- "transformation"+ "transformation",+ "transformation_log"],"type": "string"},@@ -808,7 +809,7 @@"type": "null"}],- "description": "Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, or transformation.\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"+ "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"},"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.jsonindex 01e620113d66..04bb42fff703 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@@ -447,7 +447,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",+ "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","enum": ["destination","site_destination",@@ -455,7 +455,8 @@"source_webhook","warehouse_source_webhook","site_app",- "transformation"+ "transformation",+ "transformation_log"],"type": "string"},@@ -463,7 +464,7 @@"type": "null"}],- "description": "Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, or transformation.\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"+ "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"}},"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.jsonindex 10c155472b3f..1b7f47d262aa 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@@ -443,7 +443,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",+ "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","enum": ["destination","site_destination",@@ -451,7 +451,8 @@"source_webhook","warehouse_source_webhook","site_app",- "transformation"+ "transformation",+ "transformation_log"],"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 719d58d3d792..dd7693008a6d 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@@ -447,7 +447,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",+ "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","enum": ["destination","site_destination",@@ -455,7 +455,8 @@"source_webhook","warehouse_source_webhook","site_app",- "transformation"+ "transformation",+ "transformation_log"],"type": "string"},@@ -463,7 +464,7 @@"type": "null"}],- "description": "Function type: destination, site_destination, internal_destination, source_webhook, warehouse_source_webhook, site_app, or transformation.\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"+ "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"}},"required": ["id"],