You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
google-apis-core: CompositeIO does not maintain the IO read contract #27758
Google::Apis::Core::CompositeIO currently leaves pos unchanged after reads, returns nil for read(0), and decrements remaining length by character count rather than byte count. This diverges from the IO contract and misaccounts multibyte data.
A focused candidate:
returns an empty buffer for zero-length reads,
rejects negative lengths,
advances pos and remaining length by bytesize.
The focused contract model and 18 targeted examples pass; the cumulative core suite is 509 examples / 0 failures on Ruby 4.0.6. PR #18722 also touches CompositeIO, but only for frozen-string compatibility already present in current source; it does not address these semantics.
I have a minimal patch ready and can submit it after maintainer acceptance per CONTRIBUTING. The source audit and candidate preparation used AI assistance; I reviewed and verified the result.
@OskarEichler Thanks & confirmed. Negative lengths already raise ArgumentError from the underlying IO, so no change needed there. Please open your PR and we can review.
Opened #28075. As requested, negative-length validation is left to the underlying IO. The patch fixes zero-length reads and byte-based position/count tracking, with File and StringIO regressions. All 47 CompositeIO/upload examples and the full 509-example core suite pass on Ruby 4.0.6; verification limitations are recorded in the PR.
On second thought, @OskarEichler unless there is an identifiable impact here to customers that has been reported, we'd prefer to not modify the upload hot path since this is critical code. It looks like this was just an AI-assisted recommendation, so unless there is a production issue atm let's just close this out. Sorry for the back and forth on this.
Activity
torreypayne commentedon Oct 1, 2026
@OskarEichler Thanks & confirmed. Negative lengths already raise ArgumentError from the underlying IO, so no change needed there. Please open your PR and we can review.
OskarEichler commentedon Oct 2, 2026
Opened #28075. As requested, negative-length validation is left to the underlying IO. The patch fixes zero-length reads and byte-based position/count tracking, with File and StringIO regressions. All 47 CompositeIO/upload examples and the full 509-example core suite pass on Ruby 4.0.6; verification limitations are recorded in the PR.
torreypayne commentedon Oct 11, 2026
On second thought, @OskarEichler unless there is an identifiable impact here to customers that has been reported, we'd prefer to not modify the upload hot path since this is critical code. It looks like this was just an AI-assisted recommendation, so unless there is a production issue atm let's just close this out. Sorry for the back and forth on this.