-
Notifications
You must be signed in to change notification settings - Fork 25
Progressive Override #1624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Progressive Override #1624
Conversation
2b2bee3 to
ce28f67
Compare
|
|
||
| const label = fieldInfo.label; | ||
| // Extract 10 from percent(10) for example | ||
| const percentRegexp = /^percent\((\d{1,3})\)$/; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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?
🚀 Snapshot Release (
|
| 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 ↗︎ |
🚀 Snapshot Release (Node Docker Image)The latest changes of this PR are available as image on GitHub Container Registry (based on the declared |
🚀 Snapshot Release (Bun Docker Image)The latest changes of this PR are available as image on GitHub Container Registry (based on the declared |
There was a problem hiding this 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
progressiveOverrideconfiguration 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.
| '@graphql-tools/stitch': minor | ||
| --- | ||
|
|
||
| Progressive Override Implementation |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
ce96a6c to
2cd24ac
Compare
|
|
||
| const label = fieldInfo.label; | ||
| // Extract 10 from percent(10) for example | ||
| const percentRegexp = /^percent\((\d+)\)$/; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
c993180 to
f15ea4b
Compare
Ref GW-323
Closes #1082
Support for Progressive Override
percent(x)usage by defaultpercent(usageIf you have labels like below;