Fix re-entrant lookups for nested selections under required fields#9860
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts Fusion operation planning when inlining fields with @require so that only child selections resolvable by the consumer schema are inlined, while unresolvable descendants are planned as re-entrant lookups. It adds regression tests to ensure correct “re-enter subgraph” behavior across requirement boundaries.
Changes:
- Partition child selections when inlining fields with requirements; push unresolvable descendants (and nested requirement fields) back onto the backlog for separate planning.
- Fix selection-set pathing for partitioned child selections by rooting them at the field’s response name.
- Add new planning regression tests + snapshots covering re-entrancy vs. staying within the recommendation subgraph.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/HotChocolate/Fusion/src/Fusion.Execution/Planning/OperationPlanner.cs | Partitions inline field children against the consumer schema and corrects child selection paths for follow-up planning. |
| src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/RequirementReentrancyTests.cs | Adds regression tests for re-entrant lookup planning across @require boundaries. |
| src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/snapshots/RequirementReentrancyTests.Plan_Should_StayInRecommendation_When_InnerProduct_Selects_OnlyId.yaml | Snapshot for “no re-entry needed” case. |
| src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/snapshots/RequirementReentrancyTests.Plan_Should_Reenter_Catalog_When_EnteringFromRecommendation_Standalone.yaml | Snapshot for “re-entry required” case starting from recommendation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1098
to
+1102
| var childSelections = | ||
| ExtractResolvableChildSelections( | ||
| stepConsumer.StepId, | ||
| workItem.EstimatedDepth, | ||
| workItem.Selection, |
This was referenced Jun 6, 2026
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.
…ments