-
Notifications
You must be signed in to change notification settings - Fork 254
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix potential normalization assertion error for fragment on abstract …
…types (#2725) An abstract type (interface or union) can have different runtime types in different subgraphs. For instance, a type `T` may implement some interface `I` in subgraph A, but not in subgraph B _even_ if `I` is otherwise defined in subgraph B (admittedly something not to be abused, but it can be convenient as a temporary state when evolving schema). For named fragment, this can create a case where a fragment on an abstract type can be "rebased" on a subgraph, but where some of its application (spread) in other fragments are invalid due to being use in the context of a type that intersect the abstrat type in the supergraph but not in the particular subgraph. When that's the case, the invalid spread (for the subgraph) needs to be expanded, and that expansion properly "rebased", but the code was not handling that case at all. Instead it kept the invalid spread, and this led to some later assertion errors. Fixes #2721.
- Loading branch information
Sylvain Lebresne
authored
Aug 16, 2023
1 parent
6f1fddb
commit c6e0e76
Showing
4 changed files
with
546 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
"@apollo/query-planner": patch | ||
"@apollo/federation-internals": patch | ||
--- | ||
|
||
Fix potential assertion error for named fragment on abstract types when the abstract type does not have the same | ||
possible runtime types in all subgraphs. | ||
|
||
The error manifested itself during query planning with an error message of the form `Cannot normalize X at Y ...`. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3542,9 +3542,7 @@ describe('named fragment rebasing on subgraphs', () => { | |
t { | ||
x | ||
y | ||
... on T { | ||
z | ||
} | ||
z | ||
} | ||
} | ||
`); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.