Skip to content

Expose ros-z-debug subscription updates#2634

Merged
schmidma merged 1 commit into
HULKs:mainfrom
schmidma:twix-ros-z-debug-events
Jun 24, 2026
Merged

Expose ros-z-debug subscription updates#2634
schmidma merged 1 commit into
HULKs:mainfrom
schmidma:twix-ros-z-debug-events

Conversation

@schmidma

@schmidma schmidma commented Jun 17, 2026

Copy link
Copy Markdown
Member

Summary

This PR lets users subscribe to live updates from ros-z-debug subscriptions.

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:

  • use latest() and window() to inspect retained data
  • use subscribe_updates() to wait for future changes

Reviewer Notes

The main API change is in crates/ros-z-debug/src/subscription.rs:

  • drain_events() is replaced by subscribe_updates()
  • update receivers only see future updates
  • closed subscriptions return SubscriptionUpdateClosed

The 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 existing CancellationToken instead of storing and aborting an AbortHandle from the builders.

Test Plan

  • cargo nextest run -p ros-z-debug
  • cargo test --doc -p ros-z-debug
  • cargo clippy -p ros-z-debug --all-targets --locked -- -D warnings

@github-project-automation github-project-automation Bot moved this to In Progress in Development Jun 17, 2026
@schmidma schmidma self-assigned this Jun 17, 2026
@schmidma schmidma changed the title Expose ros-z-debug retained sample events Expose ros-z-debug subscription updates Jun 18, 2026
@schmidma schmidma force-pushed the twix-ros-z-debug-events branch 2 times, most recently from 8e7ce68 to f6d973a Compare June 23, 2026 23:27
@schmidma schmidma moved this from In Progress to Review in Development Jun 24, 2026
@schmidma schmidma removed their assignment Jun 24, 2026
@schmidma schmidma marked this pull request as ready for review June 24, 2026 12:44
@schmidma schmidma enabled auto-merge June 24, 2026 12:44
@rmburg rmburg self-assigned this Jun 24, 2026
Comment thread crates/ros-z-debug/src/subscription.rs Outdated
@schmidma schmidma force-pushed the twix-ros-z-debug-events branch from f6d973a to 92bd368 Compare June 24, 2026 18:31
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.
@schmidma schmidma force-pushed the twix-ros-z-debug-events branch from 92bd368 to 9d68c26 Compare June 24, 2026 18:46
Comment thread crates/ros-z-debug/src/event.rs

@rmburg rmburg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@schmidma schmidma added this pull request to the merge queue Jun 24, 2026
Merged via the queue into HULKs:main with commit 5c9cc82 Jun 24, 2026
7 checks passed
@schmidma schmidma deleted the twix-ros-z-debug-events branch June 24, 2026 19:53
@github-project-automation github-project-automation Bot moved this from Review to Done in Development Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants