Expose ros-z-debug subscription updates#2634
Merged
Merged
Conversation
This was referenced Jun 17, 2026
8e7ce68 to
f6d973a
Compare
rmburg
reviewed
Jun 24, 2026
f6d973a to
92bd368
Compare
Replace retained debug event draining with live update receivers. Keep status-derived diagnostics on subscription status snapshots and keep the subscription lifecycle owned by SubscriptionState.
92bd368 to
9d68c26
Compare
rmburg
reviewed
Jun 24, 2026
This was referenced Jun 27, 2026
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.
Summary
This PR lets users subscribe to live updates from
ros-z-debugsubscriptions.A user can now keep a handle to the latest received data, and also wait for changes on that handle. Updates report new data, status changes with retained diagnostic messages, and missed messages when a receiver falls behind.
Closing a subscription closes the update stream. The last retained data and status stay available through the handle.
Motivation
Debug tools often need to react when subscription data changes. Before this PR, callers could only drain a small internal event buffer. That mixed two different jobs: storing recent state and notifying live consumers.
This PR makes the split clearer:
latest()andwindow()to inspect retained datasubscribe_updates()to wait for future changesReviewer Notes
The main API change is in
crates/ros-z-debug/src/subscription.rs:drain_events()is replaced bysubscribe_updates()SubscriptionUpdateClosedThe event types live in
crates/ros-z-debug/src/event.rs.The subscription lifecycle also moved into
SubscriptionState::spawn. This keeps live update stream closure, receive-task cancellation, and weak-state receive-loop ownership in one place. The receive task now exits cooperatively through the existingCancellationTokeninstead of storing and aborting anAbortHandlefrom the builders.Test Plan
cargo nextest run -p ros-z-debugcargo test --doc -p ros-z-debugcargo clippy -p ros-z-debug --all-targets --locked -- -D warnings