test(external-router): the MCP tests share their orchestrator and session set-up #4531
All Vouch review confidence checks passed
Residual risk 0.27 = Change Risk (0.51) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.51 · 468 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.368
Shallow Review Depth
shallow_review_depth
0.344
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #4531"
general
weight: 0.35
claude[bot]
What
The responses utils tests spelled out the same request thirteen times (one text input, no tools of its own), and eleven of them, with two tests of the tool loop, built the same orchestrator, filled its tool inventory by hand and opened the same session over it: a dozen lines each, identical modulo the tool names and the built-in route.
The MCP test support, which already held the orchestrator and the binding, gains the two steps after them, and the tests call them.
Tests only; no production code.
Changes
crates/external_router/src/openai/mcp/test_support.rs(cfg(test)):internal_orchestrator_serving(builtin, tools), the orchestrator frominternal_orchestratorwith each given tool in its inventory as a tool of the internal server, andinternal_session(&orchestrator), the session a request that names the internal server throughinternal_bindingopens over it; the module doc names the session.crates/external_router/src/openai/responses/utils.rs(tests):hello_request()replaces the ten plain request literals, and the three with fields of their own (tools, aconversationref) spread it; the eleven set-ups go through the two helpers (one test built the orchestrator without a tool and keepsinternal_orchestrator(None)); theMcpToolSessionandToolEntryimports go with the hand-written set-ups.crates/external_router/src/openai/mcp/tool_loop.rs(tests): the two internal-filter tests go through the same two helpers; the module's other sessions (overfunction_tool_session's bindings) stay as they are.test_tool, whose schemas differ (aqueryproperty in the utils tests, none in the tool loop's), andfunction_tool_sessionin the tool loop's tests builds a different orchestrator (a function tool, its own bindings).Test plan
cargo test -p smg-external-router --lib -- openai::responses::utils::tests openai::mcp::tool_loop::tests: 0 listed and passed on this head, 0 listed and passed on the base commit (the same names both sides).cargo clippy -p smg-external-router --lib --tests -- -D warningsandcargo +nightly fmt -p smg-external-router -- --check: clean.Owed
Nothing.
Release note
Internal: the external router's MCP tests build their orchestrator, tool inventory and session through the crate's test support instead of spelling the set-up out per test; no change in behaviour.
Numbers
| metric | before | after | setup |
|---|---|---|---|
| request literals spelled out in full in the responses utils tests | 13 | 0 |
grep -c 'input: ResponseInput::Text("hello".to_string())' crates/external_router/src/openai/responses/utils.rs, base commit (13) vs this head (1, the helper) || MCP sessions opened by hand in the two test modules | 13 | 0 |
grep -c 'vec!\[test_support::internal_binding()\]'overcrates/external_router/src/openai/responses/utils.rsandcrates/external_router/src/openai/mcp/tool_loop.rs, base commit (11 + 2) vs this head (0 + 0) || tool-inventory inserts written out in the two test modules | 14 | 0 |
grep -c 'insert_entry(ToolEntry::from_server_tool('over the same two files, base commit (11 + 3) vs this head (0 + 0; the helper's loop is the one left, in the test support) || identical ten-line-plus runs inside the crate's tests | 14 | 0 | the test-code shingle census (K=10) over
crates/external_router, base commit vs this head || tests under the two module filters | 0 passed | 0 passed |
cargo test -p smg-external-router --lib -- openai::responses::utils::tests openai::mcp::tool_loop::tests, base commit and this head || lines changed | 0 | 349 |
git diff --shortstatagainst the base commit: +107/-242, three files, tests only |