From 9fe57443d23439826543536c51a44c6df5a4bb6e Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Tue, 17 Nov 2026 13:59:51 +0100 Subject: [PATCH] docs: bring three upstream notes back in line with the code Three notes about upstream code had drifted from what they cite. DESIGN.md's sentence on what rmcp 3.9 changed in code this crate builds left out four changes: stateful session workers now follow config.cancellation_token (#1427), the in-band -32600 for a protocol-error frame survives a cancelled receive (#1370), and two Deserialize fixes in model.rs (#1405, #1383) that this server compiles and never runs. main.rs sets that token, so the note on it now says what #1427 does here, measured on the binary against a 3.8 lock: a stateful session dispatches nothing that completes after the signal, where it used to keep dispatching until the process exited, and an initialize still in its handler is answered 500. The exit code, the time to exit and the fate of a call already in flight do not change. The comment over the three serve_failure exclusions in mutants.toml said to drop them if rmcp starts constructing the variants. rmcp already constructs two of them, and since 3.9 this build reaches one on http. The exclusions rest on neither reaching serve_failure, and the comment now names what would change that. A test comment cited tokio 1.53 lines.rs:126-129 for the two trailing pops. In the locked 1.54 they are at lines 130 and 133. --- .cargo/mutants.toml | 9 ++++-- crates/bugwarden/tests/binary_tracing_caps.rs | 2 +- docs/DESIGN.md | 32 ++++++++++++++++--- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/.cargo/mutants.toml b/.cargo/mutants.toml index 2fbac63..b1a9dfd 100644 --- a/.cargo/mutants.toml +++ b/.cargo/mutants.toml @@ -53,8 +53,13 @@ minimum_test_timeout = 720 # InitializeResult, and ServiceExt::serve never cancels its token. Deleting # them is a no-op (the wildcard still compiles) so they survive every week # and the scheduled job emails a false gap. Reachable arms stay in scope -# (Some(frame), ConnectionClosed, InitializeFailed, TransportError). Drop -# these if rmcp starts constructing the variants. +# (Some(frame), ConnectionClosed, InitializeFailed, TransportError). rmcp +# does construct UnexpectedInitializeResponse and Cancelled, and since 3.9 +# an http session's handshake can end in Cancelled inside rmcp. Neither can +# reach serve_failure, which sees only the stdio handshake. Drop one when its +# premise goes: a construction site passing None, an initialize answer not +# mapped to InitializeResult, or a stdio serve whose token can fire +# during the handshake. # # Proven-equivalent mutants, 2026-10-11 campaign: each entry below was found # by a scheduled run, hand-proved behaviorally identical, and pinned by an diff --git a/crates/bugwarden/tests/binary_tracing_caps.rs b/crates/bugwarden/tests/binary_tracing_caps.rs index abf915b..7f1f490 100644 --- a/crates/bugwarden/tests/binary_tracing_caps.rs +++ b/crates/bugwarden/tests/binary_tracing_caps.rs @@ -494,7 +494,7 @@ fn longest_run(text: &str, probe: char) -> usize { /// /// "In any line's text" is the honest scope. `log` was assembled from /// tokio's `Lines`, which pops a trailing `\n` and then a trailing `\r` -/// (tokio 1.53 `io/util/lines.rs:126-129`), so a CR sitting immediately +/// (tokio 1.54 `io/util/lines.rs:130-133`), so a CR sitting immediately /// before a line end is gone before this function ever sees it. Both /// #275 rows put their CR in the middle of a value, where that blind /// spot does not reach. diff --git a/docs/DESIGN.md b/docs/DESIGN.md index 9e05b89..b6146a9 100644 --- a/docs/DESIGN.md +++ b/docs/DESIGN.md @@ -2885,12 +2885,22 @@ wired, `server.rs` and `main.rs` are the reference. none of which this crate's features build. 3.9 is the RUSTSEC-2026-0462 fix (unbounded Streamable HTTP client response buffering, now 16 MiB / 64 KiB caps): the client, auth and child-process parts it changes are - not built here either; the server parts it does build — discover-session + not built here either; of the server parts it does build, discover-session rejection, the serialize-contract `outputSchema` generator, media-type - matching, `Mcp-Param` rejection — change no served shape (full suite + matching and `Mcp-Param` rejection change no served shape (full suite green on a 3.9 lock with no test touched), the skills extension stays undeclared, and of the stamped notes below only the inline-version - flag's mechanism moved. 3.10 changes no code the shipped binary builds: + flag's mechanism moved. Built here as well: stateful session workers now + follow `config.cancellation_token` (#1427, + `transport/streamable_http_server/tower.rs`), which does change what a + client is served around a shutdown and which that suite cannot see, its + http shutdown rows asserting a clean exit and bugwarden's own log line; + the note on the token below has the measurements. The in-band `-32600` + for a protocol-error frame is queued, so a cancelled `receive` no longer + loses it (#1370, `transport/async_rw.rs`), a case no test here forces. + And two `Deserialize` fixes in `model.rs` (#1405, #1383) touch types + this server never deserializes. 3.10 changes no code the shipped binary + builds: its doc comments aside, it adds a `skills-fs` catalog behind a feature left off and fixes the client's `x-mcp-header` validation (#1428, `client-side-sse` — built into this crate's test targets by the @@ -3772,7 +3782,21 @@ wired, `server.rs` and `main.rs` are the reference. out. If a per-caller identity (#32) changes this calculus, revisit here and at the add_attachment row together. The `cancellation_token` is named so SIGINT and SIGTERM tear the live transport down with the process instead of - leaving it to outlive the shutdown. + leaving it to outlive the shutdown. Since rmcp 3.9 (#1427) that cancel + reaches each stateful session's worker too, which until then ran on a + token of its own: the serve loop stops at the signal, waits up to 2 s for + calls in flight, and rmcp then closes the session. Measured on the binary + against a 3.8 lock: the session dispatches nothing that completes after + the signal, where a 3.8 lock kept dispatching until the process exited; + such a request is answered an empty `200` during the wait and `404` + (`Session not found`) once the session is closed. An `initialize` still + inside its handler at the signal is answered `500`, where the handshake + used to complete. rmcp's own lines for this are `task cancelled` and + `serve finished quit_reason=Cancelled` at INFO, a WARN when the wait runs + out, and two ERROR lines beside that `500`. The same on both locks in + every case measured: the exit code, the time to exit, the fate of a + session call in flight at the signal (no reply, the same audit record), + and the handshake-free path. An operator who does know the authorities their deployment answers to names them with a repeated `--allowed-hosts`, or with `MCP_ALLOWED_HOSTS` as one