-
Notifications
You must be signed in to change notification settings - Fork 273
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): match JS condition order with multiple skip/include on the same selection #6120
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
…on the same selection Rust was iterating in a consistent order, JS iterates in declaration order. Surprisingly this was the only place we use the consistent order. This removes the `iter_sorted()` method from DirectiveList that is now no longer used. Internally, DirectiveList still uses the consistent sort order for hashing and equality. I think it's somewhat nicer to use the consistent order here, so you do not get different plans based on an innocuous input difference, but so be it. We can consider using a consistent order everywhere we handle directives in the future.
goto-bus-stop
requested review from
dariuszkuc,
sachindshinde,
SimonSapin,
lrlna,
TylerBloom and
duckki
as code owners
October 4, 2024 09:23
✅ Docs Preview ReadyConfiguration{
"repoOverrides": {
"apollographql/router@dev": {
"remote": {
"owner": "apollographql",
"repo": "router",
"branch": "renee/ROUTER-799"
}
}
}
}
2 pages published. Build will be available for 30 days. |
@goto-bus-stop, please consider creating a changeset entry in |
CI performance tests
|
TylerBloom
approved these changes
Oct 7, 2024
goto-bus-stop
added a commit
that referenced
this pull request
Oct 10, 2024
…n the same selection PR #6120 was the wrong solution. JS doesn't actually maintain the order of the conditions, like I thought. Instead, it always puts `@skip` first and `@include` second, the opposite of what Rust was doing. The queries I was testing with just happened to pass in #6120. This changes the implementation of `Conditions::from_directives` to pick the directives out manually instead of iterating. Technically, this does two iterations of the directive list...but, the code is a bit simpler, I think.
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.
Rust was iterating in a consistent order, JS iterates in declaration
order.
Surprisingly this was the only place we use the consistent order. This
removes the
iter_sorted()
method from DirectiveList that is now nolonger used. Internally, DirectiveList still uses the consistent sort
order for hashing and equality.
I think it's somewhat nicer to use the consistent order here, so you do
not get different plans based on an innocuous input difference, but so
be it. We can consider using a consistent order everywhere we handle
directives in the future.