Handle buffer end offsets as no-op. - #194
Merged
Merged
Conversation
samuel-williams-shopify
force-pushed
the
buffer-offset-boundary
branch
from
June 25, 2026 03:22
deca278 to
3d8e28b
Compare
Assisted-By: devx/242ffd92-f36a-421a-88b9-270e5488162a
samuel-williams-shopify
force-pushed
the
buffer-offset-boundary
branch
4 times, most recently
from
June 25, 2026 03:38
a262a0f to
d2dc0e3
Compare
Assisted-By: devx/242ffd92-f36a-421a-88b9-270e5488162a
samuel-williams-shopify
force-pushed
the
buffer-offset-boundary
branch
from
June 25, 2026 03:39
d2dc0e3 to
53c8ee2
Compare
There was a problem hiding this comment.
Pull request overview
This PR tightens boundary handling for buffered IO operations so that an offset equal to the buffer size is treated as a zero-capacity no-op (returning 0) rather than attempting to touch the underlying IO. This aligns behavior across the pure-Ruby Select selector and the native kqueue, epoll, and io_uring implementations, and adds regression coverage to prevent closed-IO side effects.
Changes:
- Add regression tests for
io_read/io_writereturning0whenoffset == buffer.size. - Update
Selectselector Ruby implementation to return0for end-offset operations before invoking IO. - Update
kqueue,epoll, andio_uringnative paths to treatoffset == sizeas a no-op and avoid descriptor/IO access in that case.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/io/event/selector/buffered_io.rb | Adds regression tests covering offset == buffer.size returning 0 for read/write. |
| lib/io/event/selector/select.rb | Adds explicit end-offset handling (offset == buffer.size => 0) for Select-based read/write. |
| ext/io/event/selector/uring.c | Ensures end-offset returns 0 before descriptor/seek handling in io_uring read/write paths. |
| ext/io/event/selector/kqueue.c | Refactors kqueue buffered read/write to early-return 0 on end-offset and operate on the remaining region. |
| ext/io/event/selector/epoll.c | Refactors epoll buffered read/write similarly to handle end-offset as a no-op consistently. |
ioquatix
approved these changes
Jun 25, 2026
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.
Summary
Verification