Skip to content

fix: chema sdl resolver to ignore auto fix composite schema execution…#7614

Merged
n1ru4l merged 1 commit into
mainfrom
fix/sdl-resolver-monolith-composition-ignore
Feb 3, 2026
Merged

fix: chema sdl resolver to ignore auto fix composite schema execution…#7614
n1ru4l merged 1 commit into
mainfrom
fix/sdl-resolver-monolith-composition-ignore

Conversation

@mskorokhodov

Copy link
Copy Markdown
Collaborator

… in case of monolith

Background

Description

Schema sdl resolver to ignore auto fix composite schema execution in case of monolith

Checklist

  • Input validation
  • Output encoding
  • Authentication management
  • Session management
  • Access control
  • Cryptographic practices
  • Error handling and logging
  • Data protection
  • Communication security
  • System configuration
  • Database security
  • File management
  • Memory management
  • Testing

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @mskorokhodov, 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 refines the schema resolution process by introducing a conditional bypass for composite schema auto-fixing in environments where a supergraph SDL is not applicable, such as monoliths. Concurrently, it enhances the user experience on the laboratory page by integrating error handling for schema introspection, ensuring that any issues during schema fetching are gracefully managed and communicated to the user.

Highlights

  • Schema Resolution Logic: Modified the getCompositeSchemaSdl method to prevent the autoFixCompositeSchemaSdl function from executing if a supergraphSDL is not present, specifically addressing monolith scenarios.
  • Frontend Error Handling: Implemented robust error handling in the LaboratoryPageContent component to catch and display errors during GraphQL schema introspection using sonner toasts, improving user feedback.
  • Changelog Entry: Added a new changeset file to document the fix for the schema SDL resolver.
Changelog
  • .changeset/afraid-pans-thank.md
    • Added a new changeset file documenting the fix for the schema SDL resolver to ignore auto-fix composite schema execution in monolith cases.
  • packages/services/api/src/modules/schema/providers/schema-version-helper.ts
    • Introduced a check within getCompositeSchemaSdl to return compositeSchemaSDL directly if hasPersistedSchemaChanges is true but supergraphSDL is not available, effectively skipping autoFixCompositeSchemaSdl for monoliths.
    • Added a blank line for improved code readability.
  • packages/web/app/src/pages/target-laboratory-new.tsx
    • Imported toast from sonner for displaying notifications.
    • Wrapped the introspectionFromSchema(buildSchema(sdl)) call in a try-catch block to handle potential errors during schema parsing and introspection, displaying an error toast if an issue occurs.
Activity
  • The pull request was created by mskorokhodov.
  • No other activity has been recorded yet.
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.

@mskorokhodov mskorokhodov requested a review from n1ru4l February 3, 2026 12:03

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

Copy link
Copy Markdown
Contributor

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 correctly prevents autoFixCompositeSchemaSdl from running on monolith projects by checking for the existence of supergraphSDL. Additionally, it introduces robust error handling on the frontend by wrapping the schema building logic in a try-catch block, which prevents UI crashes from invalid SDLs. I've suggested a minor refactoring for improved clarity in the backend logic, aligning with the principle of prioritizing readability, and a more precise error message for the user in the frontend.

Comment on lines +108 to 114
if (!schemaVersion.supergraphSDL) {
return schemaVersion.compositeSchemaSDL;
}

return schemaVersion.compositeSchemaSDL
? this.autoFixCompositeSchemaSdl(schemaVersion.compositeSchemaSDL, schemaVersion.id)
: null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

While the logic is correct, it can be simplified to improve readability and reduce redundancy. You can restructure it to first handle the null case for compositeSchemaSDL, then the monolith case, and finally the federation case.

      if (!schemaVersion.compositeSchemaSDL) {
        return null;
      }

      if (!schemaVersion.supergraphSDL) {
        return schemaVersion.compositeSchemaSDL;
      }

      return this.autoFixCompositeSchemaSdl(schemaVersion.compositeSchemaSDL, schemaVersion.id);
References
  1. Prioritize readability over conciseness. Avoid using the logical OR assignment operator (||=) when a more explicit if/else block is clearer, especially for operations like initializing an array in a map.

try {
return introspectionFromSchema(buildSchema(sdl));
} catch (err) {
toast.error('Failed to fetch schema', {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The error message "Failed to fetch schema" is slightly misleading. The schema SDL has been fetched, but building the GraphQLSchema object from it has failed. A more accurate message would be "Failed to build schema".

Suggested change
toast.error('Failed to fetch schema', {
toast.error('Failed to build schema', {

@github-actions

github-actions Bot commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

🚀 Snapshot Release (alpha)

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

Package Version Info
hive 9.3.1-alpha-20260203122022-3c89d23ea9f526bd12ff6a620d0748bed131a232 npm ↗︎ unpkg ↗︎

@github-actions

github-actions Bot commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

📚 Storybook Deployment

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

@github-actions

github-actions Bot commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

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

Targets: build

Platforms: linux/amd64

Image Tag: 3c89d23ea9f526bd12ff6a620d0748bed131a232

@github-actions

github-actions Bot commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

💻 Website Preview

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

@mskorokhodov mskorokhodov force-pushed the fix/sdl-resolver-monolith-composition-ignore branch from c088a44 to 3c89d23 Compare February 3, 2026 12:19
@n1ru4l n1ru4l enabled auto-merge (squash) February 3, 2026 12:40
@n1ru4l n1ru4l disabled auto-merge February 3, 2026 12:44
@n1ru4l n1ru4l merged commit e853916 into main Feb 3, 2026
26 of 27 checks passed
@n1ru4l n1ru4l deleted the fix/sdl-resolver-monolith-composition-ignore branch February 3, 2026 12:44
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.

2 participants