Skip to content

[test] Use GitHub's GraphQL schema definition#256

Merged
joshlf merged 1 commit intomainfrom
Gbbdff26495afa0bdc2c7c26b01675eb5da40a4d1
Dec 28, 2025
Merged

[test] Use GitHub's GraphQL schema definition#256
joshlf merged 1 commit intomainfrom
Gbbdff26495afa0bdc2c7c26b01675eb5da40a4d1

Conversation

@joshlf
Copy link
Owner

@joshlf joshlf commented Dec 28, 2025


Latest Update: v7 — Compare vs v6

📚 Full Patch History

Links show the diff between the row version and the column version.

Version v6 v5 v4 v3 v2 v1 Base
v7 vs v6 vs v5 vs v4 vs v3 vs v2 vs v1 vs Base
v6 vs v5 vs v4 vs v3 vs v2 vs v1 vs Base
v5 vs v4 vs v3 vs v2 vs v1 vs Base
v4 vs v3 vs v2 vs v1 vs Base
v3 vs v2 vs v1 vs Base
v2 vs v1 vs Base
v1 vs Base

@gemini-code-assist
Copy link

Summary of Changes

Hello @joshlf, 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 testing utility's GraphQL mock server by integrating a robust GraphQL parser and schema validator. This change ensures that the mock server accurately interprets and responds to GraphQL queries according to the official GitHub schema, moving away from brittle regex-based parsing. The update improves the reliability and maintainability of GraphQL-related tests.

Highlights

  • GraphQL Parsing Improvement: The mock GraphQL server in testutil has been refactored to use apollo-compiler for parsing and validating incoming GraphQL queries against GitHub's schema, replacing the previous regex-based approach.
  • Dependency Updates: The Cargo.lock file has been updated to include numerous new dependencies related to GraphQL parsing and compilation (e.g., apollo-compiler, apollo-parser, pest, rowan), and several existing dependencies like thiserror and bitflags have been updated to specific versions.
  • Mock Server Logic Refinement: The graphql handler in mock_server.rs now processes GraphQL operations by traversing the parsed Abstract Syntax Tree (AST) rather than relying on string pattern matching, leading to more accurate and maintainable handling of mutations and queries.
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

This pull request is a great improvement for the test suite's mock server. It replaces brittle regex-based parsing of GraphQL queries with apollo-compiler, using GitHub's actual GraphQL schema for validation. This makes the mock server much more robust, maintainable, and aligned with the real API. The code is well-structured into helper functions for different GraphQL operations. I have one suggestion to fully complete the transition away from string-based query matching by refactoring the remaining legacy fallback logic.

@joshlf joshlf force-pushed the Gbbdff26495afa0bdc2c7c26b01675eb5da40a4d1 branch from 2ac19fd to dcf561d Compare December 28, 2025 22:22
@joshlf
Copy link
Owner Author

joshlf commented Dec 28, 2025

/gemini review

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

This pull request is a great improvement to the test suite's mock server. It replaces brittle regex-based parsing of GraphQL queries with a proper GraphQL parser using the apollo-compiler crate. This makes the mock server more robust and easier to maintain.

My review focuses on further improving this new implementation by fully eliminating the remaining string-based query matching. I've suggested a refactoring to the GraphQL query handling logic to make it more comprehensive and remove a legacy fallback, which will make the code cleaner and more aligned with the goals of this PR.

@joshlf joshlf force-pushed the Gbbdff26495afa0bdc2c7c26b01675eb5da40a4d1 branch from dcf561d to 6f570a0 Compare December 28, 2025 22:26
@joshlf
Copy link
Owner Author

joshlf commented Dec 28, 2025

/gemini review

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

This pull request is a significant improvement, replacing fragile regex-based GraphQL parsing in the test mock server with proper schema-based parsing and validation using apollo-compiler. This makes the tests more robust and maintainable. The code has been well-refactored into smaller, more manageable functions. I've provided a few suggestions to further enhance code quality by removing redundant code, avoiding hardcoded values, and using more idiomatic Rust constructs.

@joshlf joshlf force-pushed the Gbbdff26495afa0bdc2c7c26b01675eb5da40a4d1 branch from 6f570a0 to ede917a Compare December 28, 2025 22:37
@joshlf
Copy link
Owner Author

joshlf commented Dec 28, 2025

/gemini review

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

This pull request is a great improvement to the test suite. It replaces a brittle regex-based GraphQL query parsing in the mock server with a robust approach using apollo-compiler and a real GraphQL schema. This makes the tests more reliable and easier to maintain. The code is also nicely refactored into smaller, more manageable functions.

I've added a couple of suggestions to make the test failure modes even clearer by using expect() for required GraphQL input fields, which will help catch issues in test setups more effectively.

@joshlf joshlf force-pushed the Gbbdff26495afa0bdc2c7c26b01675eb5da40a4d1 branch from ede917a to 9edc14c Compare December 28, 2025 22:51
@joshlf
Copy link
Owner Author

joshlf commented Dec 28, 2025

/gemini review

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

This pull request is a great improvement to the test utilities. It replaces the fragile regex-based parsing of GraphQL queries in the mock server with apollo-compiler, which parses and validates queries against the actual GitHub GraphQL schema. This makes the mock server much more robust and reliable. The changes also include some nice refactorings, like using constants for default repository owner and name. I have one suggestion to further improve the accuracy of the mock server by validating the owner and name arguments in repository queries.

@joshlf joshlf force-pushed the Gbbdff26495afa0bdc2c7c26b01675eb5da40a4d1 branch from 9edc14c to c5d4485 Compare December 28, 2025 23:47
@joshlf
Copy link
Owner Author

joshlf commented Dec 28, 2025

/gemini review

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

This pull request introduces significant improvements to the mock GitHub GraphQL server by integrating apollo-compiler for schema validation and query parsing. This change replaces the previous regex-based parsing, making the mock server more robust and accurate in simulating GitHub's GraphQL API. New test cases have been added to verify the repository query arguments, ensuring the mock server behaves as expected. The dependency updates in Cargo.lock reflect the addition of apollo-compiler and related crates, along with consistent thiserror versioning. Overall, these changes enhance the reliability and maintainability of the test utility.

gherrit-pr-id: Gbbdff26495afa0bdc2c7c26b01675eb5da40a4d1
@joshlf joshlf force-pushed the Gbbdff26495afa0bdc2c7c26b01675eb5da40a4d1 branch from c5d4485 to 27b3b7a Compare December 28, 2025 23:52
@joshlf joshlf merged commit d889795 into main Dec 28, 2025
2 checks passed
@joshlf joshlf deleted the Gbbdff26495afa0bdc2c7c26b01675eb5da40a4d1 branch December 28, 2025 23:54
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