fix(io): treat a fully transferred read/write as success#319
Conversation
read and write reported any error_code surfaced by the final read_some/write_some, even when that completion delivered the last bytes and filled the buffer. A generic observer (when_any/when_all) then saw a completed transfer as a failure. The most common trigger is end-of-stream coincident with a full read (read_some returns [eof, n] that fills the buffer). Report the contingency only when the buffer was not fully transferred: when n == buffer_size(buffers) the transfer succeeded and ec is success. Tighten the documented postcondition accordingly. Codify the same invariant in the ReadStream and WriteStream concept contracts: a read_some/write_some that fills its buffer reports success, so n == buffer_size(buffers) implies no error (a coincident condition such as end-of-stream surfaces on a subsequent call). Add a mock stream that reports a contingency in the same completion that transfers bytes (the test read/write streams report errors with zero bytes) and cover both the filled-is-success and short-transfer-is-reported cases.
|
An automated preview of the documentation is available at https://319.capy.prtest3.cppalliance.org/index.html If more commits are pushed to the pull request, the docs will rebuild at the same URL. 2026-06-16 19:25:12 UTC |
|
GCOVR code coverage report https://319.capy.prtest3.cppalliance.org/gcovr/index.html Build time: 2026-06-16 19:41:20 UTC |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #319 +/- ##
===========================================
- Coverage 98.09% 98.07% -0.03%
===========================================
Files 164 164
Lines 8873 8758 -115
===========================================
- Hits 8704 8589 -115
Misses 169 169
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 10 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
Resolves #257.
Resolves #258.
read and write reported any error_code surfaced by the final read_some/write_some, even when that completion delivered the last bytes and filled the buffer. A generic observer (when_any/when_all) then saw a completed transfer as a failure. The most common trigger is end-of-stream coincident with a full read (read_some returns [eof, n] that fills the buffer).
Report the contingency only when the buffer was not fully transferred: when n == buffer_size(buffers) the transfer succeeded and ec is success. Tighten the documented postcondition accordingly.
Codify the same invariant in the ReadStream and WriteStream concept contracts: a read_some/write_some that fills its buffer reports success, so n == buffer_size(buffers) implies no error (a coincident condition such as end-of-stream surfaces on a subsequent call).
Add a mock stream that reports a contingency in the same completion that transfers bytes (the test read/write streams report errors with zero bytes) and cover both the filled-is-success and short-transfer-is-reported cases.