You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Previously, when an anonymous client submitted a GraphQL query requesting a field that did not exist in the schema (e.g., isUser on the Owner type), the error_formatter in graphql_api/views.py would incorrectly categorize this as an INTERNAL SERVER ERROR.
This led to these client-side schema validation errors being logged as server errors and captured by Sentry, creating unnecessary noise and misrepresenting the nature of the issue.
This change modifies the error_formatter to specifically detect Cannot query field errors. For anonymous users, these are now returned as a ValidationError with a generic message, and crucially, they no longer trigger Sentry error capture. Authenticated users continue to receive the full GraphQL validation details. This ensures that only genuine server-side issues are reported to Sentry.
Legal Boilerplate
Look, I get it. The entity doing business as "Codecov" is owned by Harness, Inc. In 2026 Harness acquired Codecov and as a result Harness is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Harness can use, modify, copy, and redistribute my contributions, under Harness's choice of terms.
This PR stops Sentry from capturing client-side GraphQL schema-validation errors ("Cannot query field") for anonymous users by returning a typed ValidationError response and returning early before capture_exception. The change itself is correct and well-scoped, but it changes behavior that an existing test explicitly asserts without updating that test, so CI will fail as-is. Fix the stale assertion before merge.
Top findings
HIGH · TESTapps/codecov-api/graphql_api/views.py:353 — Existing test_when_bad_query_and_anonymous still asserts "INTERNAL SERVER ERROR"; the new anonymous bad-query path returns "Bad query: field does not exist on this type", so that test breaks.
Seer wants to keep iterating on this pull request to get CI passing, but the Sentry GitHub App installation is missing permissions it needs to read the failing checks and push a fix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, when an anonymous client submitted a GraphQL query requesting a field that did not exist in the schema (e.g.,
isUseron theOwnertype), theerror_formatteringraphql_api/views.pywould incorrectly categorize this as anINTERNAL SERVER ERROR.This led to these client-side schema validation errors being logged as server errors and captured by Sentry, creating unnecessary noise and misrepresenting the nature of the issue.
This change modifies the
error_formatterto specifically detectCannot query fielderrors. For anonymous users, these are now returned as aValidationErrorwith a generic message, and crucially, they no longer trigger Sentry error capture. Authenticated users continue to receive the full GraphQL validation details. This ensures that only genuine server-side issues are reported to Sentry.Legal Boilerplate
Look, I get it. The entity doing business as "Codecov" is owned by Harness, Inc. In 2026 Harness acquired Codecov and as a result Harness is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Harness can use, modify, copy, and redistribute my contributions, under Harness's choice of terms.
Fixes API-F1D
This PR was automatically generated by Sentry. You can adjust this setting at any time.