Skip to content

Conversation

@ardatan
Copy link
Member

@ardatan ardatan commented Oct 24, 2025

Ref GW-323
Closes #1082

Support for Progressive Override

If you have labels like below;

type Foo {
   # If label is active, it overrides `Foo.bar` from A, and use this subgraph not A.
   bar: String @override(from: "A", label: "my_custom_label")
}
defineConfig({
  // You can control the label through headers like below;
  progressiveOverride(label, context) {
     if (label === 'my_custom_label' && context.request.headers.has('x-use-my-custom-label')) {
        return true;
     }
     return false;
  }
})

@ardatan ardatan force-pushed the progressive-override branch 3 times, most recently from 2b2bee3 to ce28f67 Compare October 24, 2025 11:37

const label = fieldInfo.label;
// Extract 10 from percent(10) for example
const percentRegexp = /^percent\((\d{1,3})\)$/;
Copy link
Contributor

Choose a reason for hiding this comment

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

A valid value for percentage is, I think, up to 8 digits or something

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm I guess they don't have a limit;
https://github.com/apollographql/router/blob/dev/apollo-router/src/plugins/progressive_override/mod.rs#L113
But they parse it as float so I should remove the limit too.

Copy link
Contributor

Choose a reason for hiding this comment

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

The "limit" is limited by the producer of supergraph (composition - longer numbers fail composition)

Copy link
Member Author

@ardatan ardatan Oct 24, 2025

Choose a reason for hiding this comment

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

So we don't need to limit it as it is right now, no?

@theguild-bot
Copy link
Collaborator

theguild-bot commented Oct 24, 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/batch-delegate 10.0.2-alpha-55039db9b96449b3de63ec097f58c0d4ff28eb08 npm ↗︎ unpkg ↗︎
@graphql-tools/delegate 11.1.0-alpha-55039db9b96449b3de63ec097f58c0d4ff28eb08 npm ↗︎ unpkg ↗︎
@graphql-tools/federation 4.1.0-alpha-55039db9b96449b3de63ec097f58c0d4ff28eb08 npm ↗︎ unpkg ↗︎
@graphql-mesh/fusion-runtime 1.3.0-alpha-55039db9b96449b3de63ec097f58c0d4ff28eb08 npm ↗︎ unpkg ↗︎
@graphql-hive/gateway 2.1.11-alpha-55039db9b96449b3de63ec097f58c0d4ff28eb08 npm ↗︎ unpkg ↗︎
@graphql-hive/logger 1.0.7-alpha-55039db9b96449b3de63ec097f58c0d4ff28eb08 npm ↗︎ unpkg ↗︎
@graphql-hive/nestjs 2.0.16-alpha-55039db9b96449b3de63ec097f58c0d4ff28eb08 npm ↗︎ unpkg ↗︎
@graphql-hive/plugin-aws-sigv4 2.0.11-alpha-55039db9b96449b3de63ec097f58c0d4ff28eb08 npm ↗︎ unpkg ↗︎
@graphql-hive/plugin-opentelemetry 1.0.13-alpha-55039db9b96449b3de63ec097f58c0d4ff28eb08 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-prometheus 2.0.14-alpha-55039db9b96449b3de63ec097f58c0d4ff28eb08 npm ↗︎ unpkg ↗︎
@graphql-hive/gateway-runtime 2.2.0-alpha-55039db9b96449b3de63ec097f58c0d4ff28eb08 npm ↗︎ unpkg ↗︎
@graphql-tools/stitch 10.1.0-alpha-55039db9b96449b3de63ec097f58c0d4ff28eb08 npm ↗︎ unpkg ↗︎
@graphql-tools/stitching-directives 4.0.2-alpha-55039db9b96449b3de63ec097f58c0d4ff28eb08 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-common 1.0.7-alpha-55039db9b96449b3de63ec097f58c0d4ff28eb08 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-http 1.0.7-alpha-55039db9b96449b3de63ec097f58c0d4ff28eb08 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-http-callback 1.0.7-alpha-55039db9b96449b3de63ec097f58c0d4ff28eb08 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-ws 2.0.7-alpha-55039db9b96449b3de63ec097f58c0d4ff28eb08 npm ↗︎ unpkg ↗︎
@graphql-tools/wrap 11.0.2-alpha-55039db9b96449b3de63ec097f58c0d4ff28eb08 npm ↗︎ unpkg ↗︎

@theguild-bot
Copy link
Collaborator

theguild-bot commented Oct 24, 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 24, 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 24, 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 24, 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 24, 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.11-alpha-55039db9b96449b3de63ec097f58c0d4ff28eb08

@theguild-bot
Copy link
Collaborator

theguild-bot commented Oct 24, 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.11-alpha-55039db9b96449b3de63ec097f58c0d4ff28eb08-bun

@ardatan ardatan marked this pull request as ready for review October 24, 2025 11:52
@Copilot Copilot AI review requested due to automatic review settings October 24, 2025 11:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements Progressive Override functionality for GraphQL federation, allowing dynamic field resolution control based on labels. The feature supports both percentage-based automatic overrides (using percent(x) syntax) and custom handler functions that evaluate labels against context.

Key changes:

  • Added progressiveOverride configuration option that accepts a handler function to evaluate override labels
  • Implemented override logic in delegation planning and field filtering stages
  • Built-in support for percent(x) syntax for percentage-based progressive rollouts

Reviewed Changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/runtime/src/types.ts Added progressiveOverride configuration option to gateway config interface
packages/runtime/src/createGatewayRuntime.ts Wired progressive override handler through to unified graph manager
packages/fusion-runtime/src/unifiedGraphManager.ts Added handler parameter to unified graph manager options and handler setup
packages/fusion-runtime/src/federation/supergraph.ts Passed progressive override handler to supergraph configuration
packages/federation/src/utils.ts Defined handler types and percentage-based possibility handler
packages/federation/src/supergraph.ts Extracted override metadata from supergraph SDL and configured field-level overrides
packages/delegate/src/types.ts Added override configuration to merged field config
packages/delegate/src/handleOverrideByDelegation.ts Created memoized handler for override evaluation
packages/delegate/src/finalizeGatewayRequest.ts Integrated override handling into field filtering logic
packages/delegate/src/index.ts Exported override handler for external use
packages/stitch/src/createDelegationPlanBuilder.ts Integrated override logic into delegation planning and subschema selection
packages/stitch/src/getFieldsNotInSubschema.ts Added override checks when determining unavailable fields
packages/federation/tests/progressive-override.test.ts Added comprehensive test coverage for progressive override scenarios
packages/federation/tests/getStitchedSchemaFromLocalSchemas.ts Extended test helper to support progressive override handler
e2e/progressive-override/* Added end-to-end tests with sample services demonstrating the feature
.changeset/cool-wolves-sort.md Documented the minor version change for affected packages

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@theguild-bot
Copy link
Collaborator

theguild-bot commented Oct 24, 2025

🚀 Snapshot Release (Binary for Windows-X64)

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

Download

'@graphql-tools/stitch': minor
---

Progressive Override Implementation
Copy link
Contributor

Choose a reason for hiding this comment

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

This changeset could show an actual example and link to documentation

Copy link
Member Author

Choose a reason for hiding this comment

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

Added

@ardatan ardatan force-pushed the progressive-override branch from ce96a6c to 2cd24ac Compare October 24, 2025 14:06

const label = fieldInfo.label;
// Extract 10 from percent(10) for example
const percentRegexp = /^percent\((\d+)\)$/;
Copy link
Contributor

Choose a reason for hiding this comment

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

\d+ won’t pass floats

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@ardatan ardatan force-pushed the progressive-override branch from c993180 to f15ea4b Compare October 24, 2025 14:50
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.

support progressive override in Hive gateway

4 participants