Skip to content

Fix ChunkedArrayWriter position at exact chunk boundaries - #10243

Merged
michaelstaib merged 2 commits into
mainfrom
mst/chunked-array-writer-position
Aug 16, 2026
Merged

michaelstaib merged 2 commits into
mainfrom
mst/chunked-array-writer-position

Conversation

@michaelstaib

Copy link
Copy Markdown
Member

No description provided.

Copilot AI lite review requested due to automatic review settings August 16, 2026 12:16

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 fixes how ChunkedArrayWriter.Position is computed when the writer is exactly at a chunk boundary (i.e., _currentChunkOffset == BufferSize), ensuring the reported position/length reflects the correct flat byte count instead of losing the carry into the next chunk.

Changes:

  • Fix ChunkedArrayWriter.Position to use arithmetic addition instead of bitwise OR so chunk-boundary positions carry correctly.
  • Add regression tests to validate Position/Length at exact chunk boundaries and that captured boundary positions can be used to address subsequently written bytes (including via the scratch-buffer path).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/HotChocolate/Utilities/test/Utilities.Tests/ChunkedArrayWriterTests.cs Adds regression coverage for Position and addressing correctness at exact chunk boundaries.
src/HotChocolate/Utilities/src/Utilities.Buffers/ChunkedArrayWriter.cs Fixes Position computation so boundary offsets correctly increment the flat cursor.

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

@github-actions

github-actions Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Patch coverage

100.0% of changed lines covered (1/1)

File Covered Changed Patch %
…/Utilities/src/Utilities.Buffers/ChunkedArrayWriter.cs 1 1 100.0% 🟢

Project coverage: 54.5% (243355/446634 lines)

@michaelstaib
michaelstaib merged commit f46994c into main Aug 16, 2026
7 of 8 checks passed
@michaelstaib
michaelstaib deleted the mst/chunked-array-writer-position branch August 16, 2026 12:27
This was referenced Aug 29, 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