Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(insights): enforce ANN on product_analytics/backend (#58995)

Thomas Obermüller76103d9687e7
diff --git a/products/product_analytics/backend/hogql_queries/paths/paths_query_runner.py b/products/product_analytics/backend/hogql_queries/paths/paths_query_runner.py
index 64ffcc310d96..395dcdcc14e8 100644
--- a/products/product_analytics/backend/hogql_queries/paths/paths_query_runner.py
+++ b/products/product_analytics/backend/hogql_queries/paths/paths_query_runner.py
@@ -54,7 +54,7 @@ class PathsQueryRunner(AnalyticsQueryRunner[PathsQueryResponse]):
timings: Optional[HogQLTimings] = None,
modifiers: Optional[HogQLQueryModifiers] = None,
limit_context: Optional[LimitContext] = None,
- ):
+ ) -> None:
super().__init__(query, team=team, timings=timings, modifiers=modifiers, limit_context=limit_context)
if not self.query.pathsFilter:
@@ -824,7 +824,7 @@ class PathsQueryRunner(AnalyticsQueryRunner[PathsQueryResponse]):
now=datetime.now(),
)
- def _refresh_frequency(self):
+ def _refresh_frequency(self) -> timedelta:
date_to = self.query_date_range.date_to()
date_from = self.query_date_range.date_from()
interval = self.query_date_range.interval_name
@@ -841,7 +841,7 @@ class PathsQueryRunner(AnalyticsQueryRunner[PathsQueryResponse]):
return refresh_frequency
- def validate_results(self, results):
+ def validate_results(self, results: list) -> list:
# Query guarantees results list to be:
# 1. Directed, Acyclic Tree where each node has only 1 child
# 2. All start nodes beginning with 1_
diff --git a/products/product_analytics/backend/hogql_queries/paths/test/test_paths_query_runner_ee.py b/products/product_analytics/backend/hogql_queries/paths/test/test_paths_query_runner_ee.py
index f61b8f7d8184..b1791bff292a 100644
--- a/products/product_analytics/backend/hogql_queries/paths/test/test_paths_query_runner_ee.py
+++ b/products/product_analytics/backend/hogql_queries/paths/test/test_paths_query_runner_ee.py
@@ -3783,8 +3783,7 @@ class TestClickhousePathsEdgeValidation(TestCase):
def test_no_start_point(self):
edges = set(self.BASIC_PATH + self.BASIC_PATH_2 + [("2_w", "3_z"), ("3_x", "4_d")])
edges.remove(("1_a", "2_b")) # remove first start point
- edges = list(edges) # type: ignore
- results = PathsQueryRunner(query={"pathsFilter": {}}, team=MagicMock()).validate_results(edges)
+ results = PathsQueryRunner(query={"pathsFilter": {}}, team=MagicMock()).validate_results(list(edges))
self.assertCountEqual(results, self.BASIC_PATH_2)
diff --git a/products/ruff.toml b/products/ruff.toml
index 949352effc05..161504ad46b1 100644
--- a/products/ruff.toml
+++ b/products/ruff.toml
@@ -33,7 +33,6 @@ extend-select = ["ANN001", "ANN201", "ANN202", "ANN204"]
"marketing_analytics/backend/**" = ["ANN"]
"messaging/backend/**" = ["ANN"]
"notebooks/backend/**" = ["ANN"]
-"product_analytics/backend/**" = ["ANN"]
"product_tours/backend/**" = ["ANN"]
"revenue_analytics/backend/**" = ["ANN"]
"signals/backend/**" = ["ANN"]