Repository navigation
fix(net): the session driver's Send and Sync proofs fit the default recursion limit - #9143
Conversation
Quest-Claim: dff27e3588d78aec
…ecursion limit The lite publisher's control children prove Send + Sync once in a SendCell, the driver proves Send once from its fields and is explicitly !Sync, and send-depth checks moq-tokio's spawn and the driver's Sync answer under the lint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…depth # Conflicts: # sh/rs/select.sh
There was a problem hiding this comment.
✅ No new issues found.
Approach: sound. It ends the recursion at the narrowest types: the lite publisher's task set proves its bounds once in a SendCell, Driver answers Sync with a definite no, and Driver proves Send once per field. Dropping the quest's "Send + Sync" goal is justified, because Driver was already !Sync: the ietf TaskSet holds BoxTask = Box<dyn FnMut(..) + Send>, with no Sync (rs/moq-net/src/util.rs:17).
Reviewed changes — the full diff at 67f90e4 across all 8 files.
Publisher::childrenin aSendCell: the same approach #8657 used for the subscriber.SendCell::default()still requireskio::Tasks<Control>: Send + Syncwhen the cell is built.SendCell: DerefMut: sound. A&mut Tcan only swap in another value of the sameT, and auto traits depend only on the type, so theunsafe impl Send/Syncreasoning still holds.Driveris!Syncon purpose: aPhantomData<Cell<()>>field. No public API change, sinceDriverwas neverSync.unsafe impl Send for Driver: backed by aconstblock that destructures every field and asserts each isSend. Adding a field, or changing one to a non-Sendtype, fails to build. This matches what the old whole-type assertion caught, andBoxablerequiresSend + Syncon every target, so nothing changes per platform.sendtest probes: an autoref-specialization probe checks thatDriveranswers no toSync, withSessionas a control that answers yes. Afn(Driver)coercion checksSend. Both compile under-D recursion_depth_exceeding_limitthroughsend-depth.sh's--test send.- Gate coverage:
send-depth.shnow also checksmoq-tokio --lib. That covers the spawn inconnect_session(rs/moq-tokio/src/client.rs:703), which is built with default features.select.shnow runs the gate on moq-tokio changes too, with a matching case inselect.test.py.
claude-opus-5-5 | 𝕏
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes: the one commit since the last review merges origin/main.
- Merged
origin/maininto the branch: the conflict insh/rs/select.shkeeps both gates. Thesend-depthline still runs on(moq-net|moq-tokio)changes, next to main's newwants libmoq→just rs c-tests --syntaxline.sh/rs/select.test.pyalso keeps the moq-tokiosend-depthassertion and main'stest_gate_compiles_c_callers_against_libmoq.
claude-opus-5-5 | 𝕏
moq's main now builds moq-tokio and the facade without tripping recursion_depth_exceeding_limit (moq-dev/moq#9143). Port every moq program and bench to its API: groups keyed by a start timestamp, origin routes in place of publications, inclusive time ranges, and libmoq in place of moq-c. Drop the stale excludes and exclude the six new refusals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Finishes quest/m1/driver-sync-depth.md.
Summary
On the flake's pinned nightly, under
-D recursion_depth_exceeding_limit, two things overflowed: asking whethermoq_net::DriverisSync(the moq-ffi exporter asks this through rustc'sis_syncquery), and moq-tokio's spawn ofpanic::isolate(time::run(driver))provingSend. Both now settle within the default limit:lite::publisher::Publisher::childrenis aSendCell<kio::Tasks<Control>>, as #8657 did for the subscriber.SendCellgainsDerefMut, which is sound because a&mutcan only put in another value of the sameT, whose bounds the constructor already checked.Driveris explicitly!Sync(aPhantomData<Cell<()>>field). It was neverSync: moq-transport'sTaskSetholdsBox<dyn FnMut + Send>children. The publisher cell alone still overflowed, and so did the marker alone. Together they settle.DriverprovesSendonce: anunsafe impl Sendbacked by a compile-time assertion that destructures every field, so adding a field without checking it fails to build. This cuts moq-tokio's chain (isolate,kio::clock::drive,time::run<Driver>).just rs send-depthalso checks moq-tokio's lib, and thesendtest assertsDriver: Sendand that theSynccheck answers no (an autoref-specialization probe, with aSessioncontrol that answers yes).sh/rs/select.shruns send-depth on moq-tokio changes too.Public API:
DriverstaysSendand!Sync, as before; it is now!Syncon purpose. Wire: none.Decisions
Made without the maintainer (away); a review can undo each:
Driveris!Sync, notSend + Sync. The quest asked to proveDriver: Send + Sync, butDriverhas never beenSync(the ietfTaskSet, see above), and the exporter only needs the question to settle, not a yes. A driver is polled only through&mut, soSyncgains nothing. Alternative: make the ietf task setSyncas well (aSyncWrapper-style cell forBoxTask), which adds unsafe code for no consumer.unsafe impl Send for Driverinstead of another cell, becauseStateis notSyncandSendCellrequires both. The exhaustive destructuring keeps it checked.assert Sync, since the answer is no.Validation
All on the flake's pinned nightly with
-D recursion_depth_exceeding_limit(the send-depth environment):a245f604: the newDriverprobe overflowed throughdriver::State,Protocol,lite::session::Driver,lite::publisher::Publisher, andkio::Tasks<Control>, andcargo check -p moq-tokio --liboverflowed atrs/moq-tokio/src/client.rs:703, matching the quest's measurement.State: Syncoverflows; without the!Syncmarker, theDriverprobe overflows; without theunsafe impl Send, moq-tokio overflows. With all three,just rs send-depthpasses.cargo test -p moq-net --features async --test sendpasses (5 tests),python3 sh/rs/select.test.pypasses, andjust checkpasses.just ffi moq-cppagainst this branch. Its remaining 19 export errors are fixed by rust2's own pin bump.Caused by
No single PR: the overflow is a new compiler lint (rust-lang/rust#159228) applied to session state that had grown deep over many PRs.
Follow-ups
None.
Models
Size: S
Implementer: Claude Code, claude-opus-5-5, medium effort (arm B)
(Written by Claude Opus 5.5 with medium)
Review
Rewritten by
quest reviewafter each round.Head: 979b919
Base: origin/main at b2372ad
Risk: medium,
the base has no RISK.md to name what is always high or customer-facing, so every change is mediumClassified: medium by default
Reviewer: Codex, gpt-6.1-sol, medium effort
Session:
01a1f1ba-d6aa-7132-b732-13142930b029, round 2Score: 9/10,
No actionable defects were found in the merge integration; the combined check selection preserves both branches' checks, though builds and tests were not run as instructed.Rounds: 2; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none