From 5bf117ae9208ef5e58bb878e6c82dca4fbc852dd Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Wed, 18 Nov 2026 16:20:25 -0800 Subject: [PATCH] quest: prove the session driver Sync within the default recursion limit Co-Authored-By: Claude Opus 5.5 --- quest/m1/driver-sync-depth.md | 47 +++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 quest/m1/driver-sync-depth.md diff --git a/quest/m1/driver-sync-depth.md b/quest/m1/driver-sync-depth.md new file mode 100644 index 0000000000..6abeeb3921 --- /dev/null +++ b/quest/m1/driver-sync-depth.md @@ -0,0 +1,47 @@ +# [S] Prove the session driver Sync, and moq-tokio's spawn Send, within the default recursion limit + +## Goal + +`moq_net::Driver: Send + Sync` and moq-tokio's spawned session future prove `Send` at +Rust's default recursion limit, so moq-tokio and any crate that needs `Driver: Sync`, such +as the moq-ffi facade rust2's exporter builds, compile with +`-D recursion_depth_exceeding_limit`. The lint warns today and becomes a hard error in a +later nightly ([rust-lang/rust#159228](https://github.com/rust-lang/rust/issues/159228)). +`just rs send-depth` checks both, so the overflow cannot return. Raising +`recursion_limit` is not a fix. + +## Plan + +Decided 2026-11-14 (maintainer, in +[kixel-ai/rust2#809](https://github.com/kixel-ai/rust2/pull/809)): ✅ wrap the lite +publisher's `kio::Tasks` so it proves `Send + Sync` once, as +[#8657](https://github.com/moq-dev/moq/pull/8657) did for the subscriber, and gate moq-tokio +and the facade under the lint (rejected: record the wait only; allow the lint for moq's +crates, which only defers the failure until a nightly makes it a hard error). + +Measured 2026-11-18 at `71c6209f` with rust2's `just ffi moq-cpp`, which denies the lint, on +the flake's pinned nightly: + +- moq-tokio overflows proving `Send` for the `Instrumented<...>` spawned at + `rs/moq-tokio/src/client.rs:703`, through `panic::isolate`, `kio::clock::drive`, and + `moq_net::time::run`. +- The facade overflows proving `moq_net::Driver: Sync`, through `driver::State`, + `Protocol`, `lite::session::Driver`, `lite::publisher::Publisher`, and its + `kio::Tasks` (`rs/moq-net/src/lite/publisher.rs:264`), into `ControlState` and + `RequestServe`. + +Both chains run through the session driver, so the publisher's proof likely fixes both; +check moq-tokio after it. `sh/rs/send-depth.sh` checks only moq-net's lib and its `send` +test, which proves downstream futures `Send` but never `Driver: Sync`: add that assertion +to the `send` test and check moq-tokio's lib in the same script. The script's nightly is +the flake's pin, so only a pin bump changes the compiler it checks. + +Recommended: prove `Send + Sync` at the narrowest type that cuts the chain, with an +`unsafe impl` only where a safe newtype cannot, and a `// SAFETY:` that names what the +wrapped state holds. Measure the gate's added time. + +This unblocks rust2's exporter moq pin bump +([kixel-ai/rust2's quest/m1/ffi-refusals/moq-pin.md](https://github.com/kixel-ai/rust2/blob/main/quest/m1/ffi-refusals/moq-pin.md)), +which waits on `just ffi moq-cpp` passing at moq's `main`. + +Public API: none. Wire: none.