fix(composition,query-planner): Fix @shareable
mutation field behavior
#3303
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current behavior for
@shareable
mutation fields has some bugs. At a high level:@shareable
mutation field.@shareable
mutation field satisfiable when it shouldn't be.This PR fixes both of these issues. It specifically:
@shareable
mutation field can be satisfied starting at the same subgraph. (I.e., that no matter what selection set is on the@shareable
mutation field, the query planner will not need to make multiple calls to that mutation field across subgraphs.)ValidationState
by the initial subgraph when a shared mutation field is encountered, and keeping track of separate error stacks as well. If all these partitions experience satisfiability errors, then there's no way to satisfy the selection set containing the witness operation from each partition using a single@shareable
mutation field call, and the user is asked to fix (at least) one of the partition's satisfiability errors.Note this PR should be fine to release in a patch release from the gateway/router perspective, since it restricts composition and relaxes QP (from the composition perspective, the actual rejection of some compositions isn't great, but the incidence of broken
@shareable
mutation fields is rare and the alternative is runtime errors).