From 224d21cec9804f7b81edd087a1f40904f0da16a9 Mon Sep 17 00:00:00 2001 From: lucarlig Date: Fri, 11 Sep 2026 11:14:28 +0100 Subject: [PATCH] feat(dataplane): upgrade rmcp to 3.3.0 and add modern cancel relay test Signed-off-by: lucarlig --- Cargo.lock | 8 ++-- Cargo.toml | 2 +- .../tests/gateway/plugins.rs | 45 +++++++++++++++++++ 3 files changed, 50 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8f33b1f4..97934378 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2239,9 +2239,9 @@ dependencies = [ [[package]] name = "rmcp" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42b6914fac0be956fe704a38239c3f44a9f841d1b06a5713d2f638065593f5b5" +checksum = "b88db56b8ae316560e9e868b6b978ea940f27cb883323fc90e07435e44158f5c" dependencies = [ "async-trait", "base64 0.23.1", @@ -2273,9 +2273,9 @@ dependencies = [ [[package]] name = "rmcp-macros" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdf1c49bd4d52014b94db0877410db273c2008f01628b0252a2e9460ad9b7fda" +checksum = "873b730df6f0a9b74b13eb514e0dca4c2db0d8b68b74af98a2e9bf3f9d436585" dependencies = [ "darling", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index cd783c35..6c24d415 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ repository = "https://github.com/contextforge-org/contextforge-data-plane" # Keep dependencies here only when at least two workspace members inherit them. contextforge-data-plane-cpex = { path = "./crates/contextforge-data-plane-cpex" } contextforge-data-plane-apis = { path = "./crates/contextforge-data-plane-apis"} -rmcp = { version = "3.2.0", default-features = false, features = [ +rmcp = { version = "3.3.0", default-features = false, features = [ "server", "client", "transport-streamable-http-server", diff --git a/crates/contextforge-data-plane-lib/tests/gateway/plugins.rs b/crates/contextforge-data-plane-lib/tests/gateway/plugins.rs index c97cefc6..69bfe14f 100644 --- a/crates/contextforge-data-plane-lib/tests/gateway/plugins.rs +++ b/crates/contextforge-data-plane-lib/tests/gateway/plugins.rs @@ -611,6 +611,51 @@ async fn post_hook_deny_drops_progress_notifications_without_failing_call() { } #[tokio::test(flavor = "multi_thread", worker_threads = 1)] +#[ignore = "2026-07-28 protocol transition"] +async fn downstream_cancellation_is_relayed_to_backend() { + let gateway = start_gateway(TEST_USER_ID, true, Arc::new(CpexRuntimeRegistry::default())).await; + let service = gateway.connect(TEST_USER_ID).await; + + let request = CallToolRequestParams::new("wait_for_cancellation"); + let handle = service + .send_cancellable_request( + ClientRequest::CallToolRequest(Request::new(request)), + PeerRequestOptions::no_options(), + ) + .await + .expect("wait_for_cancellation request is sent"); + wait_for_event_count(&gateway.backend_state.calls, 1).await; + + handle.cancel(Some("client gave up".to_owned())).await.expect("cancellation is sent"); + wait_for_event_count(&gateway.backend_state.cancellations, 1).await; +} + +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +async fn modern_downstream_cancellation_is_relayed_to_backend() { + let gateway = start_gateway(TEST_USER_ID, true, Arc::new(CpexRuntimeRegistry::default())).await; + let service = crate::harness::connect_modern_client( + gateway.gateway_url(), + crate::harness::create_client(TEST_USER_ID), + crate::harness::modern_client_info(), + ) + .await; + + let request = CallToolRequestParams::new("wait_for_cancellation"); + let handle = service + .send_cancellable_request( + ClientRequest::CallToolRequest(Request::new(request)), + PeerRequestOptions::no_options(), + ) + .await + .expect("wait_for_cancellation request is sent"); + wait_for_event_count(&gateway.backend_state.calls, 1).await; + + handle.cancel(Some("client gave up".to_owned())).await.expect("cancellation is sent"); + wait_for_event_count(&gateway.backend_state.cancellations, 1).await; +} + +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] + async fn post_hook_can_return_raw_cmf_result_content() { let plugin = Arc::new(TestPlugin::new("post", vec![cmf_hook_names::TOOL_POST_INVOKE]).with_raw_post_rewrite()); let runtime = runtime_with_post(plugin).await;