Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 16 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 6 additions & 2 deletions _context/wiki/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,18 @@ backends without recompiling a shared support tree for every feature file.
| `gateway/{tools,prompts,resources,subscriptions}.rs` | Active routed operations and exact routing failures. |
| `gateway/plugins.rs` | Gateway-owned CPEX ordering, mutation, denial, progress, and prompt seams using deterministic recording plugins. Resource coverage includes direct and aliased URIs, text/blob conversion, canonical pre-hook URIs, published-target rewrites, rejection of unpublished targets, metadata preservation, and pre/post denial. Concrete plugin behavior stays in each plugin crate. |
| `gateway/harness/` | Authentication, modern and compatibility clients, in-memory configuration, concrete mock backends, and owned server fixtures. |
| `gateway/future_contracts/` | Deferred fanout, pagination, TLS, completions, subscriptions, and cancellation contracts. |
| `gateway/future_contracts/` | Deferred fanout, pagination, TLS, completions, and subscriptions contracts. |

The active plugin suite verifies modern downstream cancellation reaches the
backend, including cancellation before the response stream starts. The regression
uses a three-second timeout so a cancellation deadlock fails promptly.

`TestServer` binds `127.0.0.1:0` before spawning, uses cooperative
cancellation, and has a `Drop` fallback. `GatewayFixture` owns the gateway and
all backend servers. Tests should request the minimum topology: one virtual host
and one backend by default, with extra backends declared explicitly by the case.

The workspace currently keeps 13 ignored tests: 11 library future contracts
The workspace currently keeps 12 ignored tests: 10 library future contracts
and two real-process Redis/binary E2E tests. Ignored tests are not dead tests:
keep them compiling, keep their intended assertions, give each a concrete
blocker reason, and list them with:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
mod completions;
mod pagination;
mod plugins;
mod prompts;
mod resource_templates;
mod subscriptions;
Expand Down

This file was deleted.

29 changes: 29 additions & 0 deletions crates/contextforge-data-plane-lib/tests/gateway/plugins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,35 @@ async fn post_hook_deny_drops_progress_notifications_without_failing_call() {
assert!(progress.lock().expect("progress lock poisoned").is_empty());
}

#[tokio::test]
async fn downstream_cancellation_is_relayed_to_backend() {
tokio::time::timeout(std::time::Duration::from_secs(3), assert_downstream_cancellation())
.await
.expect("downstream cancellation relay completes within three seconds");
}

async fn assert_downstream_cancellation() {
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 handle = service
.send_cancellable_request(
ClientRequest::CallToolRequest(Request::new(CallToolRequestParams::new("wait_for_cancellation"))),
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());
Expand Down