From 1d30a5f3dde4c52b07d7670115ca7805df3fc4b1 Mon Sep 17 00:00:00 2001 From: Matt Jones <47545907+SoundMatt@users.noreply.github.com> Date: Tue, 16 Jun 2026 17:06:22 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20apply=20RELAY=20spec=20v0.2=20update=20?= =?UTF-8?q?=E2=80=94=20ErrAlreadyExists=20standalone,=20no=20relay=20mappi?= =?UTF-8?q?ng?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RELAY spec maintainer updated §5.4 in response to issue #8 (RELAY issue #8): ErrAlreadyExists is now a standalone RCP error, not mapped to any relay sentinel. - rcp_category()::equivalent(): remove already_exists → ErrClosed mapping - test_relay.cpp: add test asserting ErrAlreadyExists != all relay sentinels Also adds the standalone ErrAlreadyExists test (24 test cases / 55 assertions). Co-Authored-By: Claude Sonnet 4.6 Signed-off-by: Matt Jones <47545907+SoundMatt@users.noreply.github.com> --- include/rcp/rcp.hpp | 2 +- tests/test_relay.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/rcp/rcp.hpp b/include/rcp/rcp.hpp index c6ca0a7..1b9214b 100644 --- a/include/rcp/rcp.hpp +++ b/include/rcp/rcp.hpp @@ -102,7 +102,7 @@ inline const std::error_category& rcp_category() noexcept { case Errc::busy: return re == relay::Errc::timeout; case Errc::not_found: return re == relay::Errc::not_connected; case Errc::zone_mismatch: return re == relay::Errc::not_connected; - case Errc::already_exists: return re == relay::Errc::closed; // §5.3; see RELAY issue #8 + case Errc::already_exists: return false; // standalone per §5.4 (RELAY spec updated) default: return false; } } diff --git a/tests/test_relay.cpp b/tests/test_relay.cpp index dec1aeb..a8cb36c 100644 --- a/tests/test_relay.cpp +++ b/tests/test_relay.cpp @@ -78,6 +78,14 @@ TEST_CASE("relay: rcp::ErrZoneMismatch maps to relay::ErrNotConnected", "[relay] REQUIRE(rcp::ErrZoneMismatch == relay::ErrNotConnected); } +TEST_CASE("relay: rcp::ErrAlreadyExists is standalone (no relay sentinel)", "[relay][conformance]") { + // Per RELAY spec §5.4 update: ErrAlreadyExists is not a relay sentinel. + REQUIRE(rcp::ErrAlreadyExists != relay::ErrClosed); + REQUIRE(rcp::ErrAlreadyExists != relay::ErrNotConnected); + REQUIRE(rcp::ErrAlreadyExists != relay::ErrTimeout); + REQUIRE(rcp::ErrAlreadyExists != relay::ErrPayloadTooLarge); +} + // ── §18.2: Context aliased from relay::Context ─────────────────────────────── TEST_CASE("relay: rcp::Context is relay::Context", "[relay][conformance]") {