--- id: review-002-cov-deployment-knobs name: Coverage — with_ws_idle_timeout integration test, call_tool production dispatch, small dark arms (COV-11b/12) status: completed depends_on: [review-002-ws13-idle-progress] scope: moderate risk: low impact: component level: implementation tags: [infra, review-002, coverage, websocket, mcp] --- ## Description Review 002's deployment-knob coverage gaps — production code paths dark in **all** binaries: - **`with_ws_idle_timeout`** (`server/adapter.rs:228-242`): the WS-13 server-side knob is called by no test — a regression silently disables the idle timer on the default surface while tungstenite unit tests stay green. Add: integration test building via `HttpAdapter::new(...).with_ws_idle_timeout(Some(small))` → connect a WS client → assert server closes with 1001 ≈ at the knob; plus a `None` variant (session survives a long silence). NOTE: the progress-semantics change from review-002-ws13-idle-progress lands first — the 1001 assert must reflect final semantics (progress-based). - **`call_tool` production dispatch** (`to_mcp.rs:459-468`): all four tools + unknown-name are tested via `invoke_tool`, which **bypasses** `call_tool` — the rmcp-entered routing shell (what production runs) has never executed. Test: in `from_mcp_integration.rs`'s live-server harness, one client-side `peer.call_tool("search"|"batch"|"schema"| "call"|unknown)` round-trip through the real rmcp protocol. - **Small dark arms (COV-12)**, one test each: `to_mcp` missing-argument validation for `schema` (None args) and `batch` (empty/no calls) tools (:175, :221); `from_mcp` non-object tool arguments wrapped as `{"value": …}` (:405-408); `routes.rs` first- line-invalid-JSON `/publish` 400 (:263-266); `decoy.rs` directory→index.html resolution (:133-138); `openapi_spec.rs` array-of-`$ref` resolution (:428-433 — the arm the coverage pass initially mis-flagged; the *code is correct*, add the test) and `style: simple` + `explode: true` rejection (:561-566). ## Acceptance Criteria - [ ] Idle-knob integration test (Some(small) → 1001 per final semantics; None → survives) in ws_upgrade_session.rs - [ ] One rmcp-protocol `call_tool` round-trip test per tool + unknown (feature `mcp`) - [ ] Each small arm test lands (list above; skip any proven unreachable during implementation — document which and why) - [ ] `cargo llvm-cov --all-features` re-run: http_client.rs function %, adapter.rs 228-242, to_mcp.rs call_tool no longer dark - [ ] `cargo test --all-features`, `cargo clippy --all-features --all-targets -- -D warnings`, `cargo fmt --check` pass ## References - docs/reviews/002-post-remediation-review.md (Part G', COV-11b, COV-12) - src/server/adapter.rs:228-242, src/adapters/to_mcp.rs:459-468, tests/ws_upgrade_session.rs, tests/from_mcp_integration.rs - tasks/websocket/review-002-ws13-idle-progress.md (lands the semantics this asserts) - tasks/adapters/review-002-oai11-ref-memoization.md (owns the array-$ref behavior; this adds only its test if not already added there) ## Notes Sequence after ws13 (the idle-knob assert must match final semantics). The array-`$ref` test is coverage-only insurance — if review-002-oai11-ref-memoization already added it, check the box and skip. The from_mcp/`{"value": …}` wrap test goes in from_mcp_integration.rs (real wire behavior). ## Summary COV-11b/12 closed: rmcp production call_tool round-trip for all 4 gateway tools, mcp schema/batch dark arms, /publish first-line JSON arm (updated to 422), decoy index.html, array-$ref + style:simple-import-arm pins. COV-11b idle-knob already covered by ws13's tests. Test-only.