Repository navigation
[Fusion] Fix an empty variable batch answering 500 instead of 400 or 422 - #10433
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
All reviewed changes are covered by regression tests and no unresolved blocking issues were identified.
Review effort: Lite
Findings: None
What changed in this PR
Fixes Fusion handling of empty variable batches by returning the appropriate 400/422 request error instead of a 500, while preserving execution for operations without declared variables.
Changes:
- Added an empty-batch execution guard and localized error message.
- Added Fusion and Core regression coverage.
- Preserved 500 behavior for unexpectedly missing coerced variables.
| File | Description |
|---|---|
src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/VariableBatchingTests.cs |
Adds Fusion HTTP regression tests. |
src/HotChocolate/Fusion/src/Fusion.Execution/Properties/FusionExecutionResources.resx |
Adds the request error message. |
src/HotChocolate/Fusion/src/Fusion.Execution/Properties/FusionExecutionResources.Designer.cs |
Exposes the localized resource. |
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Pipeline/OperationExecutionMiddleware.cs |
Detects empty variable batches. |
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/ErrorHelper.cs |
Creates the request error result. |
src/HotChocolate/AspNetCore/test/AspNetCore.Tests/GraphQLOverHttpSpecTests.cs |
Verifies Core behavior for variable-free operations. |
Files not reviewed (1)
- src/HotChocolate/Fusion/src/Fusion.Execution/Properties/FusionExecutionResources.Designer.cs: Generated file
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
Patch coverage100.0% of changed lines covered (10/10)
Project coverage: 58.9% (300480/510416 lines) |
This was referenced Oct 25, 2026
Merged
This was referenced Nov 1, 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.
Summary
variablesarray with 500 "Unexpected Execution Error", because execution read the first variable set. It now answers the request error Core returns since Fix missing pipeline state answering 400 or 422 instead of 500 #10430, "A variable batch request must contain at least one variable set.", which is 400 underDraft20250508and 422 underDraft20260903. With cost analysis on, the analyzer still rejects the empty batch first.Test plan
VariableBatchingTestsinFusion.AspNetCore.Testspins three answers over HTTP: the request error under both transport versions, a single execution for an operation that declares no variables, and 500 for a batch that reaches execution without coerced sets. Removing either guard condition fails exactly the test that pins it.GraphQLOverHttpSpecTests.Post_Should_ExecuteOnce_When_VariableBatchIsEmptyAndNoVariableIsDeclaredpins Core's answer for an operation that declares no variables.Fusion.AspNetCore.Tests,Fusion.Execution.Tests, andGraphQLOverHttpSpecTestspass.