:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(insights): add data checks routes for an insight's events (#116818)
Sam Pennington96986be7e3fc
diff --git a/posthog/hogql_queries/query_runner.py b/posthog/hogql_queries/query_runner.pyindex 2cb44ffb3a9b..162f6373bd7b 100644--- a/posthog/hogql_queries/query_runner.py+++ b/posthog/hogql_queries/query_runner.py@@ -562,6 +562,52 @@ def get_api_queries_budget_status(team: Team) -> Optional[BudgetStatus]:return None+def enforce_api_queries_budget(team: Team) -> None:+ """Hourly read budget for api key queries. Observe-only until the org is flagged in;+ then an exhausted budget is a 429. The query that crosses the line still runs in full,+ since the budget is debited after the query and the next request is the one refused."""+ status = get_api_queries_budget_status(team)+ if status is None:+ return+ API_QUERIES_BUDGET_BALANCE_HISTOGRAM.observe(status.remaining_bytes)+ if status.remaining_bytes > 0:+ return+ enforced = _api_queries_budget_enforcement_enabled(team)+ outcome = "enforced" if enforced else "observed"+ API_QUERIES_BUDGET_LIMITED_COUNTER.labels(outcome=outcome).inc()+ budget_logger.info(+ "api_queries_budget_limited",+ organization_id=str(team.organization_id),+ team_id=team.pk,+ remaining_bytes=status.remaining_bytes,+ bytes_per_hour=status.spec.bytes_per_hour,+ retry_after_seconds=status.retry_after_seconds,+ outcome=outcome,+ )+ if claim_limited_event(str(team.pk)):+ try:+ access_method = get_query_tag_value("access_method")+ product = get_query_tag_value("product")+ report_team_action(+ team,+ "api queries budget limited",+ {+ "outcome": outcome,+ "team_id": team.pk,+ "bytes_per_hour": status.spec.bytes_per_hour,+ "remaining_bytes": status.remaining_bytes,+ "retry_after_seconds": status.retry_after_seconds,+ "access_method": str(access_method) if access_method else None,+ "product": str(product) if product else None,+ },+ )+ except Exception as e:+ API_QUERIES_BUDGET_ERRORS_COUNTER.labels(op="limited_event").inc()+ capture_exception(e)+ if outcome == "enforced":+ raise APIQueriesBudgetExceeded(wait=status.retry_after_seconds)++RunnableQueryNode = Union[TrendsQuery,FunnelsQuery,@@ -3001,49 +3047,7 @@ class QueryRunner(ABC, Generic[Q, R, CR]):return feature.get("limit") if feature else Nonedef _enforce_api_queries_budget(self) -> None:- """Hourly read budget for api key queries. Observe-only until the org is flagged in;- then an exhausted budget is a 429. The query that crosses the line still runs in full,- since the budget is debited after the query and the next request is the one refused."""- status = get_api_queries_budget_status(self.team)- if status is None:- return- API_QUERIES_BUDGET_BALANCE_HISTOGRAM.observe(status.remaining_bytes)- if status.remaining_bytes > 0:- return- enforced = _api_queries_budget_enforcement_enabled(self.team)- outcome = "enforced" if enforced else "observed"- API_QUERIES_BUDGET_LIMITED_COUNTER.labels(outcome=outcome).inc()- budget_logger.info(- "api_queries_budget_limited",- organization_id=str(self.team.organization_id),- team_id=self.team.pk,- remaining_bytes=status.remaining_bytes,- bytes_per_hour=status.spec.bytes_per_hour,- retry_after_seconds=status.retry_after_seconds,- outcome=outcome,- )- if claim_limited_event(str(self.team.pk)):- try:- access_method = get_query_tag_value("access_method")- product = get_query_tag_value("product")- report_team_action(- self.team,- "api queries budget limited",- {- "outcome": outcome,- "team_id": self.team.pk,- "bytes_per_hour": status.spec.bytes_per_hour,- "remaining_bytes": status.remaining_bytes,- "retry_after_seconds": status.retry_after_seconds,- "access_method": str(access_method) if access_method else None,- "product": str(product) if product else None,- },- )- except Exception as e:- API_QUERIES_BUDGET_ERRORS_COUNTER.labels(op="limited_event").inc()- capture_exception(e)- if outcome == "enforced":- raise APIQueriesBudgetExceeded(wait=status.retry_after_seconds)+ enforce_api_queries_budget(self.team)@abstractmethoddef to_query(self) -> ast.SelectQuery | ast.SelectSetQuery:diff --git a/products/product_analytics/backend/presentation/insight.py b/products/product_analytics/backend/presentation/insight.pyindex 1136d56d980d..58b2288d990c 100644--- a/products/product_analytics/backend/presentation/insight.py+++ b/products/product_analytics/backend/presentation/insight.py@@ -35,7 +35,7 @@ from rest_framework_csv import renderers as csvrenderersfrom posthog.schema import AccessControlFilterWarning, DataWarehouseSyncWarning, ProductKey, QueryStatus-from posthog.hogql.errors import ExposedHogQLError+from posthog.hogql.errors import ExposedHogQLError, ResolutionErrorfrom posthog import schemafrom posthog.api.documentation import extend_schema, extend_schema_field, extend_schema_serializer@@ -57,7 +57,7 @@ from posthog.auth import (from posthog.caching.insight_result import InsightResultfrom posthog.clickhouse.cancel import cancel_query_on_clusterfrom posthog.clickhouse.client.limit import ConcurrencyLimitExceeded-from posthog.clickhouse.query_tagging import AccessMethod, tags_context+from posthog.clickhouse.query_tagging import AccessMethod, get_query_tag_value, tag_queries, tags_contextfrom posthog.constants import INSIGHT, AvailableFeaturefrom posthog.errors import ExposedCHQueryError, QueryErrorCategory, classify_query_errorfrom posthog.event_usage import EventSource, get_event_source, get_request_analytics_properties, report_user_action@@ -79,7 +79,7 @@ from posthog.hogql_queries.apply_dashboard_filters import (resolve_effective_dashboard_filters,resolve_filter_layers_by_priority,)-from posthog.hogql_queries.query_runner import ExecutionMode+from posthog.hogql_queries.query_runner import ExecutionMode, enforce_api_queries_budgetfrom posthog.hogql_queries.refresh_policy import ComputeSurface, resolve_execution_modefrom posthog.kafka_client.topics import KAFKA_METRICS_TIME_TO_SEE_DATAfrom posthog.models import User@@ -174,12 +174,22 @@ from products.product_analytics.backend.facade.api import (record_insight_views,with_last_viewed_at,)+from products.product_analytics.backend.facade.data_checks import run_insight_data_checks+from products.product_analytics.backend.facade.enums import (+ InsightDataCheckAction,+ InsightDataCheckKey,+ InsightDataCheckLevel,+ InsightDataCheckMethod,+ InsightDataCheckSkipReason,+ InsightDataChecksStatus,+)from products.product_analytics.backend.facade.models import Insight, resolve_insight_by_id_or_short_idfrom products.product_analytics.backend.presentation.insight_metadata import (InsightMetadataTimeoutError,generate_insight_metadata,)from products.product_analytics.backend.presentation.insight_write_validation import validate_insight_write+from products.product_analytics.backend.presentation.query_concurrency import query_concurrency_slotsfrom common.hogvm.python.utils import HogVMException@@ -1701,6 +1711,123 @@ class InsightBulkSetTestAccountFilterResponseSerializer(serializers.Serializer):)+class InsightDataChecksRequestSerializer(serializers.Serializer):+ query = QueryFieldSerializer(+ help_text=(+ "The insight query to check, in the shape an insight stores it: an `InsightVizNode` with its `source`. "+ "Pass the query of a saved insight, or one that is not saved yet."+ )+ )+++class InsightDataCheckSerializer(serializers.Serializer):+ key = serializers.ChoiceField(choices=InsightDataCheckKey.choices, help_text="Which check this is.")+ level = serializers.ChoiceField(+ choices=InsightDataCheckLevel.choices,+ help_text=(+ "`passed` when the check found nothing worth acting on, `warning` for a small share of the events, "+ "`problem` for a fifth of the events or more, and `skipped` when the check could not run."+ ),+ )+ skip_reason = serializers.ChoiceField(+ choices=InsightDataCheckSkipReason.choices,+ allow_null=True,+ help_text="Why the check did not run. Null unless `level` is `skipped`.",+ )+ method = serializers.ChoiceField(+ choices=InsightDataCheckMethod.choices,+ allow_null=True,+ help_text=(+ "`counted` when the check counted every event on the days checked, `sampled` when it read a sample. "+ "Null when the check did not run."+ ),+ )+ events = serializers.IntegerField(+ allow_null=True,+ help_text="How many events on the days checked the check found. Null when the check did not run.",+ )+ share = serializers.FloatField(+ allow_null=True,+ help_text=(+ "`events` as a share of the events checked, from 0 to 1. Null when the check did not run, or when the "+ "sample is too small to give a share."+ ),+ )+ scaled = serializers.BooleanField(+ help_text="True when `events` is an estimate scaled up from a sample, rather than a count of every event."+ )+ action = serializers.ChoiceField(+ choices=InsightDataCheckAction.choices,+ allow_null=True,+ help_text=(+ "The change that fixes it. `open_filter_settings`: change the project's internal and test users filter. "+ "Null when there is no single change."+ ),+ )+ top_events = serializers.ListField(+ child=serializers.CharField(), help_text="The event names the check found most often, most affected first."+ )+ top_hosts = serializers.ListField(+ child=serializers.CharField(),+ help_text="For the local development check, the local hosts found most often, most affected first.",+ )+ top_bots = serializers.ListField(+ child=serializers.CharField(),+ help_text="For the bot traffic check, the bots and crawlers found most often, most affected first.",+ )+++class InsightDataChecksSampleSerializer(serializers.Serializer):+ rate = serializers.FloatField(+ help_text="The share of the events on the days checked that the sample read, from 0 to 1."+ )+ events = serializers.IntegerField(help_text="How many events the sample read.")+ distinct_ids = serializers.IntegerField(help_text="How many distinct IDs sent the events the sample read.")+++class InsightDataChecksCoverageSerializer(serializers.Serializer):+ date_from = serializers.DateField(help_text="The first day of the insight's date range.")+ date_to = serializers.DateField(help_text="The last day of the insight's date range.")+ days_in_range = serializers.IntegerField(help_text="How many days the insight's date range holds.")+ checked_date_from = serializers.DateField(help_text="The first day the checks read.")+ checked_date_to = serializers.DateField(help_text="The last day the checks read.")+ days_checked = serializers.IntegerField(+ help_text="How many days the checks read. The checks read the newest days of the range, up to 7."+ )+ filters_test_accounts = serializers.BooleanField(+ help_text="True when the insight filters out the project's internal and test users."+ )+ events_checked = serializers.IntegerField(+ allow_null=True,+ help_text=(+ "How many events the insight reads on the days checked, scaled up from the sample when the sample did "+ "not read every event. Null when the sample did not run."+ ),+ )+ sample = InsightDataChecksSampleSerializer(+ allow_null=True, help_text="The sample the bot and duplicate checks read. Null when the sample did not run."+ )+++class InsightDataChecksSerializer(serializers.Serializer):+ status = serializers.ChoiceField(+ choices=InsightDataChecksStatus.choices,+ help_text=(+ "The worst result across the checks. `no_events` when no event matches the insight's events, filters "+ "and date range. `unsupported` when the insight has no event series to check, such as a SQL insight, "+ "and when a property the checks read is hidden from the caller. `inconclusive` when no check could run."+ ),+ )+ checks = InsightDataCheckSerializer(many=True, help_text="Every check, in a fixed order, whatever its result.")+ coverage = InsightDataChecksCoverageSerializer(+ allow_null=True,+ help_text=(+ "Which days and how many events the checks read. Null when the checks could not choose the days to "+ "read, such as for an `unsupported` insight."+ ),+ )++@extend_schema(extensions={"x-product": ProductKey.PRODUCT_ANALYTICS})@extend_schema_view(list=extend_schema(@@ -2429,6 +2556,56 @@ When set, the specified dashboard's filters and date range override will be applreturn Response(status=status.HTTP_201_CREATED)+ @validated_request(+ request_serializer=InsightDataChecksRequestSerializer,+ responses={+ 200: OpenApiResponse(response=InsightDataChecksSerializer, description="The result of every check.")+ },+ description=(+ "Check the events behind an insight for the common ways they mislead: local development traffic, bots "+ "and crawlers, and events sent twice. Works for trends, funnels, stickiness and lifecycle insights whose "+ "series are events. The checks apply the insight's own filters, and read the newest days of its date "+ "range, up to 7. The bot and duplicate checks read a sample of those days. Nothing is stored. This route "+ "runs the query it is sent, so it needs query access as well as insight access. To check a saved insight by its id, send a GET request "+ "to `insights/{id}/data_checks/`."+ ),+ )+ @action(methods=["POST"], detail=False, required_scopes=["insight:read", "query:read"])+ def data_checks(self, request: ValidatedRequest, *args: Any, **kwargs: Any) -> Response:+ # The scope covers a token. A session has no scopes, and a token's scope does not prove its owner has access.+ if not self.user_access_control.check_access_level_for_resource("query", "viewer"):+ raise PermissionDenied("You need query access to check a query that is not saved as an insight.")+ return self._data_checks_response(request.validated_data["query"])++ @validated_request(+ parameters=[INSIGHT_ID_PATH_PARAMETER],+ responses={+ 200: OpenApiResponse(response=InsightDataChecksSerializer, description="The result of every check.")+ },+ description=(+ "Run the data checks on a saved insight, found by its numeric id or its `short_id`. The checks read the "+ "query the insight stores, and work the same way as the checks on a query that is not saved. The "+ "`status` is `unsupported` for an insight that still stores legacy `filters` and no query. Nothing is "+ "stored."+ ),+ )+ @action(methods=["GET"], detail=True, url_path="data_checks", required_scopes=["insight:read"])+ def saved_insight_data_checks(self, request: ValidatedRequest, *args: Any, **kwargs: Any) -> Response:+ insight = self.get_object()+ return self._data_checks_response(upgrade(insight.query) if insight.query else {})++ def _data_checks_response(self, query: dict[str, Any]) -> Response:+ # A personal API key reads within the same hourly budget as the query API, and each check query debits it.+ if get_query_tag_value("access_method") == AccessMethod.PERSONAL_API_KEY:+ tag_queries(api_queries_budgeted=True)+ enforce_api_queries_budget(self.team)+ try:+ with query_concurrency_slots(self.team):+ checks = run_insight_data_checks(query, team=self.team, user=cast(User, self.request.user))+ except (ExposedHogQLError, ExposedCHQueryError, ResolutionError) as error:+ raise ValidationError(str(error), getattr(error, "code_name", None))+ return Response(InsightDataChecksSerializer(checks).data)+# `Sequence` rather than `list` here: this viewset defines a `list` method that shadows the builtin `list`# in the class namespace, so `list[...]` in this signature breaks both at class-definition time and for mypy.def _bulk_filter_editable_insights(diff --git a/products/product_analytics/backend/presentation/query_concurrency.py b/products/product_analytics/backend/presentation/query_concurrency.pynew file mode 100644index 000000000000..6f64b055d60f--- /dev/null+++ b/products/product_analytics/backend/presentation/query_concurrency.py@@ -0,0 +1,41 @@+from collections.abc import Iterator+from contextlib import contextmanager++from django.conf import settings++from rest_framework.exceptions import Throttled++from posthog.api.query import CONCURRENCY_LIMIT_USER_MESSAGE+from posthog.clickhouse.client.limit import (+ ConcurrencyLimitExceeded,+ app_org_concurrency_slot,+ get_api_team_rate_limiter,+)+from posthog.clickhouse.query_tagging import get_query_tag_value, is_api_key_access_method+from posthog.constants import AvailableFeature+from posthog.models.team import Team+++def _api_key_concurrency_limit(team: Team) -> int | None:+ if not settings.EE_AVAILABLE or not settings.API_QUERIES_ENABLED:+ return None+ feature = team.organization.get_available_feature(AvailableFeature.API_QUERIES_CONCURRENCY)+ return feature.get("limit") if feature else None+++@contextmanager+def query_concurrency_slots(team: Team) -> Iterator[None]:+ """Hold the slots a chart query holds, so a read that runs outside a query runner counts against the same limits."""+ is_api_key_access = is_api_key_access_method(get_query_tag_value("access_method"))+ try:+ with (+ get_api_team_rate_limiter().run(+ is_api=is_api_key_access,+ team_id=team.pk,+ limit=_api_key_concurrency_limit(team) if is_api_key_access else None,+ ),+ app_org_concurrency_slot(team),+ ):+ yield+ except ConcurrencyLimitExceeded as error:+ raise Throttled(detail=CONCURRENCY_LIMIT_USER_MESSAGE) from errordiff --git a/products/product_analytics/backend/tests/api/test_insight.py b/products/product_analytics/backend/tests/api/test_insight.pyindex 0a19acd210d6..975bb7ecb6ec 100644--- a/products/product_analytics/backend/tests/api/test_insight.py+++ b/products/product_analytics/backend/tests/api/test_insight.py@@ -3790,7 +3790,7 @@ class TestInsight(ClickhouseTestMixin, APIBaseTest, QueryMatchingTest):self.assertIn(visible_insight.id, [insight["id"] for insight in response.json()["results"]])self.assertIn(hidden_insight.id, [insight["id"] for insight in response.json()["results"]])- def test_insight_activity_respects_access_control(self) -> None:+ def test_insight_activity_and_data_checks_respect_access_control(self) -> None:self.organization.available_product_features = [{"key": AvailableFeature.ACCESS_CONTROL, "name": AvailableFeature.ACCESS_CONTROL},{"key": AvailableFeature.ROLE_BASED_ACCESS, "name": AvailableFeature.ROLE_BASED_ACCESS},@@ -3814,6 +3814,9 @@ class TestInsight(ClickhouseTestMixin, APIBaseTest, QueryMatchingTest):activity_response = self.client.get(f"/api/projects/{self.team.pk}/insights/{insight.id}/activity/")self.assertEqual(activity_response.status_code, status.HTTP_403_FORBIDDEN)+ data_checks_response = self.client.get(f"/api/projects/{self.team.pk}/insights/{insight.id}/data_checks/")+ self.assertEqual(data_checks_response.status_code, status.HTTP_403_FORBIDDEN)+def test_create_insight_in_specific_folder(self):response = self.client.post(f"/api/projects/{self.team.id}/insights/",diff --git a/products/product_analytics/backend/tests/test_insight_data_checks.py b/products/product_analytics/backend/tests/test_insight_data_checks.pyindex 504697321d72..5dc4cd40e1d3 100644--- a/products/product_analytics/backend/tests/test_insight_data_checks.py+++ b/products/product_analytics/backend/tests/test_insight_data_checks.py@@ -11,13 +11,18 @@ from unittest.mock import patchfrom django.test import SimpleTestCasefrom parameterized import parameterized+from rest_framework import statusfrom posthog.constants import AvailableFeaturefrom posthog.errors import ExposedCHQueryError+from posthog.exceptions import APIQueriesBudgetExceededfrom posthog.models import PropertyDefinition+from posthog.models.organization import OrganizationMembership+from posthog.models.team import Teamfrom products.access_control.backend.facade.api import upsert_property_access_controlfrom products.access_control.backend.facade.contracts import PropertyAccessLevel, UpsertPropertyAccessControlInput+from products.access_control.backend.models.access_control import AccessControlfrom products.cohorts.backend.models.cohort import Cohortfrom products.product_analytics.backend.facade.contracts import InsightDataChecks, InsightDataChecksCoveragefrom products.product_analytics.backend.facade.data_checks import run_insight_data_checks@@ -26,6 +31,7 @@ from products.product_analytics.backend.facade.enums import (InsightDataCheckLevel,InsightDataCheckSkipReason,)+from products.product_analytics.backend.facade.models import Insightfrom products.product_analytics.backend.insight_data_check_days import newest_days_withinfrom products.product_analytics.backend.insight_data_check_results import (CheckedEvents,@@ -54,6 +60,7 @@ ORDINARY_BROWSER_USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 14_0) AcmeLOCAL_HOST = "localhost:8010"CHECKS_MODULE = "products.product_analytics.backend.insight_data_checks"RESULTS_MODULE = "products.product_analytics.backend.insight_data_check_results"+ROUTE_MODULE = "products.product_analytics.backend.presentation.insight"ON_LOCAL_HOST = {"key": "$host", "value": [LOCAL_HOST], "operator": "exact", "type": "event"}FROM_A_BOT = {"key": "$raw_user_agent", "value": [BOT_USER_AGENT], "operator": "exact", "type": "event"}NOT_A_BOT = {"key": "$virt_traffic_type", "value": ["Bot"], "operator": "is_not", "type": "event"}@@ -557,3 +564,113 @@ class TestInsightDataChecks(ClickhouseTestMixin, APIBaseTest):)assert self._check(self._query()).status == status++ @parameterized.expand(+ [+ ("found_by_numeric_id", "id", True, {"events_checked": 540}),+ ("found_by_short_id", "short_id", True, {"events_checked": 540}),+ ("without_a_stored_query", "id", False, {"status": "unsupported"}),+ ]+ )+ def test_checks_the_query_a_saved_insight_stores(+ self, _name: str, reference: str, stores_a_query: bool, expected: dict[str, Any]+ ) -> None:+ insight = Insight.objects.create(+ team=self.team,+ query=self._query(filterTestAccounts=True) if stores_a_query else None,+ filters={} if stores_a_query else {"insight": "LIFECYCLE", "events": [{"id": EVENT}]},+ )++ response = self.client.get(f"/api/projects/{self.team.id}/insights/{getattr(insight, reference)}/data_checks/")++ assert response.status_code == status.HTTP_200_OK, response.content+ body = response.json()+ summary = {"status": body["status"], "events_checked": body["coverage"] and body["coverage"]["events_checked"]}+ assert {key: summary[key] for key in expected} == expected++ def test_does_not_check_an_insight_from_another_project(self) -> None:+ other_team = Team.objects.create(organization=self.organization, name="other team")+ insight = Insight.objects.create(team=other_team, query=self._query())++ response = self.client.get(f"/api/projects/{self.team.id}/insights/{insight.id}/data_checks/")++ assert response.status_code == status.HTTP_404_NOT_FOUND++ @parameterized.expand(+ [+ ("without_the_query_scope", ["insight:read"], status.HTTP_403_FORBIDDEN),+ ("with_the_query_scope", ["insight:read", "query:read"], status.HTTP_200_OK),+ ]+ )+ def test_an_api_key_needs_the_query_scope_to_check_a_query_that_is_not_saved(+ self, _name: str, scopes: list[str], expected: int+ ) -> None:+ key = self.create_personal_api_key_with_scopes(scopes)+ self.client.logout()++ response = self.client.post(+ f"/api/projects/{self.team.id}/insights/data_checks/",+ {"query": self._query()},+ format="json",+ headers={"authorization": f"Bearer {key}"},+ )++ assert response.status_code == expected, response.content++ @parameterized.expand(+ [("api_key", True, status.HTTP_429_TOO_MANY_REQUESTS), ("session", False, status.HTTP_200_OK)]+ )+ def test_an_api_key_checks_within_the_query_read_budget(self, _name: str, uses_a_key: bool, expected: int) -> None:+ headers = {}+ if uses_a_key:+ headers = {+ "authorization": f"Bearer {self.create_personal_api_key_with_scopes(['insight:read', 'query:read'])}"+ }+ self.client.logout()++ with patch(f"{ROUTE_MODULE}.enforce_api_queries_budget", side_effect=APIQueriesBudgetExceeded(wait=5)):+ response = self.client.post(+ f"/api/projects/{self.team.id}/insights/data_checks/",+ {"query": self._query()},+ format="json",+ headers=headers,+ )++ assert response.status_code == expected, response.content++ def test_a_member_without_query_access_can_only_check_a_saved_insight(self) -> None:+ insight = Insight.objects.create(team=self.team, query=self._query())+ self.organization.available_product_features = [+ {"name": AvailableFeature.ACCESS_CONTROL, "key": AvailableFeature.ACCESS_CONTROL}+ ]+ self.organization.save()+ self.organization_membership.level = OrganizationMembership.Level.MEMBER+ self.organization_membership.save()+ AccessControl.objects.create(+ team=self.team, resource="query", organization_member=self.organization_membership, access_level="none"+ )++ not_saved = self.client.post(+ f"/api/projects/{self.team.id}/insights/data_checks/", {"query": self._query()}, format="json"+ )+ saved = self.client.get(f"/api/projects/{self.team.id}/insights/{insight.id}/data_checks/")++ assert not_saved.status_code == status.HTTP_403_FORBIDDEN, not_saved.content+ assert saved.status_code == status.HTTP_200_OK, saved.content++ @parameterized.expand(+ [+ ("without_a_query", None),+ ("with_a_filter_that_is_not_valid_sql", {"properties": [{"type": "hogql", "key": "1 +"}]}),+ (+ "with_a_filter_on_a_field_that_does_not_exist",+ {"properties": [{"type": "hogql", "key": "timestamp.day"}]},+ ),+ ]+ )+ def test_rejects_a_request_it_cannot_check(self, _name: str, source: dict[str, Any] | None) -> None:+ body = {} if source is None else {"query": self._query(**source)}++ response = self.client.post(f"/api/projects/{self.team.id}/insights/data_checks/", body, format="json")++ assert response.status_code == status.HTTP_400_BAD_REQUEST, response.contentdiff --git a/products/product_analytics/frontend/generated/api.schemas.ts b/products/product_analytics/frontend/generated/api.schemas.tsindex 3d01b32293a9..6afe013c3822 100644--- a/products/product_analytics/frontend/generated/api.schemas.ts+++ b/products/product_analytics/frontend/generated/api.schemas.ts@@ -9122,6 +9122,198 @@ export interface ActivityLogPaginatedResponseApi {total_count: number}+/**+ * * `passed` - No data issues found+ * * `warning` - A check found a small issue+ * * `problem` - A check found a large issue+ * * `no_events` - No events to check+ * * `unsupported` - This kind of insight cannot be checked+ * * `inconclusive` - No check could run+ */+export type InsightDataChecksStatusEnumApi =+ (typeof InsightDataChecksStatusEnumApi)[keyof typeof InsightDataChecksStatusEnumApi]++export const InsightDataChecksStatusEnumApi = {+ Passed: 'passed',+ Warning: 'warning',+ Problem: 'problem',+ NoEvents: 'no_events',+ Unsupported: 'unsupported',+ Inconclusive: 'inconclusive',+} as const++/**+ * * `local_development` - Local development events+ * * `bot_traffic` - Bot and crawler traffic+ * * `duplicate_events` - Events sent twice+ */+export type InsightDataCheckKeyEnumApi = (typeof InsightDataCheckKeyEnumApi)[keyof typeof InsightDataCheckKeyEnumApi]++export const InsightDataCheckKeyEnumApi = {+ LocalDevelopment: 'local_development',+ BotTraffic: 'bot_traffic',+ DuplicateEvents: 'duplicate_events',+} as const++/**+ * * `passed` - Passed+ * * `warning` - Warning+ * * `problem` - Problem+ * * `skipped` - Not checked+ */+export type InsightDataCheckLevelEnumApi =+ (typeof InsightDataCheckLevelEnumApi)[keyof typeof InsightDataCheckLevelEnumApi]++export const InsightDataCheckLevelEnumApi = {+ Passed: 'passed',+ Warning: 'warning',+ Problem: 'problem',+ Skipped: 'skipped',+} as const++/**+ * * `too_many_events` - The days checked hold too many events to count+ * * `read_limit` - The check would read more data than it is allowed+ * * `time_limit` - The check took longer than it is allowed+ * * `memory_limit` - The check needed more memory than it is allowed+ * * `too_few_sampled_events` - The sample has too few events to give a share+ * * `filtered_by_traffic_type` - The insight already filters on traffic type+ */+export type InsightDataCheckSkipReasonEnumApi =+ (typeof InsightDataCheckSkipReasonEnumApi)[keyof typeof InsightDataCheckSkipReasonEnumApi]++export const InsightDataCheckSkipReasonEnumApi = {+ TooManyEvents: 'too_many_events',+ ReadLimit: 'read_limit',+ TimeLimit: 'time_limit',+ MemoryLimit: 'memory_limit',+ TooFewSampledEvents: 'too_few_sampled_events',+ FilteredByTrafficType: 'filtered_by_traffic_type',+} as const++/**+ * * `counted` - Counted every event on the days checked+ * * `sampled` - Checked a sample of the events on the days checked+ */+export type InsightDataCheckMethodEnumApi =+ (typeof InsightDataCheckMethodEnumApi)[keyof typeof InsightDataCheckMethodEnumApi]++export const InsightDataCheckMethodEnumApi = {+ Counted: 'counted',+ Sampled: 'sampled',+} as const++/**+ * * `open_filter_settings` - Change the project's internal and test users filter+ */+export type InsightDataCheckActionEnumApi =+ (typeof InsightDataCheckActionEnumApi)[keyof typeof InsightDataCheckActionEnumApi]++export const InsightDataCheckActionEnumApi = {+ OpenFilterSettings: 'open_filter_settings',+} as const++export interface InsightDataCheckApi {+ /** Which check this is.+ *+ * * `local_development` - Local development events+ * * `bot_traffic` - Bot and crawler traffic+ * * `duplicate_events` - Events sent twice */+ key: InsightDataCheckKeyEnumApi+ /** `passed` when the check found nothing worth acting on, `warning` for a small share of the events, `problem` for a fifth of the events or more, and `skipped` when the check could not run.+ *+ * * `passed` - Passed+ * * `warning` - Warning+ * * `problem` - Problem+ * * `skipped` - Not checked */+ level: InsightDataCheckLevelEnumApi+ /** Why the check did not run. Null unless `level` is `skipped`.+ *+ * * `too_many_events` - The days checked hold too many events to count+ * * `read_limit` - The check would read more data than it is allowed+ * * `time_limit` - The check took longer than it is allowed+ * * `memory_limit` - The check needed more memory than it is allowed+ * * `too_few_sampled_events` - The sample has too few events to give a share+ * * `filtered_by_traffic_type` - The insight already filters on traffic type */+ skip_reason: InsightDataCheckSkipReasonEnumApi | null+ /** `counted` when the check counted every event on the days checked, `sampled` when it read a sample. Null when the check did not run.+ *+ * * `counted` - Counted every event on the days checked+ * * `sampled` - Checked a sample of the events on the days checked */+ method: InsightDataCheckMethodEnumApi | null+ /**+ * How many events on the days checked the check found. Null when the check did not run.+ * @nullable+ */+ events: number | null+ /**+ * `events` as a share of the events checked, from 0 to 1. Null when the check did not run, or when the sample is too small to give a share.+ * @nullable+ */+ share: number | null+ /** True when `events` is an estimate scaled up from a sample, rather than a count of every event. */+ scaled: boolean+ /** The change that fixes it. `open_filter_settings`: change the project's internal and test users filter. Null when there is no single change.+ *+ * * `open_filter_settings` - Change the project's internal and test users filter */+ action: InsightDataCheckActionEnumApi | null+ /** The event names the check found most often, most affected first. */+ top_events: string[]+ /** For the local development check, the local hosts found most often, most affected first. */+ top_hosts: string[]+ /** For the bot traffic check, the bots and crawlers found most often, most affected first. */+ top_bots: string[]+}++export interface InsightDataChecksSampleApi {+ /** The share of the events on the days checked that the sample read, from 0 to 1. */+ rate: number+ /** How many events the sample read. */+ events: number+ /** How many distinct IDs sent the events the sample read. */+ distinct_ids: number+}++export interface InsightDataChecksCoverageApi {+ /** The first day of the insight's date range. */+ date_from: string+ /** The last day of the insight's date range. */+ date_to: string+ /** How many days the insight's date range holds. */+ days_in_range: number+ /** The first day the checks read. */+ checked_date_from: string+ /** The last day the checks read. */+ checked_date_to: string+ /** How many days the checks read. The checks read the newest days of the range, up to 7. */+ days_checked: number+ /** True when the insight filters out the project's internal and test users. */+ filters_test_accounts: boolean+ /**+ * How many events the insight reads on the days checked, scaled up from the sample when the sample did not read every event. Null when the sample did not run.+ * @nullable+ */+ events_checked: number | null+ /** The sample the bot and duplicate checks read. Null when the sample did not run. */+ sample: InsightDataChecksSampleApi | null+}++export interface InsightDataChecksApi {+ /** The worst result across the checks. `no_events` when no event matches the insight's events, filters and date range. `unsupported` when the insight has no event series to check, such as a SQL insight, and when a property the checks read is hidden from the caller. `inconclusive` when no check could run.+ *+ * * `passed` - No data issues found+ * * `warning` - A check found a small issue+ * * `problem` - A check found a large issue+ * * `no_events` - No events to check+ * * `unsupported` - This kind of insight cannot be checked+ * * `inconclusive` - No check could run */+ status: InsightDataChecksStatusEnumApi+ /** Every check, in a fixed order, whatever its result. */+ checks: InsightDataCheckApi[]+ /** Which days and how many events the checks read. Null when the checks could not choose the days to read, such as for an `unsupported` insight. */+ coverage: InsightDataChecksCoverageApi | null+}+export interface InsightBulkDeleteRequestApi {/*** Insight IDs to soft-delete (or restore). At most 1000 ids per request. Soft-deleted insights can be brought back via the bulk_restore endpoint.@@ -9228,6 +9420,11 @@ export interface BulkUpdateTagsResponseApi {skipped: BulkUpdateTagsErrorApi[]}+export interface InsightDataChecksRequestApi {+ /** The insight query to check, in the shape an insight stores it: an `InsightVizNode` with its `source`. Pass the query of a saved insight, or one that is not saved yet. */+ query: _InsightQuerySchemaApi+}+/*** Insight enriched with view-count and recent-viewer fields, used by the trending action.*/@@ -9656,6 +9853,18 @@ export const InsightsActivityRetrieveFormat = {Json: 'json',} as const+export type InsightsDataChecksRetrieveParams = {+ format?: InsightsDataChecksRetrieveFormat+}++export type InsightsDataChecksRetrieveFormat =+ (typeof InsightsDataChecksRetrieveFormat)[keyof typeof InsightsDataChecksRetrieveFormat]++export const InsightsDataChecksRetrieveFormat = {+ Csv: 'csv',+ Json: 'json',+} as const+export type InsightsAllActivityRetrieveParams = {format?: InsightsAllActivityRetrieveFormat/**@@ -9735,6 +9944,18 @@ export const InsightsCancelCreateFormat = {Json: 'json',} as const+export type InsightsDataChecksCreateParams = {+ format?: InsightsDataChecksCreateFormat+}++export type InsightsDataChecksCreateFormat =+ (typeof InsightsDataChecksCreateFormat)[keyof typeof InsightsDataChecksCreateFormat]++export const InsightsDataChecksCreateFormat = {+ Csv: 'csv',+ Json: 'json',+} as const+export type InsightsGenerateMetadataCreateParams = {format?: InsightsGenerateMetadataCreateFormat}diff --git a/products/product_analytics/frontend/generated/api.ts b/products/product_analytics/frontend/generated/api.tsindex 2836a67af852..b281a6cc6db6 100644--- a/products/product_analytics/frontend/generated/api.ts+++ b/products/product_analytics/frontend/generated/api.ts@@ -27,6 +27,8 @@ import type {InsightBulkRestoreResponseApi,InsightBulkSetTestAccountFilterRequestApi,InsightBulkSetTestAccountFilterResponseApi,+ InsightDataChecksApi,+ InsightDataChecksRequestApi,InsightViewedRequestApi,InsightsActivityRetrieveParams,InsightsAllActivityRetrieveParams,@@ -36,6 +38,8 @@ import type {InsightsBulkUpdateTagsCreateParams,InsightsCancelCreateParams,InsightsCreateParams,+ InsightsDataChecksCreateParams,+ InsightsDataChecksRetrieveParams,InsightsDestroyParams,InsightsGenerateMetadataCreateParams,InsightsListParams,@@ -579,6 +583,41 @@ export const insightsActivityRetrieve = async (})}+export const getInsightsDataChecksRetrieveUrl = (+ projectId: string,+ id: number | string,+ params?: InsightsDataChecksRetrieveParams+) => {+ const normalizedParams = new URLSearchParams()++ Object.entries(params || {}).forEach(([key, value]) => {+ if (value !== undefined) {+ normalizedParams.append(key, value === null ? 'null' : String(value))+ }+ })++ const stringifiedParams = normalizedParams.toString()++ return stringifiedParams.length > 0+ ? `/api/projects/${projectId}/insights/${id}/data_checks/?${stringifiedParams}`+ : `/api/projects/${projectId}/insights/${id}/data_checks/`+}++/**+ * Run the data checks on a saved insight, found by its numeric id or its `short_id`. The checks read the query the insight stores, and work the same way as the checks on a query that is not saved. The `status` is `unsupported` for an insight that still stores legacy `filters` and no query. Nothing is stored.+ */+export const insightsDataChecksRetrieve = async (+ projectId: string,+ id: number | string,+ params?: InsightsDataChecksRetrieveParams,+ options?: RequestInit+): Promise<InsightDataChecksApi> => {+ return apiMutator<InsightDataChecksApi>(getInsightsDataChecksRetrieveUrl(projectId, id, params), {+ ...options,+ method: 'GET',+ })+}+export const getInsightsAllActivityRetrieveUrl = (projectId: string, params?: InsightsAllActivityRetrieveParams) => {const normalizedParams = new URLSearchParams()@@ -793,6 +832,39 @@ export const insightsCancelCreate = async (})}+export const getInsightsDataChecksCreateUrl = (projectId: string, params?: InsightsDataChecksCreateParams) => {+ const normalizedParams = new URLSearchParams()++ Object.entries(params || {}).forEach(([key, value]) => {+ if (value !== undefined) {+ normalizedParams.append(key, value === null ? 'null' : String(value))+ }+ })++ const stringifiedParams = normalizedParams.toString()++ return stringifiedParams.length > 0+ ? `/api/projects/${projectId}/insights/data_checks/?${stringifiedParams}`+ : `/api/projects/${projectId}/insights/data_checks/`+}++/**+ * Check the events behind an insight for the common ways they mislead: local development traffic, bots and crawlers, and events sent twice. Works for trends, funnels, stickiness and lifecycle insights whose series are events. The checks apply the insight's own filters, and read the newest days of its date range, up to 7. The bot and duplicate checks read a sample of those days. Nothing is stored. This route runs the query it is sent, so it needs query access as well as insight access. To check a saved insight by its id, send a GET request to `insights/{id}/data_checks/`.+ */+export const insightsDataChecksCreate = async (+ projectId: string,+ insightDataChecksRequestApi: InsightDataChecksRequestApi,+ params?: InsightsDataChecksCreateParams,+ options?: RequestInit+): Promise<InsightDataChecksApi> => {+ return apiMutator<InsightDataChecksApi>(getInsightsDataChecksCreateUrl(projectId, params), {+ ...options,+ method: 'POST',+ headers: { 'Content-Type': 'application/json', ...options?.headers },+ body: JSON.stringify(insightDataChecksRequestApi),+ })+}+export const getInsightsGenerateMetadataCreateUrl = (projectId: string,params?: InsightsGenerateMetadataCreateParamsdiff --git a/products/product_analytics/frontend/generated/api.zod.ts b/products/product_analytics/frontend/generated/api.zod.tsindex 79cef7bd0c80..ce11674670b4 100644--- a/products/product_analytics/frontend/generated/api.zod.ts+++ b/products/product_analytics/frontend/generated/api.zod.ts@@ -286,6 +286,13 @@ export const InsightsCancelCreateBody = /* @__PURE__ */ zod.record(zod.string(), zod.unknown()).describe('Deep\/recursive schema (opaque in Zod — use TypeScript types for full shape)')+/**+ * Check the events behind an insight for the common ways they mislead: local development traffic, bots and crawlers, and events sent twice. Works for trends, funnels, stickiness and lifecycle insights whose series are events. The checks apply the insight's own filters, and read the newest days of its date range, up to 7. The bot and duplicate checks read a sample of those days. Nothing is stored. This route runs the query it is sent, so it needs query access as well as insight access. To check a saved insight by its id, send a GET request to `insights/{id}/data_checks/`.+ */+export const InsightsDataChecksCreateBody = /* @__PURE__ */ zod+ .record(zod.string(), zod.unknown())+ .describe('Deep\/recursive schema (opaque in Zod — use TypeScript types for full shape)')+/*** Generate an AI-suggested name and description for an insight based on its query configuration.*/diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex bb16e0f9e481..e0186e815125 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -59930,6 +59930,204 @@ export namespace Schemas {legacy: number;}+ /**+ * * `local_development` - Local development events+ * * `bot_traffic` - Bot and crawler traffic+ * * `duplicate_events` - Events sent twice+ */+ export type InsightDataCheckKeyEnum = typeof InsightDataCheckKeyEnum[keyof typeof InsightDataCheckKeyEnum];+++ export const InsightDataCheckKeyEnum = {+ LocalDevelopment: 'local_development',+ BotTraffic: 'bot_traffic',+ DuplicateEvents: 'duplicate_events',+ } as const;++ /**+ * * `passed` - Passed+ * * `warning` - Warning+ * * `problem` - Problem+ * * `skipped` - Not checked+ */+ export type InsightDataCheckLevelEnum = typeof InsightDataCheckLevelEnum[keyof typeof InsightDataCheckLevelEnum];+++ export const InsightDataCheckLevelEnum = {+ Passed: 'passed',+ Warning: 'warning',+ Problem: 'problem',+ Skipped: 'skipped',+ } as const;++ /**+ * * `too_many_events` - The days checked hold too many events to count+ * * `read_limit` - The check would read more data than it is allowed+ * * `time_limit` - The check took longer than it is allowed+ * * `memory_limit` - The check needed more memory than it is allowed+ * * `too_few_sampled_events` - The sample has too few events to give a share+ * * `filtered_by_traffic_type` - The insight already filters on traffic type+ */+ export type InsightDataCheckSkipReasonEnum = typeof InsightDataCheckSkipReasonEnum[keyof typeof InsightDataCheckSkipReasonEnum];+++ export const InsightDataCheckSkipReasonEnum = {+ TooManyEvents: 'too_many_events',+ ReadLimit: 'read_limit',+ TimeLimit: 'time_limit',+ MemoryLimit: 'memory_limit',+ TooFewSampledEvents: 'too_few_sampled_events',+ FilteredByTrafficType: 'filtered_by_traffic_type',+ } as const;++ /**+ * * `counted` - Counted every event on the days checked+ * * `sampled` - Checked a sample of the events on the days checked+ */+ export type InsightDataCheckMethodEnum = typeof InsightDataCheckMethodEnum[keyof typeof InsightDataCheckMethodEnum];+++ export const InsightDataCheckMethodEnum = {+ Counted: 'counted',+ Sampled: 'sampled',+ } as const;++ /**+ * * `open_filter_settings` - Change the project's internal and test users filter+ */+ export type InsightDataCheckActionEnum = typeof InsightDataCheckActionEnum[keyof typeof InsightDataCheckActionEnum];+++ export const InsightDataCheckActionEnum = {+ OpenFilterSettings: 'open_filter_settings',+ } as const;++ export interface InsightDataCheck {+ /** Which check this is.+ *+ * * `local_development` - Local development events+ * * `bot_traffic` - Bot and crawler traffic+ * * `duplicate_events` - Events sent twice */+ key: InsightDataCheckKeyEnum;+ /** `passed` when the check found nothing worth acting on, `warning` for a small share of the events, `problem` for a fifth of the events or more, and `skipped` when the check could not run.+ *+ * * `passed` - Passed+ * * `warning` - Warning+ * * `problem` - Problem+ * * `skipped` - Not checked */+ level: InsightDataCheckLevelEnum;+ /** Why the check did not run. Null unless `level` is `skipped`.+ *+ * * `too_many_events` - The days checked hold too many events to count+ * * `read_limit` - The check would read more data than it is allowed+ * * `time_limit` - The check took longer than it is allowed+ * * `memory_limit` - The check needed more memory than it is allowed+ * * `too_few_sampled_events` - The sample has too few events to give a share+ * * `filtered_by_traffic_type` - The insight already filters on traffic type */+ skip_reason: InsightDataCheckSkipReasonEnum | null;+ /** `counted` when the check counted every event on the days checked, `sampled` when it read a sample. Null when the check did not run.+ *+ * * `counted` - Counted every event on the days checked+ * * `sampled` - Checked a sample of the events on the days checked */+ method: InsightDataCheckMethodEnum | null;+ /**+ * How many events on the days checked the check found. Null when the check did not run.+ * @nullable+ */+ events: number | null;+ /**+ * `events` as a share of the events checked, from 0 to 1. Null when the check did not run, or when the sample is too small to give a share.+ * @nullable+ */+ share: number | null;+ /** True when `events` is an estimate scaled up from a sample, rather than a count of every event. */+ scaled: boolean;+ /** The change that fixes it. `open_filter_settings`: change the project's internal and test users filter. Null when there is no single change.+ *+ * * `open_filter_settings` - Change the project's internal and test users filter */+ action: InsightDataCheckActionEnum | null;+ /** The event names the check found most often, most affected first. */+ top_events: string[];+ /** For the local development check, the local hosts found most often, most affected first. */+ top_hosts: string[];+ /** For the bot traffic check, the bots and crawlers found most often, most affected first. */+ top_bots: string[];+ }++ /**+ * * `passed` - No data issues found+ * * `warning` - A check found a small issue+ * * `problem` - A check found a large issue+ * * `no_events` - No events to check+ * * `unsupported` - This kind of insight cannot be checked+ * * `inconclusive` - No check could run+ */+ export type InsightDataChecksStatusEnum = typeof InsightDataChecksStatusEnum[keyof typeof InsightDataChecksStatusEnum];+++ export const InsightDataChecksStatusEnum = {+ Passed: 'passed',+ Warning: 'warning',+ Problem: 'problem',+ NoEvents: 'no_events',+ Unsupported: 'unsupported',+ Inconclusive: 'inconclusive',+ } as const;++ export interface InsightDataChecksSample {+ /** The share of the events on the days checked that the sample read, from 0 to 1. */+ rate: number;+ /** How many events the sample read. */+ events: number;+ /** How many distinct IDs sent the events the sample read. */+ distinct_ids: number;+ }++ export interface InsightDataChecksCoverage {+ /** The first day of the insight's date range. */+ date_from: string;+ /** The last day of the insight's date range. */+ date_to: string;+ /** How many days the insight's date range holds. */+ days_in_range: number;+ /** The first day the checks read. */+ checked_date_from: string;+ /** The last day the checks read. */+ checked_date_to: string;+ /** How many days the checks read. The checks read the newest days of the range, up to 7. */+ days_checked: number;+ /** True when the insight filters out the project's internal and test users. */+ filters_test_accounts: boolean;+ /**+ * How many events the insight reads on the days checked, scaled up from the sample when the sample did not read every event. Null when the sample did not run.+ * @nullable+ */+ events_checked: number | null;+ /** The sample the bot and duplicate checks read. Null when the sample did not run. */+ sample: InsightDataChecksSample | null;+ }++ export interface InsightDataChecks {+ /** The worst result across the checks. `no_events` when no event matches the insight's events, filters and date range. `unsupported` when the insight has no event series to check, such as a SQL insight, and when a property the checks read is hidden from the caller. `inconclusive` when no check could run.+ *+ * * `passed` - No data issues found+ * * `warning` - A check found a small issue+ * * `problem` - A check found a large issue+ * * `no_events` - No events to check+ * * `unsupported` - This kind of insight cannot be checked+ * * `inconclusive` - No check could run */+ status: InsightDataChecksStatusEnum;+ /** Every check, in a fixed order, whatever its result. */+ checks: InsightDataCheck[];+ /** Which days and how many events the checks read. Null when the checks could not choose the days to read, such as for an `unsupported` insight. */+ coverage: InsightDataChecksCoverage | null;+ }++ export interface InsightDataChecksRequest {+ /** The insight query to check, in the shape an insight stores it: an `InsightVizNode` with its `source`. Pass the query of a saved insight, or one that is not saved yet. */+ query: _InsightQuerySchema;+ }+/*** * `trends` - trends* * `funnel` - funnel@@ -126299,6 +126497,18 @@ export namespace Schemas {Json: 'json',} as const;+ export type InsightsDataChecksRetrieveParams = {+ format?: InsightsDataChecksRetrieveFormat;+ };++ export type InsightsDataChecksRetrieveFormat = typeof InsightsDataChecksRetrieveFormat[keyof typeof InsightsDataChecksRetrieveFormat];+++ export const InsightsDataChecksRetrieveFormat = {+ Csv: 'csv',+ Json: 'json',+ } as const;+export type InsightsAllActivityRetrieveParams = {format?: InsightsAllActivityRetrieveFormat;/**@@ -126379,6 +126589,18 @@ export namespace Schemas {Json: 'json',} as const;+ export type InsightsDataChecksCreateParams = {+ format?: InsightsDataChecksCreateFormat;+ };++ export type InsightsDataChecksCreateFormat = typeof InsightsDataChecksCreateFormat[keyof typeof InsightsDataChecksCreateFormat];+++ export const InsightsDataChecksCreateFormat = {+ Csv: 'csv',+ Json: 'json',+ } as const;+export type InsightsGenerateMetadataCreateParams = {format?: InsightsGenerateMetadataCreateFormat;};