Xuanwo opened a new pull request, #8781:
URL: https://github.com/apache/opendal/pull/8781

   # Which issue does this PR close?
   
   No linked issue. This fixes a verified data-loss bug in 
`FuturesAsyncReader::read_to_end_buffer`; the regression tests added here fail 
against the previous implementation.
   
   # Rationale for this change
   
   `read_to_end_buffer` moved bytes out of `self.buf` and advanced `self.pos` 
before awaiting `next_buffer`. If the future was dropped while pending, for 
example under `TimeoutLayer` or `select!`, or a later read returned an error, 
the bytes already read lived only in the future's locals and were discarded 
while `pos` had advanced. Retrying then resumed from the advanced position and 
silently lost the prefix.
   
   # What changes are included in this PR?
   
   `read_to_end_buffer` stages chunks in `self.read_to_end_parts` and leaves 
`self.pos` unchanged until it returns successfully. `take_buffered` combines 
the staged chunks with `self.buf`; `merge_read_to_end_parts` folds them back 
before `read_buffer`, `poll_fill_buf`, `consume`, `poll_read`, and `poll_seek` 
inspect or consume buffered data. This keeps the buffered cursor consistent 
after cancellation, errors, and seeks.
   
   Added deterministic regression tests covering cancellation and errors with 
and without pre-buffered bytes, reading after cancellation, empty streams, and 
exact `seek(Current(0))` positions.
   
   # Are there any user-facing changes?
   
   No API change. `read_to_end_buffer` now preserves bytes across cancellation 
and errors instead of silently dropping them.
   
   # Breaking changes
   
   # AI Usage Statement
   
   - Harness: pi-coding-agent 1.5.2
   - Model: group/deepseek (Magpie provider)
   - Effort: max
   - Role: AI authored the implementation and regression tests, and ran 
formatting, clippy, and core tests under maintainer direction. The accountable 
human contributor remains responsible for review and merge.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to