Skip to content

Fix batching limits skipped for entries of request and operation batches - #10826

Merged
glen-84 merged 3 commits into
mainfrom
gai/batch-entry-variable-limits
Nov 9, 2026
Merged

glen-84 merged 3 commits into
mainfrom
gai/batch-entry-variable-limits

Conversation

@glen-84

@glen-84 glen-84 commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Batching and MaxBatchSize now apply to each entry of a POST request batch and to each operation of an operation batch, the same as to a single request. An entry whose variable sets exceed MaxBatchSize, or that is a variable batch while variable batching is disabled, refuses the whole batch. As for a single request, a refusal because variable batching is disabled reports that reason to server diagnostics.
  • An operation batch whose batchOperations list names more operations than MaxBatchSize is refused, as a request batch with too many entries already is.
  • ExecutorSession.ExecuteOperationBatchAsync has a new overload that takes GraphQLServerOptions, which the POST middleware now calls. The overload without options is obsolete.

Test plan

  • New HttpPostMiddlewareTests cases refuse a request batch entry and an operation batch whose variable sets exceed MaxBatchSize or use variable batching while it is disabled, and an operation batch that names more operations than MaxBatchSize. They fail on main. Two of them check the reason reported to server diagnostics.
  • Ran on net10.0: HotChocolate.AspNetCore.Tests and HotChocolate.Fusion.AspNetCore.Tests.

Copilot AI lite review requested due to automatic review settings November 9, 2026 13:10

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 change still has an active moderate issue because variable-batch policy rejections do not emit the specific diagnostic reason needed by listeners.

1 open issue
What changed in this PR

This pull request applies batching limits consistently to POST request batches and operation batches, including variable-set limits and disabled variable batching.

Changes:

  • Passes GraphQLServerOptions into operation-batch execution.
  • Enforces operation-count, variable-set-count, and variable-batching restrictions.
  • Adds regression tests for oversized and disallowed batches.
File Summary
src/​HotChocolate/​AspNetCore/​test/​AspNetCore.Tests/​HttpPostMiddlewareTests.cs Adds coverage for rejected oversized and disallowed request and operation batches.
src/​HotChocolate/​AspNetCore/​src/​AspNetCore.Pipeline/​HttpPostMiddlewareBase.cs Routes operation-batch execution through the options-aware overload.
src/​HotChocolate/​AspNetCore/​src/​AspNetCore.Pipeline/​ExecutorSession.cs Validates batch sizes and variable-batching configuration. The variable-batching rejection should emit the specific VariableBatchingDisabled diagnostic, and the new exception construction should use ThrowHelper.

This pull request requires changes.

Review effort: Lite

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Patch coverage

98.1% of changed lines covered (51/52)

File Covered Changed Patch %
…/AspNetCore/src/AspNetCore.Pipeline/ExecutorSession.cs 45 46 97.8% 🟡
…/AspNetCore/src/AspNetCore.Pipeline/HttpPostMiddlewareBase.cs 6 6 100.0% 🟢
Uncovered changed lines (JSON)
{
  "sha": "54607821892bba8fac08b3d157507464491e8e46",
  "files": [
    { "path": "src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/ExecutorSession.cs", "ranges": [[190, 190]] }
  ]
}

Project coverage: 59.5% (321563/540867 lines)

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

No active review issues are identified, and the added validation paths are accompanied by regression coverage for batch limits, disabled variable batching, and diagnostics.

No open issues 🎉

1 resolved since last review

Review effort: Lite

@glen-84
glen-84 merged commit 1ea1e1c into main Nov 9, 2026
157 checks passed
@glen-84
glen-84 deleted the gai/batch-entry-variable-limits branch November 9, 2026 17:17
glen-84 added a commit that referenced this pull request Nov 9, 2026
This was referenced Nov 19, 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