Skip to content
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

Stitching composition result is not predictable #3897

Closed
Tracked by #3858
n1ru4l opened this issue Feb 1, 2024 · 0 comments · Fixed by #3911
Closed
Tracked by #3858

Stitching composition result is not predictable #3897

n1ru4l opened this issue Feb 1, 2024 · 0 comments · Fixed by #3911

Comments

@n1ru4l
Copy link
Collaborator

n1ru4l commented Feb 1, 2024

The composition of stitching projects is not predictable.

In stitching the composition result is affected by the order of the service SDLs passed to the stitching implementation.
Within Hive, we always load the service SDLs ordered by their creation date. By doing so the order of the services is unpredictable, as the service's position within the list can change based on when it was last published. If there are conflicting type definitions within multiple services this can lead to unexpected composed schemas.

Example:

# service A
type Notification {
  message: String
}
# service B
type Notification {
  message: String!
}

If B is behind A, in the composed schema Notification.message will be of type String!.
If A is behind B, in the composed schema Notification.message will be of type String.

const { allStitchingDirectivesTypeDefs, stitchingDirectivesValidator } = stitchingDirectives();
const parsedStitchingDirectives = parse(allStitchingDirectivesTypeDefs);
const stitchingDirectivesNames = extractDirectiveNames(parsedStitchingDirectives);

Since we detect schema changes based on diffing composed schemas the service order change can lead to unexpected schema changes being reported, which are unrelated to the schema being published, but related to the changed order of the services that was triggered by a publish.

This confuses users of Hive and makes the predictability and usage of the composed schema (and services CDN endpoint) unsafe.

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 a pull request may close this issue.

1 participant