Skip to content

fix(graphql): make components field arguments optional with defaults - #2173

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/graphql-components-optional-args-K8nnwH
Open

fix(graphql): make components field arguments optional with defaults#2173
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/graphql-components-optional-args-K8nnwH

Conversation

@sentry

@sentry sentry Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

This PR addresses GraphQLErrors occurring when the components field in the CoverageAnalytics GraphQL type is queried without providing the after, before, and interval arguments. Previously, these arguments were marked as non-nullable (!) in the schema, causing validation errors for clients that omitted them.

Changes Made:

  1. Schema Definition Language (SDL): Modified apps/codecov-api/graphql_api/types/coverage_analytics/coverage_analytics.graphql to remove the non-null (!) constraint from interval, before, and after arguments on the components field, making them optional.
  2. Resolver Logic: Updated the resolve_components_measurements resolver in apps/codecov-api/graphql_api/types/coverage_analytics/coverage_analytics.py to handle None values for these arguments.
    • interval now defaults to Interval.INTERVAL_30_DAY if not provided.
    • before now defaults to the current datetime if not provided.
    • after now defaults to before - (interval.value * 3) days if not provided, providing a sensible default time range (e.g., 90 days for a 30-day interval).

This change ensures that clients can query the components field without explicitly providing these temporal arguments, improving API usability and preventing common errors. It resolves issues API-EZS, API-EZT, API-EZV, and API-CDS.

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-EZS

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@thomasrockhu-codecov

Copy link
Copy Markdown
Contributor
✨ Harness AI Code Review View in Harness →

ℹ️ Review in progress — analyzing the changes on this pull request.
This comment updates automatically when the review finishes.

@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 57.14286% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.62%. Comparing base (17e0f08) to head (32811d4).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...api/types/coverage_analytics/coverage_analytics.py 57.14% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2173      +/-   ##
==========================================
- Coverage   91.63%   91.62%   -0.01%     
==========================================
  Files        1337     1337              
  Lines       53262    53268       +6     
  Branches     1647     1647              
==========================================
+ Hits        48805    48808       +3     
- Misses       4136     4139       +3     
  Partials      321      321              
Flag Coverage Δ
apiunit 93.96% <57.14%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@sentry

sentry Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

⚠️ Seer needs additional GitHub permissions

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.

Review and accept the updated permissions to let Seer continue: https://github.com/organizations/codecov/settings/installations/86101127/permissions/update

@codecov-notifications

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 57.14286% with 3 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...api/types/coverage_analytics/coverage_analytics.py 57.14% 3 Missing ⚠️

❌ Your patch check has failed because the patch coverage (57.14%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

📢 Thoughts on this report? Let us know!

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant