Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion quest/m1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ audit's receive-memory, priority, and lease bugs rank ahead of that reshape.
- [Stats groups as tracks](/quest/m1/stats-group-tracks.md) - one stable node broadcast per stats producer, with each group a produced track listed by TRACKS
- [No reused track names](/quest/m1/name-reuse.md) - no first-party publisher re-creates a finished track under its old name
- [Routing guide](/quest/m1/routing-guide.md) - concepts and practical outbound federation setup
- [Controlled time](/quest/m1/time/README.md) - every crate and package reads time through moq-clock or @moq/clock, with regression tests for the changed contracts
- [Receive pinning](/quest/m1/quic-receive-pinning.md) - tiny DATAGRAM or STREAM frames cannot pin moq-quic receive batches past the receive budgets
- [Priority requeue](/quest/m1/quic-priority-requeue.md) - raising a queued QUIC stream's priority moves it at once instead of after it next sends
- [Lease bookkeeping](/quest/m1/quic-lease-bookkeeping.md) - receive leases and the connection window keep exact books, and eviction stops scanning every stream
Expand Down
7 changes: 3 additions & 4 deletions quest/m1/binding-timestamps.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,9 @@ Decided 2026-10-20 (maintainer): the moq-c half lands on the
[generated C package](/quest/m1/c/README.md), not the frozen hand-written
ABI, so C users break once.

Wall and monotonic times stay `moq_clock::Wall` and `moq_clock::Instant`, not
media timestamps; keep the types distinct.

## Required

- [Generated C bindings](/quest/m1/c/README.md) - `moq_timestamp` reaches C through the generated package, so C users break once

## Related

- [Controlled time](/quest/m1/time/README.md) - wall and monotonic time, not media timestamps; keep the types distinct
7 changes: 2 additions & 5 deletions quest/m1/test-flakes-2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ Rules every child keeps:
slow, fix that.
- A paused clock auto-advances while the runtime idles, so it can fire a
timer before a real socket delivers. Where real sockets fight the paused
clock, make the timers mockable or move the test off real sockets.
clock, drive the timers with a `moq_clock::Manual` clock or the sim (every
crate's timers run on `moq-clock`), or move the test off real sockets.
- A mocked clock still flakes when the code jitters its timers with `rand`
(the draft-16 cancel race was a retry sweep jittered past a fixed settle
budget). Wait out the jitter's whole window, not a count of small steps.
Expand All @@ -44,7 +45,3 @@ Public API: none. Wire: none.
- [IETF22 fallback](/quest/m1/test-flakes-2/ietf22-fallback.md) - an IETF22 browser viewer follows a fallback within the media lane's bound, keeping its session and its audio
- [Interop timestamp gap](/quest/m1/test-flakes-2/interop-timestamp-gap.md) - `rust -> js-native-node` audio has no gap under load
- [Go reservation grant](/quest/m1/test-flakes-2/go-reservation-grant.md) - the Go reservation test waits for its grant

## Related

- [Controlled time](/quest/m1/time/README.md) - the systemic fix these rules ask for: every crate on a controlled clock
113 changes: 0 additions & 113 deletions quest/m1/time/README.md

This file was deleted.

9 changes: 6 additions & 3 deletions quest/m2/rs2ts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,12 @@ This supersedes the earlier generated-TypeScript-only decision, the absolute
no-regression gate, and the codec/model/session translation sequence. Keep
Rust async, kio, integer representations, and storage unless evidence calls
for a source change. A batched boundary is an optimization candidate, not a
reason to require a full sans-IO rewrite. Controlled time remains independently
useful; source-level `Instant` mappings depend on the chosen backend.
reason to require a full sans-IO rewrite.

The Rust and JS clocks (`moq-clock` and `@moq/clock`) must agree on origin and
units under either backend. WASM keeps Rust's time types; a source translator
chooses its `Instant` mapping with its backend. A JS `number` of nanoseconds is
exact for 104 days of uptime and only loses sub-microsecond precision after.

Decided with the maintainer on 2026-10-17
([#5838](https://github.com/moq-dev/moq/pull/5838)): the WASM binding is moq-ffi
Expand Down Expand Up @@ -79,4 +83,3 @@ any necessary breaks. Wire: no changes intended.
- [JS-only @moq/net](/quest/m2/rs2ts-js.md) - the eventual distribution uses no WASM runtime
- [rust2's TS translator](https://github.com/kixelated/rust2/blob/main/quest/m2/ts.md) - a parallel research track translating moq-net's codec through an own rustc driver
- [Browser media report](/quest/m2/rs2ts-browser-report.md) - broader media measurements after adoption
- [Controlled time](/quest/m1/time/README.md) - coherent Rust and JS clocks regardless of backend
7 changes: 1 addition & 6 deletions quest/m2/runtime-trait.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@ the sim: today `Cluster::new` and the auth decider `tokio::spawn`.

## Plan

Decided 2026-10-10: deferred until [controlled time](/quest/m1/time/README.md)
lands; time came first because it is what tests need. Decide in a planning
Time landed first, as `moq-clock`, because it is what tests need. Decide in a planning
pass whether I/O seams belong in the trait, given moq-quic's sans-IO core and
moq-sock already split I/O by runtime. The sim in `moq-clock` is its first
non-tokio implementation.

## Required

- [Controlled time](/quest/m1/time/README.md) - the time half this builds on
5 changes: 2 additions & 3 deletions quest/m2/sim-seed.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ replays bit-exact.

## Plan

Decided 2026-10-10: out of [controlled time](/quest/m1/time/README.md); with
controlled time a test advances past the largest jitter, so seeding only adds
exact replay. Production keeps its OS randomness.
Decided 2026-10-10: with controlled time a test advances past the largest
jitter, so seeding only adds exact replay. Production keeps its OS randomness.
28 changes: 22 additions & 6 deletions quest/m2/time-test-sweep.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,27 @@ workspace lint prevents new direct reads outside backends and measurements.

## Plan

The production and exported API migrations stay in m1. This follow-up owns
unrelated legacy test conversions, the workspace-wide lint ratchet, and the
final audit of harness exceptions. Real I/O synchronizes on events; only
watchdogs and performance measurements use wall time.
Production code and exported APIs already read time through `moq-clock` and
`@moq/clock`. This follow-up owns the legacy test conversions, the
workspace-wide lint ratchet, and the final audit of harness exceptions.

## Required
Decided with the m1 migrations, so this sweep doesn't reopen them:

- [Controlled time](/quest/m1/time/README.md) - the clocks and production migrations
- **Sim first.** A test with no real I/O runs on the `moq-clock` sim
(`#[moq_clock::test]`). One that cannot run there yet uses paused tokio,
whose clock `moq-clock` reads.
- **Real I/O syncs on events.** A test with sockets, browsers, codecs, or
hardware never uses paused tokio, which auto-advances to the next timer while
the OS event is still in flight. Wall time is allowed only for its watchdog
and explicit performance measurements.
- **The ratchet.** Today each crate's `clippy.toml` bans direct clock reads and
timers (`disallowed-methods`, `disallowed-types`), and tests opt out with
`expect(clippy::disallowed_methods)`; the biome `noRestrictedGlobals`
override skips `*.test.ts`. The sweep removes those opt-outs as it converts,
leaving only the backend modules.
- **Third-party std clocks.** An API that takes `std::time::Instant` (str0m,
srt-tokio, winit, qlog) converts with `Instant::into_std` and
`Instant::from_std`. Device threads outside any runtime keep
`std::thread::sleep` under a per-site `#[allow]`, since they have no ambient
clock (decided 2026-10-20 by the maintainer, in
[#6135](https://github.com/moq-dev/moq/pull/6135)).
22 changes: 22 additions & 0 deletions rs/qmux/clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
disallowed-methods = [
{ path = "std::time::Instant::now", reason = "read the ambient clock: moq_clock::now()" },
{ path = "std::time::Instant::elapsed", reason = "read the ambient clock: moq_clock::Instant::elapsed()" },
{ path = "std::time::SystemTime::now", reason = "read the ambient clock: moq_clock::wall()" },
{ path = "std::time::SystemTime::elapsed", reason = "wall time never measures elapsed time" },
{ path = "std::thread::sleep", reason = "sleep on the ambient clock: moq_clock::sleep()" },
{ path = "tokio::time::Instant::now", reason = "read the ambient clock: moq_clock::now()" },
{ path = "tokio::time::sleep", reason = "sleep on the ambient clock: moq_clock::sleep()" },
{ path = "tokio::time::sleep_until", reason = "sleep on the ambient clock: moq_clock::sleep_until()" },
{ path = "tokio::time::timeout", reason = "use the ambient clock: moq_clock::timeout()" },
{ path = "tokio::time::interval", reason = "use the ambient clock: moq_clock::interval()" },
{ path = "tokio::time::timeout_at", reason = "use deadlines from the ambient clock" },
{ path = "tokio::time::interval_at", reason = "tick on the ambient clock" },
]

disallowed-types = [
{ path = "std::time::SystemTime", reason = "use moq_clock::Wall" },
{ path = "std::time::Instant", reason = "use moq_clock::Instant" },
{ path = "tokio::time::Instant", reason = "use moq_clock::Instant" },
{ path = "tokio::time::Sleep", reason = "use moq_clock::Sleep" },
{ path = "tokio::time::Interval", reason = "use moq_clock::Interval" },
]
4 changes: 2 additions & 2 deletions rs/qmux/examples/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub fn payload(seed: usize) -> Vec<u8> {
/// Write all of `data` then the FIN, bounded by [`TIMEOUT`].
pub async fn send_all(send: &mut SendStream, data: &[u8], what: &str) -> anyhow::Result<()> {
let mut data = Bytes::copy_from_slice(data);
tokio::time::timeout(TIMEOUT, async {
moq_clock::timeout(TIMEOUT, async {
while !data.is_empty() {
send.write_buf(&mut data).await?;
}
Expand All @@ -47,7 +47,7 @@ pub async fn send_all(send: &mut SendStream, data: &[u8], what: &str) -> anyhow:
/// Read until the FIN, bounded by [`TIMEOUT`].
pub async fn recv_all(recv: &mut RecvStream, what: &str) -> anyhow::Result<Bytes> {
let mut buf = BytesMut::new();
tokio::time::timeout(TIMEOUT, async {
moq_clock::timeout(TIMEOUT, async {
while let Some(chunk) = recv.read_chunk(usize::MAX).await? {
buf.extend_from_slice(&chunk);
}
Expand Down
10 changes: 5 additions & 5 deletions rs/qmux/examples/interop-client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ async fn run(mut session: Session, version: Version) -> anyhow::Result<()> {
}

// Rust -> TypeScript.
let mut send = tokio::time::timeout(TIMEOUT, session.open_uni(SendOptions::default()))
let mut send = moq_clock::timeout(TIMEOUT, session.open_uni(SendOptions::default()))
.await
.context("timed out opening the client unidirectional stream")??;
send_all(&mut send, &payload(CLIENT_SEED), "the client flow-control payload").await?;

// TypeScript -> Rust. Server-initiated streams are the ids only a
// `Session::accept` session may mint; a client-role server would be rejected
// here rather than accepted.
let mut recv = tokio::time::timeout(TIMEOUT, session.accept_uni())
let mut recv = moq_clock::timeout(TIMEOUT, session.accept_uni())
.await
.context("timed out accepting the server unidirectional stream")??;
let received = recv_all(&mut recv, "the server flow-control payload").await?;
Expand All @@ -36,7 +36,7 @@ async fn run(mut session: Session, version: Version) -> anyhow::Result<()> {
}

// Exercise both halves of one bidirectional stream and FIN propagation.
let (mut send, mut recv) = tokio::time::timeout(TIMEOUT, session.open_bi(SendOptions::default()))
let (mut send, mut recv) = moq_clock::timeout(TIMEOUT, session.open_bi(SendOptions::default()))
.await
.context("timed out opening the bidirectional stream")??;
let request = format!("ping:{}", version.alpn());
Expand All @@ -49,7 +49,7 @@ async fn run(mut session: Session, version: Version) -> anyhow::Result<()> {
// DATAGRAM is available only on record-framed drafts (QMux01+).
if version.uses_records() {
session.send_datagram(Bytes::from_static(b"rust-datagram"), SendOptions::default())?;
let datagram = tokio::time::timeout(TIMEOUT, session.recv_datagram())
let datagram = moq_clock::timeout(TIMEOUT, session.recv_datagram())
.await
.context("timed out receiving the TypeScript datagram")??;
if datagram.as_ref() != b"typescript-datagram" {
Expand All @@ -59,7 +59,7 @@ async fn run(mut session: Session, version: Version) -> anyhow::Result<()> {
bail!("QMux00 unexpectedly negotiated datagram support");
}

let closed = tokio::time::timeout(TIMEOUT, session.closed())
let closed = moq_clock::timeout(TIMEOUT, session.closed())
.await
.context("timed out waiting for the TypeScript server to close")?;
match closed {
Expand Down
Loading
Loading