Skip to content

Commit

Permalink
Fix directives preventing scope to "refine" themselves properly
Browse files Browse the repository at this point in the history
The `Scope.refine` method, which is in charge of ensuring the scope are
"minimal" (don't contain unecessary conditions), has a bug whereby if we
refine with a directive, we don't minimalize the resulting code
properly.

This can lead a query plan to include conditions of the form:
```
... on I {
  ... on E @foo {
    v
  }
}
```
where `E` is an implementation of interface `I` (and as such the
condition on `I` is redundant). This is harmless in many situations but
this can happen in a query to a subgraph that does not know of interface
`I`, thus leading to an invalid query.

The fix is simply to remove the special casing for directives that
leads to not properly minimizing the scope. That condition was an
unfortunate left-over of a previous version of the code that wasn't
properly updated.

Fixes: #801
  • Loading branch information
Sylvain Lebresne committed Jun 10, 2021
1 parent d727603 commit 7b37769
Show file tree
Hide file tree
Showing 4 changed files with 576 additions and 4 deletions.
4 changes: 4 additions & 0 deletions gateway-js/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
- _Nothing yet! Stay tuned!_

## v0.28.1

- Fix plan querying a subgraph with an interface it doesn't know due to directives ([#801](https://github.com/apollographql/federation/issues/801)).

## v0.28.0

- Expand the range of supported `node` versions in the package's `engines` specifier to include the now-tested Node.js `16`. [PR #713](https://github.com/apollographql/federation/pull/713)
Expand Down

0 comments on commit 7b37769

Please sign in to comment.