: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
fix(error_tracking): stop capturing symbol set upload rejections (#99253)
posthog[bot]f45a6688bb05
diff --git a/products/error_tracking/backend/logic/symbol_sets.py b/products/error_tracking/backend/logic/symbol_sets.pyindex eed1e5906bae..2607c3497b48 100644--- a/products/error_tracking/backend/logic/symbol_sets.py+++ b/products/error_tracking/backend/logic/symbol_sets.py@@ -269,7 +269,10 @@ def _needs_upload()+# The DRF ValidationErrors on this path are the CLI upload contract, not server faults, so+# error tracking must not see them. Real faults are still captured, by DRF's global reporting+# hook (posthog.exceptions.exception_reporting), which reports every non-APIException.[email protected](capture_exceptions=False)def bulk_check_symbol_sets(new_symbol_sets: list[SymbolSetUpload],team: Team,@@ -304,7 +307,7 @@ def bulk_check_symbol_sets(return chunk_ids_to_upload[email protected](capture_exceptions=False)def bulk_create_symbol_sets(new_symbol_sets: list[SymbolSetUpload],team: Team,diff --git a/products/error_tracking/backend/tests/api/test_error_tracking_api.py b/products/error_tracking/backend/tests/api/test_error_tracking_api.pyindex 162e1c48665c..7999ca77ab2e 100644--- a/products/error_tracking/backend/tests/api/test_error_tracking_api.py+++ b/products/error_tracking/backend/tests/api/test_error_tracking_api.py@@ -1786,6 +1786,60 @@ class TestErrorTracking(APIBaseTest):symbol_set.refresh_from_db()assert symbol_set.release_id == first_release.id+ @parameterized.expand(+ [+ # (name, endpoint, the upload names the other release, expected rejection code)+ ("start_upload", "bulk_start_upload", True, "release_id_mismatch"),+ ("check_upload", "bulk_check_upload", False, "content_hash_mismatch"),+ ]+ )+ @patch("products.error_tracking.backend.logic.symbol_sets.posthoganalytics.capture_exception")+ def test_bulk_upload_conflict_is_not_reported_to_error_tracking(+ self,+ _name: str,+ endpoint: str,+ upload_names_other_release: bool,+ expected_code: str,+ patched_capture_exception: Mock,+ ) -> None:+ chunk_id = str(uuid7())+ release = ErrorTrackingRelease.objects.create(+ team=self.team,+ hash_id="conflict-release",+ version="1.0.0",+ project="test",+ )+ other_release = ErrorTrackingRelease.objects.create(+ team=self.team,+ hash_id="conflict-other-release",+ version="1.0.1",+ project="test",+ )+ ErrorTrackingSymbolSet.objects.create(+ team=self.team,+ ref=chunk_id,+ storage_ptr="existing",+ content_hash="already_uploaded",+ release=release,+ )++ upload = {+ "chunk_id": chunk_id,+ "content_hash": "already_uploaded" if upload_names_other_release else "different_hash",+ }+ if upload_names_other_release:+ upload["release_id"] = str(other_release.id)++ response = self.client.post(+ f"/api/environments/{self.team.id}/error_tracking/symbol_sets/{endpoint}",+ data={"symbol_sets": [upload]},+ format="json",+ )++ assert response.status_code == status.HTTP_400_BAD_REQUEST+ assert response.json()["code"] == expected_code+ patched_capture_exception.assert_not_called()+@parameterized.expand([# (name, existing row (None = missing), upload names the release, request flags, expected to upload)