Xuanwo opened a new pull request, #8808: URL: https://github.com/apache/opendal/pull/8808
# Which issue does this PR close? N/A. This was found while auditing suffix-range handling; the included regression tests reproduce it deterministically. # Rationale for this change `StreamReader::read` required every bounded range to return exactly `BytesRange::size()` bytes. A suffix range can validly return fewer bytes when the object is shorter than the requested suffix, so `BytesRange::suffix(100)` on a 5-byte object failed with `reader got unexpected data size` instead of returning the whole object. This matches RFC 9110 suffix-range semantics and the existing `CompleteReader` behavior. # What changes are included in this PR? - Resolve the exact suffix length with `RpRead` metadata as `min(suffix, content_length)` when the full object size is known. - Without metadata, allow a shorter suffix read but reject data beyond the requested suffix. - Keep exact-length validation for forward bounded ranges. - Add deterministic tests for suffixes larger and smaller than the content, `suffix(0)`, over-sized and under-sized responses, and a short forward bounded response. # Are there any user-facing changes? Suffix reads through `oio::Read::read` return the available bytes instead of failing when the object is smaller than the requested suffix. Forward bounded reads keep their exact-length contract. No public API changes. # Breaking changes # AI Usage Statement - Harness: Pi (T3 Code) - Model: group/deepseek - Effort: max - Role: Investigated suffix-range validation, implemented the fix and regression tests, and ran validation. Tests use deterministic in-process readers; no live service requests were made. -- 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]
