Skip to content

Add subgraph alias batching - #10146

Open
michaelstaib wants to merge 10 commits into
mainfrom
mst/alias-batching
Open

Add subgraph alias batching#10146
michaelstaib wants to merge 10 commits into
mainfrom
mst/alias-batching

Conversation

@michaelstaib

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings July 23, 2026 13:14
@michaelstaib michaelstaib changed the title Add alias batching capability, client plumbing, and operation rewriter Add subgraph alias batching Jul 23, 2026
Fusion: alias batching capability with client request and response
pipeline, operation rewriter, variable merger, cache key, and response
reader adapted to source schema streams.

Language: packed UTF-8 syntax tree for executable operations with the
Utf8GraphQLOperationParser building the row-based metadata database.

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 introduces alias batching for Fusion HTTP source schema clients (rewriting batched rows into aliased root selections in a single spec-conformant GraphQL request), along with supporting infrastructure in the UTF-8 language stack and buffer utilities.

Changes:

  • Added an alias-batching HTTP client, operation rewriter, variable merger, and response splitter, plus DI/config plumbing and end-to-end tests.
  • Added ChunkedArrayWriter.WriteAt to enable patching previously-advanced bytes (used for packed metadata patching scenarios) and corresponding tests.
  • Added/extended UTF-8 language helpers and introduced a new UTF-8 syntax tree project + extensive parser tests.

Reviewed changes

Copilot reviewed 53 out of 53 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/HotChocolate/Utilities/test/Utilities.Tests/ChunkedArrayWriterTests.cs Adds coverage for ChunkedArrayWriter.WriteAt behavior and edge cases.
src/HotChocolate/Utilities/src/Utilities.Buffers/HotChocolate.Utilities.Buffers.csproj Grants internals access to UTF-8 language projects/tests.
src/HotChocolate/Utilities/src/Utilities.Buffers/ChunkedArrayWriter.cs Adds WriteAt API to overwrite already-advanced bytes.
src/HotChocolate/Language/test/Language.Tests/Parser/Utf8GraphQLOperationParserTests.cs Adds extensive test suite for the new packed operation parser/document model.
src/HotChocolate/Language/src/Language.Utf8/Utf8Helper.cs Adds Validate and strengthens unicode-escape validation.
src/HotChocolate/Language/src/Language.Utf8/Utf8GraphQLOperationParser.cs Introduces a packed executable-document parser that patches metadata via WriteAt.
src/HotChocolate/Language/src/Language.Utf8/HotChocolate.Language.Utf8.csproj Adds references to the new UTF-8 syntax tree + buffers package.
src/HotChocolate/Language/src/Language.Utf8.SyntaxTree/Utf8VariableNameMap.cs Adds variable name substitution map for formatting packed syntax.
src/HotChocolate/Language/src/Language.Utf8.SyntaxTree/Utf8VariableDefinitionNode.cs Adds packed-tree variable-definition view + enumerable.
src/HotChocolate/Language/src/Language.Utf8.SyntaxTree/Utf8SyntaxKind.cs Adds syntax-kind enum for the packed UTF-8 syntax representation.
src/HotChocolate/Language/src/Language.Utf8.SyntaxTree/Utf8SyntaxFormatter.cs Adds formatter to write verbatim source ranges with variable-name substitutions.
src/HotChocolate/Language/src/Language.Utf8.SyntaxTree/Utf8SelectionSetNode.cs Adds selection-set view + enumerable.
src/HotChocolate/Language/src/Language.Utf8.SyntaxTree/Utf8SelectionNode.cs Adds heterogeneous selection view and formatting helpers.
src/HotChocolate/Language/src/Language.Utf8.SyntaxTree/Utf8OperationDocument.VariableTable.cs Implements packed variable-site table and directory for substitutions.
src/HotChocolate/Language/src/Language.Utf8.SyntaxTree/Utf8OperationDocument.MetaDb.cs Implements packed metadata storage for the syntax tree.
src/HotChocolate/Language/src/Language.Utf8.SyntaxTree/Utf8OperationDocument.DbRow.cs Defines packed row layout and accessors.
src/HotChocolate/Language/src/Language.Utf8.SyntaxTree/Utf8OperationDocument.cs Adds packed executable-document representation + formatting and disposal.
src/HotChocolate/Language/src/Language.Utf8.SyntaxTree/Utf8OperationDefinitionNode.cs Adds operation-definition view + enumerable over packed rows.
src/HotChocolate/Language/src/Language.Utf8.SyntaxTree/Utf8InlineFragmentNode.cs Adds inline-fragment view and formatting.
src/HotChocolate/Language/src/Language.Utf8.SyntaxTree/Utf8FragmentSpreadNode.cs Adds fragment-spread view and formatting.
src/HotChocolate/Language/src/Language.Utf8.SyntaxTree/Utf8FragmentDefinitionNode.cs Adds fragment-definition view + enumerable.
src/HotChocolate/Language/src/Language.Utf8.SyntaxTree/Utf8FieldNode.cs Adds field-selection view with alias/selection-set helpers.
src/HotChocolate/Language/src/Language.Utf8.SyntaxTree/IUtf8SyntaxNode.cs Adds common formatting interface for packed UTF-8 syntax nodes.
src/HotChocolate/Language/src/Language.Utf8.SyntaxTree/HotChocolate.Language.Utf8.SyntaxTree.csproj Introduces new package/project for packed UTF-8 syntax tree.
src/HotChocolate/Language/HotChocolate.Language.slnx Adds the new UTF-8 syntax tree project to the Language solution.
src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Execution/Clients/AliasVariableMergerTests.cs Adds tests for merged variables JSON generation for alias batching.
src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Execution/Clients/AliasResponseReaderTests.cs Adds tests for splitting merged responses back into per-row results.
src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Execution/Clients/AliasBatchingRewriterTests.cs Adds tests for alias/variable rewriting rules and error cases.
src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Execution/Clients/AliasBatchingHttpSourceSchemaClientTests.cs Adds integration-style tests for the alias-batching HTTP client behavior.
src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Execution/Clients/AliasBatchingHttpSourceSchemaClientFactoryTests.cs Adds factory selection/caching tests for alias batching client.
src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Execution/Clients/AliasBatchCacheKeyTests.cs Adds tests for cache-key building and sizing behavior.
src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/FusionTestBase.cs Threads alias-batching option through Fusion test harness configuration.
src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/FusionTestBase.CreateSourceSchema.cs Adds aliasBatching option when creating test source schemas.
src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/AliasBatchingTests.cs Adds end-to-end gateway tests comparing alias batching vs existing batching modes.
src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/snapshots/AliasBatchingTests.BatchedLookup_Should_SendOneAliasedRequest_When_AliasBatchingEnabled.yaml Snapshot for outbound alias-batched subgraph request.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Clients/SourceSchemaClientCapabilities.cs Adds AliasBatching capability and clarifies All semantics.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Clients/SourceSchemaCallbackHelper.cs Extracts shared callback wiring for HTTP clients.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Clients/HttpSourceSchemaClientConfiguration.cs Adds alias-batching configuration options and cache capacity.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Clients/HttpSourceSchemaClient.cs Uses SourceSchemaCallbackHelper for consistent request hooks.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Clients/AliasBatching/AliasVariableMerger.cs Implements variables-object merge using prefixed variable names.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Clients/AliasBatching/AliasRowResult.cs Adds per-row result wrapper used by the response reader/client glue.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Clients/AliasBatching/AliasResponseReader.cs Splits merged response into per-row documents and routes errors.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Clients/AliasBatching/AliasPrefixTable.cs Defines alias/variable mapping table used by merger and reader.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Clients/AliasBatching/AliasBatchingRewriter.cs Rewrites operations into alias-batched merged document + prefix table.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Clients/AliasBatching/AliasBatchingHttpSourceSchemaClientFactory.cs Adds factory to select alias-batching HTTP client via configuration.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Clients/AliasBatching/AliasBatchingHttpSourceSchemaClient.cs Implements alias-batching execution paths, caching, and wiring.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Clients/AliasBatching/AliasBatchedRequestBody.cs Carries pre-serialized { query, variables } body for transport emission.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Clients/AliasBatching/AliasBatchedOperation.cs Stores merged operation text + prefix metadata as a cacheable value.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Clients/AliasBatching/AliasBatchCacheKey.cs Builds cache keys for rewritten alias-batched operations.
src/HotChocolate/Fusion/src/Fusion.Execution/DependencyInjection/HotChocolateFusionServiceCollectionExtensions.cs Registers alias-batching client factory ahead of the default HTTP factory.
src/HotChocolate/Fusion/src/Fusion.Execution/DependencyInjection/CoreFusionGatewayBuilderExtensions.SourceSchemaClients.cs Plumbs alias-batching options through gateway builder configuration.
src/Build.Pack.slnx Includes the new UTF-8 syntax tree project in pack solution.
src/All.slnx Includes the new UTF-8 syntax tree project in full solution.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/HotChocolate/Language/src/Language.Utf8/Utf8GraphQLOperationParser.cs Outdated
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