Skip to content

Fix pagination fields losing parallel execution - #10564

Merged
michaelstaib merged 1 commit into
ChilliCream:mainfrom
bbarry:feature/pagination-fields-parallel
Oct 23, 2026
Merged

michaelstaib merged 1 commit into
ChilliCream:mainfrom
bbarry:feature/pagination-fields-parallel

Conversation

@bbarry

@bbarry bbarry commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

The edges, nodes and totalCount fields of connection types, and the items and totalCount fields of collection segment types, replaced their field flags and cleared ParallelExecutable. When a schema registers global field middleware these fields compile without a pure resolver, so they stayed serial. The ParallelExecutable flag is now kept, as for the node and nodes fields (#7661).

fixes #10563

The edges, nodes and totalCount fields of connection types, and the items and
totalCount fields of collection segment types, replaced their field flags and
cleared ParallelExecutable. When a schema registers global field middleware
these fields compile without a pure resolver, so they stayed serial. The
ParallelExecutable flag is now kept, as for the node and nodes fields (ChilliCream#7661).
Copilot AI balanced review requested due to automatic review settings October 16, 2026 19:44
@CLAassistant

CLAassistant commented Oct 16, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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.

🟢 Approval recommended

The narrow flag fix preserves existing metadata, and regression tests cover the reported middleware condition; tests were not executed.

0 open findings

What changed in this PR

Restores parallel execution for pagination fields when global field middleware is registered, addressing #10563.

Changes:

  • Preserves ParallelExecutable alongside existing pagination field flags.
  • Adds regression tests for connection and collection segment fields with global middleware.
File Description
src/​HotChocolate/​Core/​test/​Types.OffsetPagination.Tests/​CollectionSegmentTypeTests.cs Verifies collection segment fields remain parallel executable.
src/​HotChocolate/​Core/​test/​Types.CursorPagination.Tests/​ConnectionTypeTests.cs Verifies connection fields remain parallel executable.
src/​HotChocolate/​Core/​src/​Types.OffsetPagination/​CollectionSegmentType~1.cs Preserves parallel execution for items and totalCount.
src/​HotChocolate/​Core/​src/​Types.CursorPagination/​ConnectionType.cs Preserves parallel execution for edges, nodes, and totalCount.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@michaelstaib michaelstaib left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This one is wrong. TotalCount is not an async field but a pure resolver. This means they are folded into the execution of the parent.

I will close the PR, while you could technically execute them in parallel that would lead to a task wrapped around this and fields would be handled in their own execution task which would lead to slower execution.

@michaelstaib michaelstaib reopened this Oct 21, 2026
@michaelstaib
michaelstaib merged commit 1e8bc18 into ChilliCream:main Oct 23, 2026
4 checks passed
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.

Connection and collection segment fields lose ParallelExecutable when global field middleware is registered

4 participants