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

   # Which issue does this PR close?
   
   <!-- No linked issue. -->
   
   # Rationale for this change
   
   `ObjectStoreService` in `object_store_opendal` misclassified several 
`object_store` errors as `ErrorKind::Unexpected`:
   
   - `object_store::Error::NotModified` (returned when `If-None-Match` or 
`If-Modified-Since` conditions are not satisfied) fell through to `_ => 
ErrorKind::Unexpected` instead of `ErrorKind::ConditionNotMatch`.
   - `object_store::Error::UnknownConfigurationKey` fell through to `_ => 
ErrorKind::Unexpected` instead of `ErrorKind::ConfigInvalid`.
   - Unsatisfiable / out-of-bounds range reads (such as `range(10..20)` or 
`range(10..)` on a 5-byte object, or `range(0..1)` on an empty object) are 
reported by `object_store` 0.14 as `object_store::Error::Generic` because 
`object_store::Error` has no dedicated range variant (`InvalidGetRange` is 
crate-private). As a result, `ObjectStoreReader::open` returned 
`ErrorKind::Unexpected` instead of `ErrorKind::RangeNotSatisfied`.
   
   # What changes are included in this PR?
   
   - Map `object_store::Error::NotModified` to `ErrorKind::ConditionNotMatch` 
and `object_store::Error::UnknownConfigurationKey` to 
`ErrorKind::ConfigInvalid` in `integrations/object_store/src/service/error.rs` 
while preserving the source error.
   - In `integrations/object_store/src/service/reader.rs`, when a non-suffix 
ranged `get_opts` call fails with `object_store::Error::Generic`, check range 
validity (and object size via a `head` request preserving `version`) and return 
`ErrorKind::RangeNotSatisfied` with the original source error when the 
requested range is unsatisfiable; keep in-bounds `Generic` failures as 
`ErrorKind::Unexpected`.
   - Add unit and end-to-end tests in 
`integrations/object_store/src/service/error.rs` and 
`integrations/object_store/src/service/mod.rs` covering `NotModified`, 
`UnknownConfigurationKey`, out-of-bounds reads via `Operator`, and in-bounds 
`Generic` failures.
   
   # Are there any user-facing changes?
   
   `ObjectStoreService` now returns `ErrorKind::RangeNotSatisfied` for 
unsatisfiable range reads, `ErrorKind::ConditionNotMatch` for 
`object_store::Error::NotModified`, and `ErrorKind::ConfigInvalid` for 
`object_store::Error::UnknownConfigurationKey` instead of 
`ErrorKind::Unexpected`.
   
   # Breaking changes
   
   # AI Usage Statement
   
   - **Harness:** pi
   - **Model:** Gemini 4 Neon
   - **Effort:** high
   - **Role:** Investigated `object_store` 0.14 error variants and 
`ObjectStoreService` error handling, implemented the error-mapping fixes and 
tests, and ran formatting, clippy, and unit/behavior test checks.
   


-- 
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