Skip to content

fix(graphql): Add changeCode field to ComponentComparison and FlagComparison - #1874

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/api-esk-change-code
Open

fix(graphql): Add changeCode field to ComponentComparison and FlagComparison#1874
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/api-esk-change-code

Conversation

@sentry

@sentry sentry Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

This PR addresses issue API-ESK, a GraphQLError: Cannot query field 'changeCode' on type 'ComponentComparison'.

The root cause was that the changeCode field was being queried by a client but was not defined in the GraphQL schema for either ComponentComparison or FlagComparison types, nor was it implemented in their respective resolvers.

To fix this, the changeCode: Float field has been added to:

  • apps/codecov-api/graphql_api/types/component_comparison/component_comparison.graphql
  • apps/codecov-api/graphql_api/types/flag_comparison/flag_comparison.graphql

Corresponding resolvers have been implemented in:

  • apps/codecov-api/graphql_api/types/component_comparison/component_comparison.py
  • apps/codecov-api/graphql_api/types/flag_comparison/flag_comparison.py

These resolvers calculate changeCode as the difference between head_totals.coverage and base_totals.coverage, returning None if either total or their coverage values are unavailable. While a similar concept exists as changeCoverage on the Comparison type, changeCode was used here to directly match the field name requested by the client query.

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

@codecov-notifications

codecov-notifications Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

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

Files with missing lines Patch % Lines
...types/component_comparison/component_comparison.py 18.18% 9 Missing ⚠️
...aphql_api/types/flag_comparison/flag_comparison.py 18.18% 9 Missing ⚠️

📢 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.

@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 18.18182% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.80%. Comparing base (d8942db) to head (63df12f).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...types/component_comparison/component_comparison.py 18.18% 9 Missing ⚠️
...aphql_api/types/flag_comparison/flag_comparison.py 18.18% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1874      +/-   ##
==========================================
- Coverage   91.83%   91.80%   -0.04%     
==========================================
  Files        1332     1332              
  Lines       51830    51852      +22     
  Branches     1647     1647              
==========================================
+ Hits        47598    47602       +4     
- Misses       3911     3929      +18     
  Partials      321      321              
Flag Coverage Δ
apiunit 94.67% <18.18%> (-0.09%) ⬇️

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.

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.

0 participants