preserve v5 properties on retained messages#79
Merged
Conversation
10 tasks
butterflyfish
added a commit
to butterflyfish/mqtt-lib
that referenced
this pull request
May 16, 2026
After LabOverWire#79 landed lint cleanup ahead of this PR, the rebase dropped the overlapping `chore(lint)` commit but reverted two spots where the reviewer noted my variants were preferable. - `quic_acceptor.rs`: `#[allow(clippy::collapsible_match, reason = ...)]` on the nested match preserves the original control flow rather than refactoring to early-`continue`. - `bench_cmd.rs`: collapse the rate calc to `(1_000_000u64 * ...).checked_div(cmd.rate)` returning `Option<u64>` directly, replacing the `if cmd.rate > 0 { ... .unwrap_or(0) }` wrap.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #77.
Summary
broker::storage::RetainedMessageonly stored payload/qos/retain/expiry —response_topic,correlation_data,content_type,user_properties, andpayload_format_indicatorwere dropped on the way into storage and never restored on subscribe.RetainedMessage, extracted them inRetainedMessage::newand re-attached them into_publish_packet(same pattern already used byInflightMessagein the same module).#[serde(default)]so existing file-backend payloads still deserialize.Test plan
retained_properties_preserved.rs— late subscriber asserts all five v5 properties survive the retained round-trip. Confirmed to fail before the fix.cargo test -p mqtt5 --lib --bins— 418/418 passcargo test -p mqtt5 --test integration_complete_flow --test integration_retain_as_published --test message_queuing --test persistence— all passcargo make ci-verify(pre-commit hook) — fmt + clippy clean on native and wasm