Skip to content

fix(graphql): Add Segments type alias for backward compatibility - #1986

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/graphql-segments-alias
Open

fix(graphql): Add Segments type alias for backward compatibility#1986
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/graphql-segments-alias

Conversation

@sentry

@sentry sentry Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

This PR addresses the GraphQLError: Unknown type 'Segments' that occurs when older clients query the GraphQL API using ... on Segments.

The root cause was that the GraphQL schema no longer defines a type named Segments; the correct type for the segments field's successful result is SegmentComparisons. However, some clients (like the one that triggered API-EW1) were still using the deprecated Segments type name.

To ensure backward compatibility and prevent schema validation errors for these clients, this change introduces Segments as a type alias for SegmentComparisons within the SegmentsResult union. This allows queries using ... on Segments to pass schema validation, preventing a GraphQLError and allowing the request to proceed (though the Segments fields will resolve to the same data as SegmentComparisons).

Changes include:

  • Adding type Segments to segment_comparison.graphql as a duplicate of SegmentComparisons.
  • Including Segments in the SegmentsResult union in segment_comparison.graphql.
  • Registering segments_bindable = ObjectType("Segments") in segment_comparison.py.
  • Exporting and registering segments_bindable in the relevant __init__.py files.

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

@thomasrockhu-codecov

Copy link
Copy Markdown
Contributor

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

@codecov-notifications

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 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 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.63%. Comparing base (a8ec2db) to head (053723f).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1986   +/-   ##
=======================================
  Coverage   91.63%   91.63%           
=======================================
  Files        1336     1336           
  Lines       53230    53231    +1     
  Branches     1647     1647           
=======================================
+ Hits        48778    48779    +1     
  Misses       4131     4131           
  Partials      321      321           
Flag Coverage Δ
apiunit 93.99% <100.00%> (+<0.01%) ⬆️

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