Skip to content

feat: RELAY-conformant cpp-rcp CLI (§11/§12 version/capabilities/status) - #14

Merged
SoundMatt merged 2 commits into
mainfrom
feat/relay-cli
Jun 17, 2026
Merged

SoundMatt merged 2 commits into
mainfrom
feat/relay-cli

Conversation

@SoundMatt

Copy link
Copy Markdown
Owner

Summary

Adds the cpp-rcp CLI binary so relay conform / relay report (RELAY tool v0.7/v0.8) can validate cpp-RCP against the embedded §12 JSON schemas. This is the v0.3 CLI-conformance follow-up flagged when adopting the spec (issue #11).

Implements the three mandatory commands (§11.1):

Command Output Schema
version [--format text|json] §12.1 version document cli-version.json
capabilities §12.2 capabilities document (always JSON) cli-capabilities.json
status [--format text|json] §12.3 status document cli-status.json

Exit codes per §11.3: 0 success, 2 invalid args.

Design

  • include/rcp/cli.hpp — rcp::cli::run(args, out, err) holds all logic in the header so it's unit-testable without spawning a subprocess. JSON is hand-written to exact, fixed shapes (no JSON dependency added).
  • cli/main.cpp — thin argv→run() wrapper.
  • include/rcp/version.hpp — rcp::kVersion = "0.3.0".
  • CMake — -DRELAY_BUILD_CLI=ON builds the cpp-rcp binary (§13.2 lowercase name); project version bumped 0.1.0 → 0.3.0.

Schema fidelity

All three documents are field-exact against the schemas (which set additionalProperties: false):

$ cpp-rcp version --format json
{"tool":"cpp-rcp","protocol":"RCP","protocol_int":5,"version":"0.3.0","spec_version":"0.3","language":"cpp","runtime":"clang-21"}
$ cpp-rcp capabilities
{"kind":"capabilities","tool":"cpp-rcp","version":"0.3.0","spec_version":"0.3","commands":["version","capabilities","status"],"transports":["mock","sim","shmem"],"features":["loaning"],"interfaces":["Node","Caller"],"optional_interfaces":["LoaningController"],"adapt":true}
$ cpp-rcp status --format json
{"protocol":"RCP","tool":"cpp-rcp","version":"0.3.0","healthy":true,"connected":false,"endpoint":"","details":{}}

Validated with Python: valid JSON, no extra keys, all required keys present for all three.

Test plan

  • 8 new rcp_cli conformance tests; 28/28 CTest cases pass locally
  • Binary exercised directly (exit codes 0/0/0, unknown cmd → 2)
  • CI matrix green (now builds -DRELAY_BUILD_CLI=ON on all 5 platforms)

SoundMatt and others added 2 commits June 17, 2026 06:15
…/status)

Adds the CLI binary required for `relay conform` / `relay report` to validate
cpp-RCP against the embedded §12 JSON schemas (the v0.3 follow-up flagged in #11).

- include/rcp/cli.hpp: rcp::cli::run() emitting the three mandatory documents as
  JSON conforming field-for-field to RELAY spec/schemas/cli-{version,capabilities,
  status}.json (additionalProperties:false — exact field sets, no extras). Logic
  lives in the header so it is unit-testable without a subprocess.
- include/rcp/version.hpp: rcp::kVersion = "0.3.0" single source of truth.
- cli/main.cpp: thin argv wrapper; exit codes per §11.3 (0 ok / 2 invalid args).
- CMakeLists.txt: -DRELAY_BUILD_CLI=ON builds the `cpp-rcp` binary (§13.2);
  project VERSION bumped 0.1.0 → 0.3.0 to match releases.
- tests/test_cli.cpp: 8 conformance tests — required fields, kind discriminator,
  exit codes, default text vs --format json. 28/28 CTest cases pass.
- ci.yml: build matrix now configures -DRELAY_BUILD_CLI=ON so the binary compiles
  on clang-14, gcc-12 (C++17/20), macOS clang, and MSVC.

JSON output validated as well-formed and schema-field-exact for all three docs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Matt Jones <47545907+SoundMatt@users.noreply.github.com>
…d sleep)

The "transitions to Faulted after misses exceed fault_after" test slept a fixed
250 ms then asserted the state once. On loaded/preempted CI runners the keeper's
background thread can be scheduled late, so the 3 × 20 ms miss cycles haven't
completed by the single check — observed failing on the macOS shared runner in
PR #14 CI (unrelated to the CLI change).

Fix: poll for HealthState::Faulted up to a 5 s deadline before asserting. Same
hardening pattern already used for the command-latency test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Matt Jones <47545907+SoundMatt@users.noreply.github.com>
@SoundMatt
SoundMatt merged commit 3bba0f7 into main Jun 17, 2026
19 checks passed
@SoundMatt
SoundMatt deleted the feat/relay-cli branch June 17, 2026 13:27
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