-
Notifications
You must be signed in to change notification settings - Fork 268
fix(query-planner): @requires fetch group optimization selects invalid key #3246
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
Conversation
|
@ryan01010111: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/ |
🦋 Changeset detectedLatest commit: 5b4b389 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Docs preview has no changesThe preview was not built because there were no changes. Build ID: 902e5499d2d799b68cbce00f |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
|
Could someone confirm requirements met for having this reviewed? @duckki @lennyburdette |
Thank you for creating this PR. The federation team will review. |
|
Thanks for filing the PR and including a test. The issue more specifically is that This means that when |
|
@sachindshinde Thank you very much for the review, and explanation! Do you happen to have an ETA on whatever release you expect the fix to go into? |
…d from the wrong group (#3293) When a `@requires` edge needs a subgraph jump, this would sometimes cause the locally satisfiable key fields needed by that jump to be fetched from the parent group instead of the current group (which apparently was done as an optimization). This can be a problem, since `canSatisfyConditions()` only really guarantees the current group has those key fields. This PR updates the code using the parent group to now explicitly check whether the locally satisfiable key can be fetched from that group, and if not, falls back to the current group (adding it as a parent, if needed). This lets us keep the optimization and avoid unnecessarily changing query plans. Fixes #3113 and #2987 , and derives a simpler example test from the one given in #3246 .
Notes
Fixes #3113 and #2987.
FWIW, this fix has held up in production systems for 6+ months.
Problem
Fetch group optimization/handling for
@requiresconditions "assumes" existence of a key in the parent group's schema. This leads to failed query planning in cases where the parent group's schema does not define the same keys for an entity as that of the child group.Fix Summary