Skip to content

test(moq-tokio,moq-relay): the relay, Client, and Server over QUIC on the sim - #8709

Merged
kixelated merged 4 commits into
mainfrom
quest/m1/quic-sim
Nov 14, 2026
Merged

kixelated merged 4 commits into
mainfrom
quest/m1/quic-sim

Conversation

@kixelated

@kixelated kixelated commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Finishes quest/m1/quic-sim.md.

Problem

MoQ sessions already ran over moq-quic on the kio::clock sim, but only on the raw driver. moq-tokio's Client and Server always bound a UDP socket, so the relay, the Happy Eyeballs race, WebTransport, and the reconnect loop could only be tested over real sockets and the host clock, or over the in-memory transport, which skips QUIC.

Approach

  • quic::driver::sim::Host is one IP on the sim Network. Host::bind binds a port on it, or the next free ephemeral port for 0 (it fails with AddrInUse instead of panicking), and draws the endpoint's rng_seed from the network's seed, so endpoints replay with the network.
  • client::Config::sim and server::Config::sim (under sim + quic) bind the QUIC endpoint on that host at the configured bind port. The client backend keeps a Bind (UDP address or sim host), so fresh_port redials on the sim too. The relay gets cluster::Options::sim for its peer dials.
  • A simulated client fails loudly rather than leaking out to real I/O: it dials only https, moqt, and moql (new Error::SimScheme). It skips the WebSocket fallback race, and it refuses a hostname that would need getaddrinfo unless the addresses are pinned (new quic::Error::SimResolve).
  • The session-level spawns go through runtime::Spawner instead of tokio: server::Request::ok, Server::serve's per-session task, origin::spawn_config, qmux drivers, and connect_session. They land on the simulator when one runs. The TCP/Unix accept loops keep tokio because they need its sockets.
  • Tests:
    • rs/moq-tokio/tests/integration/sim_client.rs: raw QUIC and WebTransport over a lossy, reordering path. Happy Eyeballs across two pinned addresses, where the first path's handshake takes seconds and the second wins after the race delay. A server restart on the same address, which the reconnect loop redials.
    • rs/moq-relay/tests/integration/quic_sim.rs: publisher → relay → subscriber, and publisher → relay A ← relay B (cluster peer over QUIC) → subscriber, every hop lossy.

Decisions

  • How Client and Server take a simulated QUIC socket. Taken by the agent under /quest-afk, for the maintainer's review: a sim: Option<quic::driver::sim::Host> field on client::Config and server::Config (and cluster::Options::sim in the relay), with the port still coming from the bind config. Rejected options:
    • (a) Extending Client::with_network to carry the QUIC network. It routes dials around the transports entirely, and it has no server half.
    • (b) A with_socket(driver::endpoint::Socket) on each. One socket can't serve fresh_port's redials or the relay's per-peer clients.
    • (c) Dropping the quest because the memory network covers hops. That network skips the QUIC accept path, ALPN, WebTransport, the address race, and QUIC closes. It also contradicts the 2026-11-13 move to m1 as the base for fault schedules.
  • A simulated client refuses non-QUIC schemes and unpinned hostnames instead of silently opening real sockets or resolving through the host (per "fail loud").
  • moq-dev/moq#8637 (backlog audit) edited this quest's file and moved quic-realtime to quest/m4/quic-realtime.md. The merge of main keeps the file deleted and drops the moved quest's Related link to it.

Impact

  • moq-tokio, sim feature only (test support, documented as tracking internals): new quic::driver::sim::Host, Network::host, client::Config::sim, server::Config::sim, Error::SimScheme, quic::Error::SimResolve. Not breaking: the config structs are #[non_exhaustive].
  • moq-relay, test-support + quic: new cluster::Options::sim.
  • Behavior: inside kio::clock::sim::run, origin::spawn, accepted sessions' drivers, and qmux/connect_with drivers now run on the simulator instead of tokio. Outside the sim, nothing changes.
  • Wire: none.

Validation

  • cargo test -p moq-tokio --test integration sim: 7 passed (the 3 new tests plus the 4 existing driver tests).
  • cargo test -p moq-relay --features test-support --test integration quic_sim: 2 passed, in 1.6 s.
  • Second check, by mutation: setting the relay test paths to 100% loss fails both relay tests, so the traffic really crosses the impaired sim paths and doesn't bypass them. The reconnect test first failed on a cert mismatch: the restarted server generated a new identity, and the log showed the redials over QUIC being refused. That confirms it exercises the real QUIC reconnect path. It now reuses one tls::Serve.
  • just check passes: 7625 tests run, all passed. The merge gate grows by about 2 s of sim tests.

Alternatives

See Decisions.

Follow-ups

None.

Models

Size: M
Implementer: Claude Code, claude-opus-5-5, unknown effort
Implementer: Claude Code, claude-opus-5-5, low effort (iterate, M)

🤖 Generated with Claude Code

(Written by Claude Opus 5.5)

Review

Rewritten by quest review after each round.

  • Head: 85442c1

  • Base: origin/main at a6ba6aa

  • Reviewer: Codex, gpt-6.1-sol, high effort

  • Session: 01a1d864-34ee-7550-a009-b0c8af5d0e60, round 2

  • Score: 10/10, The only new branch change moves documentation onto the correct function, introduces no behavioral changes, and leaves no actionable findings; builds and tests were not run as instructed.

  • Rounds: 2; findings 0: fixed 0, refuted 0, open 0

  • Findings: none

kixelated and others added 2 commits November 13, 2026 19:44
Quest-Claim: c0c5637117125976
… the sim

A `quic::driver::sim::Host` is one address on the sim `Network`.
`client::Config::sim`, `server::Config::sim`, and `cluster::Options::sim`
bind QUIC endpoints there instead of on UDP sockets, fresh-port redials
included, with each endpoint's seed drawn from the network. A simulated
client dials only QUIC and refuses names it would have to resolve.
Session-level spawns go through `runtime::Spawner`, so they land on the
simulator when one runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title The relay over QUIC on the sim test(moq-tokio,moq-relay): the relay, Client, and Server over QUIC on the sim Nov 14, 2026
@kixelated
kixelated marked this pull request as ready for review November 14, 2026 04:52

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one misplaced doc comment inline.

Reviewed changes

Reviewed the full diff: Client, Server, and the relay can now bind their QUIC endpoint on a simulated host, and the session-level spawns now run on the simulator.

  • quic::driver::sim::Host — one IP on a sim Network. Binding a port it already holds returns AddrInUse, port 0 picks the next free ephemeral port, and each endpoint's rng_seed comes from the network's seed.
  • client::Config::sim / server::Config::sim — the backend Client keeps a Bind enum, so fresh_port redials on the sim as well. The server's sim path skips the UDP and reuseport member binding.
  • Fail-loud guards — a simulated client refuses non-QUIC schemes (Error::SimScheme), skips the WebSocket race, and refuses unpinned hostnames (quic::Error::SimResolve). IP literals under moqt:// still pass, because the IpAddr parse covers the opaque Host::Domain case.
  • Spawns through runtime::Spawner::current() — Request::ok, Server::serve, origin::spawn_config, spawn_qmux, and connect_session. Outside the sim they keep the same fallback-runtime behavior. connect_session used a bare tokio::spawn before, so it no longer panics outside a runtime.
  • Relay cluster::Options::sim — passed into each peer's client::Config.
  • Tests — sim_client.rs covers raw QUIC and WebTransport over a lossy path, the Happy Eyeballs race, and reconnect after a restart. quic_sim.rs covers one relay and two clustered relays.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using claude-opus-5-5 | 𝕏

Comment thread rs/moq-tokio/src/client.rs Resolved
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 25 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6b925cb4-d767-4c28-a4ae-d583e80743ae
Commits

Reviewing files that changed from the base of the PR and between 92f469b and 85442c1.

Files selected for processing: 21

  • quest/m1/README.md
  • quest/m1/quic-sim-rules.md
  • quest/m1/quic-sim.md
  • quest/m4/cluster-fault-schedules.md
  • quest/m4/quic-realtime.md
  • quest/m4/quic-sim-mtu.md
  • quest/m5/bench-transport-sweep.md
  • rs/moq-relay/Cargo.toml
  • rs/moq-relay/src/cluster.rs
  • rs/moq-relay/tests/integration/main.rs
  • rs/moq-relay/tests/integration/quic_sim.rs
  • rs/moq-tokio/Cargo.toml
  • rs/moq-tokio/src/client.rs
  • rs/moq-tokio/src/error.rs
  • rs/moq-tokio/src/lib.rs
  • rs/moq-tokio/src/origin.rs
  • rs/moq-tokio/src/quic/backend.rs
  • rs/moq-tokio/src/quic/driver/sim.rs
  • rs/moq-tokio/src/server.rs
  • rs/moq-tokio/tests/integration/main.rs
  • rs/moq-tokio/tests/integration/sim_client.rs

No actionable comments were generated in the recent review.

Walkthrough

The change adds simulated QUIC host binding and configuration support in moq-tokio and moq-relay. It adds integration tests for simulated client connections, relay delivery, impaired paths, connection racing, and reconnects. Driver spawning now uses the current runtime spawner in several paths. Quest documents are updated to reflect the harness and remove links to the deleted simulation plan.

Merge Risk: Minimal · previous review 92f46

This PR adds simulated QUIC support and integration tests for the moq-tokio client and server and for the relay, and updates quest documents. Behavior outside the simulator is stated to be unchanged. No merge-blocking risk was identified, though the test results were not independently verified here.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the change: tests for the moq-tokio Client and Server and the moq-relay over QUIC on the kio simulator. The changeset adds sim hosts, sim config fields, and integration tests that matc…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The PR description is specific and on-topic. It explains the simulated QUIC host added to moq-tokio's Client and Server, the sim-based cluster peers in moq-relay, the fail-loud behavior for simulated …
Full details: Title check

Explanation

The title names the change: tests for the moq-tokio Client and Server and the moq-relay over QUIC on the kio simulator. The changeset adds sim hosts, sim config fields, and integration tests that match this. The title is specific and describes the main change.

Full details: Description check

Explanation

The PR description is specific and on-topic. It explains the simulated QUIC host added to moq-tokio's Client and Server, the sim-based cluster peers in moq-relay, the fail-loud behavior for simulated clients, the spawn routing through runtime::Spawner, the new integration tests, and the validation results. It matches the changeset in the raw summary and the PR objectives.

Finishing Touches

Simplify code

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 68124017-55eb-4efc-b9a9-5dadd8d646af
Commits

Reviewing files that changed from the base of the PR and between 6f2f3ff and 92f469b.

Files selected for processing: 21

  • quest/m1/README.md
  • quest/m1/quic-sim-rules.md
  • quest/m1/quic-sim.md
  • quest/m3/quic-realtime/README.md
  • quest/m4/bench-transport-sweep.md
  • quest/m4/cluster-fault-schedules.md
  • quest/m4/quic-sim-mtu.md
  • rs/moq-relay/Cargo.toml
  • rs/moq-relay/src/cluster.rs
  • rs/moq-relay/tests/integration/main.rs
  • rs/moq-relay/tests/integration/quic_sim.rs
  • rs/moq-tokio/Cargo.toml
  • rs/moq-tokio/src/client.rs
  • rs/moq-tokio/src/error.rs
  • rs/moq-tokio/src/lib.rs
  • rs/moq-tokio/src/origin.rs
  • rs/moq-tokio/src/quic/backend.rs
  • rs/moq-tokio/src/quic/driver/sim.rs
  • rs/moq-tokio/src/server.rs
  • rs/moq-tokio/tests/integration/main.rs
  • rs/moq-tokio/tests/integration/sim_client.rs
Files with no reviewable changes: 4

  • quest/m1/quic-sim.md
  • quest/m3/quic-realtime/README.md
  • quest/m4/bench-transport-sweep.md
  • quest/m4/quic-sim-mtu.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

kixelated and others added 2 commits November 14, 2026 09:27
# Conflicts:
#	quest/m1/quic-sim.md
#	quest/m4/quic-realtime.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This run reviewed the two commits added since the prior Pullfrog review at 92f469b.

  • Moved race_error's doc comment — simulated_scheme and its doc now sit above race_error's doc, so each function keeps its own rustdoc. This addresses the earlier finding.
  • Merged origin/main — the PR's own diff changed only in the quest files: the dropped Related links now point at the relocated quest/m4/quic-realtime.md and quest/m5/bench-transport-sweep.md. The Rust code in the PR is unchanged by the merge.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@kixelated
kixelated added this pull request to the merge queue Nov 14, 2026
Merged via the queue into main with commit b6ed6ff Nov 14, 2026
5 checks passed
@kixelated
kixelated deleted the quest/m1/quic-sim branch November 14, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant