Skip to content

Index the variables object once when coercing variables - #10820

Merged
tobias-tengler merged 1 commit into
mainfrom
tte/variable-coercion-lookup
Nov 9, 2026
Merged

tobias-tengler merged 1 commit into
mainfrom
tte/variable-coercion-lookup

Conversation

@tobias-tengler

Copy link
Copy Markdown
Member

No description provided.

Copilot AI balanced review requested due to automatic review settings November 9, 2026 12:59

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.

🟡 Changes recommended

The review found an issue that should be addressed before approval.

4 open issues
What changed in this PR

Optimizes variable coercion in HotChocolate Core and Fusion by indexing supplied values once for operations declaring more than 16 variables.

Changes:

  • Adds lookups containing only declared variables, retaining linear scans for smaller operations.
  • Adds regression tests for duplicate and escaped keys, nulls, missing values, defaults, and undeclared variables.
File Description
src/​HotChocolate/​Fusion/​test/​Fusion.Execution.Tests/​Execution/​VariableCoercionHelperTests.cs Updated as part of this pull request.
src/​HotChocolate/​Fusion/​src/​Fusion.Execution/​Execution/​VariableCoercionHelper.cs Updated as part of this pull request.
src/​HotChocolate/​Core/​test/​Execution.Tests/​Processing/​VariableCoercionHelperTests.cs Updated as part of this pull request.
src/​HotChocolate/​Core/​src/​Types/​Execution/​Processing/​VariableCoercionHelper.cs Updated as part of this pull request.

Review effort: Balanced

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Patch coverage

100.0% of changed lines covered (80/80)

File Covered Changed Patch %
…/src/Types/Execution/Processing/VariableCoercionHelper.cs 40 40 100.0% 🟢
…/src/Fusion.Execution/Execution/VariableCoercionHelper.cs 40 40 100.0% 🟢

Project coverage: 59.4% (321377/540670 lines)

@tobias-tengler
tobias-tengler force-pushed the tte/variable-coercion-lookup branch 2 times, most recently from 54e1d0d to 7a09916 Compare November 9, 2026 13:17
@tobias-tengler
tobias-tengler force-pushed the tte/variable-coercion-lookup branch from 7a09916 to d8f7770 Compare November 9, 2026 13:21
@tobias-tengler
tobias-tengler merged commit 2e32f0c into main Nov 9, 2026
159 checks passed
@tobias-tengler
tobias-tengler deleted the tte/variable-coercion-lookup branch November 9, 2026 13:29
This was referenced Nov 10, 2026
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