: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
chore(cdp): move hog validation and filters into products/cdp (#115436)
Harley Alexander117c4dc7047c
diff --git a/.oxfmtrc.json b/.oxfmtrc.jsonindex 5e948632f7ab..2852f9e36798 100644--- a/.oxfmtrc.json+++ b/.oxfmtrc.json@@ -148,7 +148,7 @@"services/mcp/**/generated.ts","services/mcp/src/**/*.md","services/mcp/worker-configuration.d.ts",- "posthog/cdp/filter_globals.json",+ "products/cdp/backend/filter_globals.json","posthog/emoji_search/catalog.json","products/review_hog/backend/reviewer/prompts/**/schema.json","**/chart/*/templates/**",diff --git a/frontend/src/scenes/hog-functions/email-templater/emailTemplaterLogic.tsx b/frontend/src/scenes/hog-functions/email-templater/emailTemplaterLogic.tsxindex dcbb4d3475a6..6c97f51b928a 100644--- a/frontend/src/scenes/hog-functions/email-templater/emailTemplaterLogic.tsx+++ b/frontend/src/scenes/hog-functions/email-templater/emailTemplaterLogic.tsx@@ -120,7 +120,7 @@ function exportEditorHtml(editor: Editor): Promise<{ html: string; design: JSONT* Wrap raw html in an Unlayer design holding a single custom HTML block. Emails authored* programmatically (API/MCP) often have html but no design; loading a wrapped design shows the* email in the canvas instead of a blank editor whose save would clobber the stored html.- * Mirrors build_html_wrap_design in posthog/cdp/validation.py.+ * Mirrors build_html_wrap_design in products/cdp/backend/validation.py.*/export function buildHtmlWrapDesign(html: string): JSONTemplate {// Fixed ids keep the wrap deterministic: re-wrapping the same html yields an identicaldiff --git a/nodejs/src/cdp/templates/_destinations/posthog_signals/posthog-run-scout.template.ts b/nodejs/src/cdp/templates/_destinations/posthog_signals/posthog-run-scout.template.tsindex e3d13f2f5c85..3011924a5394 100644--- a/nodejs/src/cdp/templates/_destinations/posthog_signals/posthog-run-scout.template.ts+++ b/nodejs/src/cdp/templates/_destinations/posthog_signals/posthog-run-scout.template.ts@@ -55,7 +55,7 @@ return run// A missing or unrunnable scout answers 404, deliberately NOT listed here, so a// misconfigured node fails loudly.// required (despite being hidden): the backend only fills a schema default for a- // required input (posthog/cdp/validation.py), and an API- or MCP-built step has no+ // required input (products/cdp/backend/validation.py), and an API- or MCP-built step has no// editor to pre-fill this from the template, so it would otherwise publish with the// field unset and fail its workflow on ordinary backpressure instead of skipping.key: 'non_failure_status_codes',diff --git a/nodejs/src/cdp/utils/filter-runtime.ts b/nodejs/src/cdp/utils/filter-runtime.tsindex 70b2ec5432d3..b0e93dc188ef 100644--- a/nodejs/src/cdp/utils/filter-runtime.ts+++ b/nodejs/src/cdp/utils/filter-runtime.ts@@ -7,7 +7,7 @@ import { HogFunctionInvocationGlobals, HogFunctionInvocationGlobalsWithInputs }import { convertClickhouseRawEventToFilterGlobals, convertToHogFunctionFilterGlobal } from './hog-function-filtering'/** Where Django reads the result. Relative to the repository root. */-export const FILTER_GLOBALS_RELATIVE_PATH = 'posthog/cdp/filter_globals.json'+export const FILTER_GLOBALS_RELATIVE_PATH = 'products/cdp/backend/filter_globals.json'export type FilterRuntime = {/** Data globals every filter compiled by compile_filters_bytecode is evaluated with. */diff --git a/nodejs/src/cdp/workflows-e2e.serial.test.ts b/nodejs/src/cdp/workflows-e2e.serial.test.tsindex 7777a149ff96..f49f426a9c20 100644--- a/nodejs/src/cdp/workflows-e2e.serial.test.ts+++ b/nodejs/src/cdp/workflows-e2e.serial.test.ts@@ -2371,7 +2371,7 @@ describe('Workflows E2E (postgres-v2)', () => {})describe('posthog_ticket_tags input resolves templated values per element', () => {- // Regression guard for the templating opt-in in posthog/cdp/validation.py.+ // Regression guard for the templating opt-in in products/cdp/backend/validation.py.// Reproduces the real user-reported case: a ticket tag set to// `zendesk/{variables.zendesk_ticketid}` used to ship to the runtime as// a literal placeholder string (because the type wasn't on the bytecodediff --git a/posthog/api/cohort.py b/posthog/api/cohort.pyindex 4f33f91ff0bb..28163f08d359 100644--- a/posthog/api/cohort.py+++ b/posthog/api/cohort.py@@ -46,7 +46,6 @@ from posthog.api.services.flags_service import ()from posthog.api.shared import SearchMatchTypeSerializerMixin, SerializedPersonActorSerializer, UserBasicSerializerfrom posthog.api.utils import action, paging_params, parse_actor_property_filters-from posthog.cdp.filters import build_behavioral_event_exprfrom posthog.clickhouse.query_tagging import Feature, tag_queriesfrom posthog.dataclasses import frozenfrom posthog.event_usage import report_user_action@@ -87,6 +86,7 @@ from posthog.renderers import SafeJSONRendererfrom posthog.taxonomy.hidden_events import HIDDEN_EVENT_REASON, added_hidden_eventfrom posthog.utils import format_query_params_absolute_url, str_to_bool+from products.cdp.backend.filters import build_behavioral_event_exprfrom products.cohorts.backend.models.calculation_history import CohortCalculationHistoryfrom products.cohorts.backend.models.cohort import (DEFAULT_COHORT_INSERT_BATCH_SIZE,diff --git a/posthog/cdp/site_functions.py b/posthog/cdp/site_functions.pyindex 03cf975027d9..7b3a13893737 100644--- a/posthog/cdp/site_functions.py+++ b/posthog/cdp/site_functions.py@@ -3,11 +3,10 @@ from typing import Anyfrom posthog.hogql.compiler.javascript import JavaScriptCompiler-from posthog.cdp.filters import hog_function_filters_to_expr-from posthog.cdp.validation import transpile_template_code-+from products.cdp.backend.filters import hog_function_filters_to_exprfrom products.cdp.backend.models.hog_functions.hog_function import HogFunctionfrom products.cdp.backend.models.plugin import transpile+from products.cdp.backend.validation import transpile_template_codedef exposed_secret_input_keys(hog_function: HogFunction) -> set[str]:diff --git a/posthog/cdp/templates/helpers.py b/posthog/cdp/templates/helpers.pyindex 6a9315e2e56d..25b08b159405 100644--- a/posthog/cdp/templates/helpers.py+++ b/posthog/cdp/templates/helpers.py@@ -8,10 +8,10 @@ from unittest.mock import MagicMock, patchfrom posthog.cdp.site_functions import get_transpiled_functionfrom posthog.cdp.templates.hog_function_template import HogFunctionTemplateDC, sync_template_to_db-from posthog.cdp.validation import compile_hogfrom posthog.models.utils import uuid7from products.cdp.backend.models.hog_functions.hog_function import HogFunction+from products.cdp.backend.validation import compile_hogfrom common.hogvm.python.execute import execute_bytecodefrom common.hogvm.python.stl import nowdiff --git a/posthog/cdp/templates/knock/test_knock_template.py b/posthog/cdp/templates/knock/test_knock_template.pyindex 103909634739..30b77e61f115 100644--- a/posthog/cdp/templates/knock/test_knock_template.py+++ b/posthog/cdp/templates/knock/test_knock_template.py@@ -4,7 +4,8 @@ from parameterized import parameterizedfrom posthog.cdp.templates.helpers import BaseHogFunctionTemplateTestfrom posthog.cdp.templates.knock.template_knock import template as template_knock-from posthog.cdp.validation import generate_template_bytecode++from products.cdp.backend.validation import generate_template_bytecodefrom common.hogvm.python.execute import execute_bytecodefrom common.hogvm.python.utils import HogVMExceptiondiff --git a/posthog/cdp/templates/test_cdp_templates.py b/posthog/cdp/templates/test_cdp_templates.pyindex 661b58ca2f0e..f538809c9303 100644--- a/posthog/cdp/templates/test_cdp_templates.py+++ b/posthog/cdp/templates/test_cdp_templates.py@@ -4,10 +4,10 @@ from posthog.test.base import BaseTestfrom posthog.cdp.templates import HOG_FUNCTION_TEMPLATESfrom posthog.cdp.templates.hog_function_template import sync_template_to_db-from posthog.cdp.validation import InputsSchemaItemSerializer, compile_hogfrom products.cdp.backend.models.hog_function_template import HogFunctionTemplatefrom products.cdp.backend.models.hog_functions.hog_function import TYPES_WITH_TRANSPILED_FILTERS+from products.cdp.backend.validation import InputsSchemaItemSerializer, compile_hogclass TestTemplatesGeneral(BaseTest):diff --git a/posthog/management/commands/migrate_legacy_geoip_transformations.py b/posthog/management/commands/migrate_legacy_geoip_transformations.pyindex e72ce76e8864..4ae5546b3495 100644--- a/posthog/management/commands/migrate_legacy_geoip_transformations.py+++ b/posthog/management/commands/migrate_legacy_geoip_transformations.py@@ -4,10 +4,9 @@ from django.core.management.base import BaseCommandimport structlog-from posthog.cdp.validation import compile_hog-from products.cdp.backend.models.hog_function_template import HogFunctionTemplatefrom products.cdp.backend.models.hog_functions.hog_function import HogFunction+from products.cdp.backend.validation import compile_hoglogger = structlog.get_logger(__name__)diff --git a/posthog/management/commands/refresh_hog_functions.py b/posthog/management/commands/refresh_hog_functions.pyindex cda4264491cf..d5911657f4f6 100644--- a/posthog/management/commands/refresh_hog_functions.py+++ b/posthog/management/commands/refresh_hog_functions.py@@ -7,11 +7,11 @@ from django.core.paginator import Paginatorimport structlog-from posthog.cdp.filters import DATA_WAREHOUSE_SOURCES, RUNTIME_CONTRACT, compile_filters_bytecode-from posthog.cdp.validation import generate_template_bytecodefrom posthog.dataclasses import frozen+from products.cdp.backend.filters import DATA_WAREHOUSE_SOURCES, RUNTIME_CONTRACT, compile_filters_bytecodefrom products.cdp.backend.models.hog_functions.hog_function import HogFunction+from products.cdp.backend.validation import generate_template_bytecodelogger = structlog.get_logger(__name__)diff --git a/posthog/management/commands/test/test_migrate_hooks.py b/posthog/management/commands/test/test_migrate_hooks.pyindex 5ec2ab5b6cca..baa8fe59349a 100644--- a/posthog/management/commands/test/test_migrate_hooks.py+++ b/posthog/management/commands/test/test_migrate_hooks.py@@ -1,11 +1,11 @@from posthog.test.base import BaseTest-from posthog.cdp.filters import RUNTIME_CONTRACTfrom posthog.cdp.templates.hog_function_template import sync_template_to_dbfrom posthog.cdp.templates.zapier.template_zapier import template as template_zapierfrom posthog.management.commands.migrate_hooks import migrate_hooksfrom products.actions.backend.models.action import Action+from products.cdp.backend.filters import RUNTIME_CONTRACTfrom products.cdp.backend.models.hog_functions.hog_function import HogFunctionfrom products.cdp.backend.models.hook import Hookdiff --git a/posthog/management/commands/test/test_migrate_legacy_geoip_transformations.py b/posthog/management/commands/test/test_migrate_legacy_geoip_transformations.pyindex bcc4a9c2f3a8..1df809a3b08f 100644--- a/posthog/management/commands/test/test_migrate_legacy_geoip_transformations.py+++ b/posthog/management/commands/test/test_migrate_legacy_geoip_transformations.py@@ -5,10 +5,9 @@ from unittest.mock import patchfrom django.core.management import call_command-from posthog.cdp.validation import compile_hog-from products.cdp.backend.models.hog_function_template import HogFunctionTemplatefrom products.cdp.backend.models.hog_functions.hog_function import HogFunction+from products.cdp.backend.validation import compile_hogGEOIP_TEMPLATE_CODE = """if (event.properties?.$geoip_disable or empty(event.properties?.$ip)) {diff --git a/posthog/management/commands/test/test_refresh_hog_functions.py b/posthog/management/commands/test/test_refresh_hog_functions.pyindex 8ad4fdd71db7..6401786bcd60 100644--- a/posthog/management/commands/test/test_refresh_hog_functions.py+++ b/posthog/management/commands/test/test_refresh_hog_functions.py@@ -8,11 +8,11 @@ from django.core.management import call_commandfrom parameterized import parameterized-from posthog.cdp.filters import RUNTIME_CONTRACT-from posthog.cdp.validation import generate_template_bytecodefrom posthog.models import Team+from products.cdp.backend.filters import RUNTIME_CONTRACTfrom products.cdp.backend.models.hog_functions.hog_function import HogFunction+from products.cdp.backend.validation import generate_template_bytecodeclass TestRefreshHogFunctions(BaseTest):diff --git a/posthog/management/commands/test/test_update_hog_function_code.py b/posthog/management/commands/test/test_update_hog_function_code.pyindex bb207e62c293..d48298edc935 100644--- a/posthog/management/commands/test/test_update_hog_function_code.py+++ b/posthog/management/commands/test/test_update_hog_function_code.py@@ -7,9 +7,8 @@ from django.core.management import call_commandfrom parameterized import parameterized-from posthog.cdp.validation import compile_hog as compile_hog_for_check-from products.cdp.backend.models.hog_functions.hog_function import HogFunction+from products.cdp.backend.validation import compile_hog as compile_hog_for_check# The powerplatform branch the migration must splice into stale Microsoft Teams functions.POWERPLATFORM_BRANCH = "environment.api.powerplatform.com(:443)?/powerautomate/automations/direct/(.*/)?workflows"@@ -386,7 +385,7 @@ class TestUpdateHogFunctionCode(BaseTest):self.assertIn("Failed: 1", output)self.assertIn(str(bad_function.id), output)- @patch("posthog.cdp.validation.compile_hog")+ @patch("products.cdp.backend.validation.compile_hog")def test_invalid_replace_key(self, mock_compile_hog):"""Test handling of invalid replace key."""out = StringIO()@@ -406,7 +405,7 @@ class TestUpdateHogFunctionCode(BaseTest):output = out.getvalue()self.assertIn("Invalid replace key provided: None", output)- @patch("posthog.cdp.validation.compile_hog")+ @patch("products.cdp.backend.validation.compile_hog")def test_no_matching_functions(self, mock_compile_hog):"""Test when no functions match the criteria."""# Delete all LinkedIn functionsdiff --git a/posthog/management/commands/update_hog_function_code.py b/posthog/management/commands/update_hog_function_code.pyindex 04c64920e5b5..df5ca9e7adbc 100644--- a/posthog/management/commands/update_hog_function_code.py+++ b/posthog/management/commands/update_hog_function_code.py@@ -6,9 +6,8 @@ from django.core.paginator import Paginatorimport structlog-from posthog.cdp.validation import compile_hog-from products.cdp.backend.models.hog_functions.hog_function import HogFunction+from products.cdp.backend.validation import compile_hoglogger = structlog.get_logger(__name__)diff --git a/posthog/models/group_usage_metric.py b/posthog/models/group_usage_metric.pyindex d91437768f43..8d265401f57a 100644--- a/posthog/models/group_usage_metric.py+++ b/posthog/models/group_usage_metric.py@@ -67,6 +67,6 @@ class GroupUsageMetric(UUIDModel, BytecodeModelMixin):if self.is_data_warehouse:return ast.Constant(value=True)- from posthog.cdp.filters import hog_function_filters_to_expr+ from products.cdp.backend.filters import hog_function_filters_to_exprreturn hog_function_filters_to_expr(self.filters, self.team, {})diff --git a/posthog/models/test/test_hog_function.py b/posthog/models/test/test_hog_function.pyindex 032742c72ea4..f0a7dacdcda7 100644--- a/posthog/models/test/test_hog_function.py+++ b/posthog/models/test/test_hog_function.py@@ -8,12 +8,12 @@ from django.test import TestCasefrom parameterized import parameterized-from posthog.cdp.filters import RUNTIME_CONTRACTfrom posthog.models.file_system.file_system import FileSystemfrom posthog.models.team.team import Teamfrom posthog.models.user import Userfrom products.actions.backend.models.action import Action+from products.cdp.backend.filters import RUNTIME_CONTRACTfrom products.cdp.backend.models.hog_functions.hog_function import HogFunction, HogFunctionTypefrom products.cdp.backend.tasks.hog_functions import refresh_affected_hog_functionsfrom products.cohorts.backend.models.cohort import Cohortdiff --git a/posthog/temporal/ai_observability/test_run_evaluation.py b/posthog/temporal/ai_observability/test_run_evaluation.pyindex ee2f4615045c..ff1bd7b1a090 100644--- a/posthog/temporal/ai_observability/test_run_evaluation.py+++ b/posthog/temporal/ai_observability/test_run_evaluation.py@@ -3120,7 +3120,7 @@ class TestExecuteHogEvalActivity:team = setup_data["team"]# Compile source to bytecode for the test- from posthog.cdp.validation import compile_hog+ from products.cdp.backend.validation import compile_hogbytecode = compile_hog("return true", "destination")@@ -3146,7 +3146,7 @@ class TestExecuteHogEvalActivity:async def test_hog_eval_returns_false(self, setup_data):team = setup_data["team"]- from posthog.cdp.validation import compile_hog+ from products.cdp.backend.validation import compile_hogbytecode = compile_hog("return false", "destination")@@ -3171,7 +3171,7 @@ class TestExecuteHogEvalActivity:async def test_hog_eval_non_bool_returns_skipped(self, setup_data):team = setup_data["team"]- from posthog.cdp.validation import compile_hog+ from products.cdp.backend.validation import compile_hogbytecode = compile_hog("return 42", "destination")@@ -3201,7 +3201,7 @@ class TestExecuteHogEvalActivity:async def test_hog_eval_captures_print_as_reasoning(self, setup_data):team = setup_data["team"]- from posthog.cdp.validation import compile_hog+ from products.cdp.backend.validation import compile_hogsource = "print('checking output'); return true"bytecode = compile_hog(source, "destination")@@ -3268,7 +3268,7 @@ class TestExecuteHogEvalActivity:async def test_hog_eval_accesses_globals(self, setup_data):team = setup_data["team"]- from posthog.cdp.validation import compile_hog+ from products.cdp.backend.validation import compile_hogsource = """return output == 'test output'@@ -3299,7 +3299,7 @@ class TestExecuteHogEvalActivity:async def test_hog_eval_runtime_error_returns_skipped(self, setup_data):team = setup_data["team"]- from posthog.cdp.validation import compile_hog+ from products.cdp.backend.validation import compile_hogbytecode = compile_hog("return true", "destination")@@ -3338,7 +3338,7 @@ class TestExecuteHogEvalActivity:)async def test_hog_eval_null_comparisons_evaluate_to_false(self, source):# A missing value is no match, not a runtime error, so the eval completes with a verdict.- from posthog.cdp.validation import compile_hog+ from products.cdp.backend.validation import compile_hogbytecode = compile_hog(source, "destination")evaluation = {@@ -3380,7 +3380,7 @@ class TestExecuteHogEvalActivity:ids=["invalid-regex", "list-regex-input", "array-assignment-index"],)async def test_hog_eval_vm_user_errors_return_skipped(self, source, properties, expected_reasoning):- from posthog.cdp.validation import compile_hog+ from products.cdp.backend.validation import compile_hogbytecode = compile_hog(source, "destination")evaluation = {@@ -3406,7 +3406,7 @@ class TestExecuteHogEvalActivity:@pytest.mark.asyncioasync def test_hog_eval_unexpected_error_raises(self):- from posthog.cdp.validation import compile_hog+ from products.cdp.backend.validation import compile_hogbytecode = compile_hog("return true", "destination")@@ -3779,7 +3779,7 @@ class TestEvalResultModels:class TestRunHogEvalAllowsNA:@pytest.fixture(autouse=True)def _compile(self):- from posthog.cdp.validation import compile_hog+ from products.cdp.backend.validation import compile_hogself.compile_hog = compile_hog@@ -3844,7 +3844,7 @@ class TestExecuteHogEvalActivityAllowsNA:async def test_hog_eval_null_return_with_allows_na(self, setup_data):team = setup_data["team"]- from posthog.cdp.validation import compile_hog+ from products.cdp.backend.validation import compile_hogbytecode = compile_hog("return null", "destination")@@ -3871,7 +3871,7 @@ class TestExecuteHogEvalActivityAllowsNA:async def test_hog_eval_bool_return_with_allows_na(self, setup_data):team = setup_data["team"]- from posthog.cdp.validation import compile_hog+ from products.cdp.backend.validation import compile_hogbytecode = compile_hog("return true", "destination")@@ -3898,7 +3898,7 @@ class TestExecuteHogEvalActivityAllowsNA:async def test_hog_eval_null_return_without_allows_na_returns_skipped(self, setup_data):team = setup_data["team"]- from posthog.cdp.validation import compile_hog+ from products.cdp.backend.validation import compile_hogbytecode = compile_hog("return null", "destination")@@ -4234,7 +4234,7 @@ class TestRunLocalEvaluationActivity:START_TIME = datetime(2026, 1, 1, tzinfo=UTC)def _create_hog_evaluation(self, team, source: str):- from posthog.cdp.validation import compile_hog+ from products.cdp.backend.validation import compile_hogreturn Evaluation.objects.create(team=team,diff --git a/posthog/temporal/ai_observability/test_run_session_evaluation.py b/posthog/temporal/ai_observability/test_run_session_evaluation.pyindex d2aaa3ae96cb..7981289a4ace 100644--- a/posthog/temporal/ai_observability/test_run_session_evaluation.py+++ b/posthog/temporal/ai_observability/test_run_session_evaluation.py@@ -13,7 +13,6 @@ from posthog.schema import LLMTrace, LLMTraceEventfrom posthog.hogql.constants import MAX_SELECT_TRACES_LIMIT_EXPORT-from posthog.cdp.validation import compile_hogfrom posthog.temporal.ai_observability.evaluation_hog import run_hog_eval_for_eventfrom posthog.temporal.ai_observability.evaluation_llm_judge import (ExecuteLLMJudgeInputs,@@ -45,6 +44,7 @@ from posthog.temporal.ai_observability.run_trace_evaluation import ()from products.ai_observability.backend.hog import compile_ai_observability_hog+from products.cdp.backend.validation import compile_hogFROZEN_NOW = datetime(2024, 1, 1, 12, 0, 0, tzinfo=UTC)diff --git a/posthog/temporal/ai_observability/test_run_tagger.py b/posthog/temporal/ai_observability/test_run_tagger.pyindex 08d430650651..e5e52ed553ac 100644--- a/posthog/temporal/ai_observability/test_run_tagger.py+++ b/posthog/temporal/ai_observability/test_run_tagger.py@@ -636,7 +636,7 @@ class TestRunTaggerWorkflow:def make_hog_tagger_dict(team_id: int, source: str, tags: list[dict] | None = None) -> dict:"""Build the tagger payload that the workflow passes to the Hog activity."""- from posthog.cdp.validation import compile_hog+ from products.cdp.backend.validation import compile_hogbytecode = compile_hog(source, "tagger")return {@@ -661,7 +661,7 @@ class TestRunHogTagger:return create_mock_event_data(team_id=1)def test_returns_list_of_strings(self):- from posthog.cdp.validation import compile_hog+ from products.cdp.backend.validation import compile_hogbytecode = compile_hog("return ['billing']", "tagger")@@ -671,7 +671,7 @@ class TestRunHogTagger:assert result["error"] is Nonedef test_filters_unknown_tags_against_whitelist(self):- from posthog.cdp.validation import compile_hog+ from products.cdp.backend.validation import compile_hogbytecode = compile_hog("return ['billing', 'unknown', 'analytics']", "tagger")@@ -685,7 +685,7 @@ class TestRunHogTagger:"""When tagger_config['tags'] is empty (Hog-only freeform), the source'sreturn value is taken at face value — this is the documented behaviorfor Hog taggers without a tag whitelist."""- from posthog.cdp.validation import compile_hog+ from products.cdp.backend.validation import compile_hogbytecode = compile_hog("return ['anything', 'goes']", "tagger")@@ -695,7 +695,7 @@ class TestRunHogTagger:assert result["error"] is Nonedef test_string_return_is_promoted_to_single_tag_list(self):- from posthog.cdp.validation import compile_hog+ from products.cdp.backend.validation import compile_hogbytecode = compile_hog("return 'billing'", "tagger")@@ -705,7 +705,7 @@ class TestRunHogTagger:assert result["error"] is Nonedef test_non_list_return_type_surfaces_error(self):- from posthog.cdp.validation import compile_hog+ from products.cdp.backend.validation import compile_hogbytecode = compile_hog("return 42", "tagger")@@ -716,7 +716,7 @@ class TestRunHogTagger:assert "Must return a list of tag names" in result["error"]def test_null_return_yields_empty_tags_no_error(self):- from posthog.cdp.validation import compile_hog+ from products.cdp.backend.validation import compile_hogbytecode = compile_hog("return null", "tagger")@@ -726,7 +726,7 @@ class TestRunHogTagger:assert result["error"] is Nonedef test_print_output_captured_as_reasoning(self):- from posthog.cdp.validation import compile_hog+ from products.cdp.backend.validation import compile_hogbytecode = compile_hog("print('inspecting input'); return ['billing']", "tagger")diff --git a/posthog/temporal/ai_observability/test_run_trace_evaluation.py b/posthog/temporal/ai_observability/test_run_trace_evaluation.pyindex fa57004a5a71..50a16ae300c3 100644--- a/posthog/temporal/ai_observability/test_run_trace_evaluation.py+++ b/posthog/temporal/ai_observability/test_run_trace_evaluation.py@@ -15,7 +15,6 @@ from posthog.schema import LLMTrace, LLMTraceEventfrom posthog.hogql import astfrom posthog.api.capture import CaptureInternalError-from posthog.cdp.validation import compile_hogfrom posthog.constants import AvailableFeaturefrom posthog.models import Organization, PropertyDefinition, Team, Userfrom posthog.temporal.ai_observability.run_session_evaluation import fetch_session_for_evaluation@@ -25,6 +24,7 @@ from products.access_control.backend.models.property_access_control import Propefrom products.ai_observability.backend.models.evaluation_config import EvaluationConfigfrom products.ai_observability.backend.models.evaluations import Evaluationfrom products.ai_observability.backend.models.provider_keys import LLMProviderKey+from products.cdp.backend.validation import compile_hogfrom .evaluation_hog import execute_hog_eval_bytecodefrom .evaluation_llm_judge import BooleanEvalResultdiff --git a/products/ai_observability/backend/hog.py b/products/ai_observability/backend/hog.pyindex a565a334c7b3..47af6c97fd77 100644--- a/products/ai_observability/backend/hog.py+++ b/products/ai_observability/backend/hog.py@@ -1,6 +1,6 @@from typing import Any, Literal-from posthog.cdp.validation import compile_hog+from products.cdp.backend.validation import compile_hogAIObservabilityHogType = Literal["destination", "tagger"]diff --git a/products/ai_observability/backend/models/evaluations.py b/products/ai_observability/backend/models/evaluations.pyindex e73eb064b728..649b7a00efcf 100644--- a/products/ai_observability/backend/models/evaluations.py+++ b/products/ai_observability/backend/models/evaluations.py@@ -232,7 +232,7 @@ class Evaluation(ModelActivityMixin, UUIDTModel):return [c.get("properties", []) for c in self.conditions] != [c.get("properties", []) for c in stored]def save(self, *args, **kwargs):- from posthog.cdp.filters import compile_filters_bytecode+ from products.cdp.backend.filters import compile_filters_bytecodefrom ..hog import compile_ai_observability_hog # noqa: PLC0415 - keeps Hog compiler off model import pathdiff --git a/products/ai_observability/backend/models/taggers.py b/products/ai_observability/backend/models/taggers.pyindex 4fdfd26348d7..6af854df94bd 100644--- a/products/ai_observability/backend/models/taggers.py+++ b/products/ai_observability/backend/models/taggers.py@@ -147,7 +147,7 @@ class Tagger(UUIDTModel):return self.namedef save(self, *args, **kwargs):- from posthog.cdp.filters import compile_filters_bytecode+ from products.cdp.backend.filters import compile_filters_bytecodefrom ..hog import compile_ai_observability_hog # noqa: PLC0415 - keeps Hog compiler off model import pathdiff --git a/products/ai_observability/backend/models/test/test_evaluations.py b/products/ai_observability/backend/models/test/test_evaluations.pyindex 7e926413e9b7..dc40d313660d 100644--- a/products/ai_observability/backend/models/test/test_evaluations.py+++ b/products/ai_observability/backend/models/test/test_evaluations.py@@ -51,7 +51,7 @@ class TestEvaluationModel(BaseTest):):evaluation = self._create_hog_evaluation()- with patch("posthog.cdp.filters.compile_filters_bytecode") as mock_compile:+ with patch("products.cdp.backend.filters.compile_filters_bytecode") as mock_compile:mock_compile.return_value = {"bytecode": None, "bytecode_error": "Invalid property filter"}if updates is None:evaluation.set_status(EvaluationStatus.ERROR, EvaluationStatusReason.HOG_ERROR)diff --git a/products/ai_observability/backend/models/test/test_taggers.py b/products/ai_observability/backend/models/test/test_taggers.pyindex 3092bae7aba8..bf912fbebd6d 100644--- a/products/ai_observability/backend/models/test/test_taggers.py+++ b/products/ai_observability/backend/models/test/test_taggers.py@@ -154,7 +154,7 @@ class TestTaggerModel(BaseTest):assert isinstance(tagger.conditions[0]["bytecode"], list)def test_sets_bytecode_error_when_compilation_fails(self):- with patch("posthog.cdp.filters.compile_filters_bytecode") as mock_compile:+ with patch("products.cdp.backend.filters.compile_filters_bytecode") as mock_compile:mock_compile.return_value = {"bytecode": None, "bytecode_error": "Invalid property filter"}tagger = Tagger.objects.create(diff --git a/products/ai_observability/backend/test_hog_eval_examples.py b/products/ai_observability/backend/test_hog_eval_examples.pyindex 206783bbed51..49daf9d24f25 100644--- a/products/ai_observability/backend/test_hog_eval_examples.py+++ b/products/ai_observability/backend/test_hog_eval_examples.py@@ -13,12 +13,13 @@ from parameterized import parameterizedfrom posthog.schema import LLMTrace, LLMTraceEvent-from posthog.cdp.validation import compile_hogfrom posthog.temporal.ai_observability.evaluation_hog import execute_hog_eval_bytecodefrom posthog.temporal.ai_observability.run_evaluation import run_hog_evalfrom posthog.temporal.ai_observability.run_session_evaluation import build_session_hog_globalsfrom posthog.temporal.ai_observability.run_trace_evaluation import build_trace_hog_globals+from products.cdp.backend.validation import compile_hog+EXAMPLES_PATH = Path(__file__).resolve().parents[1] / "frontend" / "evaluations" / "hogEvalExamples.json"EXAMPLES: list[dict] = json.loads(EXAMPLES_PATH.read_text())EXAMPLE_LABELS = [e["label"] for e in EXAMPLES]diff --git a/products/alerts/backend/destination_backfill.py b/products/alerts/backend/destination_backfill.pyindex 36f774cc797a..fb0d790865ec 100644--- a/products/alerts/backend/destination_backfill.py+++ b/products/alerts/backend/destination_backfill.py@@ -19,13 +19,13 @@ from django.db.models import QuerySetimport structlog-from posthog.cdp.validation import generate_template_bytecodefrom posthog.dataclasses import frozenfrom posthog.plugins.plugin_server_api import reload_hog_functions_on_workersfrom posthog.tasks.alerts.utils import INSIGHT_ALERT_FIRING_EVENTfrom products.alerts.backend.logic.insight_alert_destinations import INSIGHT_CHART_BLOCK, SLACK_TEMPLATE_IDfrom products.cdp.backend.facade.models import HogFunction+from products.cdp.backend.validation import generate_template_bytecodelogger = structlog.get_logger(__name__)diff --git a/products/cdp/backend/api/hog_function.py b/products/cdp/backend/api/hog_function.pyindex 252b1f32b051..e8dce3d577d9 100644--- a/products/cdp/backend/api/hog_function.py+++ b/products/cdp/backend/api/hog_function.py@@ -28,21 +28,8 @@ from posthog.api.log_entries import LogEntryMixinfrom posthog.api.routing import TeamAndOrgViewSetMixinfrom posthog.api.shared import SearchMatchTypeSerializerMixin, UserBasicSerializerfrom posthog.api.utils import action, log_activity_from_viewset-from posthog.cdp.filters import DATA_WAREHOUSE_SOURCESfrom posthog.cdp.services.icons import CDPIconsServicefrom posthog.cdp.site_functions import get_transpiled_function-from posthog.cdp.validation import (- DUPLICATE_INPUT_KEYS_ERROR,- HogFunctionFiltersSerializer,- InputsSchemaSerializer,- InputsSerializer,- MappingsSerializer,- added_duplicate_input_keys,- compile_hog,- generate_template_bytecode,- masked_secret_input_keys,- reserved_functions_used,-)from posthog.event_usage import AGENT_EVENT_SOURCES, get_event_sourcefrom posthog.exceptions_capture import capture_exceptionfrom posthog.helpers.impersonation import is_impersonated@@ -61,6 +48,7 @@ from posthog.scopes import APIScopeObjectfrom products.batch_exports.backend.facade import api as batch_exports_apifrom products.batch_exports.backend.facade.contracts import InvalidBatchExportFiltersfrom products.cdp.backend.api.hog_function_template import HogFunctionTemplateSerializer+from products.cdp.backend.filters import DATA_WAREHOUSE_SOURCESfrom products.cdp.backend.internal_events import (generic_api_editable_alert_scope,is_managed_alert_internal_event,@@ -82,6 +70,18 @@ from products.cdp.backend.presentation.hog_invocations.rerun import (HogInvocationRerunRequestSerializer,HogInvocationRerunResponseSerializer,)+from products.cdp.backend.validation import (+ DUPLICATE_INPUT_KEYS_ERROR,+ HogFunctionFiltersSerializer,+ InputsSchemaSerializer,+ InputsSerializer,+ MappingsSerializer,+ added_duplicate_input_keys,+ compile_hog,+ generate_template_bytecode,+ masked_secret_input_keys,+ reserved_functions_used,+)# Maximum size of HOG code as a string in bytes (100KB)MAX_HOG_CODE_SIZE_BYTES = 100 * 1024@@ -195,7 +195,7 @@ def _named_warehouse_tables(entries: Any) -> list[Any]:"""The warehouse tables a filters blob actually names, ignoring the picker's placeholder row.Matches the placeholder rule `HogFunctionFiltersSerializer.validate` applies moments later- (posthog/cdp/validation.py): it drops any entry named "Select a table" outright, regardless of+ (products/cdp/backend/validation.py): it drops any entry named "Select a table" outright, regardless ofwhether that entry also carries a `table_name`. Checking `table_name` alone here would accept`{"name": "Select a table", "table_name": "x"}` — the serializer would still strip it a momentlater, leaving `data_warehouse: []` stored despite this check having passed.diff --git a/products/cdp/backend/api/test/test_hog_function.py b/products/cdp/backend/api/test/test_hog_function.pyindex 8cde4005fb26..7d0bb0d53a27 100644--- a/products/cdp/backend/api/test/test_hog_function.py+++ b/products/cdp/backend/api/test/test_hog_function.py@@ -10,7 +10,6 @@ from django.db import connectionfrom parameterized import parameterizedfrom rest_framework import status-from posthog.cdp.filters import RUNTIME_CONTRACTfrom posthog.cdp.templates.fixtures import template_slackfrom posthog.cdp.templates.helpers import mock_transpilefrom posthog.cdp.templates.hog_function_template import sync_template_to_db@@ -24,6 +23,7 @@ from products.cdp.backend.api.hog_function import (comparable_content,)from products.cdp.backend.api.test.test_hog_function_templates import MOCK_NODE_TEMPLATES+from products.cdp.backend.filters import RUNTIME_CONTRACTfrom products.cdp.backend.models.hog_function_template import HogFunctionTemplatefrom products.cdp.backend.models.hog_functions.hog_function import DEFAULT_STATE, HogFunction, HogFunctionStatefrom products.cohorts.backend.models.cohort import Cohortdiff --git a/products/cdp/backend/api/test/test_hooks.py b/products/cdp/backend/api/test/test_hooks.pyindex 5bfd544de77d..e736a52fe23b 100644--- a/products/cdp/backend/api/test/test_hooks.py+++ b/products/cdp/backend/api/test/test_hooks.py@@ -4,12 +4,12 @@ from typing import Anyimport pytestfrom posthog.test.base import ClickhouseTestMixin-from posthog.cdp.filters import RUNTIME_CONTRACTfrom posthog.cdp.templates.hog_function_template import sync_template_to_dbfrom posthog.cdp.templates.zapier.template_zapier import template as template_zapierfrom products.actions.backend.models.action import Actionfrom products.cdp.backend.api.hooks import create_zapier_hog_function, valid_domain+from products.cdp.backend.filters import RUNTIME_CONTRACTfrom products.cdp.backend.models.hog_functions.hog_function import HogFunctionfrom products.cdp.backend.models.hook import Hookdiff --git a/products/cdp/backend/api/test/test_plugin.py b/products/cdp/backend/api/test/test_plugin.pyindex 64408e1f9993..8491e146b67c 100644--- a/products/cdp/backend/api/test/test_plugin.py+++ b/products/cdp/backend/api/test/test_plugin.py@@ -15,7 +15,6 @@ from django.test import override_settingsfrom rest_framework import status-from posthog.cdp.filters import RUNTIME_CONTRACTfrom posthog.cdp.templates.helpers import mock_transpilefrom posthog.cdp.templates.hog_function_template import sync_template_to_dbfrom posthog.constants import FROZEN_POSTHOG_VERSION@@ -27,6 +26,7 @@ from posthog.plugins.test.mock import mocked_plugin_github_request, mocked_plugifrom posthog.plugins.test.plugin_archives import HELLO_WORLD_PLUGIN_GITHUB_ATTACHMENT_ZIP, HELLO_WORLD_PLUGIN_GITHUB_ZIPfrom products.cdp.backend.api.test.test_hog_function_templates import MOCK_NODE_TEMPLATES+from products.cdp.backend.filters import RUNTIME_CONTRACTfrom products.cdp.backend.models.hog_functions.hog_function import HogFunctionfrom products.cdp.backend.models.plugin import Plugin, PluginConfig, PluginSourceFilediff --git a/posthog/cdp/filter_globals.json b/products/cdp/backend/filter_globals.jsonsimilarity index 100%rename from posthog/cdp/filter_globals.jsonrename to products/cdp/backend/filter_globals.jsondiff --git a/posthog/cdp/filters.py b/products/cdp/backend/filters.pysimilarity index 100%rename from posthog/cdp/filters.pyrename to products/cdp/backend/filters.pydiff --git a/products/cdp/backend/max_tools.py b/products/cdp/backend/max_tools.pyindex 8dee549dec28..16487b336612 100644--- a/products/cdp/backend/max_tools.py+++ b/products/cdp/backend/max_tools.py@@ -9,8 +9,6 @@ from pydantic import BaseModel, Fieldfrom posthog.hogql import errors as hogql_errorsfrom posthog.hogql.parser import parse_program-from posthog.cdp.validation import compile_hog-from products.cdp.backend.prompts import (DESTINATION_LIMITATIONS_MESSAGE,HOG_EXAMPLE_MESSAGE,@@ -25,6 +23,7 @@ from products.cdp.backend.prompts import (TRANSFORMATION_STRUCTURE_MESSAGE,render_filters_system_prompt,)+from products.cdp.backend.validation import compile_hogfrom ee.hogai.chat_agent.schema_generator.parsers import PydanticOutputParserExceptionfrom ee.hogai.llm import MaxChatOpenAIdiff --git a/products/cdp/backend/models/hog_function_template.py b/products/cdp/backend/models/hog_function_template.pyindex 83e8a7aba0ac..897fff413aae 100644--- a/products/cdp/backend/models/hog_function_template.py+++ b/products/cdp/backend/models/hog_function_template.py@@ -136,7 +136,7 @@ class HogFunctionTemplate(UUIDTModel):self.bytecode = Nonereturntry:- from posthog.cdp.validation import compile_hog+ from products.cdp.backend.validation import compile_hog# Compile the hog code_language to bytecode and store it in the database fieldself.bytecode = compile_hog(self.code, self.type)diff --git a/products/cdp/backend/models/hog_functions/hog_function.py b/products/cdp/backend/models/hog_functions/hog_function.pyindex 09475222256b..7fa912188c07 100644--- a/products/cdp/backend/models/hog_functions/hog_function.py+++ b/products/cdp/backend/models/hog_functions/hog_function.py@@ -290,7 +290,7 @@ class HogFunction(FileSystemSyncMixin, UUIDTModel):return absolute_uri(f"/project/{self.team_id}/pipeline/destinations/hog-{str(self.id)}")def _compile_filters(self) -> dict:- from posthog.cdp.filters import compile_filters_bytecode+ from products.cdp.backend.filters import compile_filters_bytecodecompiled = compile_filters_bytecode(self.filters, self.team)if not compiled.get("bytecode_error"):diff --git a/products/cdp/backend/presentation/hog_functions.py b/products/cdp/backend/presentation/hog_functions.pyindex 8ce43a55b232..f54ceb48328f 100644--- a/products/cdp/backend/presentation/hog_functions.py+++ b/products/cdp/backend/presentation/hog_functions.py@@ -5,15 +5,16 @@ the helpers that workflows and messaging views use cross here. Their signaturesreturn untyped bytecode, so they cannot cross through the facade."""-from posthog.cdp.filters import (- DATA_WAREHOUSE_SOURCES as DATA_WAREHOUSE_SOURCES,- compile_filters_expr as compile_filters_expr,-)from posthog.cdp.flag_gated_templates import (FLAG_GATED_TEMPLATE_IDS as FLAG_GATED_TEMPLATE_IDS,gated_template_enabled as gated_template_enabled,)-from posthog.cdp.validation import (++from products.cdp.backend.filters import (+ DATA_WAREHOUSE_SOURCES as DATA_WAREHOUSE_SOURCES,+ compile_filters_expr as compile_filters_expr,+)+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/serializers.py b/products/cdp/backend/presentation/serializers.pyindex 98d36d3931b8..833b00a2c339 100644--- a/products/cdp/backend/presentation/serializers.py+++ b/products/cdp/backend/presentation/serializers.py@@ -3,7 +3,7 @@A facade must not hand out DRF classes, so these cross through presentation instead."""-from posthog.cdp.validation import (+from products.cdp.backend.validation import (HogFunctionFiltersSerializer as HogFunctionFiltersSerializer,InputsSchemaSerializer as InputsSchemaSerializer,InputsSerializer as InputsSerializer,diff --git a/products/cdp/backend/tasks/hog_functions.py b/products/cdp/backend/tasks/hog_functions.pyindex aad007930f58..e033c41c714b 100644--- a/products/cdp/backend/tasks/hog_functions.py+++ b/products/cdp/backend/tasks/hog_functions.py@@ -78,9 +78,9 @@ def refresh_affected_hog_functions(actions_by_id = {action.id: action for action in all_related_actions}- # posthog.cdp.filters pulls hogql.property and with it the HogQL/schema layer;+ # products.cdp.backend.filters pulls hogql.property and with it the HogQL/schema layer;# posthog.apps ready() imports this module in every process at setup.- from posthog.cdp.filters import compile_filters_bytecode # noqa: PLC0415 — keeps HogQL off the import path+ from products.cdp.backend.filters import compile_filters_bytecode # noqa: PLC0415 — keeps HogQL off the import pathsuccessfully_compiled_hog_functions = []for hog_function in affected_hog_functions:diff --git a/posthog/cdp/test/test_filters.py b/products/cdp/backend/test/test_filters.pysimilarity index 99%rename from posthog/cdp/test/test_filters.pyrename to products/cdp/backend/test/test_filters.pyindex 710a13c04670..25f7165449e5 100644--- a/posthog/cdp/test/test_filters.py+++ b/products/cdp/backend/test/test_filters.py@@ -7,15 +7,14 @@ from parameterized import parameterizedfrom posthog.hogql.compiler.bytecode import create_bytecode-from posthog.cdp.filters import (+from products.actions.backend.models.action import Action+from products.cdp.backend.filters import (RUNTIME_CONTRACT,build_behavioral_event_expr,cohort_filters_to_expr,compile_filters_bytecode,hog_function_filters_to_expr,)--from products.actions.backend.models.action import Actionfrom products.cohorts.backend.models.cohort import Cohortfrom common.hogvm.python.execute import execute_bytecodediff --git a/posthog/cdp/test/test_validation.py b/products/cdp/backend/test/test_validation.pysimilarity index 99%rename from posthog/cdp/test/test_validation.pyrename to products/cdp/backend/test/test_validation.pyindex 6c874e4853e0..fc945aea3cc9 100644--- a/posthog/cdp/test/test_validation.py+++ b/products/cdp/backend/test/test_validation.py@@ -10,8 +10,10 @@ from rest_framework.exceptions import ValidationErrorfrom posthog.hogql import ast-from posthog.cdp.filters import RUNTIME_CONTRACT-from posthog.cdp.validation import (+from posthog.models.integration import Integration++from products.cdp.backend.filters import RUNTIME_CONTRACT+from products.cdp.backend.validation import (FunctionInputsSerializer,HogFunctionFiltersSerializer,InputsSchemaItemSerializer,@@ -21,8 +23,6 @@ from posthog.cdp.validation import (generate_template_bytecode,reserved_functions_used,)-from posthog.models.integration import Integration-from products.messaging.backend.facade.api import validate_designfrom common.hogvm.python.operation import HOGQL_BYTECODE_VERSIONdiff --git a/posthog/cdp/validation.py b/products/cdp/backend/validation.pysimilarity index 99%rename from posthog/cdp/validation.pyrename to products/cdp/backend/validation.pyindex aef7a2de8d84..cd7cce79ea59 100644--- a/posthog/cdp/validation.py+++ b/products/cdp/backend/validation.py@@ -16,7 +16,9 @@ from posthog.hogql.context import HogQLContextfrom posthog.hogql.parser import parse_program, parse_string_templatefrom posthog.hogql.visitor import TraversingVisitor-from posthog.cdp.filters import (+from posthog.models.integration import POSTHOG_CONNECT_KIND, Integration++from products.cdp.backend.filters import (DATA_WAREHOUSE_SOURCES,FILTER_FUNCTIONS,RUNTIME_CONTRACT,@@ -25,8 +27,6 @@ from posthog.cdp.filters import (compile_filters_bytecode,compile_filters_expr,)-from posthog.models.integration import POSTHOG_CONNECT_KIND, Integration-from products.cdp.backend.models.hog_functions.hog_function import (TYPES_WITH_JAVASCRIPT_SOURCE,TYPES_WITH_TRANSPILED_FILTERS,diff --git a/products/error_tracking/backend/logic/alerts.py b/products/error_tracking/backend/logic/alerts.pyindex 52f417e395d1..68197e9380d7 100644--- a/products/error_tracking/backend/logic/alerts.py+++ b/products/error_tracking/backend/logic/alerts.py@@ -8,13 +8,13 @@ from django.db.models import QuerySetimport structlog-from posthog.cdp.filters import compile_filters_bytecodefrom posthog.models.integration import Integrationfrom posthog.models.scoping.manager import resolve_effective_team_idfrom posthog.models.team.team import Teamfrom posthog.models.user import Userfrom posthog.ph_client import feature_enabled_or_false+from products.cdp.backend.filters import compile_filters_bytecodefrom products.error_tracking.backend.models import ErrorTrackingAlert, ErrorTrackingAlertDestinationlogger = structlog.get_logger(__name__)diff --git a/products/error_tracking/backend/models.py b/products/error_tracking/backend/models.pyindex 407117058622..714158e2cd2e 100644--- a/products/error_tracking/backend/models.py+++ b/products/error_tracking/backend/models.py@@ -986,7 +986,7 @@ class ErrorTrackingAlert(TeamScopedRootMixin, UUIDTModel):enabled = models.BooleanField(default=True)triggers = models.JSONField(default=list) # list of Trigger values# Same property-filter shape hog functions store, with the compiled HogQL bytecode- # embedded under "bytecode" (see posthog.cdp.filters.compile_filters_bytecode).+ # embedded under "bytecode" (see products.cdp.backend.filters.compile_filters_bytecode).filters = models.JSONField(default=dict, blank=True)# Minimum seconds between thread-opening notifications per (alert, issue).# Replies into an existing thread are never throttled. 0 disables the throttle.diff --git a/products/error_tracking/backend/tests/test_alert_delivery.py b/products/error_tracking/backend/tests/test_alert_delivery.pyindex 74469018977d..d89e6cb2d19a 100644--- a/products/error_tracking/backend/tests/test_alert_delivery.py+++ b/products/error_tracking/backend/tests/test_alert_delivery.py@@ -17,11 +17,11 @@ from slack_sdk.web.slack_response import SlackResponsefrom temporalio.common import WorkflowIDReusePolicyfrom temporalio.exceptions import ApplicationError, WorkflowAlreadyStartedError-from posthog.cdp.filters import compile_filters_bytecodefrom posthog.models.integration import Integrationfrom posthog.models.scoping import team_scopefrom posthog.redis import get_client+from products.cdp.backend.filters import compile_filters_bytecodefrom products.error_tracking.backend.logic.alerts import MAX_THROTTLE_SECONDS, update_alertfrom products.error_tracking.backend.models import ErrorTrackingAlert, ErrorTrackingAlertThread, ErrorTrackingIssuefrom products.error_tracking.backend.tasks.tasks import dispatch_error_tracking_alert_deliveriesdiff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/browse_ai/tests/test_browse_ai_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/browse_ai/tests/test_browse_ai_source.pyindex 6ff4050bb801..a6e3218805e4 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/browse_ai/tests/test_browse_ai_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/browse_ai/tests/test_browse_ai_source.py@@ -6,8 +6,7 @@ from unittest.mock import Mockimport requests_mock-from posthog.cdp.validation import compile_hog-+from products.cdp.backend.validation import compile_hogfrom products.warehouse_sources.backend.temporal.data_imports.sources.browse_ai.settings import BASE_URLfrom products.warehouse_sources.backend.temporal.data_imports.sources.browse_ai.source import BrowseAISourcefrom products.warehouse_sources.backend.temporal.data_imports.sources.generated_configs.browseai import (diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/fintoc/tests/test_fintoc.py b/products/warehouse_sources/backend/temporal/data_imports/sources/fintoc/tests/test_fintoc.pyindex 93871e2c13b3..a93d131f0922 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/fintoc/tests/test_fintoc.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/fintoc/tests/test_fintoc.py@@ -12,8 +12,7 @@ from unittest.mock import MagicMockimport pyarrow as pafrom requests import HTTPError, PreparedRequest-from posthog.cdp.validation import compile_hog-+from products.cdp.backend.validation import compile_hogfrom products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.rest_client import (RESTClientRetryableError,)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/paymongo/tests/test_paymongo_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/paymongo/tests/test_paymongo_source.pyindex 030dc6ab7de6..98a4b36b2200 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/paymongo/tests/test_paymongo_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/paymongo/tests/test_paymongo_source.py@@ -7,8 +7,7 @@ from typing import Anyimport pytestfrom unittest.mock import MagicMock-from posthog.cdp.validation import compile_hog-+from products.cdp.backend.validation import compile_hogfrom products.warehouse_sources.backend.temporal.data_imports.sources.common.schema import UnknownResourceErrorfrom products.warehouse_sources.backend.temporal.data_imports.sources.common.testing import (ScriptedResponse,diff --git a/products/workflows/backend/test/test_github_trigger_filters.py b/products/workflows/backend/test/test_github_trigger_filters.pyindex b65b1a14fda2..c6e4c23981b7 100644--- a/products/workflows/backend/test/test_github_trigger_filters.py+++ b/products/workflows/backend/test/test_github_trigger_filters.py@@ -7,7 +7,7 @@ from parameterized import parameterizedfrom posthog.hogql.compiler.bytecode import create_bytecode-from posthog.cdp.filters import hog_function_filters_to_expr+from products.cdp.backend.filters import hog_function_filters_to_exprfrom common.hogvm.python.execute import execute_bytecodediff --git a/products/workflows/backend/test/test_refresh_hog_flows.py b/products/workflows/backend/test/test_refresh_hog_flows.pyindex dfba81496511..2d0d09ad370f 100644--- a/products/workflows/backend/test/test_refresh_hog_flows.py+++ b/products/workflows/backend/test/test_refresh_hog_flows.py@@ -9,11 +9,11 @@ from django.core.management import call_commandfrom parameterized import parameterized-from posthog.cdp.filters import RUNTIME_CONTRACTfrom posthog.cdp.templates.hog_function_template import sync_template_to_dbfrom posthog.models import Teamfrom products.cdp.backend.api.test.test_hog_function_templates import MOCK_NODE_TEMPLATES+from products.cdp.backend.filters import RUNTIME_CONTRACTfrom products.workflows.backend.models.hog_flow.hog_flow import HogFlowdiff --git a/products/workflows/backend/test/test_slack_trigger_filters.py b/products/workflows/backend/test/test_slack_trigger_filters.pyindex b51b7007e35b..a91bff0881cc 100644--- a/products/workflows/backend/test/test_slack_trigger_filters.py+++ b/products/workflows/backend/test/test_slack_trigger_filters.py@@ -7,7 +7,7 @@ from parameterized import parameterizedfrom posthog.hogql.compiler.bytecode import create_bytecode-from posthog.cdp.filters import hog_function_filters_to_expr+from products.cdp.backend.filters import hog_function_filters_to_exprfrom common.hogvm.python.execute import execute_bytecodediff --git a/products/workflows/backend/tests/api/test_hog_flow.py b/products/workflows/backend/tests/api/test_hog_flow.pyindex ab145bcc5122..5dd899502411 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 timezonefrom parameterized import parameterizedfrom rest_framework import status-from posthog.cdp.filters import RUNTIME_CONTRACTfrom posthog.cdp.flag_gated_templates import gated_template_enabledfrom posthog.cdp.templates.fixtures import template_slackfrom posthog.cdp.templates.hog_function_template import sync_template_to_db@@ -33,6 +32,7 @@ from posthog.test.fixtures import create_app_metric2from products.access_control.backend.models.access_control import AccessControlfrom products.actions.backend.models.action import Actionfrom products.cdp.backend.api.test.test_hog_function_templates import MOCK_NODE_TEMPLATES+from products.cdp.backend.filters import RUNTIME_CONTRACTfrom products.cdp.backend.models.hog_functions.hog_function import HogFunctionfrom products.cohorts.backend.models.cohort import Cohortfrom products.skills.backend.models.skills import LLMSkilldiff --git a/pyproject.toml b/pyproject.tomlindex 52f3f3d7882e..5b32289b3527 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -589,6 +589,12 @@ ignore_imports = [# Allowed: presentation can import facade and itself"products.**.backend.presentation.** -> products.**.backend.facade.**","products.**.backend.presentation.** -> products.**.backend.presentation.**",+ # TODO: cdp presentation wave — the helpers, serializers and icon service other products' views+ # reuse still live in cdp internals, and products/cdp/backend/presentation/ re-exports them.+ # Move each one into presentation and delete its entry.+ "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",# 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",diff --git a/tach.toml b/tach.tomlindex 0dc2532cc36c..04630eee5459 100644--- a/tach.toml+++ b/tach.toml@@ -550,6 +550,8 @@ depends_on = ["products.dashboards","products.exports","products.workflows", "products.access_control",+ # Evaluations and taggers compile Hog through products.cdp.backend.validation and filters.+ "products.cdp",]layer = "modules"