Skip to content

cyclic-subscriptions/ should support all SOVD resource collections and vendor extensions #253

@bburda

Description

@bburda

Summary

Cyclic subscriptions are currently hard-coded to work only with /data/ resources. Any other SOVD resource collection (faults, operations, configurations, communication-logs) or vendor extension (x-medkit-*) is rejected.

This means vendor resources registered by plugins via register_capability() can't be subscribed to, even though SOVD treats cyclic subscriptions as a generic mechanism for any resource on an entity path.

What's hard-coded

Three places in cyclic_subscription_handlers.cpp restrict subscriptions to /data/:

  1. parse_resource_uri() regex (line 442) - only matches /api/v1/{apps|components}/{id}/data/{path}:

    static const std::regex resource_regex(R"(^/api/v1/(?:apps|components)/[^/]+/data(/.*))")
  2. Prefix validation (line 118) - rejects any resource URI that doesn't start with /data/:

    std::string expected_prefix = "/api/v1/" + entity_type + "/" + entity_id + "/data/";
  3. Entity type restriction - routes are only registered for apps and components, not functions.

Additionally, subscription_manager.hpp uses topic_name for the extracted resource path, which assumes the resource is always a ROS 2 topic.

Proposed solution (optional)

Make the subscription handler resource-agnostic:

  • parse_resource_uri() should extract both the collection name and the resource path from the URI, not assume /data/
  • Prefix validation should check that the resource URI matches the entity from the route, without assuming which collection it belongs to
  • Validation: use EntityCapabilities::supports_collection() (for standard collections) or check registered plugin capabilities (for vendor extensions) to determine if the resource is subscribable
  • Rename topic_name to resource_path in CyclicSubscriptionInfo for clarity
  • Route registration should cover all entity types that support cyclic subscriptions per SOVD Table 8

The SSE streaming logic itself (set_chunked_content_provider, EventEnvelope format, replay buffer) is generic and shouldn't need changes - only the resource resolution and validation layer.

Additional context (optional)

SOVD spec (ISO 17978-3, Section 7 - cyclic subscriptions) defines cyclic subscriptions as applicable to any resource on an entity, with x-sovd-cyclic-subscription-supported: true in the capability description indicating support. The current implementation doesn't check this flag or delegate to the resource handler for data retrieval - it goes directly to NativeTopicSampler, which only works for /data/ (ROS 2 topics).

For non-data resources, the streaming callback would need to delegate to the appropriate handler/manager (e.g., FaultManager for faults, ConfigurationManager for configurations, plugin routes for vendor extensions) instead of sampling a ROS 2 topic directly.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions