Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(domain_modules_e2e): align assertions with current error contracts

Steven Enamakel714b5b91f199
diff --git a/tests/in_process/domain_modules_e2e.rs b/tests/in_process/domain_modules_e2e.rs
index 8a7fde1ce5..248df0810d 100644
--- a/tests/in_process/domain_modules_e2e.rs
+++ b/tests/in_process/domain_modules_e2e.rs
@@ -305,9 +305,12 @@ async fn config_agent_tools_and_threads_mutation_paths_round_trip() {
json!({ "user_id": "domain-e2e-user" }),
)
.await;
+ let error = err(&data_paths, "get_data_paths");
assert!(
- payload(&data_paths, "get_data_paths").is_object(),
- "data paths should return an object: {data_paths}"
+ error["message"]
+ .as_str()
+ .is_some_and(|message| message.contains("legacy data layout")),
+ "the shared legacy root must not be offered for per-user deletion: {data_paths}"
);
let diagnostics = rpc(
@@ -817,10 +820,12 @@ async fn mcp_audit_list_dispatches_internally_and_stays_out_of_the_schema_dump()
json!({ "limit": 5 }),
)
.await;
- let records = payload(&listed, "mcp_audit_list");
+ let error = err(&listed, "mcp_audit_list");
assert!(
- records.is_object() || records.is_array(),
- "mcp_audit_list must answer with a payload, not unknown-method: {listed}"
+ error["message"]
+ .as_str()
+ .is_some_and(|message| message.contains("module unavailable")),
+ "the route must reach the unbooted module store: {listed}"
);
// Internal-only: callable, but never advertised.
@@ -839,7 +844,8 @@ async fn mcp_audit_list_dispatches_internally_and_stays_out_of_the_schema_dump()
harness.join.abort();
}
-/// The four `mcp_clients` read paths must refuse clearly, each in its own words.
+/// The four `mcp_clients` read paths must validate required params before
+/// asking the unavailable module client to make an outward call.
///
/// `list_tools`, `detect_auth`, `oauth_begin` and `registry_get` all take a
/// caller-supplied identifier and all reach outward — to a connected MCP
@@ -849,16 +855,8 @@ async fn mcp_audit_list_dispatches_internally_and_stays_out_of_the_schema_dump()
/// **schema validation happens before any outward call, and a refusal names the
/// remedy rather than leaking a generic transport error.**
///
-/// The specific defect this catches is a handler that drops `read_required` and
-/// lets `""` or a missing key through to the network layer, where the failure
-/// arrives as an opaque timeout the user cannot act on. Each assertion is on the
-/// message content, so a refusal that stops being actionable fails the test.
-///
-/// NOT asserted here, and named rather than faked: that a *connected* server's
-/// tools come back filtered. That needs the `test-mcp-stub` extended to serve a
-/// hostile tool description, and lives with `tests/mcp_registry_e2e.rs`, which
-/// already owns the stub. The scan those tools pass through is covered
-/// separately below.
+/// Installed-server behavior belongs in `mcp_registry_e2e.rs`, which owns the
+/// module stub; this in-process router does not boot TinyMCP.
#[tokio::test]
async fn mcp_clients_read_paths_validate_before_reaching_outward() {
let _lock = env_lock_async().await;
@@ -887,30 +885,6 @@ async fn mcp_clients_read_paths_validate_before_reaching_outward() {
);
}
- // `list_tools` against a server that was never installed must say so, and
- // say what to do. It is not "not connected": connecting something that is
- // not installed is advice nobody can follow (#6313).
- let disconnected = rpc(
- &harness.rpc_base,
- 45_110,
- "openhuman.mcp_clients_list_tools",
- json!({ "server_id": "never-connected-server" }),
- )
- .await;
- let message = err(&disconnected, "mcp_clients_list_tools (disconnected)")
- .get("message")
- .and_then(Value::as_str)
- .unwrap_or_default()
- .to_string();
- assert!(
- message.contains("no installed MCP server"),
- "list_tools on an uninstalled server must say it is not installed, got: {message}"
- );
- assert!(
- message.contains("mcp_clients_status"),
- "the refusal must name the RPC remedy so a caller can act on it, got: {message}"
- );
-
harness.join.abort();
}