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, GraphQL validation errors (e.g., missing subfield selections, invalid syntax) were sometimes incorrectly logged as internal server errors and captured by Sentry.
The error_formatter in graphql_api/views.py had a narrow heuristic ("Cannot query field" in message) to identify client-side malformed queries. Other validation errors, like "Field 'repositories'... must have a selection of subfields", would fall through and be treated as server-side exceptions.
This change modifies the error_formatter to correctly identify all GraphQL validation errors. These errors consistently have original_error set to None by the GraphQL engine. By checking for original_error is None, we can now reliably distinguish client-side query mistakes from actual server-side exceptions. These client errors are now returned directly to the client via format_error without being logged as server errors or sent 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 reworks error_formatter in graphql_api/views.py so GraphQL validation/syntax errors (which have original_error is None) are returned directly to the client instead of being masked as INTERNAL SERVER ERROR and captured to Sentry. The core fix is sound, but it has a side effect the diff doesn't account for: Cannot query field errors now reach anonymous users unmasked, which reverses prior behavior and breaks the existing test_when_bad_query_and_anonymous test. Fix that first — either update the test to the new intended behavior or re-gate anonymous field-name disclosure.
Top findings
HIGH · TEST-GAPapps/codecov-api/graphql_api/views.py:353 — New original_error is None early return exposes bad-field errors to anonymous users and breaks test_when_bad_query_and_anonymous (asserts INTERNAL SERVER ERROR).
MEDIUM · SIMPLIFICATIONapps/codecov-api/graphql_api/views.py:359 — Legacy is_bad_query branch is now unreachable dead code; remove it and the now-unused user/is_anonymous locals.
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, GraphQL validation errors (e.g., missing subfield selections, invalid syntax) were sometimes incorrectly logged as internal server errors and captured by Sentry.
The
error_formatteringraphql_api/views.pyhad a narrow heuristic ("Cannot query field" in message) to identify client-side malformed queries. Other validation errors, like "Field 'repositories'... must have a selection of subfields", would fall through and be treated as server-side exceptions.This change modifies the
error_formatterto correctly identify all GraphQL validation errors. These errors consistently haveoriginal_errorset toNoneby the GraphQL engine. By checking fororiginal_error is None, we can now reliably distinguish client-side query mistakes from actual server-side exceptions. These client errors are now returned directly to the client viaformat_errorwithout being logged as server errors or sent 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-F1C
This PR was automatically generated by Sentry. You can adjust this setting at any time.