-
Notifications
You must be signed in to change notification settings - Fork 272
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(demand_control): use correct parent type in fragment definitions #6162
Conversation
Fixes errors like: ``` Attempted to look up a field on type MyInterface, but the field does not exist ``` Fragment definitions have a type condition, and all selections inside the fragment are executed against that type condition. Previously, the demand control cost calculator executed them against the parent type *where the fragment is used*, which is often different.
✅ Docs Preview ReadyNo new or changed pages found. |
@goto-bus-stop, please consider creating a changeset entry in |
@@ -0,0 +1,102 @@ | |||
schema |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just the existing basic_schema.graphql
run through rover compose to get a supergraph with a single subgraph.
CI performance tests
|
} | ||
Selection::InlineFragment(i) => self.score_inline_fragment( | ||
ctx, | ||
i, | ||
i.type_condition.as_ref().unwrap_or(parent_type), | ||
parent_type, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this into score_inline_fragment
, I think that makes more sense. It's less brittle if we add more places that call score_inline_fragment
in the future, as every call site doesn't need to account for the type condition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing a changelog, otherwise LGTM
oops, i had enabled auto-merge. I'll follow up with a changeset |
Prerequisite for #6013.
Fixes errors like:
Fragment definitions have a type condition, and all selections inside
the fragment are executed against that type condition. Previously, the
demand control cost calculator executed them against the parent type
where the fragment is used, which is often different.
Checklist
Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.
Footnotes
It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this. ↩
Configuration is an important part of many changes. Where applicable please try to document configuration examples. ↩
Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions. ↩