Skip to content

fix(graphql): restore directChangedFiles field on Comparison type - #1981

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/graphql-direct-changed-files
Open

fix(graphql): restore directChangedFiles field on Comparison type#1981
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/graphql-direct-changed-files

Conversation

@sentry

@sentry sentry Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

This PR addresses issue API-EVX, where an external client was encountering a GraphQLError: Cannot query field 'directChangedFiles' on type 'Comparison'.

The root cause was that the Comparison GraphQL type only exposed directChangedFilesCount (an integer) but not the directChangedFiles connection field that the client was attempting to query.

To resolve this, the following changes were made:

  1. Schema Update (apps/codecov-api/graphql_api/types/comparison/comparison.graphql):

    • Added the directChangedFiles(filters: ImpactedFilesFilters): ImpactedFilesResult! field to the Comparison type.
  2. Resolver Implementation (apps/codecov-api/graphql_api/types/comparison/comparison.py):

    • A new resolver resolve_direct_changed_files was added.
    • This resolver utilizes the existing command.fetch_impacted_files method.
    • It explicitly sets has_unintended_changes=False in the filters to ensure that only files with direct changes are returned, aligning with the semantic meaning of 'direct changed files'.
    • The results are returned in the ImpactedFilesResult format, which is consistent with other file list queries.

Note for clients: While the field is restored, clients previously querying with Relay-style edges { node { headName } } will need to adjust their queries to use the results: [...] structure provided by ImpactedFilesResult.

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

@thomasrockhu-codecov

Copy link
Copy Markdown
Contributor

🤖 Harness AI Code Review in progress… · View results →

@codecov-notifications

Copy link
Copy Markdown

Codecov Report

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

Files with missing lines Patch % Lines
...cov-api/graphql_api/types/comparison/comparison.py 37.50% 5 Missing ⚠️

❌ Your patch check has failed because the patch coverage (37.50%) 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.

@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 37.50000% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.60%. Comparing base (68c86d1) to head (1b37e70).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...cov-api/graphql_api/types/comparison/comparison.py 37.50% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1981      +/-   ##
==========================================
- Coverage   91.61%   91.60%   -0.01%     
==========================================
  Files        1336     1336              
  Lines       53174    53182       +8     
  Branches     1647     1647              
==========================================
+ Hits        48715    48718       +3     
- Misses       4138     4143       +5     
  Partials      321      321              
Flag Coverage Δ
apiunit 93.92% <37.50%> (-0.03%) ⬇️

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.

1 participant