Skip to content

feat: RELAY spec v0.2 conformance — relay:: namespace, Channel<T>, Adapt()#7

Merged
SoundMatt merged 1 commit into
mainfrom
feat/relay-conformance
Jun 17, 2026
Merged

feat: RELAY spec v0.2 conformance — relay:: namespace, Channel<T>, Adapt()#7
SoundMatt merged 1 commit into
mainfrom
feat/relay-conformance

Conversation

@SoundMatt

Copy link
Copy Markdown
Owner

Summary

Implements RELAY spec §18.2 C++ bindings in cpp-RCP, closing issue #5.

  • include/relay/relay.hpp: New relay:: namespace header with:

    • relay::Protocol enum (§3) — CAN=1…SOMEIP=6
    • relay::Message universal envelope (§4)
    • relay::Errc error category named "relay" with four mandatory sentinels: ErrClosed, ErrNotConnected, ErrTimeout, ErrPayloadTooLarge (§5.1)
    • relay::Context — lightweight deadline context (§18.2), now the canonical definition
    • relay::BackPressurePolicy + relay::SubscriberOptions with default depth 64 (§14, §18.2)
    • relay::Channel<T> — generic typed bounded channel; bool push() returns false when full or closed (§18.2)
    • relay::Node and relay::Caller abstract classes (§18.2)
    • relay::kRelaySpecVersion = "0.2" (§19.4)
  • include/rcp/rcp.hpp: Updated:

    • rcp::Context → alias for relay::Context (§18.2)
    • rcp::StatusChannel → alias for relay::Channel<Status> (§18.2)
    • rcp_category()::equivalent() maps rcp::Errcrelay::Errc via std::error_condition equivalence (§5.2, §5.3)
  • include/rcp/adapt.hpp: New file:

    • rcp::Adapt(shared_ptr<Controller>)unique_ptr<relay::Caller> (§10.3)
    • zone_to_relay_id / zone_from_relay_id for PascalCase zone names (§4.2)
    • status_to_message / response_to_message / message_to_command (§15.7.5)
    • RcpCallerAdapter implementing all three relay::Node/Caller virtual methods
  • tests/test_relay.cpp: 23 new conformance tests — all 27/27 tests pass locally.

Spec gaps raised on RELAY repo (issue #6)

8 issues filed on SoundMatt/RELAY covering: SpecVersion inconsistency (§17.12 vs §19.4), Channel<T> by-value in subscribe() signature, missing C++ Adapt() signature, missing std::error_condition equivalence example, rcp.healthy meta key absent from §4.3, missing C++ ToMessage()/FromMessage() signatures, ErrAlreadyExists wrapping ErrClosed semantically wrong, and CLI conformance undefined for header-only C++ libraries.

Test plan

  • Local build with clang++ / C++17 — all 27/27 CTest cases pass
  • rcp_relay conformance test — 51 assertions in 23 test cases
  • CI: Ubuntu clang-14/gcc-12, macOS clang, Windows MSVC matrix

Implements RELAY spec §18.2 C++ bindings for cpp-RCP (closes issue #5):

- include/relay/relay.hpp: relay:: namespace with Protocol enum, Message
  envelope, Errc error category with ErrClosed/ErrNotConnected/ErrTimeout/
  ErrPayloadTooLarge sentinels, Context, BackPressurePolicy, SubscriberOptions,
  Channel<T> generic typed channel, Node and Caller abstract classes, and
  kRelaySpecVersion = "0.2" constant.

- include/rcp/rcp.hpp: rcp::Context aliased to relay::Context; rcp::StatusChannel
  aliased to relay::Channel<Status>; rcp_category() gains equivalent() mapping
  rcp::Errc codes to relay::Errc conditions (§5.2, §5.3).

- include/rcp/adapt.hpp: rcp::Adapt() wrapping Controller as relay::Caller;
  zone_to_relay_id/zone_from_relay_id helpers; status_to_message/
  response_to_message/message_to_command conversions (§15.7.5).

- tests/test_relay.cpp: 23 conformance tests covering spec version, Protocol
  enum values, all four mandatory error sentinels (§5.1), error_condition
  equivalence mappings (§5.2), Channel<T> push/recv semantics, SubscriberOptions
  defaults (§14), Context alias, StatusChannel alias, and Adapt() call/send/
  subscribe/close behaviour (§10.3). All 27/27 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Matt Jones <47545907+SoundMatt@users.noreply.github.com>
@SoundMatt
SoundMatt merged commit 60296ca into main Jun 17, 2026
19 checks passed
@SoundMatt
SoundMatt deleted the feat/relay-conformance branch June 17, 2026 00:04
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.

1 participant