Repository navigation
[Fusion] Fix requirements anchored below the lookup target returning null - #10704
Merged
Merged
Conversation
…null The planner inlines a requiring field into a lookup step even when the field sits below the step target, for example when the requiring type has no lookup of its own. The requirement then carries the path of the selection set that holds the field, while the executor mapped its selection map from the target element. The map found nothing, the step was never sent and the field returned null without an error. FetchResultStore now resolves each requirement from the element at its path relative to the target, as OperationRequirement documents and as the Apollo representation builder and the deferred requirement import already do. A target is skipped when it has no object at that path: the anchor or an object on the way to it is null, a type condition does not match, or a list is on the way, since one variable cannot carry a value per list item. The fast paths still handle requirements anchored at the target.
Contributor
Patch coverage100.0% of changed lines covered (79/79)
Project coverage: 59.4% (317161/533756 lines) |
This was referenced Oct 28, 2026
Open
Merged
This file contains hidden or 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
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.
When a field with
@requireis on a type that has no lookup in its source schema, the planner fetches it through the lookup of the nearest parent that has one. The plan then says that the requirement data sits below that parent, at the object that holds the field. The gateway ignored this and looked for the data on the parent itself. It found nothing, so it never sent the request, and the field came back as null without an error.The gateway now follows the requirement's path from the parent down to the object and reads the data there. If that object is null, a type condition does not match, or a list is in the way, the gateway skips that item instead of sending a request with missing data. The plans themselves do not change.
Example
Schema
a:Schema
b, whereDetailshas no lookup:{ products { id details { shippingEstimate } } }Before,
bwas never called and everyshippingEstimatecame back asnull, although the field is non-null. Nowbreceives each product's weight and returns the estimates.