From b21d450f6eadd3917bce936bae4bdff4b54076bd Mon Sep 17 00:00:00 2001 From: "flamingo[bot]" <277372822+flamingo[bot]@users.noreply.github.com> Date: Tue, 11 Aug 2026 10:21:29 +0000 Subject: [PATCH] fix(NATSRS-003): Info::cluster field uses skip_serializing_if but is Option, missing Option::is_none guard --- async-nats/src/jetstream/consumer/mod.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/async-nats/src/jetstream/consumer/mod.rs b/async-nats/src/jetstream/consumer/mod.rs index 12334cc2b..01a705a4d 100644 --- a/async-nats/src/jetstream/consumer/mod.rs +++ b/async-nats/src/jetstream/consumer/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2020-2023 The NATS Authors +// Copyright 2020-2025 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -183,7 +183,7 @@ pub struct Info { /// The number of messages pending delivery pub num_pending: u64, /// Information about the consumer's cluster - #[serde(skip_serializing_if = "is_default")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub cluster: Option, /// Indicates if any client is connected and receiving messages from a push consumer #[serde(default, skip_serializing_if = "is_default")] @@ -193,8 +193,11 @@ pub struct Info { #[serde(default)] pub paused: bool, #[cfg(feature = "server_2_11")] - /// The remaining time the consumer is paused - #[serde(default, with = "serde_nanos")] + /// The remaining time the consumer is paused. + /// Only meaningful when `paused` is true. A value of `Some(Duration::ZERO)` or `None` + /// both indicate the consumer is not paused (or the pause has expired). + /// Always check the `paused` field as the authoritative gate before inspecting this value. + #[serde(default, with = "serde_nanos::option", skip_serializing_if = "Option::is_none")] pub pause_remaining: Option, }