Skip to content

Conversation

@ardatan
Copy link
Member

@ardatan ardatan commented Oct 29, 2025

Support promises in progressiveOverride option

defineConfig({
    async progressiveOverride(label: string, context: GatewayContext) {
        if (label === 'my_label') {
            const serviceResponse = await fetch('http://example.com/should_override', {
                headers: {
                    'x-some-header': context.headers['x-some-header'],
                }
            });
            const result = await serviceResponse.json();
            return result?.override;
        }
        return false;
    }
})

@gemini-code-assist
Copy link

Summary of Changes

Hello @ardatan, 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 progressiveOverride feature by enabling it to handle asynchronous logic. This allows gateway configurations to make dynamic override decisions, for instance, by querying external services, thereby increasing the flexibility and power of progressive rollouts. The changes include updates to type definitions, core runtime logic to process promises, and new E2E tests to validate the functionality.

Highlights

  • Asynchronous Progressive Override: The progressiveOverride configuration option now supports asynchronous return values (Promises), allowing for dynamic override decisions based on external service calls or complex computations.
  • Refactored Context Handling: The gateway runtime's context creation logic has been refactored to directly modify the context object, ensuring consistent header and connection parameter handling.
  • Enhanced E2E Testing: New end-to-end tests and a dedicated 'label' service have been added to demonstrate and validate the asynchronous progressiveOverride functionality.
  • Internal Override Label Management: The UnifiedGraphManager now tracks enabled override labels per context using a WeakMap and processes asynchronous override results to apply them correctly.
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 enhances the progressiveOverride functionality by adding support for asynchronous operations, allowing it to return a Promise<boolean>. This is a great improvement for scenarios requiring external service calls to determine overrides. The implementation correctly handles both synchronous and asynchronous return values and uses a WeakMap to cache results per request context. I've added a couple of minor suggestions to improve code style and clarity.

@theguild-bot
Copy link
Collaborator

theguild-bot commented Oct 29, 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/federation 4.2.0-alpha-5f41185b1e0b0102794421e62730e3dec4580827 npm ↗︎ unpkg ↗︎
@graphql-mesh/fusion-runtime 1.4.0-alpha-5f41185b1e0b0102794421e62730e3dec4580827 npm ↗︎ unpkg ↗︎
@graphql-hive/gateway 2.1.12-alpha-5f41185b1e0b0102794421e62730e3dec4580827 npm ↗︎ unpkg ↗︎
@graphql-hive/nestjs 2.0.17-alpha-5f41185b1e0b0102794421e62730e3dec4580827 npm ↗︎ unpkg ↗︎
@graphql-hive/plugin-aws-sigv4 2.0.12-alpha-5f41185b1e0b0102794421e62730e3dec4580827 npm ↗︎ unpkg ↗︎
@graphql-hive/plugin-deduplicate-request 2.0.4-alpha-5f41185b1e0b0102794421e62730e3dec4580827 npm ↗︎ unpkg ↗︎
@graphql-mesh/hmac-upstream-signature 2.0.4-alpha-5f41185b1e0b0102794421e62730e3dec4580827 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-jwt-auth 2.0.7-alpha-5f41185b1e0b0102794421e62730e3dec4580827 npm ↗︎ unpkg ↗︎
@graphql-hive/plugin-opentelemetry 1.0.14-alpha-5f41185b1e0b0102794421e62730e3dec4580827 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-prometheus 2.0.15-alpha-5f41185b1e0b0102794421e62730e3dec4580827 npm ↗︎ unpkg ↗︎
@graphql-hive/gateway-runtime 2.3.0-alpha-5f41185b1e0b0102794421e62730e3dec4580827 npm ↗︎ unpkg ↗︎
@graphql-hive/gateway-testing 2.0.0-alpha-5f41185b1e0b0102794421e62730e3dec4580827 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-common 1.0.8-alpha-5f41185b1e0b0102794421e62730e3dec4580827 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-http 1.0.8-alpha-5f41185b1e0b0102794421e62730e3dec4580827 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-http-callback 1.0.8-alpha-5f41185b1e0b0102794421e62730e3dec4580827 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-ws 2.0.8-alpha-5f41185b1e0b0102794421e62730e3dec4580827 npm ↗︎ unpkg ↗︎

@theguild-bot
Copy link
Collaborator

theguild-bot commented Oct 29, 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 Oct 29, 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 Oct 29, 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 Oct 29, 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 Oct 29, 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.12-alpha-5f41185b1e0b0102794421e62730e3dec4580827

@theguild-bot
Copy link
Collaborator

theguild-bot commented Oct 29, 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.12-alpha-5f41185b1e0b0102794421e62730e3dec4580827-bun

@theguild-bot
Copy link
Collaborator

theguild-bot commented Oct 29, 2025

🚀 Snapshot Release (Binary for Windows-X64)

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

Download

Copy link
Member

@enisdenjo enisdenjo left a comment

Choose a reason for hiding this comment

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

Looking nice! Just one small remark about the example in changesets and lets land this.

@ardatan ardatan marked this pull request as draft October 29, 2025 12:45
@ardatan ardatan marked this pull request as ready for review October 29, 2025 13:18
@ardatan ardatan merged commit af7a7de into main Oct 29, 2025
32 of 33 checks passed
@ardatan ardatan deleted the support-async branch October 29, 2025 13:18
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.

3 participants