-
Notifications
You must be signed in to change notification settings - Fork 266
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
fix(federation): test directives on fragment spreads #5785
Merged
Merged
Conversation
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
goto-bus-stop
requested review from
dariuszkuc,
sachindshinde,
SimonSapin,
lrlna,
TylerBloom and
duckki
as code owners
August 7, 2024 10:36
@goto-bus-stop, please consider creating a changeset entry in |
CI performance tests
|
dariuszkuc
reviewed
Aug 7, 2024
auto-merge was automatically disabled
August 7, 2024 14:48
Pull request was converted to draft
goto-bus-stop
force-pushed
the
renee/remove-incorrect-test
branch
from
August 26, 2024 09:52
14b4886
to
8e5cc88
Compare
goto-bus-stop
changed the title
chore(federation): remove incorrect test
fix(federation): test custom directives on fragment spreads
Aug 26, 2024
goto-bus-stop
changed the title
fix(federation): test custom directives on fragment spreads
fix(federation): test directives on fragment spreads
Aug 26, 2024
goto-bus-stop
added a commit
that referenced
this pull request
Aug 27, 2024
Currently, if we produce an invalid subgraph operation, it looks exactly the same as a validation error from the input query. This makes issues harder to debug. This PR turns validation errors at the end of planning into internal errors, so we know where they come from, and so end users do not get confused about what a validation error means. The new error explicitly mentions that it's a bug in the query planner that should be reported to Apollo. It's not possible to add a test for this, as it only triggers for bugs. I manually tested it with the bug that's fixed in #5785: ``` Details: Query planning produced an invalid subgraph operation. Error: fragSpreadOnly directive is not supported for INLINE_FRAGMENT location ```
dariuszkuc
pushed a commit
that referenced
this pull request
Aug 29, 2024
Currently, if we produce an invalid subgraph operation, it looks exactly the same as a validation error from the input query. This makes issues harder to debug. This PR turns validation errors at the end of planning into internal errors, so we know where they come from, and so end users do not get confused about what a validation error means. The new error explicitly mentions that it's a bug in the query planner that should be reported to Apollo. It's not possible to add a test for this, as it only triggers for bugs. I manually tested it with the bug that's fixed in #5785: ``` Details: Query planning produced an invalid subgraph operation. Error: fragSpreadOnly directive is not supported for INLINE_FRAGMENT location ```
lrlna
approved these changes
Sep 2, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In JS, we supported a functionality that does not make sense and is invalid per GraphQL spec.
@include
cannot be used on a named fragment definition. See definition of include and skip.Support for this was removed in the Rust port. This removes the test.
A related misfeature is migrating directives from a named fragment spread to an inline fragment. This happens during expansion:
Becomes:
@namedonly
cannot be used onINLINE_FRAGMENT
, so this is invalid.However, we do rely on this feature for
@skip
and@include
, and potentially other directives.As a compromise fix, this PR raises an error when a directive on a named fragment spread cannot also be used on an inline fragment. This supports
@skip
and@include
and provides a more helpful error for unsupported cases. In the future we may consider maintaining named fragments if they have directives but this would require a major refactor.