Precompute selection type shape for Fusion value completion - #10199
Merged
Conversation
Contributor
Patch coverage86.0% of changed lines covered (92/107)
Uncovered changed lines (JSON){
"sha": "d06881e0b8ead19abcb225deb9dcf6e858a292e6",
"files": [
{ "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/ValueCompletion.cs", "ranges": [[136, 139], [811, 815], [912, 912], [1223, 1226]] },
{ "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/Selection.cs", "ranges": [[152, 152]] }
]
}Project coverage: 54.4% (242365/445677 lines) |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR optimizes Fusion’s value completion by precomputing key type-shape facts on Selection (non-null, unwrapped kind, list element shape, value-type flags) and then using those facts during result materialization to reduce wrapper-walking and repeated type inspection on hot paths.
Changes:
- Precomputes selection type shape in
Selection(non-null, unwrapped kind/type, first list element kind/type, value-type named type). - Refactors
ValueCompletionto rely on precomputed selection facts (including a dedicated enum fast-path overload) and simplifies several completion call sites. - Adds tests covering nested list completion, null propagation for non-null list elements, and enum completion on the slow path when an error trie is present.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Execution/Results/FetchResultStoreTests.cs |
Adds new test coverage for nested lists, non-null list element null propagation, and enum completion when errors are present. |
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/ValueCompletion.cs |
Refactors completion logic to use selection-precomputed type facts and introduces an enum overload to avoid repeated type checks. |
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/Selection.cs |
Adds cached type-shape fields/flags (non-null, unwrapped kind/type, list element shape, value-type named type) to support faster completion. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+704
to
+705
| Assert.Equal(expected, RenderData(store)); | ||
| Assert.Null(store.Errors); |
This was referenced Aug 9, 2026
Merged
Open
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.
No description provided.