From c803661cec70de2fa16c94f7a4daed255a39cde5 Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 9 Jun 2026 14:08:23 +1000 Subject: [PATCH] fix(gateway): register relay connection checker The platform-connected-checker invariant test requires every built-in Platform enum member to have either a generic token path or a bespoke entry in _PLATFORM_CONNECTED_CHECKERS. Platform.RELAY was added without one, so test_all_builtins_have_checker_or_generic_token_path failed. Relay dials OUT to a connector and is 'connected' once an endpoint URL is configured (extra['relay_url'] or extra['url']); the capability descriptor is negotiated at handshake time, so the URL is the only config-level signal in the experimental phase. Add the checker plus a synthetic-config case exercising its True path. --- gateway/config.py | 7 +++++++ tests/gateway/test_platform_connected_checkers.py | 2 ++ 2 files changed, 9 insertions(+) diff --git a/gateway/config.py b/gateway/config.py index eb92d833e23..0ebf23e12d0 100644 --- a/gateway/config.py +++ b/gateway/config.py @@ -493,6 +493,13 @@ _PLATFORM_CONNECTED_CHECKERS: dict[Platform, Callable[[PlatformConfig], bool]] = (cfg.extra.get("client_id") or os.getenv("DINGTALK_CLIENT_ID")) and (cfg.extra.get("client_secret") or os.getenv("DINGTALK_CLIENT_SECRET")) ), + # Relay dials OUT to a connector; it is "connected" once an endpoint URL is + # configured (extra["relay_url"] or extra["url"]). The capability descriptor + # is negotiated at handshake time, so the URL is the only config-level + # signal in the experimental phase. EXPERIMENTAL — may change. + Platform.RELAY: lambda cfg: bool( + cfg.extra.get("relay_url") or cfg.extra.get("url") + ), } diff --git a/tests/gateway/test_platform_connected_checkers.py b/tests/gateway/test_platform_connected_checkers.py index f7677a3a676..e53e0fa4cfc 100644 --- a/tests/gateway/test_platform_connected_checkers.py +++ b/tests/gateway/test_platform_connected_checkers.py @@ -98,6 +98,8 @@ def test_checker_returns_true_when_configured(platform, checker, monkeypatch): mock_config.extra = {"app_id": "app", "app_secret": "sec"} elif platform == Platform.DINGTALK: mock_config.extra = {"client_id": "id", "client_secret": "sec"} + elif platform == Platform.RELAY: + mock_config.extra = {"relay_url": "wss://connector.example/relay"} else: pytest.skip(f"No synthetic config defined for {platform.value}")