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.

fix(data-quality): return 404 for non-uuid check ids (#130031)

Thiago Salvatorea48cb3b75caa
diff --git a/products/data_quality/backend/presentation/views.py b/products/data_quality/backend/presentation/views.py
index 3a135d9b0af4..2175197e39f6 100644
--- a/products/data_quality/backend/presentation/views.py
+++ b/products/data_quality/backend/presentation/views.py
@@ -15,12 +15,12 @@ from typing import TYPE_CHECKING, Any, ClassVar, cast
from uuid import UUID
from django.db.models import QuerySet
-from django.shortcuts import get_object_or_404
from drf_spectacular.types import OpenApiTypes
from drf_spectacular.utils import OpenApiParameter, extend_schema, extend_schema_view
from rest_framework import mixins, status, viewsets
from rest_framework.exceptions import APIException, NotFound, PermissionDenied, ValidationError
+from rest_framework.generics import get_object_or_404
from rest_framework.permissions import SAFE_METHODS, BasePermission, IsAuthenticated
from rest_framework.request import Request
from rest_framework.response import Response
diff --git a/products/data_quality/backend/tests/test_api.py b/products/data_quality/backend/tests/test_api.py
index acab28085ad6..8ae6474f33af 100644
--- a/products/data_quality/backend/tests/test_api.py
+++ b/products/data_quality/backend/tests/test_api.py
@@ -579,6 +579,11 @@ class TestDataQualityCheckAPI(APIBaseTest):
self.suites_url = f"/api/projects/{self.team.id}/data_quality_runs"
self.subject = {"subject_type": SubjectType.VIEW, "subject_uuid": str(self.view.id)}
+ def test_non_uuid_check_id_returns_404(self) -> None:
+ response = self.client.get(f"{self.url}/999999999/runs/")
+
+ assert response.status_code == status.HTTP_404_NOT_FOUND
+
def test_model_history_includes_deleted_checks_without_other_models(self) -> None:
check = self._create_check()
other_view = DataWarehouseSavedQuery.objects.create(