Skip to content

feat(hiroz): graph-settle wait + service-schema discovery (hu stack 3/9)#234

Open
YuanYuYuan wants to merge 3 commits into
dev/pr-hu-1b-logger-msgsfrom
dev/pr-hu-1c-core
Open

feat(hiroz): graph-settle wait + service-schema discovery (hu stack 3/9)#234
YuanYuYuan wants to merge 3 commits into
dev/pr-hu-1b-logger-msgsfrom
dev/pr-hu-1c-core

Conversation

@YuanYuYuan

@YuanYuYuan YuanYuYuan commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Stacked PR 3 of 9 (#231 split). Core-library primitives the hu plugin host builds on:

  • Graph::has_external_entity / wait_for_external_settled: wait for a genuinely external participant then graph-quiet, so one-shot introspection can replace blind sleeps with a real condition.
  • ZNode::discover_service_schema: resolve a service's request/response type names from the graph.
  • parameter wire-types + service tweaks and an ffi/service.rs adjustment; demo client updated to the refined API.

Base: dev/pr-hu-1b-logger-msgs.

Breaking Changes

ZNode::create_service now additionally requires T::Request: WithTypeInfo and T::Response: WithTypeInfo (to auto-register the service schema for discovery). Downstream callers whose request/response types implement ServiceTypeInfo but not MessageTypeInfo will need to add it. In practice all generated hiroz message types already implement it. (Correcting the initial 'none' — thanks to the Copilot review for catching this.)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds new graph and schema-discovery primitives that enable one-shot tooling (notably the hu plugin host) to replace fixed sleeps with condition-based waiting and to resolve service Request/Response schemas via live ~get_type_description queries. It also wires built-in parameter services into the type-description service so those schemas become discoverable.

Changes:

  • Add Graph::has_external_entity and Graph::wait_for_external_settled to wait for a genuinely external participant and then graph quiet.
  • Add ZNode::discover_service_schema and extend ZNode::create_service to auto-register Request/Response schemas with the node’s type-description service.
  • Register rcl_interfaces parameter service Request/Response schemas at ParameterService startup when the type-description service is enabled, and refine FFI service client call reply handling.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
crates/hiroz/src/parameter/wire_types.rs Adds explicit schema builders + registration for built-in parameter service wire types.
crates/hiroz/src/parameter/service.rs Passes optional type-description service into ParameterService and registers parameter schemas on startup.
crates/hiroz/src/node.rs Adds discover_service_schema and service-side schema auto-registration in create_service.
crates/hiroz/src/graph.rs Adds external-participant detection and a two-phase “external then quiet” wait helper.
crates/hiroz/src/ffi/service.rs Ensures per-call reply isolation for FFI service client calls and maps “no queryable matches” to timeout.
crates/hiroz/examples/demo_nodes/add_two_ints_client.rs Increases demo client call timeout to accommodate longer discovery/interop latencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/hiroz/src/graph.rs Outdated
Comment thread crates/hiroz/src/node.rs
Comment thread crates/hiroz/src/node.rs

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

crates/hiroz/src/graph.rs:567

  • Phase 2 of wait_for_external_settled never re-checks that an external entity is still present. If an external participant briefly appears and then disappears before the graph goes quiet, this can still return true, contradicting the doc comment that the entity is still present and causing one-shot callers to proceed with an empty/self-only graph.
        loop {
            let notified = self.change_notify.notified();
            tokio::pin!(notified);
            let remaining = deadline.saturating_duration_since(tokio::time::Instant::now());
            if remaining.is_zero() {

Comment thread crates/hiroz/src/node.rs
…types

Adds the core-library primitives the hu plugin host builds on, none of which
change existing behavior:
- Graph::has_external_entity / wait_for_external_settled: wait for a genuinely
  external participant to appear and the graph to go quiet, so one-shot
  introspection commands can replace blind sleeps with a real condition.
- ZNode::discover_service_schema: resolve a service's request/response type
  names from the graph, mirroring the topic-schema path.
- parameter wire-types + service tweaks and an ffi/service.rs adjustment.
Also updates the add_two_ints_client demo to the refined node API.
…rror

Addresses Copilot review on the core PR:
- wait_for_external_settled doc dropped a dangling [wait_settled] link and now
  states the real return contract (a phase-2 timeout returns true with the
  entity present but not necessarily a full quiet window).
- discover_service_schema now distinguishes 'server present but no node
  identity' from 'no server found' instead of the misleading blanket message.
The type-description poll loop slept a full poll_interval unconditionally, overshooting the requested timeout by up to 100ms. Clamp the final sleep to the remaining time.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Comment thread crates/hiroz/src/node.rs
Comment on lines +440 to +444
/// `T::Request` and `T::Response` must implement [`WithTypeInfo`] (enforced by
/// the trait bounds below). Type information is always populated with this
/// node's type-description service so schema discovery (e.g. by hiroz-union's
/// WASM plugin host) can resolve the Request/Response schemas via live
/// `get_type_description` queries.
Comment thread crates/hiroz/src/node.rs
Comment on lines +1148 to +1152
pub async fn discover_service_schema(
&self,
service_name: &str,
request_type_name: &str,
response_type_name: &str,
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.

2 participants