Skip to content

Precompute selection type shape for Fusion value completion - #10199

Merged
michaelstaib merged 2 commits into
mainfrom
mst/fusion-selection-type-shape
Aug 5, 2026
Merged

Precompute selection type shape for Fusion value completion#10199
michaelstaib merged 2 commits into
mainfrom
mst/fusion-selection-type-shape

Conversation

@michaelstaib

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings August 5, 2026 09:32
@michaelstaib
michaelstaib merged commit 8fea46e into main Aug 5, 2026
149 checks passed
@michaelstaib
michaelstaib deleted the mst/fusion-selection-type-shape branch August 5, 2026 09:41
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Patch coverage

86.0% of changed lines covered (92/107)

File Covered Changed Patch %
…/src/Fusion.Execution/Execution/Results/ValueCompletion.cs 56 70 80.0% 🟡
…/Fusion/src/Fusion.Execution/Execution/Nodes/Selection.cs 36 37 97.3% 🟡
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)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ValueCompletion to 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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants