Repository navigation
Add wide condition mask - #10319
Merged
Merged
Add wide condition mask#10319
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends HotChocolate (Core + Fusion) to support operations with more than 64 @skip/@include and @defer conditions by introducing a multi-word condition flag representation and updating compilation, execution, projection-building, and result-document writing to evaluate “wide” condition masks correctly.
Changes:
- Introduces
ConditionFlags(word0 + optional overflow words) and adds wide-aware include/defer evaluation APIs across selections and execution contexts. - Updates Core and Fusion operation compilers and planners to build and carry wide include/defer masks, plus configurable per-operation condition ceilings surfaced via request options.
- Updates projection selector building/caching and adds tests/benchmarks validating boundary behavior and plan/transport round-trips.
Reviewed changes
Copilot reviewed 86 out of 86 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Execution/WideConditionMaskTests.cs | Adds Fusion execution-level tests for wide include/defer masks and ceilings. |
| src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Execution/OperationCompilerTests.cs | Updates tests to use ConditionFlags and new include-flag API name. |
| src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/WideConditionMaskTests.cs | Adds Fusion gateway/transport tests exercising wide include/defer behavior and ceilings. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Text/Json/SourceResultDocumentBuilder.cs | Adds ConditionFlags overload and wide include evaluation for source result shaping. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Text/Json/CompositeResultDocument.cs | Adds ConditionFlags overloads and wide include/defer evaluation for composite results. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Planning/OperationPlanner.cs | Wires defer-condition ceiling into planner defer condition collection. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Planning/DeferPartitioner.cs | Updates delivery group condition index type to int. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/FetchResultStore.Pooling.cs | Plumbs include/defer ConditionFlags through result store initialization/reset. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/FetchResultStore.cs | Stores wide include/defer flags in result store state. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/OperationPlanContext.Pooling.cs | Evaluates include/defer condition flags per request instead of ulong only. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/OperationPlanContext.cs | Exposes IncludeConditionFlags/DeferConditionFlags plus compatibility word0 accessors. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/Selection.cs | Adds wide include/defer evaluation APIs, guards narrow overloads, and wide delivery-group logic. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/ReusableFieldContext.cs | Switches field context to expose IncludeConditionFlags. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/PathIncludeFlagsBuilder.cs | New copy-on-write builder for per-path include masks with overflow words. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/OperationCompiler.cs | Compiles wide include/defer masks and enforces per-kind max condition ceilings. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/Operation.cs | Adds wide-flag metadata and creates include/defer ConditionFlags per request. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/IntrospectionExecutionNode.cs | Switches introspection execution to use ConditionFlags. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/IncludeConditionCollection.cs | Removes hard 64 cap; adds configurable max and throws GraphQL request error when exceeded. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/FieldSelectionNode.cs | Carries per-path include overflow words to compilation. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/FieldContext.cs | Exposes IncludeConditionFlags from resolver field context. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/DeliveryGroup.cs | Changes defer condition index from byte to int. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/DeferConditionCollection.cs | Removes hard 64 cap; adds configurable max and throws GraphQL request error when exceeded. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/FusionRequestOptions.cs | Adds MaxAllowedIncludeConditions / MaxAllowedDeferConditions options. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/FusionRequestExecutorManager.cs | Constructs OperationCompiler using request option ceilings. |
| src/HotChocolate/Fusion/benchmarks/Fusion.Execution.Benchmarks/WideConditionMaskBenchmark.cs | Adds benchmark validating narrow include performance remains unchanged and wide path works. |
| src/HotChocolate/Data/test/Data.EntityFramework.Tests/IntegrationTests.cs | Adds regression tests for projection selector caching with wide include flags and diagnostics. |
| src/HotChocolate/Data/src/Data/QueryContextParameterExpressionBuilder.cs | Switches query context projection selector creation to IncludeConditionFlags. |
| src/HotChocolate/Data/src/Data/Projections/SelectionVisitor`1.cs | Uses IncludeConditionFlags while traversing selections. |
| src/HotChocolate/Data/src/Data/Projections/ProjectionVisitor.cs | Uses IncludeConditionFlags in projection traversal. |
| src/HotChocolate/Data/src/Data/Projections/ISelectionVisitorContext.cs | Adds IncludeConditionFlags and obsoletes the ulong include flags property. |
| src/HotChocolate/Data/src/Data/Projections/Extensions/ProjectionObjectFieldDescriptorExtensions.cs | Exposes IncludeConditionFlags on middleware context proxy. |
| src/HotChocolate/Data/src/Data/Filters/Extensions/HotChocolateDataQueryableExtensions.cs | Wraps ulong include flags into ConditionFlags for selector creation. |
| src/HotChocolate/Core/test/Types.CursorPagination.Tests/QueryableCursorPagingProviderTests.cs | Updates selection enumeration to use ConditionFlags in tests. |
| src/HotChocolate/Core/test/Types.Analyzers.Tests/snapshots/ResolverTests.Inject_QueryContext.md | Updates analyzer snapshots for IncludeConditionFlags usage. |
| src/HotChocolate/Core/test/Types.Analyzers.Tests/snapshots/QueryContextProjectionAnalyzerTests.QueryContext_WithUseProjections_RaisesError.md | Updates analyzer snapshot output to use IncludeConditionFlags. |
| src/HotChocolate/Core/test/Types.Analyzers.Tests/snapshots/QueryContextProjectionAnalyzerTests.QueryContext_WithUseProjection_RaisesError.md | Updates analyzer snapshot output to use IncludeConditionFlags. |
| src/HotChocolate/Core/test/Types.Analyzers.Tests/snapshots/QueryContextProjectionAnalyzerTests.QueryContext_WithoutUseProjection_NoError.md | Updates analyzer snapshot output to use IncludeConditionFlags. |
| src/HotChocolate/Core/test/Types.Analyzers.Tests/snapshots/QueryContextProjectionAnalyzerTests.QueryContext_MultipleAttributes_OnlyUseProjectionFlagged.md | Updates analyzer snapshot output to use IncludeConditionFlags. |
| src/HotChocolate/Core/test/Types.Analyzers.Tests/snapshots/QueryContextConnectionAnalyzerTests.TypeMismatch_WithSubscriptionType_RaisesError.md | Updates analyzer snapshot output to use IncludeConditionFlags. |
| src/HotChocolate/Core/test/Types.Analyzers.Tests/snapshots/QueryContextConnectionAnalyzerTests.TypeMismatch_WithQueryType_RaisesError.md | Updates analyzer snapshot output to use IncludeConditionFlags. |
| src/HotChocolate/Core/test/Types.Analyzers.Tests/snapshots/QueryContextConnectionAnalyzerTests.TypeMismatch_WithObjectType_RaisesError.md | Updates analyzer snapshot output to use IncludeConditionFlags. |
| src/HotChocolate/Core/test/Types.Analyzers.Tests/snapshots/QueryContextConnectionAnalyzerTests.TypeMismatch_WithMutationType_RaisesError.md | Updates analyzer snapshot output to use IncludeConditionFlags. |
| src/HotChocolate/Core/test/Types.Analyzers.Tests/snapshots/QueryContextConnectionAnalyzerTests.TypeMismatch_WithInterfaceType_RaisesError.md | Updates analyzer snapshot output to use IncludeConditionFlags. |
| src/HotChocolate/Core/test/Types.Analyzers.Tests/snapshots/QueryContextConnectionAnalyzerTests.TypeMismatch_WithConnection_RaisesError.md | Updates analyzer snapshot output to use IncludeConditionFlags. |
| src/HotChocolate/Core/test/Types.Analyzers.Tests/snapshots/QueryContextConnectionAnalyzerTests.NoConnectionReturnType_NoError.md | Updates analyzer snapshot output to use IncludeConditionFlags. |
| src/HotChocolate/Core/test/Types.Analyzers.Tests/snapshots/QueryContextConnectionAnalyzerTests.CorrectGenericTypeMatch_WithConnection_NoError.md | Updates analyzer snapshot output to use IncludeConditionFlags. |
| src/HotChocolate/Core/test/Types.Analyzers.Tests/snapshots/QueryContextConnectionAnalyzerTests.CorrectGenericTypeMatch_NoError.md | Updates analyzer snapshot output to use IncludeConditionFlags. |
| src/HotChocolate/Core/test/Types.Analyzers.Tests/snapshots/OperationTests.Root_Projection_Single_Entity.md | Updates analyzer snapshot output to use IncludeConditionFlags. |
| src/HotChocolate/Core/test/Types.Analyzers.Tests/snapshots/NodeResolverIdParameterAnalyzerTests.StringIdParameter_NotInFirstPosition_RaisesError.md | Updates analyzer snapshot output to use IncludeConditionFlags. |
| src/HotChocolate/Core/test/Types.Analyzers.Tests/snapshots/NodeResolverIdParameterAnalyzerTests.ParameterEndingWithId_NotInFirstPosition_RaisesError.md | Updates analyzer snapshot output to use IncludeConditionFlags. |
| src/HotChocolate/Core/test/Types.Analyzers.Tests/snapshots/NodeResolverIdParameterAnalyzerTests.MethodWithoutNodeResolver_NoError.md | Updates analyzer snapshot output to use IncludeConditionFlags. |
| src/HotChocolate/Core/test/Types.Analyzers.Tests/snapshots/NodeResolverIdParameterAnalyzerTests.IdParameter_NotInFirstPosition_RaisesError.md | Updates analyzer snapshot output to use IncludeConditionFlags. |
| src/HotChocolate/Core/test/Types.Analyzers.Tests/snapshots/NodeResolverIdParameterAnalyzerTests.GuidIdParameter_NotInFirstPosition_RaisesError.md | Updates analyzer snapshot output to use IncludeConditionFlags. |
| src/HotChocolate/Core/test/Types.Analyzers.Tests/snapshots/NodeResolverIdParameterAnalyzerTests.FirstParameter_NotNamedId_NoFixableParameter_RaisesError.md | Updates analyzer snapshot output to use IncludeConditionFlags. |
| src/HotChocolate/Core/test/Types.Analyzers.Tests/snapshots/NodeResolverIdParameterAnalyzerTests.FirstParameter_NamedId_WithString_NoError.md | Updates analyzer snapshot output to use IncludeConditionFlags. |
| src/HotChocolate/Core/test/Types.Analyzers.Tests/snapshots/NodeResolverIdParameterAnalyzerTests.FirstParameter_NamedId_NoError.md | Updates analyzer snapshot output to use IncludeConditionFlags. |
| src/HotChocolate/Core/test/Types.Analyzers.Tests/snapshots/NodeResolverIdParameterAnalyzerTests.FirstParameter_EndsWithId_NoError.md | Updates analyzer snapshot output to use IncludeConditionFlags. |
| src/HotChocolate/Core/test/Execution.Tests/Processing/WideConditionMaskTests.cs | Adds execution-level tests for wide condition masks and request ceilings. |
| src/HotChocolate/Core/src/Types/Text/Json/ResultDocument.cs | Adds ConditionFlags overload and wide include/defer evaluation in result document writing. |
| src/HotChocolate/Core/src/Types/Resolvers/SelectionEnumerator.cs | Adds ConditionFlags enumerator overload and guards narrow ctor for wide operations. |
| src/HotChocolate/Core/src/Types/Resolvers/IResolverContext.cs | Adds IncludeConditionFlags API and obsoletes IncludeFlags for >64 conditions. |
| src/HotChocolate/Core/src/Types/Extensions/ResolverContextExtensions.cs | Switches selection checks to use IncludeConditionFlags. |
| src/HotChocolate/Core/src/Types/Execution/RequestExecutorManager.cs | Constructs operation compiler with max condition ceilings from options. |
| src/HotChocolate/Core/src/Types/Execution/Processing/Tasks/ResolverTaskFactory.cs | Switches defer evaluation to ConditionFlags. |
| src/HotChocolate/Core/src/Types/Execution/Processing/SelectionCollection.cs | Switches selection collection logic to carry ConditionFlags. |
| src/HotChocolate/Core/src/Types/Execution/Processing/Selection.cs | Adds wide include/defer evaluation, guards narrow overloads, and wide defer usage logic. |
| src/HotChocolate/Core/src/Types/Execution/Processing/PathIncludeFlagsBuilder.cs | New copy-on-write builder for per-path include masks with overflow words. |
| src/HotChocolate/Core/src/Types/Execution/Processing/OperationContext.Pooling.cs | Uses ConditionFlags for request include/defer flags and result document creation. |
| src/HotChocolate/Core/src/Types/Execution/Processing/OperationContext.Operation.cs | Exposes include/defer ConditionFlags on operation context. |
| src/HotChocolate/Core/src/Types/Execution/Processing/OperationCompiler.cs | Compiles wide include/defer masks and enforces per-kind max condition ceilings. |
| src/HotChocolate/Core/src/Types/Execution/Processing/Operation.cs | Adds wide-flag metadata and creates include/defer ConditionFlags per request. |
| src/HotChocolate/Core/src/Types/Execution/Processing/MiddlewareContext.Selection.cs | Uses ConditionFlags when enumerating selections. |
| src/HotChocolate/Core/src/Types/Execution/Processing/MiddlewareContext.Pure.cs | Exposes IncludeConditionFlags and WideIncludeFlags in pure context wrapper. |
| src/HotChocolate/Core/src/Types/Execution/Processing/MiddlewareContext.Global.cs | Exposes IncludeConditionFlags and WideIncludeFlags in global context. |
| src/HotChocolate/Core/src/Types/Execution/Processing/IncludeConditionCollection.cs | Removes hard 64 cap; adds configurable max and throws GraphQL request error when exceeded. |
| src/HotChocolate/Core/src/Types/Execution/Processing/FieldSelectionNode.cs | Carries per-path include overflow words to compilation. |
| src/HotChocolate/Core/src/Types/Execution/Processing/DeferUsage.cs | Changes defer condition index from byte to int. |
| src/HotChocolate/Core/src/Types/Execution/Processing/DeferConditionCollection.cs | Removes hard 64 cap; adds configurable max and throws GraphQL request error when exceeded. |
| src/HotChocolate/Core/src/Types/Execution/Options/RequestExecutorOptions.cs | Adds max condition ceiling options for include/defer. |
| src/HotChocolate/Core/src/Types.Analyzers/FileBuilders/TypeFileBuilderBase.cs | Updates generated code to pass IncludeConditionFlags into selector creation. |
| src/HotChocolate/Core/src/Execution.Projections/SelectionExpressionBuilder.cs | Plumbs wide include flags through projection expression construction and inclusion checks. |
| src/HotChocolate/Core/src/Execution.Projections/ProjectionSelectorCache.cs | Adds a wide-aware selector cache and eviction strategy spanning narrow+wide variants. |
| src/HotChocolate/Core/src/Execution.Projections/Extensions/HotChocolateExecutionSelectionExtensions.cs | Adds ConditionFlags selector APIs and wide-flag aware selector creation and caching. |
| src/HotChocolate/Core/src/Execution.Projections/Extensions/HotChocolateExecutionDataLoaderExtensions.cs | Avoids calling obsolete selector overloads by routing to non-obsolete helper. |
| src/HotChocolate/Core/src/Execution.Operation.Abstractions/ISelection.cs | Adds ConditionFlags overloads for inclusion/defer APIs and obsoletes ulong overloads. |
| src/HotChocolate/Core/src/Execution.Operation.Abstractions/ConditionFlags.cs | Introduces ConditionFlags (word0 + overflow words) as the new public flag carrier. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+42
to
+48
| Assert.Equal(JsonValueKind.Undefined, operationResult.Errors.ValueKind); | ||
| Assert.True(operationResult.Data.TryGetProperty("plain", out _)); | ||
|
|
||
| for (var i = 0; i < conditionCount; i++) | ||
| { | ||
| Assert.Equal(i % 2 == 0, operationResult.Data.TryGetProperty($"f{i}", out _)); | ||
| } |
Comment on lines
+276
to
+281
| Assert.Equal("abc", data.GetProperty("plain").GetString()); | ||
|
|
||
| for (var i = 0; i < conditionCount; i++) | ||
| { | ||
| Assert.Equal(i % 2 == 0, data.TryGetProperty($"f{i}", out _)); | ||
| } |
Contributor
Patch coverage82.9% of changed lines covered (1087/1311) +35 more changed files; see the JSON below for uncovered lines. Uncovered changed lines (JSON){
"sha": "0b46952327d78afcf06f241747ffb5d0c01e7119",
"files": [
{ "path": "src/HotChocolate/Core/src/Execution.Projections/Extensions/HotChocolateExecutionDataLoaderExtensions.cs", "ranges": [[87, 89], [91, 93], [185, 187], [189, 191], [272, 274], [276, 278], [355, 357], [359, 361]] },
{ "path": "src/HotChocolate/Core/src/Types/Execution/Processing/MiddlewareContext.Pure.cs", "ranges": [[71, 71]] },
{ "path": "src/HotChocolate/Data/src/Data/Filters/Extensions/HotChocolateDataQueryableExtensions.cs", "ranges": [[63, 64], [66, 70], [73, 74]] },
{ "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/OperationPlanContext.cs", "ranges": [[160, 160], [162, 162], [164, 164], [166, 166]] },
{ "path": "src/HotChocolate/Core/src/Types/Execution/Processing/FieldSelectionNode.cs", "ranges": [[8, 8], [11, 20], [69, 73]] },
{ "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/FieldSelectionNode.cs", "ranges": [[9, 9], [12, 21], [70, 74]] },
{ "path": "src/HotChocolate/Core/src/Types.Analyzers/FileBuilders/TypeFileBuilderBase.cs", "ranges": [[1358, 1358]] },
{ "path": "src/HotChocolate/Core/src/Types/Execution/Processing/OperationContext.Operation.cs", "ranges": [[57, 57], [62, 62]] },
{ "path": "src/HotChocolate/Data/src/Data/Projections/Extensions/ProjectionObjectFieldDescriptorExtensions.cs", "ranges": [[269, 269]] },
{ "path": "src/HotChocolate/Data/src/Data/Projections/ISelectionVisitorContext.cs", "ranges": [[11, 11]] },
{ "path": "src/HotChocolate/Data/src/Data/Projections/Optimizers/QueryableRequirementsProjectionOptimizer.cs", "ranges": [[95, 95]] },
{ "path": "src/HotChocolate/Core/src/Execution.Projections/Extensions/HotChocolateExecutionSelectionExtensions.cs", "ranges": [[67, 68], [77, 82], [106, 108], [121, 122], [189, 189], [192, 194], [205, 210], [242, 242], [291, 291], [294, 295], [328, 333], [335, 335]] },
{ "path": "src/HotChocolate/Core/src/Types/Extensions/ResolverContextExtensions.cs", "ranges": [[501, 501], [577, 577], [647, 647]] },
{ "path": "src/HotChocolate/Core/src/Types/Resolvers/SelectionEnumerator.cs", "ranges": [[29, 33], [36, 36], [70, 71], [91, 91], [98, 98], [111, 111]] },
{ "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Text/Json/SourceResultDocumentBuilder.cs", "ranges": [[54, 56], [130, 135], [138, 140]] },
{ "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/Selection.cs", "ranges": [[43, 56], [305, 305], [323, 323], [383, 384], [482, 482], [543, 544], [582, 582], [668, 669], [675, 675], [702, 702]] },
{ "path": "src/HotChocolate/Core/src/Execution.Projections/SelectionExpressionBuilder.cs", "ranges": [[58, 58], [64, 64], [102, 102], [108, 108]] },
{ "path": "src/HotChocolate/Core/src/Types/Execution/Processing/PathIncludeFlagsBuilder.cs", "ranges": [[41, 41], [43, 44]] },
{ "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/PathIncludeFlagsBuilder.cs", "ranges": [[41, 41], [43, 44]] },
{ "path": "src/HotChocolate/Core/src/Types/Execution/Processing/Selection.cs", "ranges": [[320, 320], [487, 487], [549, 553], [556, 557], [616, 617], [628, 628], [649, 649], [673, 673], [737, 738], [880, 880], [885, 888], [904, 904], [1015, 1016], [1019, 1019]] },
{ "path": "src/HotChocolate/Core/src/Types/Execution/Processing/Operation.cs", "ranges": [[150, 150], [155, 155], [301, 303], [326, 328]] },
{ "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/FusionRequestOptions.cs", "ranges": [[199, 200]] },
{ "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/Operation.cs", "ranges": [[146, 146], [151, 151], [285, 287], [318, 320]] },
{ "path": "src/HotChocolate/Core/src/Types/Execution/Processing/OperationCompiler.cs", "ranges": [[400, 404], [605, 605]] },
{ "path": "src/HotChocolate/Core/src/Execution.Projections/ProjectionSelectorCache.cs", "ranges": [[79, 79]] },
{ "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/OperationCompiler.cs", "ranges": [[50, 50], [564, 564]] }
]
}Project coverage: 57.7% (286979/497042 lines) |
This was referenced Oct 25, 2026
Merged
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.