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.

chore(cdp): move the remaining cdp helpers into products/cdp (#115445)

Harley Alexander45d6a66335da
diff --git a/posthog/cdp/templates/helpers.py b/posthog/cdp/templates/helpers.py
index 25b08b159405..863896c65bcd 100644
--- a/posthog/cdp/templates/helpers.py
+++ b/posthog/cdp/templates/helpers.py
@@ -6,11 +6,11 @@ from typing import Any, Optional, cast
from posthog.test.base import APIBaseTest, BaseTest
from unittest.mock import MagicMock, patch
-from posthog.cdp.site_functions import get_transpiled_function
from posthog.cdp.templates.hog_function_template import HogFunctionTemplateDC, sync_template_to_db
from posthog.models.utils import uuid7
from products.cdp.backend.models.hog_functions.hog_function import HogFunction
+from products.cdp.backend.site_functions import get_transpiled_function
from products.cdp.backend.validation import compile_hog
from common.hogvm.python.execute import execute_bytecode
@@ -192,7 +192,7 @@ class BaseSiteDestinationFunctionTest(APIBaseTest):
payload = edit_payload(payload)
# Mock the transpile function to avoid Node.js/pnpm dependency
- with patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile):
+ with patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile):
response = self.client.post(
f"/api/projects/{self.team.id}/hog_functions/",
data=payload,
diff --git a/posthog/egress/logodev/README.md b/posthog/egress/logodev/README.md
index 050b6c381b55..14eca8793691 100644
--- a/posthog/egress/logodev/README.md
+++ b/posthog/egress/logodev/README.md
@@ -13,13 +13,13 @@ logo.dev limits requests per month by plan, not per minute or per hour, so the b
- `LOGODEV_EGRESS_HOURLY_BUDGET` (default 5,000) caps total spend.
Icon bytes are never stored server-side, because logo.dev licenses that separately.
-Browser caching (`posthog/cdp/services/icons.py` sets `Cache-Control`) is the only dedupe, so steady-state traffic tracks unique (user, icon) first views per day.
+Browser caching (`products/cdp/backend/services/icons.py` sets `Cache-Control`) is the only dedupe, so steady-state traffic tracks unique (user, icon) first views per day.
Raise the settings if that outgrows the defaults.
## Lanes and callers
The default reserve ladder applies.
-The CDP icon picker and MCP store icons (`posthog/cdp/services/icons.py`, source `cdp_icons`) call on the `NORMAL` lane.
+The CDP icon picker and MCP store icons (`products/cdp/backend/services/icons.py`, source `cdp_icons`) call on the `NORMAL` lane.
Nothing in this domain runs `CRITICAL`, because the icon id is user-controlled and a never-shed lane would make the budget advisory.
A denied call raises `LogoDevEgressBudgetExhausted`, and the caller degrades to no icon.
diff --git a/posthog/egress/logodev/limiter.py b/posthog/egress/logodev/limiter.py
index dc9f286ee008..42d7a69727c4 100644
--- a/posthog/egress/logodev/limiter.py
+++ b/posthog/egress/logodev/limiter.py
@@ -5,7 +5,7 @@ credentials from that account, so the whole instance draws from a single shared
constant scope. logo.dev limits requests per month by plan, with no per-minute or hourly limit, so
the defaults are deliberately modest operator ceilings. Icon bytes are never stored server-side (logo.dev gates that behind a
data-caching license), so upstream volume is deduped only per user, by the browser caching that
-:mod:`posthog.cdp.services.icons` directs — steady-state traffic tracks unique (user, icon) first
+:mod:`products.cdp.backend.services.icons` directs — steady-state traffic tracks unique (user, icon) first
views per day. Raise the settings below if that outgrows the defaults.
Importing this module registers the policy as a side effect — import it (directly or via
diff --git a/posthog/management/commands/migrate_legacy_destinations_to_hog_functions.py b/posthog/management/commands/migrate_legacy_destinations_to_hog_functions.py
index 0fe4de4b4e38..76b38f5dc62d 100644
--- a/posthog/management/commands/migrate_legacy_destinations_to_hog_functions.py
+++ b/posthog/management/commands/migrate_legacy_destinations_to_hog_functions.py
@@ -2,7 +2,10 @@ 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
+from products.cdp.backend.legacy_destination_migration import (
+ disable_migrated_plugin_configs,
+ migrate_legacy_destinations,
+)
def _int_list(value: str | None) -> list[int] | None:
diff --git a/posthog/management/commands/migrate_plugins_to_hog_functions.py b/posthog/management/commands/migrate_plugins_to_hog_functions.py
index 42b3428b9852..52bc45b8ca08 100644
--- a/posthog/management/commands/migrate_plugins_to_hog_functions.py
+++ b/posthog/management/commands/migrate_plugins_to_hog_functions.py
@@ -1,6 +1,6 @@
from django.core.management.base import BaseCommand
-from posthog.cdp.migrations import migrate_legacy_plugins
+from products.cdp.backend.plugin_migrations import migrate_legacy_plugins
class Command(BaseCommand):
diff --git a/posthog/models/remote_config.py b/posthog/models/remote_config.py
index 0e684b8d735a..f530183ae5ba 100644
--- a/posthog/models/remote_config.py
+++ b/posthog/models/remote_config.py
@@ -357,10 +357,10 @@ class RemoteConfig(UUIDTModel):
def _build_site_apps_js(self):
# NOTE: This is the web focused config for the frontend that includes site apps
- from posthog.cdp.site_functions import exposed_secret_input_keys, get_transpiled_function
from posthog.plugins.site import get_site_apps_for_team, get_site_config_from_schema
from products.cdp.backend.models.hog_functions.hog_function import HogFunction
+ from products.cdp.backend.site_functions import exposed_secret_input_keys, get_transpiled_function
# Add in the site apps as an array of objects
site_apps_js = []
diff --git a/posthog/models/test/test_remote_config.py b/posthog/models/test/test_remote_config.py
index a1c0b480442c..bc2bf4476deb 100644
--- a/posthog/models/test/test_remote_config.py
+++ b/posthog/models/test/test_remote_config.py
@@ -423,7 +423,7 @@ class TestRemoteConfig(_RemoteConfigBase):
assert (function.inputs or {}) == {}
assert (function.encrypted_inputs or {})["token"]["value"] == "example-private-browser-value"
- with patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile):
+ with patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile):
result = "".join(self.remote_config._build_site_apps_js())
assert str(function.id) in result
@@ -458,7 +458,7 @@ class TestRemoteConfig(_RemoteConfigBase):
unsafe.refresh_from_db()
safe = HogFunction.objects.create(team=self.team, type="site_destination", enabled=True, hog=SITE_HOG)
- with patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile):
+ with patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile):
result = "".join(self.remote_config._build_site_apps_js())
assert str(unsafe.id) not in result
@@ -506,7 +506,7 @@ class TestRemoteConfig(_RemoteConfigBase):
mappings=list(mappings),
)
- with patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile):
+ with patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile):
result = "".join(self.remote_config._build_site_apps_js())
assert str(function.id) in result
diff --git a/products/cdp/backend/api/hog_function.py b/products/cdp/backend/api/hog_function.py
index e8dce3d577d9..0b7c72d6b637 100644
--- a/products/cdp/backend/api/hog_function.py
+++ b/products/cdp/backend/api/hog_function.py
@@ -28,8 +28,6 @@ from posthog.api.log_entries import LogEntryMixin
from posthog.api.routing import TeamAndOrgViewSetMixin
from posthog.api.shared import SearchMatchTypeSerializerMixin, UserBasicSerializer
from posthog.api.utils import action, log_activity_from_viewset
-from posthog.cdp.services.icons import CDPIconsService
-from posthog.cdp.site_functions import get_transpiled_function
from posthog.event_usage import AGENT_EVENT_SOURCES, get_event_source
from posthog.exceptions_capture import capture_exception
from posthog.helpers.impersonation import is_impersonated
@@ -70,6 +68,8 @@ from products.cdp.backend.presentation.hog_invocations.rerun import (
HogInvocationRerunRequestSerializer,
HogInvocationRerunResponseSerializer,
)
+from products.cdp.backend.services.icons import CDPIconsService
+from products.cdp.backend.site_functions import get_transpiled_function
from products.cdp.backend.validation import (
DUPLICATE_INPUT_KEYS_ERROR,
HogFunctionFiltersSerializer,
diff --git a/products/cdp/backend/api/hog_function_template.py b/products/cdp/backend/api/hog_function_template.py
index 13d8230d82a4..732fa5afce5e 100644
--- a/products/cdp/backend/api/hog_function_template.py
+++ b/products/cdp/backend/api/hog_function_template.py
@@ -10,11 +10,11 @@ from rest_framework.exceptions import NotFound
from rest_framework.request import Request
from posthog.auth import OAuthAccessTokenAuthentication, PersonalAPIKeyAuthentication, SessionAuthentication
-from posthog.cdp.flag_gated_templates import FLAG_GATED_TEMPLATE_IDS, hidden_gated_template_ids
from posthog.models.team import Team
from posthog.models.user import User
from posthog.permissions import APIScopePermission
+from products.cdp.backend.flag_gated_templates import FLAG_GATED_TEMPLATE_IDS, hidden_gated_template_ids
from products.cdp.backend.models.hog_function_template import HogFunctionTemplate
from products.cdp.backend.models.hog_functions import HogFunction
diff --git a/products/cdp/backend/api/plugin.py b/products/cdp/backend/api/plugin.py
index 451af80d5c5c..89bde4e43ead 100644
--- a/products/cdp/backend/api/plugin.py
+++ b/products/cdp/backend/api/plugin.py
@@ -717,9 +717,10 @@ class PluginConfigSerializer(serializers.ModelSerializer):
validated_data["web_token"] = generate_random_token()
# Try and create a hog function if possible, otherwise create plugin
- from posthog.cdp.legacy_plugins import hog_function_from_plugin_config
from posthog.event_usage import report_team_action
+ from products.cdp.backend.legacy_plugins import hog_function_from_plugin_config
+
report_team_action(
self.context["get_team"](),
"plugin config create called",
diff --git a/products/cdp/backend/api/test/test_hog_function.py b/products/cdp/backend/api/test/test_hog_function.py
index 7d0bb0d53a27..45f24c892c74 100644
--- a/products/cdp/backend/api/test/test_hog_function.py
+++ b/products/cdp/backend/api/test/test_hog_function.py
@@ -2177,7 +2177,7 @@ class TestHogFunctionAPI(ClickhouseTestMixin, APIBaseTest, QueryMatchingTest):
assert response.status_code == status.HTTP_201_CREATED, response.json()
assert response.json()["filters"]["source"] == "data-warehouse-view"
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_create_hog_function_with_site_app_type(self, mock_transpile_fn):
response = self.client.post(
f"/api/projects/{self.team.id}/hog_functions/",
@@ -2192,7 +2192,7 @@ class TestHogFunctionAPI(ClickhouseTestMixin, APIBaseTest, QueryMatchingTest):
assert response.json()["bytecode"] is None
assert "Hello, site_app" in response.json()["transpiled"]
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_create_hog_function_with_site_destination_type(self, mock_transpile_fn):
response = self.client.post(
f"/api/projects/{self.team.id}/hog_functions/",
@@ -2331,7 +2331,7 @@ class TestHogFunctionAPI(ClickhouseTestMixin, APIBaseTest, QueryMatchingTest):
assert "detail" in response.json()
assert "Error in TypeScript code" in response.json()["detail"]
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_create_typescript_destination_with_inputs(self, mock_transpile_fn):
payload = {
"name": "TypeScript Destination Function",
diff --git a/products/cdp/backend/api/test/test_hog_function_drafts.py b/products/cdp/backend/api/test/test_hog_function_drafts.py
index f1433e168288..a7f1493499fb 100644
--- a/products/cdp/backend/api/test/test_hog_function_drafts.py
+++ b/products/cdp/backend/api/test/test_hog_function_drafts.py
@@ -370,7 +370,7 @@ class TestHogFunctionDrafts(DraftTestCase):
assert all(change["after"] == "masked" for change in changes)
assert all("private-input" not in str(log.detail) for log in logs)
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_site_function_transpiled_output_is_not_written_to_activity_logs(self, _mock_transpile) -> None:
function_id = self._create(
type="site_destination",
diff --git a/products/cdp/backend/api/test/test_hog_function_templates.py b/products/cdp/backend/api/test/test_hog_function_templates.py
index 7ea284ba6ea4..1fa7bcc7cfe2 100644
--- a/products/cdp/backend/api/test/test_hog_function_templates.py
+++ b/products/cdp/backend/api/test/test_hog_function_templates.py
@@ -348,7 +348,7 @@ class TestHogFunctionTemplates(ClickhouseTestMixin, APIBaseTest, QueryMatchingTe
free=True,
)
- with patch("posthog.cdp.flag_gated_templates.gated_template_enabled", return_value=flag_enabled):
+ with patch("products.cdp.backend.flag_gated_templates.gated_template_enabled", return_value=flag_enabled):
response = self.client.get(f"/api/projects/{self.team.id}/hog_function_templates/")
assert response.status_code == status.HTTP_200_OK, response.json()
diff --git a/products/cdp/backend/facade/api.py b/products/cdp/backend/facade/api.py
index d44d393fbc9f..2b2de23d601c 100644
--- a/products/cdp/backend/facade/api.py
+++ b/products/cdp/backend/facade/api.py
@@ -11,10 +11,10 @@ from collections.abc import Sequence
from typing import Any
from uuid import UUID
-from posthog.cdp.flag_gated_templates import FLAG_GATED_TEMPLATE_IDS, gated_template_enabled
from posthog.models.team import Team
from posthog.models.user import User
+from products.cdp.backend.flag_gated_templates import FLAG_GATED_TEMPLATE_IDS, gated_template_enabled
from products.cdp.backend.models.hog_function_template import HogFunctionTemplate
_B = "products.cdp.backend."
diff --git a/posthog/cdp/flag_gated_templates.py b/products/cdp/backend/flag_gated_templates.py
similarity index 100%
rename from posthog/cdp/flag_gated_templates.py
rename to products/cdp/backend/flag_gated_templates.py
diff --git a/posthog/cdp/legacy_destination_migration.py b/products/cdp/backend/legacy_destination_migration.py
similarity index 100%
rename from posthog/cdp/legacy_destination_migration.py
rename to products/cdp/backend/legacy_destination_migration.py
diff --git a/posthog/cdp/legacy_plugins.py b/products/cdp/backend/legacy_plugins.py
similarity index 100%
rename from posthog/cdp/legacy_plugins.py
rename to products/cdp/backend/legacy_plugins.py
diff --git a/posthog/cdp/migrations.py b/products/cdp/backend/plugin_migrations.py
similarity index 100%
rename from posthog/cdp/migrations.py
rename to products/cdp/backend/plugin_migrations.py
diff --git a/products/cdp/backend/presentation/hog_functions.py b/products/cdp/backend/presentation/hog_functions.py
index f54ceb48328f..ca7de9183255 100644
--- a/products/cdp/backend/presentation/hog_functions.py
+++ b/products/cdp/backend/presentation/hog_functions.py
@@ -5,15 +5,14 @@ the helpers that workflows and messaging views use cross here. Their signatures
return untyped bytecode, so they cannot cross through the facade.
"""
-from posthog.cdp.flag_gated_templates import (
- FLAG_GATED_TEMPLATE_IDS as FLAG_GATED_TEMPLATE_IDS,
- gated_template_enabled as gated_template_enabled,
-)
-
from products.cdp.backend.filters import (
DATA_WAREHOUSE_SOURCES as DATA_WAREHOUSE_SOURCES,
compile_filters_expr as compile_filters_expr,
)
+from products.cdp.backend.flag_gated_templates import (
+ FLAG_GATED_TEMPLATE_IDS as FLAG_GATED_TEMPLATE_IDS,
+ gated_template_enabled as gated_template_enabled,
+)
from products.cdp.backend.validation import (
build_html_wrap_design as build_html_wrap_design,
generate_template_bytecode as generate_template_bytecode,
diff --git a/products/cdp/backend/presentation/icons.py b/products/cdp/backend/presentation/icons.py
index 79706e32c21b..0671df06e6e2 100644
--- a/products/cdp/backend/presentation/icons.py
+++ b/products/cdp/backend/presentation/icons.py
@@ -1,3 +1,3 @@
"""The destination icon service that other products' icon endpoints serve through."""
-from posthog.cdp.services.icons import CDPIconsService as CDPIconsService
+from products.cdp.backend.services.icons import CDPIconsService as CDPIconsService
diff --git a/posthog/cdp/services/icons.py b/products/cdp/backend/services/icons.py
similarity index 100%
rename from posthog/cdp/services/icons.py
rename to products/cdp/backend/services/icons.py
diff --git a/posthog/cdp/site_functions.py b/products/cdp/backend/site_functions.py
similarity index 100%
rename from posthog/cdp/site_functions.py
rename to products/cdp/backend/site_functions.py
diff --git a/posthog/cdp/test/__snapshots__/test_site_functions.ambr b/products/cdp/backend/test/__snapshots__/test_site_functions.ambr
similarity index 100%
rename from posthog/cdp/test/__snapshots__/test_site_functions.ambr
rename to products/cdp/backend/test/__snapshots__/test_site_functions.ambr
diff --git a/posthog/cdp/test/test_icons.py b/products/cdp/backend/test/test_icons.py
similarity index 98%
rename from posthog/cdp/test/test_icons.py
rename to products/cdp/backend/test/test_icons.py
index ba756a99f334..3f6644ae5d4a 100644
--- a/posthog/cdp/test/test_icons.py
+++ b/products/cdp/backend/test/test_icons.py
@@ -13,9 +13,10 @@ from requests.structures import CaseInsensitiveDict
from rest_framework import status
from rest_framework.exceptions import APIException, NotFound
-from posthog.cdp.services.icons import CDPIconsService, LogoDevBadGateway, LogoDevUnavailable
from posthog.egress.limiter.outbound import get_outbound_rate_limiter
+from products.cdp.backend.services.icons import CDPIconsService, LogoDevBadGateway, LogoDevUnavailable
+
# Fresh team id per test (and per run) so consuming the real per-team budget never accumulates
# into a denial across tests or repeated local runs against a persistent Redis.
_TEAM_IDS = count(time.time_ns() % 1_000_000_000)
@@ -308,7 +309,7 @@ class TestCDPIconsService(SimpleTestCase):
# arbitrary-domain requests from blanking icons for every other team. Denial must be
# charged to the calling team's own key, stay uncached, and never reach upstream.
with (
- patch("posthog.cdp.services.icons.get_outbound_rate_limiter") as limiter,
+ patch("products.cdp.backend.services.icons.get_outbound_rate_limiter") as limiter,
patch("requests.request") as upstream,
):
limiter.return_value.consume_sync.return_value = False
@@ -358,7 +359,7 @@ class TestCDPIconsService(SimpleTestCase):
# Search queries are free text — the same per-team gate must cover them or a team could
# drain the shared account budget through the search path instead.
with (
- patch("posthog.cdp.services.icons.get_outbound_rate_limiter") as limiter,
+ patch("products.cdp.backend.services.icons.get_outbound_rate_limiter") as limiter,
patch("requests.request") as upstream,
):
limiter.return_value.consume_sync.return_value = False
diff --git a/posthog/cdp/test/test_legacy_destination_migration.py b/products/cdp/backend/test/test_legacy_destination_migration.py
similarity index 98%
rename from posthog/cdp/test/test_legacy_destination_migration.py
rename to products/cdp/backend/test/test_legacy_destination_migration.py
index c48526061989..687a5fc05f92 100644
--- a/posthog/cdp/test/test_legacy_destination_migration.py
+++ b/products/cdp/backend/test/test_legacy_destination_migration.py
@@ -1,7 +1,9 @@
from posthog.test.base import BaseTest
-from posthog.cdp.legacy_destination_migration import disable_migrated_plugin_configs, migrate_legacy_destinations
-
+from products.cdp.backend.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
diff --git a/posthog/cdp/test/test_migrations.py b/products/cdp/backend/test/test_plugin_migrations.py
similarity index 92%
rename from posthog/cdp/test/test_migrations.py
rename to products/cdp/backend/test/test_plugin_migrations.py
index 0bbee694d09d..0933eabc3c0b 100644
--- a/posthog/cdp/test/test_migrations.py
+++ b/products/cdp/backend/test/test_plugin_migrations.py
@@ -7,7 +7,6 @@ from django.test import SimpleTestCase
from parameterized import parameterized
-from posthog.cdp.migrations import coerce_input_value, migrate_legacy_plugins
from posthog.cdp.templates._siteapps.template_notification_bar import template as notification_bar
from posthog.cdp.templates._siteapps.template_pineapple_mode import template as pineapple_mode
from posthog.cdp.templates.helpers import mock_transpile
@@ -15,6 +14,7 @@ from posthog.cdp.templates.hog_function_template import sync_template_to_db
from products.cdp.backend.models.hog_functions.hog_function import HogFunction
from products.cdp.backend.models.plugin import Plugin, PluginConfig, PluginSourceFile
+from products.cdp.backend.plugin_migrations import coerce_input_value, migrate_legacy_plugins
class TestCoerceInputValue(SimpleTestCase):
@@ -78,7 +78,7 @@ class TestMigrateSiteApps(BaseTest):
web_token=f"token-{name}",
)
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_migrates_site_app_plugin_to_hog_function(self, mock_transpile_fn):
migrate_legacy_plugins(dry_run=False, test_mode=False, kind="site_app")
@@ -99,7 +99,7 @@ class TestMigrateSiteApps(BaseTest):
self.plugin_config.refresh_from_db()
assert not self.plugin_config.enabled
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_migrates_notification_bar_custom_css(self, mock_transpile_fn):
css = ".notification-bar { font-size: 16px }"
notification_bar_config = self._create_site_app(
@@ -118,7 +118,7 @@ class TestMigrateSiteApps(BaseTest):
notification_bar_config.refresh_from_db()
assert not notification_bar_config.enabled
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_leaves_a_site_app_with_no_template_enabled(self, mock_transpile_fn):
# Disabling one of these would take it off the customer's site with nothing to replace it
unsupported = self._create_site_app(
@@ -136,7 +136,7 @@ class TestMigrateSiteApps(BaseTest):
self.plugin_config.refresh_from_db()
assert not self.plugin_config.enabled
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_disables_a_second_config_of_an_app_already_covered(self, mock_transpile_fn):
# Teams do run the same site app twice. The second one is replaced by the hog function the
# first produced, so leaving it enabled would render the app twice.
@@ -157,7 +157,7 @@ class TestMigrateSiteApps(BaseTest):
assert not second.enabled
assert not self.plugin_config.enabled
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_migration_is_idempotent(self, mock_transpile_fn):
migrate_legacy_plugins(dry_run=False, test_mode=False, kind="site_app")
PluginConfig.objects.filter(id=self.plugin_config.id).update(enabled=True)
diff --git a/posthog/cdp/test/test_site_functions.py b/products/cdp/backend/test/test_site_functions.py
similarity index 90%
rename from posthog/cdp/test/test_site_functions.py
rename to products/cdp/backend/test/test_site_functions.py
index ac436046611d..c6170eced714 100644
--- a/posthog/cdp/test/test_site_functions.py
+++ b/products/cdp/backend/test/test_site_functions.py
@@ -10,7 +10,6 @@ from django.test import TestCase
from parameterized import parameterized
-from posthog.cdp.site_functions import get_transpiled_function
from posthog.cdp.templates.helpers import mock_transpile
from posthog.models.organization import Organization
from posthog.models.project import Project
@@ -20,6 +19,7 @@ from posthog.test.test_utils import create_group_type_mapping_without_created_at
from products.actions.backend.models.action import Action
from products.cdp.backend.models.hog_functions.hog_function import HogFunction
from products.cdp.backend.models.plugin import TranspilerError
+from products.cdp.backend.site_functions import get_transpiled_function
from products.cohorts.backend.models.cohort import Cohort
@@ -64,7 +64,7 @@ class TestSiteFunctions(TestCase):
f.flush()
return subprocess.check_output(["node", f.name]).decode("utf-8")
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_get_transpiled_function_basic(self, mock_transpile_fn):
result = self.compile_and_run()
assert isinstance(result, str)
@@ -73,7 +73,7 @@ class TestSiteFunctions(TestCase):
# This ensures the transpilation logic remains stable and any changes are intentional
self.snapshot.assert_match(result)
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_get_transpiled_function_with_static_input(self, mock_transpile_fn):
self.hog_function.hog = "export function onLoad() { console.log(inputs.message); }"
self.hog_function.inputs = {"message": {"value": "Hello, Inputs!"}}
@@ -81,14 +81,14 @@ class TestSiteFunctions(TestCase):
result = self.compile_and_run()
self.snapshot.assert_match(result)
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_get_transpiled_function_with_template_input(self, mock_transpile_fn):
self.hog_function.hog = "export function onLoad() { console.log(inputs.greeting); }"
self.hog_function.inputs = {"greeting": {"value": "Hello, {person.properties.name}!"}}
result = self.compile_and_run()
self.snapshot.assert_match(result)
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_get_transpiled_function_with_filters(self, mock_transpile_fn):
self.hog_function.hog = "export function onEvent(globals) { console.log(globals); }"
self.hog_function.filters = {"events": [{"id": "$pageview", "name": "$pageview", "type": "events", "order": 0}]}
@@ -96,7 +96,7 @@ class TestSiteFunctions(TestCase):
result = self.compile_and_run()
self.snapshot.assert_match(result)
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_get_transpiled_function_with_invalid_template_input(self, mock_transpile_fn):
self.hog_function.hog = "export function onLoad() { console.log(inputs.greeting); }"
self.hog_function.inputs = {"greeting": {"value": "Hello, {person.properties.nonexistent_property}!"}}
@@ -111,7 +111,7 @@ class TestSiteFunctions(TestCase):
with pytest.raises(TranspilerError):
get_transpiled_function(self.hog_function)
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_get_transpiled_function_with_complex_inputs(self, mock_transpile_fn):
self.hog_function.hog = "export function onLoad() { console.log(inputs.complexInput); }"
self.hog_function.inputs = {
@@ -126,7 +126,7 @@ class TestSiteFunctions(TestCase):
result = self.compile_and_run()
self.snapshot.assert_match(result)
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_get_transpiled_function_with_empty_inputs(self, mock_transpile_fn):
self.hog_function.hog = 'export function onLoad() { console.log("No inputs"); }'
self.hog_function.inputs = {}
@@ -136,7 +136,7 @@ class TestSiteFunctions(TestCase):
assert 'console.log("No inputs");' in result
assert "let inputs = {\n};" in result
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_get_transpiled_function_with_non_template_string(self, mock_transpile_fn):
self.hog_function.hog = "export function onLoad() { console.log(inputs.staticMessage); }"
self.hog_function.inputs = {"staticMessage": {"value": "This is a static message."}}
@@ -147,7 +147,7 @@ class TestSiteFunctions(TestCase):
assert '"staticMessage": "This is a static message."' in result
assert "function getInputsKey" not in result
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_get_transpiled_function_with_templating_disabled(self, mock_transpile_fn):
self.hog_function.hog = "export function onLoad() { console.log(inputs.cssOverride); }"
self.hog_function.inputs_schema = [{"key": "cssOverride", "type": "string", "templating": False}]
@@ -158,7 +158,7 @@ class TestSiteFunctions(TestCase):
assert '"cssOverride": ".bar { color: red }"' in result
assert "function getInputsKey" not in result
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_get_transpiled_function_with_templating_disabled_on_a_list(self, mock_transpile_fn):
self.hog_function.hog = "export function onLoad() { console.log(inputs.notices); }"
self.hog_function.inputs_schema = [{"key": "notices", "type": "json", "templating": False}]
@@ -169,7 +169,7 @@ class TestSiteFunctions(TestCase):
# Only strings opt out of templating, so a structured value still compiles
assert "function getInputsKey" in result
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_get_transpiled_function_with_list_inputs(self, mock_transpile_fn):
self.hog_function.hog = "export function onLoad() { console.log(inputs.messages); }"
self.hog_function.inputs = {"messages": {"value": ["Hello", "World", "{person.properties.name}"]}}
@@ -180,7 +180,7 @@ class TestSiteFunctions(TestCase):
assert "function getInputsKey" in result
assert 'inputs["messages"] = getInputsKey("messages");' in result
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_get_transpiled_function_with_event_filter(self, mock_transpile_fn):
self.hog_function.hog = "export function onEvent(event) { console.log(event.properties.url); }"
self.hog_function.filters = {
@@ -203,7 +203,7 @@ class TestSiteFunctions(TestCase):
in result
)
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_get_transpiled_function_with_groups(self, mock_transpile_fn):
self.hog_function.hog = "export function onLoad() { console.log(inputs.groupInfo); }"
self.hog_function.inputs = {"groupInfo": {"value": "{groups['company']}"}}
@@ -218,7 +218,7 @@ class TestSiteFunctions(TestCase):
assert 'inputs["groupInfo"] = getInputsKey("groupInfo");' in result
assert '__getProperty(__getGlobal("groups"), "company", false)' in result
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_get_transpiled_function_with_missing_group(self, mock_transpile_fn):
self.hog_function.hog = "export function onLoad() { console.log(inputs.groupInfo); }"
self.hog_function.inputs = {"groupInfo": {"value": "{groups['nonexistent']}"}}
@@ -229,7 +229,7 @@ class TestSiteFunctions(TestCase):
assert 'inputs["groupInfo"] = getInputsKey("groupInfo");' in result
assert '__getProperty(__getGlobal("groups"), "nonexistent"' in result
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_get_transpiled_function_with_complex_filters(self, mock_transpile_fn):
action = Action.objects.create(team=self.team, name="Test Action")
action.steps = [{"event": "$pageview", "url": "https://example.com"}]
@@ -255,7 +255,7 @@ class TestSiteFunctions(TestCase):
assert '__getGlobal("event") == "$pageview"' in result
assert "https://example.com" in result
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_get_transpiled_function_with_person_property_cohort_filter_inlined(self, mock_transpile_fn):
cohort = Cohort.objects.create(
team=self.team,
@@ -333,7 +333,7 @@ class TestSiteFunctions(TestCase):
),
]
)
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_get_transpiled_function_with_unsupported_cohort_raises_error(
self, _name, is_static, filters, mock_transpile_fn
):
@@ -358,7 +358,7 @@ class TestSiteFunctions(TestCase):
with pytest.raises(Exception, match="cohort"):
get_transpiled_function(self.hog_function)
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_get_transpiled_function_with_mappings(self, mock_transpile_fn):
self.hog_function.hog = "export function onLoad({ inputs, posthog }) { console.log(inputs); }"
self.hog_function.inputs = {"greeting": {"value": "Hello, {person.properties.nonexistent_property}!"}}
@@ -375,7 +375,7 @@ class TestSiteFunctions(TestCase):
result = self.compile_and_run()
self.snapshot.assert_match(result)
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_run_function_onload(self, mock_transpile_fn):
self.hog_function.hog = "export function onLoad({ inputs, posthog }) { console.log(inputs.message); }"
self.hog_function.filters = {"events": [{"id": "$pageview", "name": "$pageview", "type": "events", "order": 0}]}
@@ -390,7 +390,7 @@ class TestSiteFunctions(TestCase):
)
assert "Hello World Bob\nLoaded" == response.strip()
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_run_function_onevent(self, mock_transpile_fn):
self.hog_function.hog = "export function onEvent({ inputs }) { console.log(inputs.message); }"
# self.hog_function.filters = {"events": [{"id": "$pageview", "name": "$pageview", "type": "events", "order": 0}]}
@@ -431,7 +431,7 @@ class TestSiteFunctions(TestCase):
)
assert "Loaded" == response.strip()
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_run_function_skip_disabled_mapping(self, mock_transpile_fn):
self.hog_function.hog = "export function onEvent({ inputs }) { console.log(inputs.message); }"
self.hog_function.inputs = {"message": {"value": "Hello World {event.properties.id}"}}
@@ -459,7 +459,7 @@ class TestSiteFunctions(TestCase):
)
assert "Loaded" == response.strip()
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_get_transpiled_function_with_ordered_inputs(self, mock_transpile_fn):
self.hog_function.hog = "export function onLoad() { console.log(inputs); }"
self.hog_function.inputs = {
@@ -477,7 +477,7 @@ class TestSiteFunctions(TestCase):
assert idx_first < idx_second < idx_third
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_get_transpiled_function_without_order(self, mock_transpile_fn):
self.hog_function.hog = "export function onLoad() { console.log(inputs); }"
self.hog_function.inputs = {
@@ -494,7 +494,7 @@ class TestSiteFunctions(TestCase):
assert idx_noOrder < idx_alsoNoOrder < idx_withOrder
- @patch("posthog.cdp.site_functions.transpile", side_effect=mock_transpile)
+ @patch("products.cdp.backend.site_functions.transpile", side_effect=mock_transpile)
def test_get_transpiled_function_with_duplicate_orders(self, mock_transpile_fn):
self.hog_function.hog = "export function onLoad() { console.log(inputs); }"
self.hog_function.inputs = {
diff --git a/posthog/cdp/test/test_workflow_step_resume.py b/products/cdp/backend/test/test_workflow_step_resume.py
similarity index 96%
rename from posthog/cdp/test/test_workflow_step_resume.py
rename to products/cdp/backend/test/test_workflow_step_resume.py
index 7797a64cde4b..086786482e89 100644
--- a/posthog/cdp/test/test_workflow_step_resume.py
+++ b/products/cdp/backend/test/test_workflow_step_resume.py
@@ -9,9 +9,9 @@ from django.test import override_settings
import jwt
import requests
-from posthog.cdp.workflow_step_resume import RESULT_BYTE_CAP, RESULT_STRING_CAP, emit_workflow_step_resume
+from products.cdp.backend.workflow_step_resume import RESULT_BYTE_CAP, RESULT_STRING_CAP, emit_workflow_step_resume
-_PRODUCE = "posthog.cdp.workflow_step_resume.produce_internal_event"
+_PRODUCE = "products.cdp.backend.workflow_step_resume.produce_internal_event"
_POST = "posthog.plugins.plugin_server_api.internal_requests.post"
diff --git a/posthog/cdp/workflow_step_resume.py b/products/cdp/backend/workflow_step_resume.py
similarity index 100%
rename from posthog/cdp/workflow_step_resume.py
rename to products/cdp/backend/workflow_step_resume.py
diff --git a/products/signals/backend/temporal/agentic/scout_scheduler.py b/products/signals/backend/temporal/agentic/scout_scheduler.py
index 8466a0dcb7d5..1e5ef9d77de5 100644
--- a/products/signals/backend/temporal/agentic/scout_scheduler.py
+++ b/products/signals/backend/temporal/agentic/scout_scheduler.py
@@ -16,7 +16,6 @@ from temporalio.client import Client
from temporalio.common import RetryPolicy, WorkflowIDConflictPolicy, WorkflowIDReusePolicy
from temporalio.exceptions import ActivityError, ApplicationError, WorkflowAlreadyStartedError, is_cancelled_exception
-from posthog.cdp.workflow_step_resume import WorkflowStepResumeStatus, emit_workflow_step_resume
from posthog.clickhouse.query_tagging import private_capture_context
from posthog.dataclasses import frozen
from posthog.models import Team
@@ -24,6 +23,7 @@ from posthog.sync import database_sync_to_async
from posthog.temporal.common.heartbeat import Heartbeater
from posthog.temporal.common.utils import close_db_connections
+from products.cdp.backend.workflow_step_resume import WorkflowStepResumeStatus, emit_workflow_step_resume
from products.signals.backend.daily_limit import capture_signal_report_daily_limit_paused, daily_report_limit_gate
from products.signals.backend.quota import (
capture_signal_report_quota_paused,
diff --git a/products/tasks/backend/logic/services/workflow_step_resume.py b/products/tasks/backend/logic/services/workflow_step_resume.py
index f80d7f3fb5f2..4309e4d8b84d 100644
--- a/products/tasks/backend/logic/services/workflow_step_resume.py
+++ b/products/tasks/backend/logic/services/workflow_step_resume.py
@@ -3,13 +3,12 @@ from uuid import UUID
from celery import current_app
-from posthog.cdp.workflow_step_resume import (
+from products.cdp.backend.workflow_step_resume import (
RESULT_BYTE_CAP,
WorkflowStepResumeStatus,
cap_value,
emit_workflow_step_resume,
)
-
from products.tasks.backend.logic.services.workflow_task_output import RUN_OUTPUT_RESERVED_KEYS
from products.tasks.backend.models import Task, TaskRun
diff --git a/products/tasks/backend/logic/services/workflow_task_output.py b/products/tasks/backend/logic/services/workflow_task_output.py
index c702d0325915..0ed5faa5a37b 100644
--- a/products/tasks/backend/logic/services/workflow_task_output.py
+++ b/products/tasks/backend/logic/services/workflow_task_output.py
@@ -4,7 +4,7 @@ import re
from collections.abc import Mapping
from typing import Any
-from posthog.cdp.workflow_step_resume import RESULT_BYTE_CAP, RESULT_STRING_CAP
+from products.cdp.backend.workflow_step_resume import RESULT_BYTE_CAP, RESULT_STRING_CAP
OUTPUT_FIELD_TYPES = ("string", "number", "boolean")
MAX_OUTPUT_FIELDS = 20
diff --git a/products/tasks/backend/logic/services/workflow_tasks.py b/products/tasks/backend/logic/services/workflow_tasks.py
index 419ce14fe97a..a6bab6232327 100644
--- a/products/tasks/backend/logic/services/workflow_tasks.py
+++ b/products/tasks/backend/logic/services/workflow_tasks.py
@@ -16,13 +16,13 @@ from django.utils import timezone as django_timezone
import structlog
-from posthog.cdp.workflow_step_resume import RESULT_STRING_CAP
from posthog.dataclasses import frozen
from posthog.models import User
from posthog.models.integration import Integration, SlackIntegration
from posthog.models.team.team import Team
from posthog.temporal.oauth import PosthogMcpScopes
+from products.cdp.backend.workflow_step_resume import RESULT_STRING_CAP
from products.mcp_store.backend.facade.api import resolve_agent_gateway_server_ids
from products.slack_app.backend.facade.api import slack_artifact_delivery_state_updates, slack_channel_is_approved
from products.slack_app.backend.models import SlackThreadTaskMapping
diff --git a/products/tasks/backend/tests/test_workflow_step_resume.py b/products/tasks/backend/tests/test_workflow_step_resume.py
index 7a6825d9c9e3..b672202fd681 100644
--- a/products/tasks/backend/tests/test_workflow_step_resume.py
+++ b/products/tasks/backend/tests/test_workflow_step_resume.py
@@ -6,8 +6,7 @@ from unittest.mock import patch
from parameterized import parameterized
-from posthog.cdp.workflow_step_resume import RESULT_BYTE_CAP
-
+from products.cdp.backend.workflow_step_resume import RESULT_BYTE_CAP
from products.tasks.backend.facade.api import update_task_run
from products.tasks.backend.logic.services.workflow_step_resume import (
DEFERRED_RESUME_TASK,
diff --git a/products/tasks/backend/tests/test_workflow_tasks_api.py b/products/tasks/backend/tests/test_workflow_tasks_api.py
index 3f18324612d1..1a6d22ec2c11 100644
--- a/products/tasks/backend/tests/test_workflow_tasks_api.py
+++ b/products/tasks/backend/tests/test_workflow_tasks_api.py
@@ -15,7 +15,6 @@ from parameterized import parameterized
from rest_framework import status
from rest_framework.test import APIClient
-from posthog.cdp.workflow_step_resume import RESULT_STRING_CAP
from posthog.jwt import PosthogJwtAudience, encode_jwt
from posthog.models.integration import Integration
from posthog.models.oauth import OAuthAccessToken, OAuthApplication
@@ -24,6 +23,7 @@ from posthog.models.scoping import team_scope
from posthog.models.team.team import Team
from posthog.temporal.oauth import ARRAY_APP_CLIENT_ID_DEV
+from products.cdp.backend.workflow_step_resume import RESULT_STRING_CAP
from products.skills.backend.models.skills import LLMSkill
from products.slack_app.backend.models import SlackChannel, SlackThreadTaskMapping
from products.tasks.backend.logic.services.workflow_tasks import (
diff --git a/products/workflows/backend/presentation/views/workflow_classifications.py b/products/workflows/backend/presentation/views/workflow_classifications.py
index 793adf2ccd41..f8b9fe633784 100644
--- a/products/workflows/backend/presentation/views/workflow_classifications.py
+++ b/products/workflows/backend/presentation/views/workflow_classifications.py
@@ -13,9 +13,9 @@ from rest_framework.request import Request
from rest_framework.response import Response
from posthog.auth import InternalAPIUser, ScopedServiceJWTAuthentication
-from posthog.cdp.flag_gated_templates import gated_template_enabled
from posthog.models import Team
+from products.cdp.backend.presentation.hog_functions import gated_template_enabled
from products.ml_inference.backend.facade.contracts import (
DEFAULT_DECISION_MODEL,
MAX_OPTIONS_PER_QUESTION,
diff --git a/products/workflows/backend/tests/api/test_hog_flow.py b/products/workflows/backend/tests/api/test_hog_flow.py
index 5dd899502411..d7efb9f4e5cb 100644
--- a/products/workflows/backend/tests/api/test_hog_flow.py
+++ b/products/workflows/backend/tests/api/test_hog_flow.py
@@ -17,7 +17,6 @@ from django.utils import timezone
from parameterized import parameterized
from rest_framework import status
-from posthog.cdp.flag_gated_templates import gated_template_enabled
from posthog.cdp.templates.fixtures import template_slack
from posthog.cdp.templates.hog_function_template import sync_template_to_db
from posthog.constants import AvailableFeature
@@ -33,6 +32,7 @@ from products.access_control.backend.models.access_control import AccessControl
from products.actions.backend.models.action import Action
from products.cdp.backend.api.test.test_hog_function_templates import MOCK_NODE_TEMPLATES
from products.cdp.backend.filters import RUNTIME_CONTRACT
+from products.cdp.backend.flag_gated_templates import gated_template_enabled
from products.cdp.backend.models.hog_functions.hog_function import HogFunction
from products.cohorts.backend.models.cohort import Cohort
from products.skills.backend.models.skills import LLMSkill
@@ -6530,7 +6530,7 @@ class TestFlagGatedTemplates(APIBaseTest):
def test_flag_eval_failure_hides_the_gated_template(self):
# A flag-service blip must hide the pre-release step, not expose it.
with patch(
- "posthog.cdp.flag_gated_templates.posthoganalytics.feature_enabled",
+ "products.cdp.backend.flag_gated_templates.posthoganalytics.feature_enabled",
side_effect=Exception("flag service down"),
):
assert gated_template_enabled("workflow-ai-task-action", self.team) is False
diff --git a/pyproject.toml b/pyproject.toml
index 5b32289b3527..633ba11b4ebe 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -595,6 +595,8 @@ ignore_imports = [
"products.cdp.backend.presentation.hog_functions -> products.cdp.backend.filters",
"products.cdp.backend.presentation.hog_functions -> products.cdp.backend.validation",
"products.cdp.backend.presentation.serializers -> products.cdp.backend.validation",
+ "products.cdp.backend.presentation.hog_functions -> products.cdp.backend.flag_gated_templates",
+ "products.cdp.backend.presentation.icons -> products.cdp.backend.services.icons",
# TODO: existing violations — fix by routing through facade
"products.alerts.backend.presentation.views.alert -> products.alerts.backend.evaluation.contract",
"products.alerts.backend.presentation.views.alert -> products.alerts.backend.evaluation.detector",