Skip to content

fix: structured timeout detection in hiroz-py subscriber recv (#224)#225

Merged
YuanYuYuan merged 4 commits into
mainfrom
dev/pubsub-timeout-structured
Jul 14, 2026
Merged

fix: structured timeout detection in hiroz-py subscriber recv (#224)#225
YuanYuYuan merged 4 commits into
mainfrom
dev/pubsub-timeout-structured

Conversation

@YuanYuYuan

Copy link
Copy Markdown
Collaborator

Summary

The Python bindings' subscriber receive paths detected timeouts by string-matching error messages (err_str.contains("timeout")), the same fragility that #221 removed from the service and action paths. Any rewording of an error message would silently turn an expected timeout into an exception. This routes subscriber timeouts through the structured Error::Timeout / hiroz::error::is_timeout() path instead. Closes #224.

Key Changes

  • Map the subscriber queue's flume::RecvTimeoutError::Timeout to the structured Error::Timeout at the core level (crates/hiroz/src/pubsub.rs, crates/hiroz-py/src/traits.rs).
  • Replace the three err_str.contains("timeout") checks in crates/hiroz-py/src/pubsub.rs (recv, recv_serialized, recv_raw_view) with hiroz::error::is_timeout(), passing the whole error (&*e) so its full source() chain is walked — consistent with the sibling service path in traits.rs.
  • Add integration test crates/hiroz-tests/tests/subscriber_timeout.rs asserting that subscriber recv timeouts are classified structurally rather than by string match.
  • Go bindings audited: they already use structured error codes, no string-sniffing.

Breaking Changes

None.

Map flume::RecvTimeoutError::Timeout to the structured Error::Timeout
at the core level (ZSub::recv_timeout / recv_serialized_timeout /
dynamic recv), and replace the string-sniffing timeout checks in
hiroz-py's recv/recv_serialized/recv_raw_view with is_timeout().
The -F rmw clippy pass (jazzy/kilted/lyrical CI) does not enable the
optional hiroz-msgs dep, so the unguarded `use hiroz_msgs::std_msgs`
failed with E0432. Gate the file with #![cfg(feature = "ros-msgs")]
like the sibling interop tests (cache.rs).
@YuanYuYuan
YuanYuYuan merged commit 4f4b625 into main Jul 14, 2026
25 checks passed
@YuanYuYuan
YuanYuYuan deleted the dev/pubsub-timeout-structured branch July 14, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hiroz-py subscriber recv paths still string-sniff timeout errors

1 participant