Skip to content

Conversation

@enisdenjo
Copy link
Member

Adjusted filtering logic to ensure key fields propagate correctly for interface/object combinations, preventing computed-field isolation from stripping required base fields.

TODO

  • Write tests

@gemini-code-assist
Copy link

Summary of Changes

Hello @enisdenjo, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves an issue where nested fragment spreads on interface fields could lead to the incorrect stripping of required base fields due to overly strict isolation logic. The change modifies the field filtering mechanism to be more inclusive, ensuring that essential fields are retained across complex interface and object type combinations, thereby improving data propagation correctness.

Highlights

  • Filtering Logic Adjustment: The logic for determining if a field is isolated within isolateComputedFieldsTransformer.ts has been updated. Specifically, the Array.prototype.every method was replaced with Array.prototype.some when evaluating isIsolatedFieldName. This modification ensures that if any of the implementing types or interfaces consider a field to be a base field (or not isolated), it is correctly propagated and not inadvertently stripped, addressing issues with nested fragment spreads on interface fields.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The change from every to some in filterBaseSubschema for both objectFieldFilter and interfaceFieldFilter is a logical correction for how isolated fields are detected within type hierarchies. This ensures that a field is identified as 'isolated' if it's defined as computed on any relevant type (e.g., an object type or any of its interfaces), which seems to be the intended behavior for correctly handling computed fields on interfaces. My main concern is the lack of tests, which is acknowledged in the pull request description. It is critical to add comprehensive tests for this logic change to ensure it behaves as expected across different schema configurations and doesn't introduce any regressions, especially for the scenarios with nested fragments and interfaces mentioned in the title.

Comment on lines 326 to 328
const isIsolatedFieldName = allTypes.some((implementingTypeName) =>
isIsolatedField(implementingTypeName, fieldName, isolatedSchemaTypes),
);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This logic change from every to some is crucial for correctly identifying isolated fields across type hierarchies. As noted in the PR description, this change is not currently covered by tests. Please add tests to verify this new behavior and prevent future regressions, especially for cases involving nested fragments and interfaces.

Comment on lines 360 to 362
const isIsolatedFieldName = allTypes.some((implementingTypeName) =>
isIsolatedField(implementingTypeName, fieldName, isolatedSchemaTypes),
);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Similar to the objectFieldFilter, this logic change from every to some is crucial. It's important to add tests that validate this new filtering logic for interface fields to ensure correctness and prevent regressions.

@theguild-bot
Copy link
Collaborator

theguild-bot commented Nov 26, 2025

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-tools/batch-delegate 10.0.6-alpha-a5e9ca8108a6c2bc82240bca7f1c84a85505b01f npm ↗︎ unpkg ↗︎
@graphql-tools/delegate 12.0.0-alpha-a5e9ca8108a6c2bc82240bca7f1c84a85505b01f npm ↗︎ unpkg ↗︎
@graphql-tools/federation 4.2.4-alpha-a5e9ca8108a6c2bc82240bca7f1c84a85505b01f npm ↗︎ unpkg ↗︎
@graphql-mesh/fusion-runtime 1.6.0-alpha-a5e9ca8108a6c2bc82240bca7f1c84a85505b01f npm ↗︎ unpkg ↗︎
@graphql-hive/gateway 2.1.20-alpha-a5e9ca8108a6c2bc82240bca7f1c84a85505b01f npm ↗︎ unpkg ↗︎
@graphql-hive/nestjs 2.0.25-alpha-a5e9ca8108a6c2bc82240bca7f1c84a85505b01f npm ↗︎ unpkg ↗︎
@graphql-hive/plugin-aws-sigv4 2.0.18-alpha-a5e9ca8108a6c2bc82240bca7f1c84a85505b01f npm ↗︎ unpkg ↗︎
@graphql-hive/plugin-opentelemetry 1.2.2-alpha-a5e9ca8108a6c2bc82240bca7f1c84a85505b01f npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-prometheus 2.1.6-alpha-a5e9ca8108a6c2bc82240bca7f1c84a85505b01f npm ↗︎ unpkg ↗︎
@graphql-hive/router-runtime 1.1.0-alpha-a5e9ca8108a6c2bc82240bca7f1c84a85505b01f npm ↗︎ unpkg ↗︎
@graphql-hive/gateway-runtime 2.3.6-alpha-a5e9ca8108a6c2bc82240bca7f1c84a85505b01f npm ↗︎ unpkg ↗︎
@graphql-tools/stitch 10.1.4-alpha-a5e9ca8108a6c2bc82240bca7f1c84a85505b01f npm ↗︎ unpkg ↗︎
@graphql-tools/stitching-directives 4.0.6-alpha-a5e9ca8108a6c2bc82240bca7f1c84a85505b01f npm ↗︎ unpkg ↗︎
@graphql-hive/gateway-testing 2.0.6-alpha-a5e9ca8108a6c2bc82240bca7f1c84a85505b01f npm ↗︎ unpkg ↗︎
@graphql-tools/wrap 11.1.0-alpha-a5e9ca8108a6c2bc82240bca7f1c84a85505b01f npm ↗︎ unpkg ↗︎

@theguild-bot
Copy link
Collaborator

theguild-bot commented Nov 26, 2025

🚀 Snapshot Release (Binary for macOS-ARM64)

The latest changes of this PR are available for download (based on the declared changesets).

Download

@theguild-bot
Copy link
Collaborator

theguild-bot commented Nov 26, 2025

🚀 Snapshot Release (Binary for Linux-X64)

The latest changes of this PR are available for download (based on the declared changesets).

Download

@theguild-bot
Copy link
Collaborator

theguild-bot commented Nov 26, 2025

🚀 Snapshot Release (Binary for Linux-ARM64)

The latest changes of this PR are available for download (based on the declared changesets).

Download

@theguild-bot
Copy link
Collaborator

theguild-bot commented Nov 26, 2025

🚀 Snapshot Release (Binary for macOS-X64)

The latest changes of this PR are available for download (based on the declared changesets).

Download

@theguild-bot
Copy link
Collaborator

theguild-bot commented Nov 26, 2025

🚀 Snapshot Release (Binary for Windows-X64)

The latest changes of this PR are available for download (based on the declared changesets).

Download

@theguild-bot
Copy link
Collaborator

theguild-bot commented Nov 26, 2025

🚀 Snapshot Release (Bun Docker Image)

The latest changes of this PR are available as image on GitHub Container Registry (based on the declared changesets):

ghcr.io/graphql-hive/gateway:2.1.20-alpha-a5e9ca8108a6c2bc82240bca7f1c84a85505b01f-bun

@theguild-bot
Copy link
Collaborator

theguild-bot commented Nov 26, 2025

🚀 Snapshot Release (Node Docker Image)

The latest changes of this PR are available as image on GitHub Container Registry (based on the declared changesets):

ghcr.io/graphql-hive/gateway:2.1.20-alpha-a5e9ca8108a6c2bc82240bca7f1c84a85505b01f

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.

2 participants