Skip to content

Conversation

@jdolle
Copy link
Collaborator

@jdolle jdolle commented Jan 14, 2026

Background

https://linear.app/the-guild/issue/CONSOLE-1678/schema-proposals-diff-view-should-show-only-what-has-changed-and-the

For changes that touch very few lines compared to the total lines of SDL, it makes sense to collapse untouched portions of the schema. This reduces the amount of text people have to scan during a review and puts focus on exactly what has changed.

Description

Using our previous method of parsing and rendering the SDL within components made it difficult to determine which lines are able to be hidden.

To accomplish our goal, parsing needs to happen first so that the lines can be categorized appropriately before render. I first created a builder instance that would be capable to capturing and then returning all the necessary data to group and render these lines.

The rest is rewriting every component to instead leverage this builder.

Screenshot 2026-01-14 at 6 01 40 PM

With this framework in place, we can fairly easily tweak the actual rendering logic of how we collapse and show lines.

@jdolle jdolle self-assigned this Jan 14, 2026
@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 fundamentally re-architects the schema diff rendering system to improve its flexibility and prepare for advanced user interface features, such as collapsible diff sections. By decoupling the diff calculation from the rendering process and introducing a structured, intermediary representation of changes, the system gains greater control over how differences are displayed and interacted with.

Highlights

  • Architectural Refactoring of Diff Rendering: The schema diff rendering mechanism has been completely rewritten to separate the diff calculation logic from its presentation, adopting a builder pattern for generating an intermediary representation of diff lines and words.
  • Introduction of Builder Pattern: New modules (builder.ts, core.tsx, lines.tsx, words.tsx, util.ts) have been added to implement a builder-based approach, allowing for programmatic construction of diff content before rendering, enhancing modularity and extensibility.
  • Enhanced Annotation Handling: The ChangeRow component now accepts an array of coordinates, enabling a single diff line to be associated with multiple annotation points, which is a key enabler for more flexible UI features.
  • Preparation for Collapsible Diffs: This significant refactoring lays the groundwork for future UI enhancements, specifically enabling the ability to collapse sections within the schema diff view.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 14, 2026

🚀 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.2-alpha-20260115213228-cd2bf3583e2164d109ab931f8469090c419eaccb npm ↗︎ unpkg ↗︎
hive 9.0.0-alpha-20260115213228-cd2bf3583e2164d109ab931f8469090c419eaccb npm ↗︎ unpkg ↗︎

@github-actions
Copy link
Contributor

github-actions bot commented Jan 14, 2026

📚 Storybook Deployment

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

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 significant and well-architected refactoring of the schema diff rendering logic. The new approach separates the diff calculation from the rendering by using a builder pattern to create an intermediate representation of the diff. This is a great improvement for maintainability and will enable new features like collapsible sections.

However, the new implementation introduces several critical correctness issues, primarily related to incorrect non-null assertions on nullable types, which will cause runtime crashes. There are also some other bugs related to change highlighting and coordinate generation that need to be addressed. Once these issues are resolved, this will be a solid improvement to the codebase.

Comment on lines +18 to +20
write(...words: WordProps[]) {
currentLine?.words.push(...words);
},
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The write method fails silently if currentLine is undefined (i.e., if write is called before newLine). This could lead to subtle bugs where parts of the diff are missing without any error being thrown.

To make the builder more robust and prevent silent failures, consider throwing an error if currentLine is not set.

    write(...words: WordProps[]) {
      if (!currentLine) {
        throw new Error('Builder.write() was called before Builder.newLine().');
      }
      currentLine.words.push(...words);
    },

@github-actions
Copy link
Contributor

github-actions bot commented Jan 14, 2026

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

Targets: build

Platforms: linux/arm64

Image Tag: cd2bf3583e2164d109ab931f8469090c419eaccb

@github-actions
Copy link
Contributor

github-actions bot commented Jan 14, 2026

💻 Website Preview

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

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