: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(product-analytics): move trends query runners into the product (#96095)
Thomas Obermüllerffd78d9c7103
diff --git a/.agents/skills/visualizing-change-over-time/SKILL.md b/.agents/skills/visualizing-change-over-time/SKILL.mdindex 8cdfcb1f8f2d..3c7b5a5c8e47 100644--- a/.agents/skills/visualizing-change-over-time/SKILL.md+++ b/.agents/skills/visualizing-change-over-time/SKILL.md@@ -85,7 +85,7 @@ There are **two** ways to render a slope graph; which you reach for depends on t- **`ChartDisplayType.SlopeGraph`** — a first-class insight display (value`'SlopeGraph'` in `frontend/src/types.ts`), rendered by the backend`SlopeGraphTrendsQueryRunner`- (`posthog/hogql_queries/insights/trends/slope_graph_trends_query_runner.py`). It+ (`products/product_analytics/backend/hogql_queries/trends/slope_graph_trends_query_runner.py`). Ittakes a `TrendsQuery` and keeps the **first and last bucket** of the date range asthe two slope points (the last segment is dashed when it's the current,still-accumulating period). Set it via `trendsFilter.display: "SlopeGraph"`diff --git a/docs/published/handbook/engineering/databases/clickhouse-queries-new-products.md b/docs/published/handbook/engineering/databases/clickhouse-queries-new-products.mdindex e5edf04b9d66..b979b8e9e612 100644--- a/docs/published/handbook/engineering/databases/clickhouse-queries-new-products.md+++ b/docs/published/handbook/engineering/databases/clickhouse-queries-new-products.md@@ -34,7 +34,7 @@ Define your queries using backend Python query runners rather than constructingThe `QueryRunner` base class gives you:-- **Caching**: Built-in caching with configurable refresh intervals. Override [`_refresh_frequency()`](https://github.com/PostHog/posthog/blob/master/posthog/hogql_queries/insights/trends/trends_query_runner.py#L125-L142) to control how often results are refreshed. Cache keys are automatically derived from the query, team, modifiers, and timezone via `get_cache_key()`.+- **Caching**: Built-in caching with configurable refresh intervals. Override [`_refresh_frequency()`](https://github.com/PostHog/posthog/blob/master/products/product_analytics/backend/hogql_queries/trends/trends_query_runner.py#L125-L142) to control how often results are refreshed. Cache keys are automatically derived from the query, team, modifiers, and timezone via `get_cache_key()`.- **Observability**: Query execution is automatically instrumented with Prometheus metrics (`QUERY_EXECUTION_TOTAL`, `QUERY_EXECUTION_DURATION`) and PostHog analytics events, giving you latency histograms and error breakdowns for free.diff --git a/posthog/hogql/database/schema/test/test_persons.py b/posthog/hogql/database/schema/test/test_persons.pyindex ff6dc1d2ff69..7b83ada891df 100644--- a/posthog/hogql/database/schema/test/test_persons.py+++ b/posthog/hogql/database/schema/test/test_persons.py@@ -37,12 +37,12 @@ from posthog.hogql.query import execute_hogql_queryfrom posthog.clickhouse.client.execute import sync_executefrom posthog.hogql_queries.actors_query_runner import ActorsQueryRunner-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunnerfrom posthog.models.person.util import create_personfrom posthog.uuidt import UUIDTfrom products.cohorts.backend.models.cohort import Cohortfrom products.cohorts.backend.models.util import recalculate_cohortpeople+from products.product_analytics.backend.facade.queries import TrendsQueryRunner@patch("posthoganalytics.feature_enabled", new=Mock(return_value=True)) # for persons-inner-where-optimizationdiff --git a/posthog/hogql/database/schema/test/test_persons_revenue_analytics.py b/posthog/hogql/database/schema/test/test_persons_revenue_analytics.pyindex d24b4b5e609b..ecfe3164a0b5 100644--- a/posthog/hogql/database/schema/test/test_persons_revenue_analytics.py+++ b/posthog/hogql/database/schema/test/test_persons_revenue_analytics.py@@ -24,9 +24,8 @@ from posthog.hogql.database.schema.test.base import RevenueAnalyticsManagedViewsfrom posthog.hogql.parser import parse_selectfrom posthog.hogql.query import execute_hogql_query-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunner-from products.data_tools.backend.models.join import DataWarehouseJoin+from products.product_analytics.backend.facade.queries import TrendsQueryRunnerfrom products.revenue_analytics.backend.views.schemas.customer import SCHEMAdiff --git a/posthog/hogql/transforms/test/test_preaggregated_table_transformation.py b/posthog/hogql/transforms/test/test_preaggregated_table_transformation.pyindex 924b376f0e65..14d3cf1f77fd 100644--- a/posthog/hogql/transforms/test/test_preaggregated_table_transformation.py+++ b/posthog/hogql/transforms/test/test_preaggregated_table_transformation.py@@ -20,9 +20,9 @@ from posthog.hogql.transforms.preaggregated_table_transformation import ()from posthog.clickhouse.client import sync_execute-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunnerfrom posthog.taxonomy.taxonomy import CORE_FILTER_DEFINITIONS_BY_GROUP+from products.product_analytics.backend.facade.queries import TrendsQueryRunnerfrom products.web_analytics.backend.hogql_queries.pre_aggregated.properties import (EVENT_PROPERTY_TO_FIELD,SESSION_PROPERTY_TO_FIELD,diff --git a/posthog/hogql_queries/insight_actors_query_options_runner.py b/posthog/hogql_queries/insight_actors_query_options_runner.pyindex 8261c062b104..f912428ee3d2 100644--- a/posthog/hogql_queries/insight_actors_query_options_runner.py+++ b/posthog/hogql_queries/insight_actors_query_options_runner.py@@ -8,11 +8,14 @@ from posthog.schema import (from posthog.hogql import ast-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunnerfrom posthog.hogql_queries.query_runner import QueryRunner, get_query_runnerfrom posthog.models.filters.mixins.utils import cached_property-from products.product_analytics.backend.facade.queries import FunnelsQueryRunner, LifecycleQueryRunner+from products.product_analytics.backend.facade.queries import (+ FunnelsQueryRunner,+ LifecycleQueryRunner,+ TrendsQueryRunner,+)class InsightActorsQueryOptionsRunner(QueryRunner):diff --git a/posthog/hogql_queries/insight_actors_query_runner.py b/posthog/hogql_queries/insight_actors_query_runner.pyindex 513c7d29c194..be4f1d639f1f 100644--- a/posthog/hogql_queries/insight_actors_query_runner.py+++ b/posthog/hogql_queries/insight_actors_query_runner.py@@ -24,7 +24,6 @@ from posthog.hogql.errors import ExposedHogQLErrorfrom posthog.hogql.query import execute_hogql_queryfrom posthog.hogql.timings import HogQLTimings-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunnerfrom posthog.hogql_queries.query_runner import AnalyticsQueryRunner, QueryRunner, get_query_runnerfrom posthog.models import Teamfrom posthog.models.filters.mixins.utils import cached_property@@ -40,6 +39,7 @@ from products.product_analytics.backend.facade.queries import (PathsV2QueryRunner,RetentionQueryRunner,StickinessQueryRunner,+ TrendsQueryRunner,)diff --git a/posthog/hogql_queries/insights/__init__.py b/posthog/hogql_queries/insights/__init__.pydeleted file mode 100644index e69de29bb2d1..000000000000diff --git a/posthog/hogql_queries/insights/trends/math_functions.py b/posthog/hogql_queries/math_functions.pysimilarity index 100%rename from posthog/hogql_queries/insights/trends/math_functions.pyrename to posthog/hogql_queries/math_functions.pydiff --git a/posthog/hogql_queries/owners.yaml b/posthog/hogql_queries/owners.yamlindex b3f38f2224f4..d77940b888bc 100644--- a/posthog/hogql_queries/owners.yaml+++ b/posthog/hogql_queries/owners.yaml@@ -5,7 +5,7 @@ rules:owners: team-product-analytics- match: '/ai/'owners: team-ai-observability- - match: ['/data_warehouse_mixin.py', '/query_context.py', '/paginators.py']+ - match: ['/data_warehouse_mixin.py', '/math_functions.py', '/query_context.py', '/paginators.py']owners: team-product-analytics- match: '/document_embeddings_query_runner.py'owners: team-self-driving@@ -19,7 +19,7 @@ rules:owners: team-data-tools- match: ['/insight_actors_query_runner.py', '/insight_actors_query_options_runner.py']owners: team-product-analytics- - match: ['/insights/', '/property_values_query_runner.py']+ - match: '/property_values_query_runner.py'owners: team-product-analytics- match: ['/sessions_query_runner.py', '/sessions_timeline_query_runner.py']owners: team-analytics-platformdiff --git a/posthog/hogql_queries/query_runner.py b/posthog/hogql_queries/query_runner.pyindex 02800ae0361b..ec79c849531d 100644--- a/posthog/hogql_queries/query_runner.py+++ b/posthog/hogql_queries/query_runner.py@@ -526,7 +526,7 @@ def get_query_runner(user=user,)- from .insights.trends.calendar_heatmap_trends_query_runner import CalendarHeatmapTrendsQueryRunner+ from products.product_analytics.backend.facade.queries import CalendarHeatmapTrendsQueryRunnerreturn CalendarHeatmapTrendsQueryRunner(query=query_obj,@@ -538,7 +538,7 @@ def get_query_runner()if display_type == ChartDisplayType.BOX_PLOT:- from .insights.trends.boxplot_trends_query_runner import BoxPlotTrendsQueryRunner+ from products.product_analytics.backend.facade.queries import BoxPlotTrendsQueryRunnerreturn BoxPlotTrendsQueryRunner(query=query_obj,@@ -550,7 +550,7 @@ def get_query_runner()if display_type == ChartDisplayType.SLOPE_GRAPH:- from .insights.trends.slope_graph_trends_query_runner import SlopeGraphTrendsQueryRunner+ from products.product_analytics.backend.facade.queries import SlopeGraphTrendsQueryRunnerreturn SlopeGraphTrendsQueryRunner(query=query_obj,@@ -587,7 +587,7 @@ def get_query_runner(user=user,)- from .insights.trends.trends_query_runner import TrendsQueryRunner+ from products.product_analytics.backend.facade.queries import TrendsQueryRunnerreturn TrendsQueryRunner(query=query_obj,@@ -643,7 +643,7 @@ def get_query_runner(user=user,)if kind == "CalendarHeatmapQuery":- from .insights.trends.calendar_heatmap_query_runner import CalendarHeatmapQueryRunner+ from products.product_analytics.backend.facade.queries import CalendarHeatmapQueryRunnerreturn CalendarHeatmapQueryRunner(query=cast(CalendarHeatmapQuery | dict[str, Any], query),diff --git a/posthog/hogql_queries/test/test_dashboard_filters_overrides.py b/posthog/hogql_queries/test/test_dashboard_filters_overrides.pyindex c7a51ca8403b..16c1edf82b17 100644--- a/posthog/hogql_queries/test/test_dashboard_filters_overrides.py+++ b/posthog/hogql_queries/test/test_dashboard_filters_overrides.py@@ -11,10 +11,11 @@ from posthog.hogql_queries.apply_dashboard_filters import (apply_dashboard_filters_to_dict,resolve_effective_dashboard_filters,)-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunnerfrom posthog.hogql_queries.query_runner import QueryRunnerfrom posthog.models import Team+from products.product_analytics.backend.facade.queries import TrendsQueryRunner+_TIME_SERIES = [EventsNode(event="$pageview")]# Only core-owned runners belong here. Product-owned runners (funnels, lifecycle, paths, retention,diff --git a/posthog/hogql_queries/test/test_query_runner.py b/posthog/hogql_queries/test/test_query_runner.pyindex 914af554259b..28fe25d876ac 100644--- a/posthog/hogql_queries/test/test_query_runner.py+++ b/posthog/hogql_queries/test/test_query_runner.py@@ -65,7 +65,6 @@ from posthog.errors import ExposedCHQueryErrorfrom posthog.exceptions import ClickHouseQueryMemoryLimitExceeded, ClickHouseQuerySizeExceeded, ClickHouseQueryTimeOutfrom posthog.hogql_queries.actors_query_runner import ActorsQueryRunnerfrom posthog.hogql_queries.hogql_query_runner import HogQLQueryRunner-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunnerfrom posthog.hogql_queries.query_failure_handling import classify_failurefrom posthog.hogql_queries.query_runner import (SHARED_FORCE_BLOCKING_STALENESS_WINDOW,@@ -100,6 +99,7 @@ from posthog.slo.types import SloOutcomefrom products.access_control.backend.facade.user_access_control import UserAccessControl, UserAccessControlErrorfrom products.access_control.backend.models.access_control import AccessControlfrom products.customer_analytics.backend.facade.constants import DEFAULT_ACTIVITY_EVENT+from products.product_analytics.backend.facade.queries import TrendsQueryRunnerfrom products.revenue_analytics.backend.views.test.data.structure import REVENUE_ANALYTICS_CONFIG_SAMPLE_EVENTMARKETING_ANALYTICS_SOURCES_MAP_SAMPLE = {diff --git a/posthog/hogql_queries/utils/sampling.py b/posthog/hogql_queries/utils/sampling.pyindex 5973f5abb3aa..1a5844d783b5 100644--- a/posthog/hogql_queries/utils/sampling.py+++ b/posthog/hogql_queries/utils/sampling.py@@ -1,6 +1,6 @@from typing import Optional, Union-from posthog.hogql_queries.insights.trends.math_functions import ALL_SUPPORTED_MATH_FUNCTIONS+from posthog.hogql_queries.math_functions import ALL_SUPPORTED_MATH_FUNCTIONSdef correct_result_for_sampling(diff --git a/posthog/test/repo_invariants/dataclass_frozen_baseline.txt b/posthog/test/repo_invariants/dataclass_frozen_baseline.txtindex b0eae65d1e81..622f2da59a04 100644--- a/posthog/test/repo_invariants/dataclass_frozen_baseline.txt+++ b/posthog/test/repo_invariants/dataclass_frozen_baseline.txt@@ -1507,7 +1507,7 @@3 posthog/cdp/internal_events.py3 posthog/dags/backups.py3 posthog/hogql/compiler/bytecode.py-3 posthog/hogql_queries/insights/trends/test/test_trends_query_runner.py+3 products/product_analytics/backend/hogql_queries/trends/test/test_trends_query_runner.py3 posthog/hogql_queries/utils/test/test_time_sliced_query.py3 posthog/local_bootstrap/importer.py3 posthog/models/kafka_debug/sql.pydiff --git a/products/analytics_platform/backend/lazy_computation/tests/test_lazy_computation_executor.py b/products/analytics_platform/backend/lazy_computation/tests/test_lazy_computation_executor.pyindex 58989d26fadb..2a025f352c42 100644--- a/products/analytics_platform/backend/lazy_computation/tests/test_lazy_computation_executor.py+++ b/products/analytics_platform/backend/lazy_computation/tests/test_lazy_computation_executor.py@@ -20,7 +20,6 @@ from posthog.hogql.query import execute_hogql_queryfrom posthog.clickhouse.client import sync_executefrom posthog.clickhouse.preaggregation.sql import DISTRIBUTED_PREAGGREGATION_RESULTS_TABLE-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunnerfrom posthog.settings import HOGQL_INCREASED_MAX_EXECUTION_TIMEfrom products.analytics_platform.backend.lazy_computation.computation_notifications import (@@ -56,6 +55,7 @@ from products.analytics_platform.backend.lazy_computation.lazy_computation_execusplit_ranges_by_ttl,)from products.analytics_platform.backend.models import PreaggregationJob+from products.product_analytics.backend.facade.queries import TrendsQueryRunnerclass TestComputationJob(BaseTest):diff --git a/products/architecture.md b/products/architecture.mdindex 622718a8656c..884bf0b625ca 100644--- a/products/architecture.md+++ b/products/architecture.md@@ -106,6 +106,9 @@ These cross the boundary as classes — allowed only under all three rules:A test whose kind the scan cannot read statically counts as `drives(unresolved-kind)` against every query location it could reach, so an unreadable spelling holds the inputs instead of releasing them in silence.`hogli product:lint` keeps the location in the inputs while a line for it stands, and lets it go when none does.Nothing is declared. Move the driving tests into the product, regenerate the baseline, and the input may leave.+ A location with several subtrees may be watched one subtree at a time.+ `product_analytics` watches `backend/hogql_queries/trends/` alone, because trends is the only subtree an outside test still drives, so its funnels, retention, lifecycle, paths and stickiness runners change without re-running the suite.+ The lint reads coverage per location rather than per subtree, so nothing mechanical holds that scope yet.The other locations stay in the inputs by presence until their channel (Celery task names, Temporal workflow names, Max tool names) is read the same way.3. **Validated registration.**Registration points check `issubclass(cls, Base)` and reject anything else.diff --git a/products/cohorts/backend/models/util.py b/products/cohorts/backend/models/util.pyindex b3761c30f4aa..6c4adba377a8 100644--- a/products/cohorts/backend/models/util.py+++ b/products/cohorts/backend/models/util.py@@ -320,7 +320,7 @@ def validate_actors_query_for_cohort(query_dict: dict[str, Any]) -> None:if not isinstance(insight, dict) or insight.get("kind") != "TrendsQuery":return- from posthog.hogql_queries.insights.trends.display import ( # noqa: PLC0415 — keeps posthog.schema off the startup path+ from products.product_analytics.backend.facade.queries import ( # noqa: PLC0415 — keeps posthog.schema off the startup pathTrendsDisplay,)diff --git a/products/endpoints/backend/insight_transformers.py b/products/endpoints/backend/insight_transformers.pyindex 6549af0a2bae..65598426492c 100644--- a/products/endpoints/backend/insight_transformers.py+++ b/products/endpoints/backend/insight_transformers.py@@ -20,9 +20,11 @@ from posthog.hogql_queries.query_runner import get_query_runnerfrom posthog.models.team import Teamif TYPE_CHECKING:- from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunner-- from products.product_analytics.backend.facade.queries import LifecycleQueryRunner, RetentionQueryRunner+ from products.product_analytics.backend.facade.queries import (+ LifecycleQueryRunner,+ RetentionQueryRunner,+ TrendsQueryRunner,+ )InsightRunner = Union["LifecycleQueryRunner", "RetentionQueryRunner", "TrendsQueryRunner"]diff --git a/products/experiments/backend/hogql_queries/base_query_utils.py b/products/experiments/backend/hogql_queries/base_query_utils.pyindex 9d9a51e032b2..88455b1bc0fa 100644--- a/products/experiments/backend/hogql_queries/base_query_utils.py+++ b/products/experiments/backend/hogql_queries/base_query_utils.py@@ -28,7 +28,6 @@ from posthog.hogql.parser import parse_exprfrom posthog.hogql.property import action_to_expr, property_to_exprfrom posthog.clickhouse.query_tagging import tag_contains_user_hogql-from posthog.hogql_queries.insights.trends.aggregation_operations import ALLOWED_SESSION_MATH_PROPERTIESfrom posthog.hogql_queries.utils.query_date_range import QueryDateRangefrom posthog.models.team.team import Team@@ -40,6 +39,7 @@ from products.experiments.backend.hogql_queries.hogql_aggregation_utils import (extract_aggregation_and_inner_expr,)from products.experiments.backend.models.experiment import Experiment+from products.product_analytics.backend.facade.queries import ALLOWED_SESSION_MATH_PROPERTIESdef is_session_property_metric(source: Union[EventsNode, ActionsNode]) -> bool:diff --git a/products/experiments/backend/hogql_queries/breakdown_injector.py b/products/experiments/backend/hogql_queries/breakdown_injector.pyindex 2e9cf19b8ed0..647c918dd63c 100644--- a/products/experiments/backend/hogql_queries/breakdown_injector.py+++ b/products/experiments/backend/hogql_queries/breakdown_injector.py@@ -20,9 +20,10 @@ from posthog.schema import (from posthog.hogql import astfrom posthog.hogql.parser import parse_expr-from posthog.hogql_queries.insights.trends.utils import get_properties_chainfrom posthog.hogql_queries.utils.breakdowns import BREAKDOWN_NULL_STRING_LABEL+from products.product_analytics.backend.facade.queries import get_properties_chain+class BreakdownInjector:"""diff --git a/products/experiments/backend/hogql_queries/experiment_breakdown_attribution_query_builder.py b/products/experiments/backend/hogql_queries/experiment_breakdown_attribution_query_builder.pyindex 0a5f0d1dd776..1704c6601008 100644--- a/products/experiments/backend/hogql_queries/experiment_breakdown_attribution_query_builder.py+++ b/products/experiments/backend/hogql_queries/experiment_breakdown_attribution_query_builder.py@@ -16,13 +16,13 @@ from posthog.schema import MultipleBreakdownTypefrom posthog.hogql import astfrom posthog.hogql.parser import parse_expr-from posthog.hogql_queries.insights.trends.utils import get_properties_chainfrom posthog.hogql_queries.utils.breakdowns import BREAKDOWN_NULL_STRING_LABEL, BREAKDOWN_OTHER_STRING_LABELfrom products.experiments.backend.hogql_queries import MULTIPLE_VARIANT_KEYfrom products.experiments.backend.hogql_queries.experiment_breakdown_attribution_query_context import (ExperimentBreakdownAttributionContext,)+from products.product_analytics.backend.facade.queries import get_properties_chainclass ExperimentBreakdownAttributionQueryBuilder:diff --git a/products/experiments/backend/hogql_queries/experiment_trends_query_runner.py b/products/experiments/backend/hogql_queries/experiment_trends_query_runner.pyindex 133c4fd018a9..900740de6f1f 100644--- a/products/experiments/backend/hogql_queries/experiment_trends_query_runner.py+++ b/products/experiments/backend/hogql_queries/experiment_trends_query_runner.py@@ -33,8 +33,7 @@ from posthog.hogql import astfrom posthog.clickhouse.query_tagging import tag_queriesfrom posthog.constants import ExperimentNoResultsErrorKeys-from posthog.hogql_queries.insights.trends.math_functions import ALL_SUPPORTED_MATH_FUNCTIONS-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunner+from posthog.hogql_queries.math_functions import ALL_SUPPORTED_MATH_FUNCTIONSfrom posthog.hogql_queries.query_runner import QueryRunnerfrom products.experiments.backend.hogql_queries import CONTROL_VARIANT_KEY@@ -50,6 +49,7 @@ from products.experiments.backend.hogql_queries.trends_statistics_v2_count impor)from products.experiments.backend.hogql_queries.types import ExperimentMetricTypefrom products.experiments.backend.models.experiment import Experiment+from products.product_analytics.backend.facade.queries import TrendsQueryRunnerclass ExperimentTrendsQueryRunner(QueryRunner):diff --git a/products/model_crossing_uses_baseline.txt b/products/model_crossing_uses_baseline.txtindex 452937ec1ae9..9e6a80e763de 100644--- a/products/model_crossing_uses_baseline.txt+++ b/products/model_crossing_uses_baseline.txt@@ -679,6 +679,56 @@ product_analytics.Insight products.reminders.backend.constants in-collection 1product_analytics.Insight products.slack_app.backend.slack_link_unfurl instance-single 1product_analytics.Insight products.surveys.backend.api.survey instance-single 1product_analytics.Insight surveys.Survey.linked_insight reverse-accessor(surveys_linked_insight) 1+product_analytics:backend/hogql_queries/ ee.clickhouse.views.test.test_experiment_saved_metrics drives(TrendsQuery) 2+product_analytics:backend/hogql_queries/ posthog.api.test.dashboards.test_dashboard drives(TrendsQuery) 6+product_analytics:backend/hogql_queries/ posthog.api.test.test_alert_15_minute_interval drives(TrendsQuery) 1+product_analytics:backend/hogql_queries/ posthog.api.test.test_alert_real_time_interval drives(TrendsQuery) 1+product_analytics:backend/hogql_queries/ posthog.hogql.database.schema.test.test_persons drives(TrendsQuery) 1+product_analytics:backend/hogql_queries/ posthog.hogql.database.schema.test.test_persons drives(TrendsQueryRunner) 2+product_analytics:backend/hogql_queries/ posthog.hogql.database.schema.test.test_persons_revenue_analytics drives(TrendsQueryRunner) 2+product_analytics:backend/hogql_queries/ posthog.hogql.transforms.test.test_preaggregated_table_transformation drives(TrendsQueryRunner) 2+product_analytics:backend/hogql_queries/ posthog.hogql_queries.test.test_dashboard_filters_overrides drives(TrendsQuery) 1+product_analytics:backend/hogql_queries/ posthog.hogql_queries.test.test_dashboard_filters_overrides drives(TrendsQueryRunner) 1+product_analytics:backend/hogql_queries/ posthog.hogql_queries.test.test_insight_actors_query_runner drives(TrendsQuery) 7+product_analytics:backend/hogql_queries/ posthog.hogql_queries.test.test_query_runner drives(TrendsQuery) 4+product_analytics:backend/hogql_queries/ posthog.hogql_queries.test.test_query_runner drives(TrendsQueryRunner) 4+product_analytics:backend/hogql_queries/ posthog.tasks.alerts.test.test_alert_check_helpers drives(TrendsQuery) 1+product_analytics:backend/hogql_queries/ posthog.tasks.alerts.test.test_alert_evaluation drives(TrendsQuery) 5+product_analytics:backend/hogql_queries/ posthog.tasks.alerts.test.test_alert_subscriptions drives(TrendsQuery) 3+product_analytics:backend/hogql_queries/ posthog.tasks.alerts.test.test_metrics_alerts drives(TrendsQuery) 1+product_analytics:backend/hogql_queries/ posthog.tasks.alerts.test.test_trends_absolute_alerts drives(TrendsQuery) 2+product_analytics:backend/hogql_queries/ posthog.tasks.alerts.test.test_trends_relative_alerts drives(TrendsQuery) 1+product_analytics:backend/hogql_queries/ products.actions.backend.api.test.test_action drives(TrendsQuery) 9+product_analytics:backend/hogql_queries/ products.alerts.backend.tests.api.test_alert drives(TrendsQuery) 7+product_analytics:backend/hogql_queries/ products.analytics_platform.backend.lazy_computation.tests.test_lazy_computation_executor drives(TrendsQueryRunner) 2+product_analytics:backend/hogql_queries/ products.cohorts.backend.models.test.test_util drives(TrendsQuery) 1+product_analytics:backend/hogql_queries/ products.dashboards.backend.api.test.test_dashboard_templates drives(TrendsQuery) 2+product_analytics:backend/hogql_queries/ products.dashboards.backend.api.test.test_run_insights drives(TrendsQuery) 1+product_analytics:backend/hogql_queries/ products.data_catalog.backend.tests.test_execution drives(TrendsQuery) 2+product_analytics:backend/hogql_queries/ products.data_warehouse.backend.tests.api.test_data_warehouse drives(TrendsQuery) 1+product_analytics:backend/hogql_queries/ products.endpoints.backend.tests.test_endpoint drives(TrendsQuery) 12+product_analytics:backend/hogql_queries/ products.endpoints.backend.tests.test_endpoint_ducklake_shadow drives(TrendsQuery) 1+product_analytics:backend/hogql_queries/ products.endpoints.backend.tests.test_endpoint_execution drives(TrendsQuery) 32+product_analytics:backend/hogql_queries/ products.endpoints.backend.tests.test_endpoint_materialization drives(TrendsQuery) 10+product_analytics:backend/hogql_queries/ products.endpoints.backend.tests.test_insight_response_parity drives(TrendsQuery) 9+product_analytics:backend/hogql_queries/ products.endpoints.backend.tests.test_materialization_suggestion drives(TrendsQuery) 1+product_analytics:backend/hogql_queries/ products.endpoints.backend.tests.test_openapi_spec drives(TrendsQuery) 4+product_analytics:backend/hogql_queries/ products.endpoints.backend.tests.test_variable_materialization drives(TrendsQuery) 1+product_analytics:backend/hogql_queries/ products.experiments.backend.test.test_presentation_api drives(TrendsQuery) 1+product_analytics:backend/hogql_queries/ products.feature_flags.backend.api.test.test_feature_flag drives(TrendsQuery) 6+product_analytics:backend/hogql_queries/ products.posthog_ai.scripts.hogql_example.test.test_hogql_example drives(TrendsQuery) 3+product_analytics:backend/hogql_queries/ products.signals.backend.test.test_scout_report_api drives(TrendsQuery) 1+product_analytics:backend/hogql_queries/ products.tasks.backend.tests.test_api drives(TrendsQuery) 3+product_analytics:backend/hogql_queries/ products.web_analytics.backend.hogql_queries.test.test_first_pageview_attribution_trends drives(TrendsQuery) 2+product_analytics:backend/hogql_queries/ products.web_analytics.backend.hogql_queries.test.test_first_pageview_attribution_trends drives(TrendsQueryRunner) 2+product_analytics:backend/hogql_queries/ products.web_analytics.backend.hogql_queries.test.test_page_reports_avg_time drives(TrendsQueryRunner) 1+product_analytics:backend/hogql_queries/ products.web_analytics.backend.hogql_queries.test.test_sample_web_analytics_queries drives(TrendsQueryRunner) 3+product_analytics:backend/hogql_queries/ products.web_analytics.backend.hogql_queries.test.test_web_calendar_heatmap_lazy_precompute drives(CalendarHeatmapTrendsQueryRunner) 3+product_analytics:backend/hogql_queries/ products.web_analytics.backend.hogql_queries.test.test_web_calendar_heatmap_lazy_precompute drives(TrendsQuery) 1+product_analytics:backend/hogql_queries/ products.web_analytics.backend.hogql_queries.test.test_web_trends_lazy_precompute drives(TrendsQuery) 1+product_analytics:backend/hogql_queries/ products.web_analytics.backend.hogql_queries.test.test_web_trends_lazy_precompute drives(TrendsQueryRunner) 9+product_analytics:backend/hogql_queries/ products.web_analytics.backend.hogql_queries.test.test_web_vitals_timeseries_lazy_precompute drives(TrendsQuery) 1+product_analytics:backend/hogql_queries/ products.web_analytics.backend.hogql_queries.test.test_web_vitals_timeseries_lazy_precompute drives(TrendsQueryRunner) 1replay_vision.ReplayScanner posthog.TaggedItem.replay_scanner reverse-accessor(tagged_items) 1signals.SignalReport tasks.Task.signal_report reverse-accessor(task) 1surveys.Survey product_tours.ProductTour.linked_surveys reverse-accessor(product_tours) 1@@ -841,9 +891,6 @@ web_analytics:backend/hogql_queries/ posthog.hogql.functions.test.test_traffic_tweb_analytics:backend/hogql_queries/ posthog.hogql.functions.test.test_traffic_type_real_ua drives(CATEGORY_TO_TRAFFIC_CATEGORY) 2web_analytics:backend/hogql_queries/ posthog.hogql.transforms.test.test_preaggregated_table_transformation drives(EVENT_PROPERTY_TO_FIELD) 4web_analytics:backend/hogql_queries/ posthog.hogql.transforms.test.test_preaggregated_table_transformation drives(SESSION_PROPERTY_TO_FIELD) 4-web_analytics:backend/hogql_queries/ posthog.hogql_queries.insights.trends.test.test_trends_data_warehouse_query drives(TrendsQuery) 23-web_analytics:backend/hogql_queries/ posthog.hogql_queries.insights.trends.test.test_trends_query_builder drives(TrendsQuery) 7-web_analytics:backend/hogql_queries/ posthog.hogql_queries.insights.trends.test.test_trends_query_runner drives(TrendsQuery) 2web_analytics:backend/hogql_queries/ posthog.hogql_queries.test.test_dashboard_filters_overrides drives(TrendsQuery) 1web_analytics:backend/hogql_queries/ posthog.hogql_queries.test.test_insight_actors_query_runner drives(TrendsQuery) 7web_analytics:backend/hogql_queries/ posthog.hogql_queries.test.test_query_runner drives(TrendsQuery) 4@@ -875,6 +922,9 @@ web_analytics:backend/hogql_queries/ products.endpoints.backend.tests.test_variaweb_analytics:backend/hogql_queries/ products.experiments.backend.test.test_presentation_api drives(TrendsQuery) 1web_analytics:backend/hogql_queries/ products.feature_flags.backend.api.test.test_feature_flag drives(TrendsQuery) 6web_analytics:backend/hogql_queries/ products.posthog_ai.scripts.hogql_example.test.test_hogql_example drives(TrendsQuery) 3+web_analytics:backend/hogql_queries/ products.product_analytics.backend.hogql_queries.trends.test.test_trends_data_warehouse_query drives(TrendsQuery) 23+web_analytics:backend/hogql_queries/ products.product_analytics.backend.hogql_queries.trends.test.test_trends_query_builder drives(TrendsQuery) 7+web_analytics:backend/hogql_queries/ products.product_analytics.backend.hogql_queries.trends.test.test_trends_query_runner drives(TrendsQuery) 2web_analytics:backend/hogql_queries/ products.product_analytics.backend.tests.api.test_insight drives(TrendsQuery) 21web_analytics:backend/hogql_queries/ products.product_analytics.backend.tests.api.test_insight_metadata drives(TrendsQuery) 5web_analytics:backend/hogql_queries/ products.product_analytics.backend.tests.api.test_insight_query drives(TrendsQuery) 4diff --git a/products/product_analytics/backend/facade/queries.py b/products/product_analytics/backend/facade/queries.pyindex 2b303e319976..4e14b6f163df 100644--- a/products/product_analytics/backend/facade/queries.py+++ b/products/product_analytics/backend/facade/queries.py@@ -4,26 +4,36 @@ Facade re-exports for product analytics HogQL query runners.Core's query-runner registry (``posthog/hogql_queries/query_runner.py``) dispatcheson query ``kind`` and constructs these runners by class identity; the paths_v2presentation imports the segment-to-funnels helpers. The implementations stay in-``backend/hogql_queries/`` (the wiring location, which stays out of the-contract-check inputs while no test outside the product drives it). Runner modules+``backend/hogql_queries/`` (the wiring location; the ``trends/`` subtree stays in the+contract-check inputs while tests outside the product drive it). Runner modulespull the heavy HogQL import chain, so — like warehouse_sources' pipeline facade —names resolve lazily (PEP 562), keeping the runners off the ``django.setup()`` paththat presentation loads at startup."""+from typing import TYPE_CHECKING+_B = "products.product_analytics.backend.hogql_queries."_LAZY = {+ "ALLOWED_SESSION_MATH_PROPERTIES": "trends.aggregation_operations","PATHS_V2_OTHER": "paths_v2.path_item",+ "BoxPlotTrendsQueryRunner": "trends.boxplot_trends_query_runner",+ "CalendarHeatmapQueryRunner": "trends.calendar_heatmap_query_runner",+ "CalendarHeatmapTrendsQueryRunner": "trends.calendar_heatmap_trends_query_runner","FunnelCorrelationQueryRunner": "funnels.funnel_correlation_query_runner","FunnelsQueryRunner": "funnels.funnels_query_runner","LifecycleQueryRunner": "lifecycle.lifecycle_query_runner","PathsQueryRunner": "paths.paths_query_runner","RetentionQueryRunner": "retention.retention_query_runner","PathsV2QueryRunner": "paths_v2.paths_v2_query_runner",+ "SlopeGraphTrendsQueryRunner": "trends.slope_graph_trends_query_runner","StickinessQueryRunner": "stickiness.stickiness_query_runner",+ "TrendsDisplay": "trends.display",+ "TrendsQueryRunner": "trends.trends_query_runner","anchored_segment_to_funnels_query": "paths_v2.funnel_converter","edge_to_funnels_query": "paths_v2.funnel_converter",+ "get_properties_chain": "trends.utils","item_label": "paths_v2.path_item","resolve_step_sources": "paths_v2.path_item","step_source_for_event": "paths_v2.path_item",@@ -32,6 +42,33 @@ _LAZY = {__all__ = sorted(_LAZY)+if TYPE_CHECKING:+ # Static view for mypy and IDEs only; runtime resolves through __getattr__ below, so these+ # modules stay off the django.setup() path. The runners that other products subclass must+ # resolve to their real class here, or subclass attribute inference collapses to Any. Ruff+ # cannot see the __getattr__ use, so each import carries an F401 guard.+ from products.product_analytics.backend.hogql_queries.trends.aggregation_operations import ( # noqa: F401+ ALLOWED_SESSION_MATH_PROPERTIES,+ )+ from products.product_analytics.backend.hogql_queries.trends.boxplot_trends_query_runner import ( # noqa: F401+ BoxPlotTrendsQueryRunner,+ )+ from products.product_analytics.backend.hogql_queries.trends.calendar_heatmap_query_runner import ( # noqa: F401+ CalendarHeatmapQueryRunner,+ )+ from products.product_analytics.backend.hogql_queries.trends.calendar_heatmap_trends_query_runner import ( # noqa: F401+ CalendarHeatmapTrendsQueryRunner,+ )+ from products.product_analytics.backend.hogql_queries.trends.display import TrendsDisplay # noqa: F401+ from products.product_analytics.backend.hogql_queries.trends.slope_graph_trends_query_runner import ( # noqa: F401+ SlopeGraphTrendsQueryRunner,+ )+ from products.product_analytics.backend.hogql_queries.trends.trends_query_runner import ( # noqa: F401+ TrendsQueryRunner,+ )+ from products.product_analytics.backend.hogql_queries.trends.utils import get_properties_chain # noqa: F401++def __getattr__(name: str):module = _LAZY.get(name)if module is None:diff --git a/products/product_analytics/backend/hogql_queries/stickiness/test/test_stickiness_query_runner.py b/products/product_analytics/backend/hogql_queries/stickiness/test/test_stickiness_query_runner.pyindex 56bb33c924c4..7f8377be26bd 100644--- a/products/product_analytics/backend/hogql_queries/stickiness/test/test_stickiness_query_runner.py+++ b/products/product_analytics/backend/hogql_queries/stickiness/test/test_stickiness_query_runner.py@@ -164,14 +164,7 @@ class TestStickinessQueryRunner(ClickhouseTestMixin, APIBaseTest):def _setup_data_warehouse(self) -> str:table, _source, _credential, _df, self.cleanUpDataWarehouse = create_data_warehouse_table_from_csv(- csv_path=Path(__file__).resolve().parents[6]- / "posthog"- / "hogql_queries"- / "insights"- / "trends"- / "test"- / "data"- / "trends_data.csv",+ csv_path=Path(__file__).resolve().parents[2] / "trends" / "test" / "data" / "trends_data.csv",table_name="test_table_stickiness",table_columns={"id": {"clickhouse": "String", "hogql": "StringDatabaseField"},diff --git a/posthog/hogql_queries/insights/trends/__init__.py b/products/product_analytics/backend/hogql_queries/trends/__init__.pysimilarity index 100%rename from posthog/hogql_queries/insights/trends/__init__.pyrename to products/product_analytics/backend/hogql_queries/trends/__init__.pydiff --git a/posthog/hogql_queries/insights/trends/aggregation_operations.py b/products/product_analytics/backend/hogql_queries/trends/aggregation_operations.pysimilarity index 99%rename from posthog/hogql_queries/insights/trends/aggregation_operations.pyrename to products/product_analytics/backend/hogql_queries/trends/aggregation_operations.pyindex 7abb60bfee0b..358df714238a 100644--- a/posthog/hogql_queries/insights/trends/aggregation_operations.py+++ b/products/product_analytics/backend/hogql_queries/trends/aggregation_operations.py@@ -20,11 +20,12 @@ from posthog.hogql.placeholders import replace_placeholdersfrom posthog.clickhouse.query_tagging import tag_contains_user_hogqlfrom posthog.constants import NON_TIME_SERIES_DISPLAY_TYPESfrom posthog.hogql_queries.data_warehouse_mixin import DataWarehouseInsightQueryMixin-from posthog.hogql_queries.insights.trends.utils import is_groups_mathfrom posthog.hogql_queries.utils.aggregations import FirstTimeForUserEventsQueryAlternator, QueryAlternatorfrom posthog.hogql_queries.utils.query_date_range import QueryDateRangefrom posthog.models.team.team import Team+from products.product_analytics.backend.hogql_queries.trends.utils import is_groups_math+DEFAULT_CURRENCY_VALUE = "USD"DEFAULT_REVENUE_PROPERTY = "$revenue"diff --git a/posthog/hogql_queries/insights/trends/boxplot_trends_query_runner.py b/products/product_analytics/backend/hogql_queries/trends/boxplot_trends_query_runner.pysimilarity index 96%rename from posthog/hogql_queries/insights/trends/boxplot_trends_query_runner.pyrename to products/product_analytics/backend/hogql_queries/trends/boxplot_trends_query_runner.pyindex 420522eeb87e..7d39856ae69b 100644--- a/posthog/hogql_queries/insights/trends/boxplot_trends_query_runner.py+++ b/products/product_analytics/backend/hogql_queries/trends/boxplot_trends_query_runner.py@@ -11,12 +11,13 @@ from posthog.hogql import astfrom posthog.hogql.query import execute_hogql_queryfrom posthog.clickhouse.query_tagging import Feature, Product, tags_context-from posthog.hogql_queries.insights.trends.aggregation_operations import AggregationOperations-from posthog.hogql_queries.insights.trends.trends_query_builder import TrendsQueryBuilder-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunnerfrom posthog.hogql_queries.utils.timestamp_utils import format_label_datefrom posthog.hogql_queries.utils.utils import get_response_hogql+from products.product_analytics.backend.hogql_queries.trends.aggregation_operations import AggregationOperations+from products.product_analytics.backend.hogql_queries.trends.trends_query_builder import TrendsQueryBuilder+from products.product_analytics.backend.hogql_queries.trends.trends_query_runner import TrendsQueryRunner+class BoxPlotTrendsQueryRunner(TrendsQueryRunner):def _calculate(self):diff --git a/posthog/hogql_queries/insights/trends/breakdown.py b/products/product_analytics/backend/hogql_queries/trends/breakdown.pysimilarity index 99%rename from posthog/hogql_queries/insights/trends/breakdown.pyrename to products/product_analytics/backend/hogql_queries/trends/breakdown.pyindex 29d083c6379f..281257e1412b 100644--- a/posthog/hogql_queries/insights/trends/breakdown.py+++ b/products/product_analytics/backend/hogql_queries/trends/breakdown.py@@ -22,8 +22,6 @@ from posthog.hogql.property import apply_path_cleaningfrom posthog.hogql.timings import HogQLTimingsfrom posthog.clickhouse.query_tagging import tag_contains_user_hogql-from posthog.hogql_queries.insights.trends.display import TrendsDisplay-from posthog.hogql_queries.insights.trends.utils import get_properties_chainfrom posthog.hogql_queries.utils.breakdowns import (BREAKDOWN_NULL_STRING_LABEL,BREAKDOWN_NUMERIC_ALL_VALUES_PLACEHOLDER,@@ -36,6 +34,9 @@ from posthog.hogql_queries.utils.query_date_range import QueryDateRangefrom posthog.models.filters.mixins.utils import cached_propertyfrom posthog.models.team.team import Team+from products.product_analytics.backend.hogql_queries.trends.display import TrendsDisplay+from products.product_analytics.backend.hogql_queries.trends.utils import get_properties_chain+def hogql_to_string(expr: ast.Expr) -> ast.Call:return ast.Call(name="toString", args=[expr])diff --git a/posthog/hogql_queries/insights/trends/calendar_heatmap_query_runner.py b/products/product_analytics/backend/hogql_queries/trends/calendar_heatmap_query_runner.pysimilarity index 99%rename from posthog/hogql_queries/insights/trends/calendar_heatmap_query_runner.pyrename to products/product_analytics/backend/hogql_queries/trends/calendar_heatmap_query_runner.pyindex 8a50832c4cc7..97693ed7d466 100644--- a/posthog/hogql_queries/insights/trends/calendar_heatmap_query_runner.py+++ b/products/product_analytics/backend/hogql_queries/trends/calendar_heatmap_query_runner.py@@ -35,7 +35,6 @@ from posthog.caching.insights_api import (REAL_TIME_INSIGHT_REFRESH_INTERVAL,REDUCED_MINIMUM_INSIGHT_REFRESH_INTERVAL,)-from posthog.hogql_queries.insights.trends.series_with_extras import SeriesWithExtrasfrom posthog.hogql_queries.query_runner import AnalyticsQueryRunnerfrom posthog.hogql_queries.utils.query_date_range import QueryDateRangefrom posthog.models import Team@@ -44,6 +43,7 @@ from posthog.models.user import Userfrom products.actions.backend.models.action import Actionfrom products.event_definitions.backend.models.property_definition import PropertyDefinition+from products.product_analytics.backend.hogql_queries.trends.series_with_extras import SeriesWithExtrasfrom products.web_analytics.backend.hogql_queries.first_pageview_attribution import (first_pageview_aware_properties_to_expr,)diff --git a/posthog/hogql_queries/insights/trends/calendar_heatmap_trends_query_runner.py b/products/product_analytics/backend/hogql_queries/trends/calendar_heatmap_trends_query_runner.pysimilarity index 92%rename from posthog/hogql_queries/insights/trends/calendar_heatmap_trends_query_runner.pyrename to products/product_analytics/backend/hogql_queries/trends/calendar_heatmap_trends_query_runner.pyindex d2f55846a6e3..856a1d748208 100644--- a/posthog/hogql_queries/insights/trends/calendar_heatmap_trends_query_runner.py+++ b/products/product_analytics/backend/hogql_queries/trends/calendar_heatmap_trends_query_runner.py@@ -8,7 +8,7 @@ from posthog.schema import (TrendsQueryResponse,)-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunner+from products.product_analytics.backend.hogql_queries.trends.trends_query_runner import TrendsQueryRunnerclass CalendarHeatmapTrendsQueryRunner(TrendsQueryRunner):@@ -21,7 +21,9 @@ class CalendarHeatmapTrendsQueryRunner(TrendsQueryRunner):"""def _calculate(self):- from posthog.hogql_queries.insights.trends.calendar_heatmap_query_runner import CalendarHeatmapQueryRunner+ from products.product_analytics.backend.hogql_queries.trends.calendar_heatmap_query_runner import (+ CalendarHeatmapQueryRunner,+ )# Convert TrendsQuery to CalendarHeatmapQuery. Forward calendarHeatmapFilter as-is# so opt-in flags (e.g. bucketBySessionStart, set by the web analytics Active Hoursdiff --git a/posthog/hogql_queries/insights/trends/display.py b/products/product_analytics/backend/hogql_queries/trends/display.pysimilarity index 100%rename from posthog/hogql_queries/insights/trends/display.pyrename to products/product_analytics/backend/hogql_queries/trends/display.pydiff --git a/posthog/hogql_queries/insights/trends/series_with_extras.py b/products/product_analytics/backend/hogql_queries/trends/series_with_extras.pysimilarity index 100%rename from posthog/hogql_queries/insights/trends/series_with_extras.pyrename to products/product_analytics/backend/hogql_queries/trends/series_with_extras.pydiff --git a/posthog/hogql_queries/insights/trends/slope_graph_trends_query_runner.py b/products/product_analytics/backend/hogql_queries/trends/slope_graph_trends_query_runner.pysimilarity index 98%rename from posthog/hogql_queries/insights/trends/slope_graph_trends_query_runner.pyrename to products/product_analytics/backend/hogql_queries/trends/slope_graph_trends_query_runner.pyindex fb7530764a57..60f0af15c49f 100644--- a/posthog/hogql_queries/insights/trends/slope_graph_trends_query_runner.py+++ b/products/product_analytics/backend/hogql_queries/trends/slope_graph_trends_query_runner.py@@ -12,7 +12,7 @@ from posthog.schema import (TrendsQueryResponse,)-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunner+from products.product_analytics.backend.hogql_queries.trends.trends_query_runner import TrendsQueryRunner# Active-users maths compute each bucket from a trailing window, so they need the days *between* the# two end buckets — the two-bucket scan restriction can't be applied without starving the lookback.diff --git a/posthog/hogql_queries/insights/trends/test/__init__.py b/products/product_analytics/backend/hogql_queries/trends/test/__init__.pysimilarity index 100%rename from posthog/hogql_queries/insights/trends/test/__init__.pyrename to products/product_analytics/backend/hogql_queries/trends/test/__init__.pydiff --git a/posthog/hogql_queries/insights/trends/test/__snapshots__/test_boxplot_trends_query_runner.ambr b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_boxplot_trends_query_runner.ambrsimilarity index 100%rename from posthog/hogql_queries/insights/trends/test/__snapshots__/test_boxplot_trends_query_runner.ambrrename to products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_boxplot_trends_query_runner.ambrdiff --git a/posthog/hogql_queries/insights/trends/test/__snapshots__/test_data_warehouse_query_builder.ambr b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_data_warehouse_query_builder.ambrsimilarity index 100%rename from posthog/hogql_queries/insights/trends/test/__snapshots__/test_data_warehouse_query_builder.ambrrename to products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_data_warehouse_query_builder.ambrdiff --git a/posthog/hogql_queries/insights/trends/test/__snapshots__/test_formula.ambr b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_formula.ambrsimilarity index 100%rename from posthog/hogql_queries/insights/trends/test/__snapshots__/test_formula.ambrrename to products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_formula.ambrdiff --git a/posthog/hogql_queries/insights/trends/test/__snapshots__/test_math_property_revenue_currency_timestamp.ambr b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_math_property_revenue_currency_timestamp.ambrsimilarity index 100%rename from posthog/hogql_queries/insights/trends/test/__snapshots__/test_math_property_revenue_currency_timestamp.ambrrename to products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_math_property_revenue_currency_timestamp.ambrdiff --git a/posthog/hogql_queries/insights/trends/test/__snapshots__/test_slope_graph_trends_query_runner.ambr b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_slope_graph_trends_query_runner.ambrsimilarity index 100%rename from posthog/hogql_queries/insights/trends/test/__snapshots__/test_slope_graph_trends_query_runner.ambrrename to products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_slope_graph_trends_query_runner.ambrdiff --git a/posthog/hogql_queries/insights/trends/test/__snapshots__/test_trends.ambr b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_trends.ambrsimilarity index 100%rename from posthog/hogql_queries/insights/trends/test/__snapshots__/test_trends.ambrrename to products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_trends.ambrdiff --git a/posthog/hogql_queries/insights/trends/test/__snapshots__/test_trends_data_warehouse_query.ambr b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_trends_data_warehouse_query.ambrsimilarity index 100%rename from posthog/hogql_queries/insights/trends/test/__snapshots__/test_trends_data_warehouse_query.ambrrename to products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_trends_data_warehouse_query.ambrdiff --git a/posthog/hogql_queries/insights/trends/test/data/boxplot_data.csv b/products/product_analytics/backend/hogql_queries/trends/test/data/boxplot_data.csvsimilarity index 100%rename from posthog/hogql_queries/insights/trends/test/data/boxplot_data.csvrename to products/product_analytics/backend/hogql_queries/trends/test/data/boxplot_data.csvdiff --git a/posthog/hogql_queries/insights/trends/test/data/date32_timestamp_test.csv b/products/product_analytics/backend/hogql_queries/trends/test/data/date32_timestamp_test.csvsimilarity index 100%rename from posthog/hogql_queries/insights/trends/test/data/date32_timestamp_test.csvrename to products/product_analytics/backend/hogql_queries/trends/test/data/date32_timestamp_test.csvdiff --git a/posthog/hogql_queries/insights/trends/test/data/string_timestamp_test.csv b/products/product_analytics/backend/hogql_queries/trends/test/data/string_timestamp_test.csvsimilarity index 100%rename from posthog/hogql_queries/insights/trends/test/data/string_timestamp_test.csvrename to products/product_analytics/backend/hogql_queries/trends/test/data/string_timestamp_test.csvdiff --git a/posthog/hogql_queries/insights/trends/test/data/timestamp_test.csv b/products/product_analytics/backend/hogql_queries/trends/test/data/timestamp_test.csvsimilarity index 100%rename from posthog/hogql_queries/insights/trends/test/data/timestamp_test.csvrename to products/product_analytics/backend/hogql_queries/trends/test/data/timestamp_test.csvdiff --git a/posthog/hogql_queries/insights/trends/test/data/trends_data.csv b/products/product_analytics/backend/hogql_queries/trends/test/data/trends_data.csvsimilarity index 100%rename from posthog/hogql_queries/insights/trends/test/data/trends_data.csvrename to products/product_analytics/backend/hogql_queries/trends/test/data/trends_data.csvdiff --git a/posthog/hogql_queries/insights/trends/test/data/trends_data_bool.csv b/products/product_analytics/backend/hogql_queries/trends/test/data/trends_data_bool.csvsimilarity index 100%rename from posthog/hogql_queries/insights/trends/test/data/trends_data_bool.csvrename to products/product_analytics/backend/hogql_queries/trends/test/data/trends_data_bool.csvdiff --git a/posthog/hogql_queries/insights/trends/test/data/trends_dw_decoy_distinct_id.csv b/products/product_analytics/backend/hogql_queries/trends/test/data/trends_dw_decoy_distinct_id.csvsimilarity index 100%rename from posthog/hogql_queries/insights/trends/test/data/trends_dw_decoy_distinct_id.csvrename to products/product_analytics/backend/hogql_queries/trends/test/data/trends_dw_decoy_distinct_id.csvdiff --git a/posthog/hogql_queries/insights/trends/test/data/trends_dw_decoy_timestamp.csv b/products/product_analytics/backend/hogql_queries/trends/test/data/trends_dw_decoy_timestamp.csvsimilarity index 100%rename from posthog/hogql_queries/insights/trends/test/data/trends_dw_decoy_timestamp.csvrename to products/product_analytics/backend/hogql_queries/trends/test/data/trends_dw_decoy_timestamp.csvdiff --git a/posthog/hogql_queries/insights/trends/test/test_aggregation_operations.py b/products/product_analytics/backend/hogql_queries/trends/test/test_aggregation_operations.pysimilarity index 99%rename from posthog/hogql_queries/insights/trends/test/test_aggregation_operations.pyrename to products/product_analytics/backend/hogql_queries/trends/test/test_aggregation_operations.pyindex ac8fc337f7e9..a006670a8049 100644--- a/posthog/hogql_queries/insights/trends/test/test_aggregation_operations.py+++ b/products/product_analytics/backend/hogql_queries/trends/test/test_aggregation_operations.py@@ -16,10 +16,11 @@ from posthog.schema import (from posthog.hogql import ast-from posthog.hogql_queries.insights.trends.aggregation_operations import AggregationOperationsfrom posthog.hogql_queries.utils.query_date_range import QueryDateRangefrom posthog.models.team.team import Team+from products.product_analytics.backend.hogql_queries.trends.aggregation_operations import AggregationOperations+@pytest.mark.parametrize("math,math_property",diff --git a/posthog/hogql_queries/insights/trends/test/test_boxplot_trends_query_runner.py b/products/product_analytics/backend/hogql_queries/trends/test/test_boxplot_trends_query_runner.pysimilarity index 99%rename from posthog/hogql_queries/insights/trends/test/test_boxplot_trends_query_runner.pyrename to products/product_analytics/backend/hogql_queries/trends/test/test_boxplot_trends_query_runner.pyindex 7047d6128a47..da63a64d639d 100644--- a/posthog/hogql_queries/insights/trends/test/test_boxplot_trends_query_runner.py+++ b/products/product_analytics/backend/hogql_queries/trends/test/test_boxplot_trends_query_runner.py@@ -23,9 +23,9 @@ from posthog.schema import (TrendsQuery,)-from posthog.hogql_queries.insights.trends.boxplot_trends_query_runner import BoxPlotTrendsQueryRunnerfrom posthog.models.utils import uuid7+from products.product_analytics.backend.hogql_queries.trends.boxplot_trends_query_runner import BoxPlotTrendsQueryRunnerfrom products.warehouse_sources.backend.facade.testing import create_data_warehouse_table_from_csvTEST_BUCKET = "test_storage_bucket-posthog.hogql.datawarehouse.boxplot"diff --git a/posthog/hogql_queries/insights/trends/test/test_breakdown_limits.py b/products/product_analytics/backend/hogql_queries/trends/test/test_breakdown_limits.pysimilarity index 92%rename from posthog/hogql_queries/insights/trends/test/test_breakdown_limits.pyrename to products/product_analytics/backend/hogql_queries/trends/test/test_breakdown_limits.pyindex 882382481ca4..5414fa8f2bab 100644--- a/posthog/hogql_queries/insights/trends/test/test_breakdown_limits.py+++ b/products/product_analytics/backend/hogql_queries/trends/test/test_breakdown_limits.py@@ -3,7 +3,7 @@ from posthog.test.base import BaseTestfrom posthog.hogql import astfrom posthog.hogql.constants import BREAKDOWN_VALUE_MAX_LENGTH-from posthog.hogql_queries.insights.trends.breakdown import Breakdown+from products.product_analytics.backend.hogql_queries.trends.breakdown import Breakdownclass TestBreakdownValueTruncation(BaseTest):diff --git a/posthog/hogql_queries/insights/trends/test/test_calendar_heatmap_query_runner.py b/products/product_analytics/backend/hogql_queries/trends/test/test_calendar_heatmap_query_runner.pysimilarity index 99%rename from posthog/hogql_queries/insights/trends/test/test_calendar_heatmap_query_runner.pyrename to products/product_analytics/backend/hogql_queries/trends/test/test_calendar_heatmap_query_runner.pyindex 7b23b7f33048..ecf779f374e6 100644--- a/posthog/hogql_queries/insights/trends/test/test_calendar_heatmap_query_runner.py+++ b/products/product_analytics/backend/hogql_queries/trends/test/test_calendar_heatmap_query_runner.py@@ -14,10 +14,12 @@ from posthog.schema import (EventsNode,)-from posthog.hogql_queries.insights.trends.calendar_heatmap_query_runner import CalendarHeatmapQueryRunnerfrom posthog.models.utils import uuid7from products.actions.backend.models.action import Action+from products.product_analytics.backend.hogql_queries.trends.calendar_heatmap_query_runner import (+ CalendarHeatmapQueryRunner,+)class TestCalendarHeatmapQueryRunner(ClickhouseTestMixin, APIBaseTest):diff --git a/posthog/hogql_queries/insights/trends/test/test_formula.py b/products/product_analytics/backend/hogql_queries/trends/test/test_formula.pysimilarity index 99%rename from posthog/hogql_queries/insights/trends/test/test_formula.pyrename to products/product_analytics/backend/hogql_queries/trends/test/test_formula.pyindex a86a257bcc3e..515438689f63 100644--- a/posthog/hogql_queries/insights/trends/test/test_formula.py+++ b/products/product_analytics/backend/hogql_queries/trends/test/test_formula.py@@ -20,12 +20,12 @@ from posthog.schema import Breakdown, BreakdownFilter, MultipleBreakdownType, Trfrom posthog.hogql.errors import ExposedHogQLErrorfrom posthog.constants import TRENDS_BOLD_NUMBER, TRENDS_CUMULATIVE, TRENDS_PIE-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunnerfrom posthog.models.group.util import create_groupfrom posthog.models.utils import uuid7from posthog.test.test_utils import create_group_type_mapping_without_created_atfrom products.cohorts.backend.models.cohort import Cohort+from products.product_analytics.backend.hogql_queries.trends.trends_query_runner import TrendsQueryRunner@override_settings(IN_UNIT_TESTING=True)diff --git a/posthog/hogql_queries/insights/trends/test/test_math_property_revenue_currency_timestamp.py b/products/product_analytics/backend/hogql_queries/trends/test/test_math_property_revenue_currency_timestamp.pysimilarity index 98%rename from posthog/hogql_queries/insights/trends/test/test_math_property_revenue_currency_timestamp.pyrename to products/product_analytics/backend/hogql_queries/trends/test/test_math_property_revenue_currency_timestamp.pyindex 3df897b4152f..798f444ac916 100644--- a/posthog/hogql_queries/insights/trends/test/test_math_property_revenue_currency_timestamp.py+++ b/products/product_analytics/backend/hogql_queries/trends/test/test_math_property_revenue_currency_timestamp.py@@ -5,8 +5,7 @@ from posthog.test.base import BaseTest, ClickhouseTestMixin, snapshot_clickhousefrom posthog.schema import DataWarehouseNode, DateRange, PropertyMathType, TrendsQuery-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunner-+from products.product_analytics.backend.hogql_queries.trends.trends_query_runner import TrendsQueryRunnerfrom products.warehouse_sources.backend.facade.testing import create_data_warehouse_table_from_csvTEST_BUCKET = "test_storage_bucket-posthog.trends.datawarehouse.timestamp_handling"diff --git a/posthog/hogql_queries/insights/trends/test/test_session_level_aggregation.py b/products/product_analytics/backend/hogql_queries/trends/test/test_session_level_aggregation.pysimilarity index 98%rename from posthog/hogql_queries/insights/trends/test/test_session_level_aggregation.pyrename to products/product_analytics/backend/hogql_queries/trends/test/test_session_level_aggregation.pyindex d734dc6ae520..a81134aec400 100644--- a/posthog/hogql_queries/insights/trends/test/test_session_level_aggregation.py+++ b/products/product_analytics/backend/hogql_queries/trends/test/test_session_level_aggregation.py@@ -4,12 +4,13 @@ from posthog.test.base import BaseTestfrom posthog.schema import ChartDisplayType, EventsNode, PropertyMathType-from posthog.hogql_queries.insights.trends.aggregation_operations import (+from posthog.hogql_queries.utils.query_date_range import QueryDateRange+from posthog.models.team import Team++from products.product_analytics.backend.hogql_queries.trends.aggregation_operations import (ALLOWED_SESSION_MATH_PROPERTIES,AggregationOperations,)-from posthog.hogql_queries.utils.query_date_range import QueryDateRange-from posthog.models.team import Teamclass TestSessionLevelAggregation(BaseTest):diff --git a/posthog/hogql_queries/insights/trends/test/test_slope_graph_trends_query_runner.py b/products/product_analytics/backend/hogql_queries/trends/test/test_slope_graph_trends_query_runner.pysimilarity index 99%rename from posthog/hogql_queries/insights/trends/test/test_slope_graph_trends_query_runner.pyrename to products/product_analytics/backend/hogql_queries/trends/test/test_slope_graph_trends_query_runner.pyindex 252dd70a7828..a6b9f1b471e7 100644--- a/posthog/hogql_queries/insights/trends/test/test_slope_graph_trends_query_runner.py+++ b/products/product_analytics/backend/hogql_queries/trends/test/test_slope_graph_trends_query_runner.py@@ -21,9 +21,12 @@ from posthog.schema import (TrendsQuery,)-from posthog.hogql_queries.insights.trends.slope_graph_trends_query_runner import SlopeGraphTrendsQueryRunnerfrom posthog.models.utils import uuid7+from products.product_analytics.backend.hogql_queries.trends.slope_graph_trends_query_runner import (+ SlopeGraphTrendsQueryRunner,+)+@freeze_time("2024-06-15T12:00:00Z")class TestSlopeGraphTrendsQueryRunner(ClickhouseTestMixin, APIBaseTest):diff --git a/posthog/hogql_queries/insights/trends/test/test_trend_validation_rules.py b/products/product_analytics/backend/hogql_queries/trends/test/test_trend_validation_rules.pysimilarity index 99%rename from posthog/hogql_queries/insights/trends/test/test_trend_validation_rules.pyrename to products/product_analytics/backend/hogql_queries/trends/test/test_trend_validation_rules.pyindex b1952fda365a..eb1be9de59a8 100644--- a/posthog/hogql_queries/insights/trends/test/test_trend_validation_rules.py+++ b/products/product_analytics/backend/hogql_queries/trends/test/test_trend_validation_rules.py@@ -17,12 +17,13 @@ from posthog.schema import (TrendsQuery,)-from posthog.hogql_queries.insights.trends.trend_validation_rules import (+from posthog.hogql_queries.validation.validation import QueryValidationContext++from products.product_analytics.backend.hogql_queries.trends.trend_validation_rules import (DisallowDaysOfWeekWithSmoothing,DisallowUnsupportedPropertyMathForHistogramBreakdown,ValidateDataWarehouseBreakdown,)-from posthog.hogql_queries.validation.validation import QueryValidationContextclass TestValidateDataWarehouseBreakdown(BaseTest):diff --git a/posthog/hogql_queries/insights/trends/test/test_trends.py b/products/product_analytics/backend/hogql_queries/trends/test/test_trends.pysimilarity index 99%rename from posthog/hogql_queries/insights/trends/test/test_trends.pyrename to products/product_analytics/backend/hogql_queries/trends/test/test_trends.pyindex 9eb6a90c7b7b..cc615db3f5cd 100644--- a/posthog/hogql_queries/insights/trends/test/test_trends.py+++ b/products/product_analytics/backend/hogql_queries/trends/test/test_trends.py@@ -30,8 +30,6 @@ from rest_framework.exceptions import ValidationErrorfrom posthog.schema import TrendsQueryfrom posthog.constants import TREND_FILTER_TYPE_EVENTS, TRENDS_BAR_VALUE, TRENDS_LINEAR, TRENDS_TABLE-from posthog.hogql_queries.insights.trends.test.test_trends_persons import get_actors-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunnerfrom posthog.hogql_queries.legacy_compatibility.filter_to_query import filter_to_queryfrom posthog.models import Entity, Filter, Organization, Personfrom posthog.models.group.util import create_group@@ -46,6 +44,8 @@ from posthog.test.test_utils import create_group_type_mapping_without_created_atfrom products.actions.backend.models.action import Actionfrom products.cohorts.backend.models.cohort import Cohortfrom products.event_definitions.backend.models.property_definition import PropertyDefinition+from products.product_analytics.backend.hogql_queries.trends.test.test_trends_persons import get_actors+from products.product_analytics.backend.hogql_queries.trends.trends_query_runner import TrendsQueryRunnerdef breakdown_label(entity: Entity, value: Union[str, int]) -> dict[str, Optional[Union[str, int]]]:@@ -7604,7 +7604,7 @@ class TestTrends(ClickhouseTestMixin, APIBaseTest):with self.assertRaises(ValidationError):self._run(Filter(data={"events": [{"id": "sign up", "math": "sum"}]}), self.team)- @patch("posthog.hogql_queries.insights.trends.trends_query_runner.execute_hogql_query")+ @patch("products.product_analytics.backend.hogql_queries.trends.trends_query_runner.execute_hogql_query")def test_should_throw_exception(self, patch_sync_execute):self._create_events()patch_sync_execute.side_effect = Exception()diff --git a/posthog/hogql_queries/insights/trends/test/test_trends_actors_query_builder.py b/products/product_analytics/backend/hogql_queries/trends/test/test_trends_actors_query_builder.pysimilarity index 99%rename from posthog/hogql_queries/insights/trends/test/test_trends_actors_query_builder.pyrename to products/product_analytics/backend/hogql_queries/trends/test/test_trends_actors_query_builder.pyindex a22cd8258c16..5c00998adaca 100644--- a/posthog/hogql_queries/insights/trends/test/test_trends_actors_query_builder.py+++ b/products/product_analytics/backend/hogql_queries/trends/test/test_trends_actors_query_builder.py@@ -37,7 +37,8 @@ from posthog.hogql.transforms.lazy_tables import find_field_chainsfrom posthog.hogql.visitor import TraversingVisitorfrom posthog.constants import UNIQUE_GROUPS-from posthog.hogql_queries.insights.trends.trends_actors_query_builder import TrendsActorsQueryBuilder++from products.product_analytics.backend.hogql_queries.trends.trends_actors_query_builder import TrendsActorsQueryBuilderdefault_query = TrendsQuery(series=[EventsNode(event="$pageview")], dateRange=DateRange(date_from="-7d"))diff --git a/posthog/hogql_queries/insights/trends/test/test_trends_breakdown_empty_null_properties.py b/products/product_analytics/backend/hogql_queries/trends/test/test_trends_breakdown_empty_null_properties.pysimilarity index 98%rename from posthog/hogql_queries/insights/trends/test/test_trends_breakdown_empty_null_properties.pyrename to products/product_analytics/backend/hogql_queries/trends/test/test_trends_breakdown_empty_null_properties.pyindex 85f32310e0ec..f3500a95b951 100644--- a/posthog/hogql_queries/insights/trends/test/test_trends_breakdown_empty_null_properties.py+++ b/products/product_analytics/backend/hogql_queries/trends/test/test_trends_breakdown_empty_null_properties.py@@ -24,9 +24,10 @@ from posthog.schema import ()from posthog.hogql_queries.actors_query_runner import ActorsQueryRunner-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunnerfrom posthog.hogql_queries.utils.breakdowns import BREAKDOWN_NULL_STRING_LABEL+from products.product_analytics.backend.hogql_queries.trends.trends_query_runner import TrendsQueryRunner+@override_settings(IN_UNIT_TESTING=True)class TestTrendsBreakdownEmptyNullProperties(ClickhouseTestMixin, APIBaseTest):diff --git a/posthog/hogql_queries/insights/trends/test/test_trends_dashboard_filters.py b/products/product_analytics/backend/hogql_queries/trends/test/test_trends_dashboard_filters.pysimilarity index 99%rename from posthog/hogql_queries/insights/trends/test/test_trends_dashboard_filters.pyrename to products/product_analytics/backend/hogql_queries/trends/test/test_trends_dashboard_filters.pyindex 4523ea29934c..9c8b6b9bc17b 100644--- a/posthog/hogql_queries/insights/trends/test/test_trends_dashboard_filters.py+++ b/products/product_analytics/backend/hogql_queries/trends/test/test_trends_dashboard_filters.py@@ -25,8 +25,7 @@ from posthog.schema import (from posthog.hogql.constants import LimitContext-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunner-+from products.product_analytics.backend.hogql_queries.trends.trends_query_runner import TrendsQueryRunnerfrom products.warehouse_sources.backend.facade.models import DataWarehouseCredential, DataWarehouseTablediff --git a/posthog/hogql_queries/insights/trends/test/test_trends_data_warehouse_query.py b/products/product_analytics/backend/hogql_queries/trends/test/test_trends_data_warehouse_query.pysimilarity index 99%rename from posthog/hogql_queries/insights/trends/test/test_trends_data_warehouse_query.pyrename to products/product_analytics/backend/hogql_queries/trends/test/test_trends_data_warehouse_query.pyindex 59a841ec42c2..bb1fab907a92 100644--- a/posthog/hogql_queries/insights/trends/test/test_trends_data_warehouse_query.py+++ b/products/product_analytics/backend/hogql_queries/trends/test/test_trends_data_warehouse_query.py@@ -38,12 +38,12 @@ from posthog.hogql.modifiers import create_default_modifiers_for_teamfrom posthog.hogql.query import execute_hogql_queryfrom posthog.hogql.timings import HogQLTimings-from posthog.hogql_queries.insights.trends.trends_query_builder import TrendsQueryBuilder-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunnerfrom posthog.hogql_queries.utils.query_date_range import QueryDateRangefrom posthog.models.instance_setting import override_instance_configfrom products.data_tools.backend.models.join import DataWarehouseJoin+from products.product_analytics.backend.hogql_queries.trends.trends_query_builder import TrendsQueryBuilder+from products.product_analytics.backend.hogql_queries.trends.trends_query_runner import TrendsQueryRunnerfrom products.warehouse_sources.backend.facade.models import DataWarehouseCredential, DataWarehouseTablefrom products.warehouse_sources.backend.facade.testing import create_data_warehouse_table_from_csvdiff --git a/posthog/hogql_queries/insights/trends/test/test_trends_persons.py b/products/product_analytics/backend/hogql_queries/trends/test/test_trends_persons.pysimilarity index 100%rename from posthog/hogql_queries/insights/trends/test/test_trends_persons.pyrename to products/product_analytics/backend/hogql_queries/trends/test/test_trends_persons.pydiff --git a/posthog/hogql_queries/insights/trends/test/test_trends_query_builder.py b/products/product_analytics/backend/hogql_queries/trends/test/test_trends_query_builder.pysimilarity index 97%rename from posthog/hogql_queries/insights/trends/test/test_trends_query_builder.pyrename to products/product_analytics/backend/hogql_queries/trends/test/test_trends_query_builder.pyindex 2d91e5f38491..8fecb366b8f7 100644--- a/posthog/hogql_queries/insights/trends/test/test_trends_query_builder.py+++ b/products/product_analytics/backend/hogql_queries/trends/test/test_trends_query_builder.py@@ -20,9 +20,10 @@ from posthog.hogql.modifiers import create_default_modifiers_for_teamfrom posthog.hogql.query import execute_hogql_queryfrom posthog.hogql.timings import HogQLTimings-from posthog.hogql_queries.insights.trends.trends_query_builder import TrendsQueryBuilderfrom posthog.hogql_queries.utils.query_date_range import QueryDateRange+from products.product_analytics.backend.hogql_queries.trends.trends_query_builder import TrendsQueryBuilder+class TestTrendsQueryBuilder(BaseTest):def setUp(self):diff --git a/posthog/hogql_queries/insights/trends/test/test_trends_query_runner.py b/products/product_analytics/backend/hogql_queries/trends/test/test_trends_query_runner.pysimilarity index 99%rename from posthog/hogql_queries/insights/trends/test/test_trends_query_runner.pyrename to products/product_analytics/backend/hogql_queries/trends/test/test_trends_query_runner.pyindex 4c17544a8fc0..a80ffdd865ae 100644--- a/posthog/hogql_queries/insights/trends/test/test_trends_query_runner.py+++ b/products/product_analytics/backend/hogql_queries/trends/test/test_trends_query_runner.py@@ -66,7 +66,6 @@ from posthog.hogql.modifiers import create_default_modifiers_for_teamfrom posthog.hogql.query import execute_hogql_queryfrom posthog.clickhouse.client.execute import sync_execute-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunnerfrom posthog.hogql_queries.utils.breakdowns import (BREAKDOWN_NULL_DISPLAY,BREAKDOWN_NULL_STRING_LABEL,@@ -81,6 +80,7 @@ from posthog.test.test_utils import create_group_type_mapping_without_created_atfrom products.actions.backend.models.action import Actionfrom products.cohorts.backend.models.cohort import Cohortfrom products.event_definitions.backend.models.property_definition import PropertyDefinition+from products.product_analytics.backend.hogql_queries.trends.trends_query_runner import TrendsQueryRunner@dataclass@@ -3449,7 +3449,7 @@ class TestTrendsQueryRunner(ClickhouseTestMixin, APIBaseTest):),])- @patch("posthog.hogql_queries.insights.trends.trends_query_runner.feature_enabled_or_false")+ @patch("products.product_analytics.backend.hogql_queries.trends.trends_query_runner.feature_enabled_or_false")def test_session_property_pre_aggregation_modifier_gate(self,_name: str,@@ -3465,7 +3465,7 @@ class TestTrendsQueryRunner(ClickhouseTestMixin, APIBaseTest):)assert runner.modifiers.sessionPropertyPreAggregation is expected- @patch("posthog.hogql_queries.insights.trends.trends_query_runner.feature_enabled_or_false")+ @patch("products.product_analytics.backend.hogql_queries.trends.trends_query_runner.feature_enabled_or_false")def test_session_property_pre_aggregation_modifier_clears_on_dashboard_reapply(self, patch_feature_enabled):# apply_dashboard_filters re-runs __post_init__. The modifier must reflect the *current*# query state, not the initial one — so a session-breakdown query that gets overridden@@ -3506,7 +3506,7 @@ class TestTrendsQueryRunner(ClickhouseTestMixin, APIBaseTest):self.assertIn("Trends insights require at least one series.", str(context.exception))- @patch("posthog.hogql_queries.insights.trends.trends_query_runner.execute_hogql_query")+ @patch("products.product_analytics.backend.hogql_queries.trends.trends_query_runner.execute_hogql_query")def test_should_throw_exception(self, patch_sync_execute):patch_sync_execute.side_effect = Exception("Error thrown inside thread")diff --git a/posthog/hogql_queries/insights/trends/test/test_utils.py b/products/product_analytics/backend/hogql_queries/trends/test/test_utils.pysimilarity index 98%rename from posthog/hogql_queries/insights/trends/test/test_utils.pyrename to products/product_analytics/backend/hogql_queries/trends/test/test_utils.pyindex 7988b84cd42b..7e78932d5e96 100644--- a/posthog/hogql_queries/insights/trends/test/test_utils.py+++ b/products/product_analytics/backend/hogql_queries/trends/test/test_utils.py@@ -9,7 +9,7 @@ from posthog.schema import (PropertyMathType,)-from posthog.hogql_queries.insights.trends.utils import get_properties_chain, is_groups_math+from products.product_analytics.backend.hogql_queries.trends.utils import get_properties_chain, is_groups_mathdef test_properties_chain_person():diff --git a/posthog/hogql_queries/insights/trends/trend_validation_rules.py b/products/product_analytics/backend/hogql_queries/trends/trend_validation_rules.pysimilarity index 97%rename from posthog/hogql_queries/insights/trends/trend_validation_rules.pyrename to products/product_analytics/backend/hogql_queries/trends/trend_validation_rules.pyindex 3544559600ce..e511606ab190 100644--- a/posthog/hogql_queries/insights/trends/trend_validation_rules.py+++ b/products/product_analytics/backend/hogql_queries/trends/trend_validation_rules.py@@ -2,12 +2,15 @@ from rest_framework.exceptions import ValidationErrorfrom posthog.schema import BreakdownType, MultipleBreakdownType, PropertyMathType, TrendsQuery-from posthog.hogql_queries.insights.trends.aggregation_operations import SUPPORTED_PROPERTY_MATH_FOR_HISTOGRAM_BREAKDOWNfrom posthog.hogql_queries.utils.breakdowns import has_breakdown_filter, has_multi_breakdown, has_single_breakdownfrom posthog.hogql_queries.utils.entities import has_data_warehouse_nodefrom posthog.hogql_queries.validation.utils import get_query_insight_namefrom posthog.hogql_queries.validation.validation import QueryValidationContext+from products.product_analytics.backend.hogql_queries.trends.aggregation_operations import (+ SUPPORTED_PROPERTY_MATH_FOR_HISTOGRAM_BREAKDOWN,+)+class ValidateDataWarehouseBreakdown:"""Event based breakdown types can't be used together with data warehouse series."""diff --git a/posthog/hogql_queries/insights/trends/trends_actors_query_builder.py b/products/product_analytics/backend/hogql_queries/trends/trends_actors_query_builder.pysimilarity index 98%rename from posthog/hogql_queries/insights/trends/trends_actors_query_builder.pyrename to products/product_analytics/backend/hogql_queries/trends/trends_actors_query_builder.pyindex 5711a42258a1..1aa901194ee1 100644--- a/posthog/hogql_queries/insights/trends/trends_actors_query_builder.py+++ b/products/product_analytics/backend/hogql_queries/trends/trends_actors_query_builder.py@@ -27,19 +27,19 @@ from posthog.hogql.property import action_to_expr, property_to_exprfrom posthog.hogql.timings import HogQLTimingsfrom posthog.dataclasses import frozen-from posthog.hogql_queries.insights.trends.aggregation_operations import (- AggregationOperations,- FirstTimeForUserEventsQueryAlternator,-)-from posthog.hogql_queries.insights.trends.breakdown import Breakdown-from posthog.hogql_queries.insights.trends.display import TrendsDisplay-from posthog.hogql_queries.insights.trends.utils import group_node_to_expr, is_groups_mathfrom posthog.hogql_queries.utils.query_compare_to_date_range import QueryCompareToDateRangefrom posthog.hogql_queries.utils.query_date_range import QueryDateRangefrom posthog.hogql_queries.utils.query_previous_period_date_range import QueryPreviousPeriodDateRangefrom posthog.models import Teamfrom products.actions.backend.models.action import Action+from products.product_analytics.backend.hogql_queries.trends.aggregation_operations import (+ AggregationOperations,+ FirstTimeForUserEventsQueryAlternator,+)+from products.product_analytics.backend.hogql_queries.trends.breakdown import Breakdown+from products.product_analytics.backend.hogql_queries.trends.display import TrendsDisplay+from products.product_analytics.backend.hogql_queries.trends.utils import group_node_to_expr, is_groups_mathfrom products.web_analytics.backend.hogql_queries.first_pageview_attribution import (first_pageview_aware_properties_to_expr,)diff --git a/posthog/hogql_queries/insights/trends/trends_query_builder.py b/products/product_analytics/backend/hogql_queries/trends/trends_query_builder.pysimilarity index 99%rename from posthog/hogql_queries/insights/trends/trends_query_builder.pyrename to products/product_analytics/backend/hogql_queries/trends/trends_query_builder.pyindex 74e4956fe59c..320e06410d65 100644--- a/posthog/hogql_queries/insights/trends/trends_query_builder.py+++ b/products/product_analytics/backend/hogql_queries/trends/trends_query_builder.py@@ -18,10 +18,6 @@ from posthog.hogql.property import action_to_expr, property_to_exprfrom posthog.hogql.timings import HogQLTimingsfrom posthog.hogql_queries.data_warehouse_mixin import DataWarehouseInsightQueryMixin-from posthog.hogql_queries.insights.trends.aggregation_operations import AggregationOperations-from posthog.hogql_queries.insights.trends.breakdown import Breakdown-from posthog.hogql_queries.insights.trends.display import TrendsDisplay-from posthog.hogql_queries.insights.trends.utils import group_node_to_expr, is_groups_mathfrom posthog.hogql_queries.utils.breakdowns import BREAKDOWN_NULL_STRING_LABEL, BREAKDOWN_OTHER_STRING_LABELfrom posthog.hogql_queries.utils.query_date_range import QueryDateRangefrom posthog.models.filters.mixins.utils import cached_property@@ -29,6 +25,10 @@ from posthog.models.team.team import Teamfrom posthog.ph_client import feature_enabled_or_falsefrom products.actions.backend.models.action import Action+from products.product_analytics.backend.hogql_queries.trends.aggregation_operations import AggregationOperations+from products.product_analytics.backend.hogql_queries.trends.breakdown import Breakdown+from products.product_analytics.backend.hogql_queries.trends.display import TrendsDisplay+from products.product_analytics.backend.hogql_queries.trends.utils import group_node_to_expr, is_groups_mathfrom products.web_analytics.backend.hogql_queries.first_pageview_attribution import (first_pageview_aware_properties_to_expr,)diff --git a/posthog/hogql_queries/insights/trends/trends_query_runner.py b/products/product_analytics/backend/hogql_queries/trends/trends_query_runner.pysimilarity index 99%rename from posthog/hogql_queries/insights/trends/trends_query_runner.pyrename to products/product_analytics/backend/hogql_queries/trends/trends_query_runner.pyindex bd92cccc7a43..181ddb5b06ca 100644--- a/posthog/hogql_queries/insights/trends/trends_query_runner.py+++ b/products/product_analytics/backend/hogql_queries/trends/trends_query_runner.py@@ -55,15 +55,6 @@ from posthog.caching.insights_api import ()from posthog.clickhouse import query_taggingfrom posthog.clickhouse.query_tagging import QueryTags-from posthog.hogql_queries.insights.trends.display import TrendsDisplay-from posthog.hogql_queries.insights.trends.series_with_extras import SeriesWithExtras-from posthog.hogql_queries.insights.trends.trend_validation_rules import (- DisallowDaysOfWeekWithSmoothing,- DisallowUnsupportedPropertyMathForHistogramBreakdown,- ValidateDataWarehouseBreakdown,-)-from posthog.hogql_queries.insights.trends.trends_actors_query_builder import TrendsActorsQueryBuilder-from posthog.hogql_queries.insights.trends.trends_query_builder import TrendsQueryBuilderfrom posthog.hogql_queries.query_runner import AnalyticsQueryRunner, resolve_series_custom_namefrom posthog.hogql_queries.utils.breakdowns import (BREAKDOWN_NULL_DISPLAY,@@ -91,6 +82,15 @@ from posthog.utils import multisortfrom products.actions.backend.models.action import Actionfrom products.cohorts.backend.models.cohort import Cohortfrom products.event_definitions.backend.models.property_definition import PropertyDefinition+from products.product_analytics.backend.hogql_queries.trends.display import TrendsDisplay+from products.product_analytics.backend.hogql_queries.trends.series_with_extras import SeriesWithExtras+from products.product_analytics.backend.hogql_queries.trends.trend_validation_rules import (+ DisallowDaysOfWeekWithSmoothing,+ DisallowUnsupportedPropertyMathForHistogramBreakdown,+ ValidateDataWarehouseBreakdown,+)+from products.product_analytics.backend.hogql_queries.trends.trends_actors_query_builder import TrendsActorsQueryBuilder+from products.product_analytics.backend.hogql_queries.trends.trends_query_builder import TrendsQueryBuilderfrom products.warehouse_sources.backend.facade.hogql import get_view_or_table_by_namediff --git a/posthog/hogql_queries/insights/trends/utils.py b/products/product_analytics/backend/hogql_queries/trends/utils.pysimilarity index 100%rename from posthog/hogql_queries/insights/trends/utils.pyrename to products/product_analytics/backend/hogql_queries/trends/utils.pydiff --git a/products/product_analytics/backend/tests/api/test_insight.py b/products/product_analytics/backend/tests/api/test_insight.pyindex e19e6c2faefd..d94bbcfee06b 100644--- a/products/product_analytics/backend/tests/api/test_insight.py+++ b/products/product_analytics/backend/tests/api/test_insight.py@@ -1925,7 +1925,10 @@ class TestInsight(ClickhouseTestMixin, APIBaseTest, QueryMatchingTest):],])- @patch("posthog.hogql_queries.insights.trends.trends_query_runner.execute_hogql_query", wraps=execute_hogql_query)+ @patch(+ "products.product_analytics.backend.hogql_queries.trends.trends_query_runner.execute_hogql_query",+ wraps=execute_hogql_query,+ )def test_insight_refreshing_query(self, properties_filter, spy_execute_hogql_query) -> None:dashboard_id, _ = self.dashboard_api.create_dashboard({"filters": {"date_from": "-14d"}})@@ -2091,7 +2094,10 @@ class TestInsight(ClickhouseTestMixin, APIBaseTest, QueryMatchingTest):],])- @patch("posthog.hogql_queries.insights.trends.trends_query_runner.execute_hogql_query", wraps=execute_hogql_query)+ @patch(+ "products.product_analytics.backend.hogql_queries.trends.trends_query_runner.execute_hogql_query",+ wraps=execute_hogql_query,+ )def test_insight_refreshing_query_async(self, properties_filter, spy_execute_hogql_query) -> None:dashboard_id, _ = self.dashboard_api.create_dashboard({"filters": {"date_from": "-14d"}})diff --git a/products/product_analytics/turbo.json b/products/product_analytics/turbo.jsonindex 0be4d6c10996..3b7f17cb427f 100644--- a/products/product_analytics/turbo.json+++ b/products/product_analytics/turbo.json@@ -7,7 +7,9 @@"backend/presentation/**","backend/routes.py","backend/models/**",- "backend/migrations/**"+ "backend/migrations/**",+ "backend/hogql_queries/trends/**",+ "!backend/hogql_queries/trends/test/**"],"outputs": [],"cache": truediff --git a/products/web_analytics/backend/hogql_queries/test/test_first_pageview_attribution_trends.py b/products/web_analytics/backend/hogql_queries/test/test_first_pageview_attribution_trends.pyindex b0bae701ecc3..069f7156bb59 100644--- a/products/web_analytics/backend/hogql_queries/test/test_first_pageview_attribution_trends.py+++ b/products/web_analytics/backend/hogql_queries/test/test_first_pageview_attribution_trends.py@@ -19,9 +19,9 @@ from posthog.schema import (TrendsQuery,)-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunnerfrom posthog.hogql_queries.query_runner import get_query_runner+from products.product_analytics.backend.facade.queries import TrendsQueryRunnerfrom products.web_analytics.backend.hogql_queries.test.first_pageview_attribution_test_base import (FirstPageviewAttributionTestMixin,)diff --git a/products/web_analytics/backend/hogql_queries/test/test_page_reports_avg_time.py b/products/web_analytics/backend/hogql_queries/test/test_page_reports_avg_time.pyindex 2d56d3f1da04..16ed5295e925 100644--- a/products/web_analytics/backend/hogql_queries/test/test_page_reports_avg_time.py+++ b/products/web_analytics/backend/hogql_queries/test/test_page_reports_avg_time.py@@ -17,9 +17,10 @@ from posthog.schema import (TrendsQuery,)-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunnerfrom posthog.models.utils import uuid7+from products.product_analytics.backend.facade.queries import TrendsQueryRunner+@dataclassclass PageViewProperties:diff --git a/products/web_analytics/backend/hogql_queries/test/test_sample_web_analytics_queries.py b/products/web_analytics/backend/hogql_queries/test/test_sample_web_analytics_queries.pyindex 345f3b4678a1..47641a33d872 100644--- a/products/web_analytics/backend/hogql_queries/test/test_sample_web_analytics_queries.py+++ b/products/web_analytics/backend/hogql_queries/test/test_sample_web_analytics_queries.py@@ -37,8 +37,7 @@ from posthog.schema import (WebStatsTableQuery,)-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunner-+from products.product_analytics.backend.facade.queries import TrendsQueryRunnerfrom products.web_analytics.backend.hogql_queries.stats_table import WebStatsTableQueryRunnerfrom products.web_analytics.backend.hogql_queries.web_overview import WebOverviewQueryRunnerdiff --git a/products/web_analytics/backend/hogql_queries/test/test_web_calendar_heatmap_lazy_precompute.py b/products/web_analytics/backend/hogql_queries/test/test_web_calendar_heatmap_lazy_precompute.pyindex f5b9c55782b8..c412606de624 100644--- a/products/web_analytics/backend/hogql_queries/test/test_web_calendar_heatmap_lazy_precompute.py+++ b/products/web_analytics/backend/hogql_queries/test/test_web_calendar_heatmap_lazy_precompute.py@@ -20,12 +20,12 @@ from posthog.schema import ()from posthog.clickhouse.client import sync_execute-from posthog.hogql_queries.insights.trends.calendar_heatmap_trends_query_runner import CalendarHeatmapTrendsQueryRunnerfrom posthog.hogql_queries.query_runner import get_query_runnerfrom posthog.models import EventDefinitionfrom posthog.models.utils import uuid7from products.analytics_platform.backend.models.preaggregation_job import PreaggregationJob+from products.product_analytics.backend.facade.queries import CalendarHeatmapTrendsQueryRunnerfrom products.web_analytics.backend.hogql_queries.web_calendar_heatmap import WebCalendarHeatmapTrendsQueryRunnerdiff --git a/products/web_analytics/backend/hogql_queries/test/test_web_trends_lazy_precompute.py b/products/web_analytics/backend/hogql_queries/test/test_web_trends_lazy_precompute.pyindex a2cd057dd3af..6bec5309296d 100644--- a/products/web_analytics/backend/hogql_queries/test/test_web_trends_lazy_precompute.py+++ b/products/web_analytics/backend/hogql_queries/test/test_web_trends_lazy_precompute.py@@ -24,11 +24,11 @@ from posthog.schema import ()from posthog.clickhouse.client import sync_execute-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunnerfrom posthog.hogql_queries.query_runner import get_query_runnerfrom posthog.models.utils import uuid7from products.analytics_platform.backend.models.preaggregation_job import PreaggregationJob+from products.product_analytics.backend.facade.queries import TrendsQueryRunnerfrom products.web_analytics.backend.hogql_queries import web_trends_lazy_precomputefrom products.web_analytics.backend.hogql_queries.web_overview import WebOverviewQueryRunnerfrom products.web_analytics.backend.hogql_queries.web_trends import WebTrendsQueryRunnerdiff --git a/products/web_analytics/backend/hogql_queries/test/test_web_vitals_timeseries_lazy_precompute.py b/products/web_analytics/backend/hogql_queries/test/test_web_vitals_timeseries_lazy_precompute.pyindex dbf3867c99c4..6ae47e21b0fe 100644--- a/products/web_analytics/backend/hogql_queries/test/test_web_vitals_timeseries_lazy_precompute.py+++ b/products/web_analytics/backend/hogql_queries/test/test_web_vitals_timeseries_lazy_precompute.py@@ -28,10 +28,10 @@ from posthog.schema import (from posthog.clickhouse.client import sync_executefrom posthog.clickhouse.query_tagging import Feature, Product, reset_query_tags, tag_queries-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunnerfrom posthog.hogql_queries.query_runner import get_query_runner_or_nonefrom products.analytics_platform.backend.models.preaggregation_job import PreaggregationJob+from products.product_analytics.backend.facade.queries import TrendsQueryRunnerfrom products.web_analytics.backend.hogql_queries.web_vitals_timeseries import WebVitalsQueryRunnerfrom products.web_analytics.backend.hogql_queries.web_vitals_timeseries_lazy_precompute import (is_vitals_precompute_enabled_for_team,diff --git a/products/web_analytics/backend/hogql_queries/web_calendar_heatmap.py b/products/web_analytics/backend/hogql_queries/web_calendar_heatmap.pyindex bd06a04f272e..1623b97b7ccb 100644--- a/products/web_analytics/backend/hogql_queries/web_calendar_heatmap.py+++ b/products/web_analytics/backend/hogql_queries/web_calendar_heatmap.py@@ -20,9 +20,9 @@ from posthog.clickhouse.preaggregation.web_overview_preaggregated_sql import (DISTRIBUTED_WEB_OVERVIEW_PREAGGREGATED_TABLE,)from posthog.clickhouse.query_tagging import Feature, Product, tag_queries-from posthog.hogql_queries.insights.trends.calendar_heatmap_trends_query_runner import CalendarHeatmapTrendsQueryRunnerfrom posthog.models import EventDefinition+from products.product_analytics.backend.facade.queries import CalendarHeatmapTrendsQueryRunnerfrom products.web_analytics.backend.hogql_queries.web_analytics_lazy_precompute import (WEB_ANALYTICS_LAZY_PRECOMPUTE_FALLBACK,WEB_ANALYTICS_LAZY_PRECOMPUTE_SUCCESS,diff --git a/products/web_analytics/backend/hogql_queries/web_trends.py b/products/web_analytics/backend/hogql_queries/web_trends.pyindex 1f23e6947dbf..98eb56db9892 100644--- a/products/web_analytics/backend/hogql_queries/web_trends.py+++ b/products/web_analytics/backend/hogql_queries/web_trends.py@@ -1,7 +1,6 @@from posthog.schema import QueryTiming, ResolvedDateRangeResponse, TrendsQueryResponse-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunner-+from products.product_analytics.backend.facade.queries import TrendsQueryRunnerfrom products.web_analytics.backend.hogql_queries.web_lazy_precompute_common import is_precompute_enabled_for_teamfrom products.web_analytics.backend.hogql_queries.web_trends_lazy_precompute import (execute_lazy_precomputed_trends,diff --git a/products/web_analytics/backend/hogql_queries/web_trends_lazy_precompute.py b/products/web_analytics/backend/hogql_queries/web_trends_lazy_precompute.pyindex b54c6c552397..e061c6082052 100644--- a/products/web_analytics/backend/hogql_queries/web_trends_lazy_precompute.py+++ b/products/web_analytics/backend/hogql_queries/web_trends_lazy_precompute.py@@ -26,12 +26,12 @@ from posthog.clickhouse.preaggregation.web_overview_preaggregated_sql import (DISTRIBUTED_WEB_OVERVIEW_PREAGGREGATED_TABLE,)from posthog.clickhouse.query_tagging import Feature, Product, tag_queries-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunnerfrom posthog.hogql_queries.query_runner import resolve_series_custom_namefrom posthog.hogql_queries.utils.timestamp_utils import format_label_datefrom posthog.models.team import Teamfrom posthog.week_start_day import WeekStartDay+from products.product_analytics.backend.facade.queries import TrendsQueryRunnerfrom products.web_analytics.backend.hogql_queries.web_analytics_lazy_precompute import (WEB_ANALYTICS_LAZY_PRECOMPUTE_FALLBACK,WEB_ANALYTICS_LAZY_PRECOMPUTE_SUCCESS,diff --git a/products/web_analytics/backend/hogql_queries/web_vitals_path_breakdown.py b/products/web_analytics/backend/hogql_queries/web_vitals_path_breakdown.pyindex 43131b1158ea..ea109ceec439 100644--- a/products/web_analytics/backend/hogql_queries/web_vitals_path_breakdown.py+++ b/products/web_analytics/backend/hogql_queries/web_vitals_path_breakdown.py@@ -13,7 +13,7 @@ from posthog.hogql.parser import parse_expr, parse_selectfrom posthog.hogql.property import get_property_type, property_to_exprfrom posthog.hogql.query import execute_hogql_query-from posthog.hogql_queries.insights.trends.math_functions import PROPERTY_MATH_FUNCTIONS+from posthog.hogql_queries.math_functions import PROPERTY_MATH_FUNCTIONSfrom products.web_analytics.backend.hogql_queries.web_analytics_query_runner import WebAnalyticsQueryRunnerfrom products.web_analytics.backend.hogql_queries.web_lazy_precompute_common import lazy_precompute_ineligible_reasondiff --git a/products/web_analytics/backend/hogql_queries/web_vitals_timeseries.py b/products/web_analytics/backend/hogql_queries/web_vitals_timeseries.pyindex 063b8ddf78f5..8c613ea05799 100644--- a/products/web_analytics/backend/hogql_queries/web_vitals_timeseries.py+++ b/products/web_analytics/backend/hogql_queries/web_vitals_timeseries.py@@ -2,9 +2,9 @@ from typing import Any, castfrom posthog.schema import QueryTiming, ResolvedDateRangeResponse, TrendsQuery, TrendsQueryResponse, WebVitalsQuery-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunnerfrom posthog.schema_helpers import to_dict+from products.product_analytics.backend.facade.queries import TrendsQueryRunnerfrom products.web_analytics.backend.hogql_queries.web_lazy_precompute_common import is_precompute_enabled_for_teamfrom products.web_analytics.backend.hogql_queries.web_vitals_timeseries_lazy_precompute import (execute_lazy_precomputed_vitals_timeseries,diff --git a/tach.toml b/tach.tomlindex 6a4d41b3c434..107e53f7bd4d 100644--- a/tach.toml+++ b/tach.toml@@ -224,6 +224,8 @@ path = "products.cohorts"depends_on = ["products.actions","posthog",+ # A behavioural cohort filter reads a trends insight's display type.+ "products.product_analytics",]layer = "modules"@@ -675,6 +677,9 @@ depends_on = ["products.event_definitions","products.annotations","products.warehouse_sources", "products.access_control",+ # A trends query filtering on a first-pageview-aware property builds it through+ # web analytics' attribution helper. Core held this import before trends moved.+ "products.web_analytics",]layer = "modules"@@ -1015,6 +1020,8 @@ depends_on = ["products.actions","products.analytics_platform","products.notifications",+ # The web trends, web vitals and calendar heatmap runners subclass product analytics' trends runners.+ "products.product_analytics","products.replay_vision",]layer = "modules"