This is an automated email from the ASF dual-hosted git repository.

Xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new ff43b5fe9d chore(deps): upgrade jiff to 1.0.1 (#8761)
ff43b5fe9d is described below

commit ff43b5fe9dd7865047b87365d98b62342fd65288
Author: Xuanwo <[email protected]>
AuthorDate: Mon Nov 23 08:09:19 2026 +0800

    chore(deps): upgrade jiff to 1.0.1 (#8761)
    
    Upgrade opendal-core's jiff dependency from 0.2 to 1.0.1.
    
    Convert jiff::Timestamp to SystemTime with try_from while keeping OpenDAL's
    From<Timestamp> for SystemTime signature. Keep jiff 0.2's js feature 
enabled on
    wasm while reqsign-core still uses jiff 0.2. The Python binding keeps jiff 
0.2
    for PyO3's jiff-02 conversions and bridges timestamps through 
SignedDuration.
    
    Sync bindings/ruby/Cargo.lock and document the breaking change in 
upgrade.md.
---
 bindings/python/src/metadata.rs |  2 +-
 bindings/python/src/options.rs  | 24 +++++++++----
 bindings/python/src/utils.rs    | 41 ++++++++++++++++++++++
 bindings/ruby/Cargo.lock        | 65 +++++++++++++++++++++++++++++++---
 core/Cargo.lock                 | 77 +++++++++++++++++++++++++++++++++++------
 core/core/Cargo.toml            | 11 ++++--
 core/core/src/docs/upgrade.md   | 14 ++++++++
 core/core/src/raw/time.rs       | 24 +++++++++++--
 8 files changed, 230 insertions(+), 28 deletions(-)

diff --git a/bindings/python/src/metadata.rs b/bindings/python/src/metadata.rs
index eedae51de1..1cb5c2ed6e 100644
--- a/bindings/python/src/metadata.rs
+++ b/bindings/python/src/metadata.rs
@@ -143,7 +143,7 @@ impl Metadata {
     /// The last modified timestamp of this entry.
     #[getter]
     pub fn last_modified(&self) -> Option<jiff::Timestamp> {
-        self.0.last_modified().map(Into::into)
+        self.0.last_modified().map(utils::timestamp_to_jiff)
     }
 
     /// The version of this entry.
diff --git a/bindings/python/src/options.rs b/bindings/python/src/options.rs
index 33a2767ab2..c66758df5b 100644
--- a/bindings/python/src/options.rs
+++ b/bindings/python/src/options.rs
@@ -194,8 +194,12 @@ impl From<ReadOptions> for ocore::options::ReadOptions {
             version: opts.version,
             if_match: opts.if_match,
             if_none_match: opts.if_none_match,
-            if_modified_since: opts.if_modified_since.map(Into::into),
-            if_unmodified_since: opts.if_unmodified_since.map(Into::into),
+            if_modified_since: opts
+                .if_modified_since
+                .map(crate::utils::timestamp_from_jiff),
+            if_unmodified_since: opts
+                .if_unmodified_since
+                .map(crate::utils::timestamp_from_jiff),
             content_length_hint: None,
             concurrent: opts.concurrent.unwrap_or_default(),
             chunk: opts.chunk,
@@ -214,8 +218,12 @@ impl From<ReadOptions> for ocore::options::ReaderOptions {
             version: opts.version,
             if_match: opts.if_match,
             if_none_match: opts.if_none_match,
-            if_modified_since: opts.if_modified_since.map(Into::into),
-            if_unmodified_since: opts.if_unmodified_since.map(Into::into),
+            if_modified_since: opts
+                .if_modified_since
+                .map(crate::utils::timestamp_from_jiff),
+            if_unmodified_since: opts
+                .if_unmodified_since
+                .map(crate::utils::timestamp_from_jiff),
             content_length_hint: None,
             concurrent: opts.concurrent.unwrap_or_default(),
             chunk: opts.chunk,
@@ -337,8 +345,12 @@ impl From<StatOptions> for ocore::options::StatOptions {
             version: opts.version,
             if_match: opts.if_match,
             if_none_match: opts.if_none_match,
-            if_modified_since: opts.if_modified_since.map(Into::into),
-            if_unmodified_since: opts.if_unmodified_since.map(Into::into),
+            if_modified_since: opts
+                .if_modified_since
+                .map(crate::utils::timestamp_from_jiff),
+            if_unmodified_since: opts
+                .if_unmodified_since
+                .map(crate::utils::timestamp_from_jiff),
             override_content_type: opts.content_type,
             override_cache_control: opts.cache_control,
             override_content_disposition: opts.content_disposition,
diff --git a/bindings/python/src/utils.rs b/bindings/python/src/utils.rs
index de2a31f170..41a82dc627 100644
--- a/bindings/python/src/utils.rs
+++ b/bindings/python/src/utils.rs
@@ -26,6 +26,23 @@ use pyo3::types::PyBytes;
 
 use crate::ocore;
 
+/// Convert a timestamp from this binding's `jiff` version to OpenDAL's.
+///
+/// PyO3's `jiff-02` feature keeps the Python binding on jiff 0.2, while
+/// `opendal-core` uses jiff 1.0. Both versions cover the same timestamp range.
+pub fn timestamp_from_jiff(ts: jiff::Timestamp) -> ocore::raw::Timestamp {
+    let duration = ts.as_duration();
+    ocore::raw::Timestamp::new(duration.as_secs(), duration.subsec_nanos())
+        .expect("jiff timestamp is within OpenDAL timestamp range")
+}
+
+/// Convert an OpenDAL timestamp to this binding's `jiff` version.
+pub fn timestamp_to_jiff(ts: ocore::raw::Timestamp) -> jiff::Timestamp {
+    let duration = ts.into_inner().as_duration();
+    jiff::Timestamp::new(duration.as_secs(), duration.subsec_nanos())
+        .expect("OpenDAL timestamp is within jiff timestamp range")
+}
+
 /// Keep immutable Python bytes alive inside an OpenDAL buffer without copying.
 pub fn py_bytes_like_into_buffer(value: &Bound<PyAny>) -> 
PyResult<ocore::Buffer> {
     if let Ok(value) = value.cast::<PyBytes>() {
@@ -106,6 +123,30 @@ mod tests {
 
     use super::*;
 
+    #[test]
+    fn test_timestamp_jiff_conversion_preserves_nanoseconds() {
+        let ts = jiff::Timestamp::new(1_646_122_354, 123_456_789).unwrap();
+        let opendal_ts = timestamp_from_jiff(ts);
+
+        assert_eq!(opendal_ts.into_inner().as_second(), 1_646_122_354);
+        assert_eq!(opendal_ts.into_inner().subsec_nanosecond(), 123_456_789);
+        assert_eq!(timestamp_to_jiff(opendal_ts), ts);
+    }
+
+    #[test]
+    fn test_timestamp_jiff_conversion_preserves_pre_epoch_nanoseconds() {
+        let ts = "1969-12-31T23:59:59.123456789Z"
+            .parse::<jiff::Timestamp>()
+            .unwrap();
+        let opendal_ts = timestamp_from_jiff(ts);
+
+        assert_eq!(
+            opendal_ts.into_inner().to_string(),
+            "1969-12-31T23:59:59.123456789Z"
+        );
+        assert_eq!(timestamp_to_jiff(opendal_ts), ts);
+    }
+
     #[test]
     fn test_buffer_into_py_bytes() {
         Python::initialize();
diff --git a/bindings/ruby/Cargo.lock b/bindings/ruby/Cargo.lock
index aa4d32ca58..62034c3571 100644
--- a/bindings/ruby/Cargo.lock
+++ b/bindings/ruby/Cargo.lock
@@ -1087,8 +1087,8 @@ source = 
"registry+https://github.com/rust-lang/crates.io-index";
 checksum = "961d16382652bfdd8c6f68b223b26a8c93e0d475c672f414411db31c6c5c900e"
 dependencies = [
  "defmt",
- "jiff-static",
- "jiff-tzdb-platform",
+ "jiff-static 0.2.32",
+ "jiff-tzdb-platform 0.1.3",
  "js-sys",
  "log",
  "portable-atomic",
@@ -1098,6 +1098,33 @@ dependencies = [
  "windows-link",
 ]
 
+[[package]]
+name = "jiff"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+checksum = "ed5d126d72eb017f10b302e73bdeca446bea405ee449af4d9e7866d6b082d83e"
+dependencies = [
+ "jiff-core",
+ "jiff-static 1.0.1",
+ "jiff-tzdb-platform 1.0.0",
+ "js-sys",
+ "log",
+ "portable-atomic",
+ "portable-atomic-util",
+ "serde_core",
+ "wasm-bindgen",
+ "windows-link",
+]
+
+[[package]]
+name = "jiff-core"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+checksum = "b6b46a105a9874634dd96231021526bf24ca04955a5998c59a9c7666e634b7b8"
+dependencies = [
+ "log",
+]
+
 [[package]]
 name = "jiff-static"
 version = "0.2.32"
@@ -1109,19 +1136,46 @@ dependencies = [
  "syn 2.0.118",
 ]
 
+[[package]]
+name = "jiff-static"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+checksum = "c0127e9bde3c6130d6169e7d8d68676e4be69c4bf7573c308b6f960a5089c428"
+dependencies = [
+ "jiff-core",
+ "proc-macro2",
+ "quote",
+ "syn 3.0.3",
+]
+
 [[package]]
 name = "jiff-tzdb"
 version = "0.1.8"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 checksum = "142bd39932ad231f10513df9ab62661fead8719872150b7ad02a2df79f4e141e"
 
+[[package]]
+name = "jiff-tzdb"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+checksum = "12e71a1b68a875a44a33bb7a1dd84392cb77145a3367a552a3cfe6a4f5cf3afc"
+
 [[package]]
 name = "jiff-tzdb-platform"
 version = "0.1.3"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 checksum = "875a5a69ac2bab1a891711cf5eccbec1ce0341ea805560dcd90b7a2e925132e8"
 dependencies = [
- "jiff-tzdb",
+ "jiff-tzdb 0.1.8",
+]
+
+[[package]]
+name = "jiff-tzdb-platform"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+checksum = "dc65b284afcfa8f6cf189c7274c805505314a7ab975c60e1f548bff56525420e"
+dependencies = [
+ "jiff-tzdb 1.0.0",
 ]
 
 [[package]]
@@ -1433,7 +1487,8 @@ dependencies = [
  "bytes",
  "futures",
  "http",
- "jiff",
+ "jiff 0.2.32",
+ "jiff 1.0.1",
  "log",
  "md-5",
  "percent-encoding",
@@ -2296,7 +2351,7 @@ dependencies = [
  "hex",
  "hmac 0.13.0",
  "http",
- "jiff",
+ "jiff 0.2.32",
  "log",
  "percent-encoding",
  "rsa",
diff --git a/core/Cargo.lock b/core/Cargo.lock
index b78fe220b4..a797eaa9b7 100644
--- a/core/Cargo.lock
+++ b/core/Cargo.lock
@@ -4150,7 +4150,7 @@ dependencies = [
  "bstr",
  "gix-error",
  "itoa",
- "jiff",
+ "jiff 0.2.35",
 ]
 
 [[package]]
@@ -5995,9 +5995,27 @@ source = 
"registry+https://github.com/rust-lang/crates.io-index";
 checksum = "668b7183bd07af9a4885f5c35b0cc5c83c4607a913c16b7e17291832910d2dcc"
 dependencies = [
  "defmt 1.1.0",
- "jiff-core",
- "jiff-static",
- "jiff-tzdb-platform",
+ "jiff-core 0.1.0",
+ "jiff-static 0.2.35",
+ "jiff-tzdb-platform 0.1.3",
+ "js-sys",
+ "log",
+ "portable-atomic",
+ "portable-atomic-util",
+ "serde_core",
+ "wasm-bindgen",
+ "windows-link",
+]
+
+[[package]]
+name = "jiff"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+checksum = "ed5d126d72eb017f10b302e73bdeca446bea405ee449af4d9e7866d6b082d83e"
+dependencies = [
+ "jiff-core 1.0.1",
+ "jiff-static 1.0.1",
+ "jiff-tzdb-platform 1.0.0",
  "js-sys",
  "log",
  "portable-atomic",
@@ -6016,31 +6034,67 @@ dependencies = [
  "defmt 1.1.0",
 ]
 
+[[package]]
+name = "jiff-core"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+checksum = "b6b46a105a9874634dd96231021526bf24ca04955a5998c59a9c7666e634b7b8"
+dependencies = [
+ "log",
+]
+
 [[package]]
 name = "jiff-static"
 version = "0.2.35"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 checksum = "3a69dcb3a21cfb32ce1cd056169337ca284af0766dd766e7878819b251a49204"
 dependencies = [
- "jiff-core",
+ "jiff-core 0.1.0",
  "proc-macro2",
  "quote",
  "syn 2.0.118",
 ]
 
+[[package]]
+name = "jiff-static"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+checksum = "c0127e9bde3c6130d6169e7d8d68676e4be69c4bf7573c308b6f960a5089c428"
+dependencies = [
+ "jiff-core 1.0.1",
+ "proc-macro2",
+ "quote",
+ "syn 3.0.3",
+]
+
 [[package]]
 name = "jiff-tzdb"
 version = "0.1.6"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 checksum = "c900ef84826f1338a557697dc8fc601df9ca9af4ac137c7fb61d4c6f2dfd3076"
 
+[[package]]
+name = "jiff-tzdb"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+checksum = "12e71a1b68a875a44a33bb7a1dd84392cb77145a3367a552a3cfe6a4f5cf3afc"
+
 [[package]]
 name = "jiff-tzdb-platform"
 version = "0.1.3"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 checksum = "875a5a69ac2bab1a891711cf5eccbec1ce0341ea805560dcd90b7a2e925132e8"
 dependencies = [
- "jiff-tzdb",
+ "jiff-tzdb 0.1.6",
+]
+
+[[package]]
+name = "jiff-tzdb-platform"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+checksum = "dc65b284afcfa8f6cf189c7274c805505314a7ab975c60e1f548bff56525420e"
+dependencies = [
+ "jiff-tzdb 1.0.0",
 ]
 
 [[package]]
@@ -6364,7 +6418,7 @@ version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 checksum = "80f4ed78a03a30c12285135d98330f0f5d53cb0019bd1ac6d66863dae72d8d52"
 dependencies = [
- "jiff",
+ "jiff 0.2.35",
  "logforth-core",
 ]
 
@@ -6403,7 +6457,7 @@ version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 checksum = "9d86a105f8f32151ca1e0a6d4097d478badb02d5715239ba0fa431a188a5d966"
 dependencies = [
- "jiff",
+ "jiff 0.2.35",
  "logforth-core",
  "serde",
  "serde_json",
@@ -6416,7 +6470,7 @@ source = 
"registry+https://github.com/rust-lang/crates.io-index";
 checksum = "4eafe007ac55293d807e8c7f5a23002e2518d32e476e195443cde23e7845416a"
 dependencies = [
  "colored",
- "jiff",
+ "jiff 0.2.35",
  "logforth-core",
 ]
 
@@ -7430,7 +7484,8 @@ dependencies = [
  "bytes",
  "futures",
  "http 1.5.0",
- "jiff",
+ "jiff 0.2.35",
+ "jiff 1.0.1",
  "log",
  "logforth",
  "md-5 0.11.0",
@@ -10500,7 +10555,7 @@ dependencies = [
  "hex",
  "hmac 0.13.0",
  "http 1.5.0",
- "jiff",
+ "jiff 0.2.35",
  "log",
  "percent-encoding",
  "rsa 0.9.10",
diff --git a/core/core/Cargo.toml b/core/core/Cargo.toml
index 1839de9219..1274bf9ae3 100644
--- a/core/core/Cargo.toml
+++ b/core/core/Cargo.toml
@@ -55,7 +55,7 @@ internal-tokio-rt = ["tokio/rt-multi-thread"]
 # so signing services (s3, gcs, azblob, ...) can load credentials over HTTP.
 # Services that need request signing enable it automatically; it is off by
 # default so local-only services (memory, fs, ...) don't pull in reqsign-core.
-reqsign = ["dep:reqsign-core"]
+reqsign = ["dep:reqsign-core", "dep:jiff-02"]
 
 # Deprecated: memory service is always enabled.
 services-memory = []
@@ -71,7 +71,7 @@ base64 = { workspace = true }
 bytes = { workspace = true }
 futures = { workspace = true, features = ["std", "async-await"] }
 http = { workspace = true }
-jiff = { version = "0.2.28", features = ["serde"] }
+jiff = { version = "1.0.1", features = ["serde"] }
 log = { workspace = true }
 md-5 = "0.11.0"
 percent-encoding = "2"
@@ -84,7 +84,12 @@ url = { workspace = true }
 uuid = { workspace = true, features = ["serde", "v4"] }
 
 [target.'cfg(target_arch = "wasm32")'.dependencies]
-jiff = { version = "0.2.28", features = ["serde", "js"] }
+jiff = { version = "1.0.1", features = ["serde", "js"] }
+# reqsign-core still uses jiff 0.2, which needs its `js` feature for
+# `Timestamp::now()` on wasm. Keep this shim until reqsign moves to jiff 1.0.
+jiff-02 = { package = "jiff", version = "0.2.28", default-features = false, 
features = [
+  "js",
+], optional = true }
 tokio = { workspace = true, features = ["time"] }
 uuid = { workspace = true, features = ["serde", "v4", "js"] }
 
diff --git a/core/core/src/docs/upgrade.md b/core/core/src/docs/upgrade.md
index cece716d7c..04722e1af3 100644
--- a/core/core/src/docs/upgrade.md
+++ b/core/core/src/docs/upgrade.md
@@ -63,6 +63,20 @@ with `SignedDuration::from_secs(5)` or parse a duration 
string. The builder
 setters still accept `std::time::Duration`, and string/map configuration still
 accepts duration strings such as `"5s"`.
 
+## `jiff` upgraded to 1.0
+
+OpenDAL now uses `jiff` 1.0. `opendal::raw` re-exports `jiff::SignedDuration`,
+and `opendal::raw::Timestamp` exposes its inner `jiff::Timestamp` through
+`into_inner()` and `From` conversions. If your code uses these types directly,
+upgrade your direct `jiff` dependency to `1.0`. jiff 1.0 requires Rust 1.85,
+which is below OpenDAL's minimum supported Rust version.
+
+`SystemTime::from(opendal::raw::Timestamp)` keeps its signature, but it can
+still panic when the target's `SystemTime` cannot represent the timestamp,
+matching the previous jiff 0.2 conversion. For example, wasm cannot represent
+timestamps before the Unix epoch. Convert a `jiff::Timestamp` directly with
+`SystemTime::try_from(timestamp)` and handle the error.
+
 ## Tokio executor moved to `opendal-executor-tokio`
 
 If you depend directly on `opendal-core`, remove its `executors-tokio` feature
diff --git a/core/core/src/raw/time.rs b/core/core/src/raw/time.rs
index 4ff95f4463..705f2b27de 100644
--- a/core/core/src/raw/time.rs
+++ b/core/core/src/raw/time.rs
@@ -180,16 +180,21 @@ impl From<jiff::Timestamp> for Timestamp {
 
 impl From<Timestamp> for SystemTime {
     fn from(ts: Timestamp) -> Self {
+        // jiff 1.0 makes converting a `jiff::Timestamp` to `SystemTime`
+        // fallible. Keep the public conversion infallible but surface the same
+        // failure as the previous jiff 0.2 conversion when `SystemTime` cannot
+        // represent the value. On wasm, `web_time::SystemTime` additionally
+        // cannot represent times before the Unix epoch.
         #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
         {
-            SystemTime::from(ts.0)
+            SystemTime::try_from(ts.0).expect("jiff timestamp should fit in 
SystemTime")
         }
 
         #[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
         {
             use std::time::SystemTime as StdSystemTime;
 
-            let t = StdSystemTime::from(ts.0);
+            let t = StdSystemTime::try_from(ts.0).expect("jiff timestamp 
should fit in SystemTime");
             <web_time::SystemTime as web_time::web::SystemTimeExt>::from_std(t)
         }
     }
@@ -311,6 +316,21 @@ mod tests {
         assert_eq!("Sat, 29 Oct 1994 19:43:31 GMT", v.format_http_date());
     }
 
+    #[test]
+    fn test_timestamp_to_system_time() {
+        let ts = test_time();
+        let system_time: SystemTime = ts.into();
+
+        assert_eq!(Timestamp::try_from(system_time).unwrap(), ts);
+    }
+
+    #[cfg(all(unix, target_pointer_width = "64"))]
+    #[test]
+    fn test_min_and_max_timestamps_convert_to_system_time() {
+        let _: SystemTime = Timestamp::MIN.into();
+        let _: SystemTime = Timestamp::MAX.into();
+    }
+
     #[test]
     fn test_signed_duration_to_duration_rejects_negative_values() {
         
assert!(signed_duration_to_duration(SignedDuration::from_secs(-1)).is_err());

Reply via email to