Skip to content

Conversation

@jdolle
Copy link
Collaborator

@jdolle jdolle commented Dec 9, 2025

Background

Schema proposals require a full list of changes to be able to patch the schemas. Currently, our schema checks are responsible for calculating this list of changes and saving it to the DB. However, checks don't include the nested changes. e.g. if a new type is added, checks don't care about showing that type's new fields.

Description

This change modifies the check behavior so that it captures all changes and then the resolvers use the Rule from graphql-inspector to filter out the nested types.

@jdolle jdolle requested a review from n1ru4l December 9, 2025 19:40
@jdolle jdolle self-assigned this Dec 9, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @jdolle, 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 significantly enhances the schema change detection and reporting capabilities. It addresses a limitation where nested schema changes were not fully captured, by modifying the schema check process to record all changes. Furthermore, it introduces a new GraphQL argument to allow clients to dynamically request either a comprehensive or a simplified list of schema changes, improving both accuracy and usability for schema evolution management.

Highlights

  • Comprehensive Schema Change Capture: Schema checks now capture a full list of changes, including nested modifications (e.g., new fields within a newly added type), ensuring no detail is missed during schema evolution.
  • Flexible Change Filtering: Introduced a new simplifyChanges: Boolean = true argument to GraphQL queries for schemaChanges, breakingSchemaChanges, and safeSchemaChanges. This allows consumers to choose between a full, detailed list of changes or a simplified view where nested changes are filtered out by graphql-inspector rules.
  • Refactored Schema Diff Logic: The internal schema diffing mechanism has been updated to accept a list of Rules, providing greater flexibility in how changes are processed and filtered based on specific requirements.
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.

this.logger.debug('Comparing Schemas');

const changes = await diff(existing, incoming, [DiffRule.simplifyChanges]);
const changes = await diff(existing, incoming, rules);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This change exposes the rules option up the callstack so it can be modifies.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 9, 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-hive/cli 0.57.0-alpha-20251210003101-e6a477cba341d23819c344c9c2168be7477d6f55 npm ↗︎ unpkg ↗︎
hive 8.13.0-alpha-20251210003101-e6a477cba341d23819c344c9c2168be7477d6f55 npm ↗︎ unpkg ↗︎

@github-actions
Copy link
Contributor

github-actions bot commented Dec 9, 2025

📚 Storybook Deployment

The latest changes are available as preview in: https://pr-7395.hive-storybook.pages.dev

* @todo modify the simplifyChanges rule to loosen the argument requirements. This rule
* doesn't need more information than the change type and path fields.
*/
return DiffRule.simplifyChanges({
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The rule's type definition is very strict and that our SchemaCheck model slightly modifies the change structure, but the only thing this specific rule is using is a change's path and a type, which are unmodified. So technically this is safe to use here even though the typing is a mess.

I'd be interested in hearing recommendations for how maybe we can avoid this typecasting.

Copy link
Contributor

@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

This pull request introduces a mechanism to fetch a full, non-simplified list of schema changes by adding a simplifyChanges argument to the relevant GraphQL fields. The implementation correctly modifies the schema, resolvers, and underlying providers to support this functionality. The approach of storing the full list of changes and filtering them at the resolver level is sound. I've included a few suggestions for improving code clarity and safety.

Comment on lines +49 to +54
return DiffRule.simplifyChanges({
changes: schemaCheck.safeSchemaChanges as any,
oldSchema: undefined as any,
newSchema: undefined as any,
config: undefined,
}) as unknown as typeof schemaCheck.safeSchemaChanges;
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Using as any here bypasses type safety. While the @todo notes a plan to fix this upstream, a safer intermediate step could be to define a local, less strict context type that only includes the properties you are providing (like changes) and cast to that. This would make the code more self-documenting and slightly safer against future changes.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 9, 2025

💻 Website Preview

The latest changes are available as preview in: https://pr-7395.hive-landing-page.pages.dev

@github-actions
Copy link
Contributor

github-actions bot commented Dec 9, 2025

🐋 This PR was built and pushed to the following Docker images:

Targets: build

Platforms: linux/amd64

Image Tag: e6a477cba341d23819c344c9c2168be7477d6f55

})
@cache<SchemaVersion>(version => version.id)
private async _getSchemaChanges(schemaVersion: SchemaVersion) {
@cache<{ version: SchemaVersion; simplified: boolean }>(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the cache typing requires everything be passed as a single argument.
I then cache these versions separately to avoid having to recalculate the simplified or full list.

@jdolle jdolle changed the title General a full list of changes on schema check, and add an argument to filter change lists Generate a full list of changes on schema check, and add an argument to filter change lists Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant