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

   # Which issue does this PR close?
   
   N/A. Found while reviewing the trailing-slash handling in 
`object_store_opendal`.
   
   # Rationale for this change
   
   `object_store::path::Path` drops trailing slashes, so `ObjectStoreDeleter` 
and `ObjectStoreService::stat` treated `foo/` as the regular file `foo`. 
`op.delete("foo/")` could delete `foo`, and `stat("foo/")` returned file 
metadata for a directory path.
   
   `timestamp_to_datetime` cast `jiff`'s signed subsecond to `u32`. Every 
pre-epoch timestamp with a fractional second converted to `None`, silently 
replacing `ObjectMeta::last_modified` with the default and dropping 
`if_modified_since` / `if_unmodified_since` preconditions.
   
   `OpendalStore::get_ranges` mapped `IsADirectory` differently from `get` and 
`head`, and same-path copy/rename operations leaked OpenDAL's `IsSameFile` 
instead of following `object_store`'s contract (`AlreadyExists` when the source 
exists, `NotFound` when it does not).
   
   # What changes are included in this PR?
   
   - Treat trailing-slash delete paths as directories: `delete_once` succeeds 
without touching the store, and `delete_batch` reports them as succeeded 
without sending them to the backend. This matches object stores that have no 
directory marker objects.
   - `ObjectStoreService::stat` returns directory metadata for `/` and 
`NotFound` for other trailing-slash paths, both with and without 
`SimulateLayer`.
   - Convert `jiff` timestamps with a floor second and a non-negative 
nanosecond, using `checked_sub` at the lower bound.
   - Route `get_ranges` errors through `format_get_error`, so directory paths 
behave like `get` and `head`.
   - Short-circuit same-path copy and rename: `AlreadyExists` for create-only 
operations on an existing source, `NotFound` for a missing source, and a no-op 
for overwrite operations.
   - Add local regression tests for each case. The new tests fail on the 
previous behavior and pass with this change.
   
   # Are there any user-facing changes?
   
   `delete("foo/")` no longer deletes a regular file named `foo`. 
`stat("foo/")` no longer returns file metadata, and `get_ranges` now reports 
`NotFound` instead of a generic `IsADirectory` error for directory paths. 
Pre-epoch modification times are preserved instead of silently becoming the 
epoch.
   
   # Breaking changes
   
   # AI Usage Statement
   
   - Harness: T3 Code
   - Model: DeepSeek
   - Effort: max
   - Role: Drafted the changes and regression tests, and ran the local 
verification. Assumption affecting review: for an overwrite rename onto the 
same path, the implementation keeps the object in place (matching 
`LocalFileSystem`); `InMemory`'s default copy-then-delete removes it, so the 
return codes, not that side effect, follow the reference implementations.


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