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 @@ -157,7 +157,6 @@ audit's receive-memory, priority, and lease bugs rank ahead of that reshape.
- [IETF lazy discovery](/quest/m1/ietf-lazy-discovery.md) - moq-transport sessions ask for announcements only under watched prefixes, starting with UNSUBSCRIBE_NAMESPACE on d14/15
- [Interop coverage](/quest/m1/interop-coverage/README.md) - the riskiest moq-transport features moq-net exposes get cross-implementation tests over the even drafts 14 to 22
- [One Annex-B exporter](/quest/m1/annexb-export.md) - H.264 and H.265 Annex-B export share one private lifecycle, which also follows a rebound rendition
- [Simplification audit](/quest/m1/audit-simplify.md) - repeat the simplification audit, starting with the m0 leftovers, before the next major release
- [Caption store bounds](/quest/m1/caption-store-bounds.md) - a hostile caption track cannot grow a viewer's cue and region store or its per-frame work without bound
- [Peers advertise their implementation and version](/quest/m1/peer-version.md) - moq-net and `@moq/net` send a `name/version` SETUP parameter both ways, and the auth request and session span carry the client's
- [Binding peer version](/quest/m1/binding-peer-version.md) - every binding names itself ahead of the Rust core in that parameter
Expand Down
89 changes: 0 additions & 89 deletions quest/m1/audit-simplify.md

This file was deleted.

2 changes: 2 additions & 0 deletions quest/m2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ lite-07; bitrate enforcement is not part of this release.
- [Rust releases publish through OIDC](/quest/m2/release-rs-oidc.md) - release-plz publishes with trusted publishing and `CARGO_REGISTRY_TOKEN` is revoked
- [Go module proxy](/quest/m2/go-module-proxy.md) - `moq.dev/moq-ffi` ships from a static GOPROXY we host, so its staticlibs stop growing git history by ~61 MiB per release
- [Go per-platform lib modules](/quest/m2/go-ffi-platform-modules.md) - a Go build downloads only the host's staticlib, and `go mod vendor` works
- [Go cancelled results](/quest/m2/go-cancelled-result.md) - a Go call cancelled as it completes destroys the handle it produced instead of leaving it to the finalizer
- [Dart on iOS](/quest/m2/dart-ios.md) - prove the shipped iOS native asset actually loads on a device, which no CI can
- [Mobile completion](/quest/m2/mobile-completion.md) - verify the Swift and Kotlin bindings over Rust-owned capture
- [Browser publishing paths under test](/quest/m2/publish-firefox.md) - the media harness publishes from Firefox too, covering the worker capture and video-element fallback Chromium never takes
Expand Down Expand Up @@ -220,6 +221,7 @@ lite-07; bitrate enforcement is not part of this release.
- [Quest tree audit](/quest/m2/audit-quests.md) - repeat the whole-tree audit after the release ships, against the m1 baseline
- [CI workflow audit](/quest/m2/audit-ci.md) - repeat the per-workflow and per-job review after the release ships, against the m1 baselines
- [Performance audit](/quest/m2/audit-perf.md) - benchmarks that regressed since the m1 run are explained, fixed, or planned, and unbenched hot paths get coverage
- [Simplification audit](/quest/m2/audit-simplify.md) - repeat the simplification audit, starting with the m1 leftovers, after the release ships
- [Upstream unknown-env option in usage-rs](/quest/m2/usage-unknown-env.md) - jdx/usage refuses unknown prefixed env vars, replacing the moq-tokio helper
- [Artifact size audit](/quest/m2/audit-size.md) - repeat the shipping, native, WASM and browser attribution after the release ships
- [Compile time audit](/quest/m2/audit-compile-time.md) - build-time hotspots are measured against the m1 baselines, starting with the transport share now that moq-net compiles once, and the worst are fixed or planned
107 changes: 107 additions & 0 deletions quest/m2/audit-simplify.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# [M] Simplification audit

## Goal

The code and APIs that cost the most complexity for what they deliver are
simplified: duplicate mechanisms merged, layers, options, and generics with
one user collapsed, and features that don't earn their keep narrowed or
removed. The result is net simpler, even where that means less scope.

## Plan

Recurs once per major release (decided 2026-10-19). The PR that finishes
this run also adds the next one with the same file name at the end of the next
milestone's `Required` (m0 to m1, m1 to m2). The successor keeps the Goal
and this paragraph; the rest of its Plan is rewritten with what this run
learned: baselines, results, and what to check first. A successor placed in m2
also lists the [release cut](/quest/m2/release/cut.md) under `Required`, so it
waits for the release in flight to ship. Only `/quest-delete` ends the
recurrence. Fixes land in the run's PR, one commit each, rather than as follow-ups.
Only a change that needs a maintainer decision (public API, scope) or is
independently landable and too large to review alongside the rest becomes a
follow-up through `/quest-plan`.

Narrowing a feature or reshaping an API is the maintainer's call, so those
are proposals with a recommendation, filed as follow-ups. Unlike the [dead
code audit](/quest/m2/audit-dead-code.md), this targets code that is used but
overbuilt.

### Check first

The m1 run (2026-10-23) ran while about 150 PRs were open, touching every
moq-net session module, the bindings, moq-tokio, moq-relay, and moq-cli, so it
skipped those. Still open from m0, unchanged because open work kept editing
the same code:

- `ietf/session.rs` `start()` builds both halves twice across the draft arms,
and the IETF publisher/subscriber constructors drifted from lite's config
structs.
- Lite and IETF `GroupServe` share their open, flush, and FIN-settle driver.
- `ietf/adapter.rs` reimplements `kio::Queue`; keep a drop guard for the
writer.
- Python's `connect` forwards every `Client` parameter, still about a dozen
after the [wrapper config](https://github.com/moq-dev/moq/pull/6507) nesting.
Binding `connect = Client` keeps the call signature, so it needs no
decision. Expect the wrappers' other forwarding layers to have changed too.

New from m1:

- The codec importers (H.264, H.265, AV1, VP8, VP9, AAC, Opus, MP3, FLAC, and
legacy) each forward `demand`, `flush`, `finish`, `abort`, `cut`,
`discontinuity`, and `seek` to their container producer. Dropping the
forwards means exposing a shared track handle, which is an API proposal. The
audio and video producers differ in their config type, so check the
handle can be one type before proposing it.
- moq-mux's H.264 and H.265 `Import` and `Split` share their shape but differ
in SEI scanning, open-GOP recovery points, and error variants. A generic
version needed enough hooks that it was left alone; recheck it if those
converge.

Proposals from m0 are settled. The moq-video raw-frame publisher and the
shared `Background` would each have had moq-ffi as their only user once the
[generated C bindings](/quest/m1/c/README.md) retire moq-c's hand-written
copies, so both were dropped. The Go wrapper's missing `bridge.CallHandle` is
in the generated binding, not the wrapper: see
[Go cancelled results](/quest/m2/go-cancelled-result.md).

### Results (m1, 2026-10-23)

One PR, private and behavior-preserving: moq-mux's `import::Track` and
`TrackStream` expand their codec arms through one macro each, and nine
importers lost a deleted method's doc left on `cut`. The H.264 and H.265
exporters were already planned as [one Annex-B exporter](/quest/m1/annexb-export.md),
ordered after the rendition rebind, so this run left them alone. Search the
quest tree before fixing a duplicate: the 2026-10-22 refactor audit filed
several.

### Kept on purpose

- Backend and playback traits have several implementations or device-free
test doubles; catalog traits erase application extension types.
- The ietf publisher's `RequestWaker` and lite's `FetchWake` stay apart from
the queue-once waker: one collects into a list and wakes an owner, the
other fills a set.
- js/net's subscriber grant checks stay hand-written: `auth_gate.ts` `Gate`
only checks publish grants, and a direction flag costs what it saves.
- The JS datagram send and receive loops: the lite and IETF error handling
and `served` bookkeeping differ, so a shared loop needs hooks.
- Dart and C++ wrappers are already thin. The Swift wrapper's forwarding
classes stay classes, for argument labels and unprefixed names.
- Kotlin's `AnnounceConsumer.updates()` cancels on every completion, as its
doc promises.
- The `until_wanted` loop copied into moq-audio, moq-boy, moq-video, and
moq-transcode is one line over `Demand::wanted_changed`. A helper on
`Demand` would be a second way to wait for the one demand signal.
- js/net's lite version gates mirror Rust's on purpose, and its per-message
IETF error classes are distinct wire messages.

Transport adapter deduplication and compression removal have dedicated work;
avoid a second design here. Start with the items above, then the largest
modules again, and the bindings' forwarding layers. The largest moq-net
modules at the end of m1: `ietf/publisher.rs` 17,182 lines,
`ietf/subscriber.rs` 17,066, `model/origin.rs` 13,036, `lite/publisher.rs`
8,508, and `lite/subscriber.rs` 7,839. The three m0 named all grew.

## Required

- [Release cut](/quest/m2/release/cut.md) - wait for the release in flight to ship
43 changes: 43 additions & 0 deletions quest/m2/go-cancelled-result.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# [S] Go cancelled results

## Goal

A Go call whose context is cancelled just as the native call completes
destroys the handle it produced right away, instead of leaving it live until
the garbage collector runs its finalizer. The case that matters is
`Server.Accept`: today the incoming session it accepted sits unanswered until
GC, and the same goes for subscriptions, fetches, resolves, and broadcast
requests the caller gave up on.

## Plan

Found in the m1 simplification audit (2026-10-23) and checked against the
generated binding. The cause is in `uniffiRustCallAsync`, which
`kixelated/uniffi-bindgen-go` generates. When ctx is cancelled, it cancels
the Rust future and waits for it. If the future had already completed, the
result is lifted into a Go object anyway, then dropped behind
`ctx.Err()`. The object has a finalizer, so it is reclaimed eventually but
not promptly.

The wrapper cannot close this. `bridge.CallHandle` releases a late handle
only when the call has its own `cancel` (as `Request.Accept` does), because
it then gives the binding a context that never cancels. These calls have no
such `cancel`, so the Rust future would keep running after the caller
leaves. For `Server.Accept` that future would take the next incoming
request, which the release then destroys: a real connection lost. With a nil
`cancel`, `CallHandle` passes ctx through, so `Auth.Add` leaks the same way.

Fix it in the generator: when the call was cancelled, run the result type's
destroyer instead of returning nothing. The generator already emits a
destroyer per type, including records and optionals that hold objects. Then
the wrapper's direct ctx calls (`Server.Accept`, `SubscribeTrack`,
`FetchGroup`, `Resolve`, `RequestBroadcast`) and `Auth.Add` are correct as
they are. A binding that destroys the result returns `ctx.Err()`, which
`run` never releases, so nothing is destroyed twice. Check
whether `bridge.CallHandle` still covers anything once the binding releases
these results itself. If the
[generator hard fork](/quest/m2/uniffi-fork.md) has landed, the change goes
there; otherwise into the current fork, with a pin bump.

Test it with a cancelled context racing a call that completes at once, and
count live native handles rather than waiting on GC.
2 changes: 0 additions & 2 deletions rs/moq-mux/src/codec/aac/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ impl Import {
self.track.abort(err);
}

/// Publish what the track measured (bitrate, jitter) into the catalog rendition, filling only
/// the fields its config didn't supply.
/// Record the media duration emitted together by the TS importer.
pub(crate) fn burst(&mut self, duration: std::time::Duration) -> crate::Result<()> {
self.track.burst(duration)
Expand Down
2 changes: 0 additions & 2 deletions rs/moq-mux/src/codec/av1/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,6 @@ impl Import {
self.track.abort(err);
}

/// Publish what the track measured (bitrate, jitter) into the catalog rendition, filling only
/// the fields its config didn't supply.
/// Cut the current group at `end` without finishing the track.
pub fn cut(&mut self, end: Option<moq_net::Timestamp>) -> Result<()> {
self.track.cut(end)?;
Expand Down
2 changes: 0 additions & 2 deletions rs/moq-mux/src/codec/flac/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ impl Import {
self.track.abort(err);
}

/// Publish what the track measured (bitrate, jitter) into the catalog rendition, filling only
/// the fields its config didn't supply.
/// Cut the current group at `end` without finishing the track.
pub fn cut(&mut self, end: Option<moq_net::Timestamp>) -> crate::Result<()> {
self.track.cut(end)?;
Expand Down
2 changes: 0 additions & 2 deletions rs/moq-mux/src/codec/h265/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ impl Import {
self.track.abort(err);
}

/// Publish what the track measured (bitrate, jitter) into the catalog rendition, filling only
/// the fields its config didn't supply.
/// Cut the current group at `end` without finishing the track.
pub fn cut(&mut self, end: Option<moq_net::Timestamp>) -> Result<()> {
self.track.cut(end)?;
Expand Down
2 changes: 0 additions & 2 deletions rs/moq-mux/src/codec/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,6 @@ impl Import {
self.track.abort(err);
}

/// Publish what the track measured (bitrate, jitter) into the catalog rendition, filling only
/// the fields its config didn't supply.
/// Cut the current group at `end` without finishing the track.
pub fn cut(&mut self, end: Option<moq_net::Timestamp>) -> crate::Result<()> {
self.track.cut(end)?;
Expand Down
2 changes: 0 additions & 2 deletions rs/moq-mux/src/codec/mp3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,6 @@ impl Import {
self.track.abort(err);
}

/// Publish what the track measured (bitrate, jitter) into the catalog rendition, filling only
/// the fields its config didn't supply.
/// Cut the current group at `end` without finishing the track.
pub fn cut(&mut self, end: Option<moq_net::Timestamp>) -> crate::Result<()> {
self.track.cut(end)?;
Expand Down
2 changes: 0 additions & 2 deletions rs/moq-mux/src/codec/opus/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ impl Import {
self.track.abort(err);
}

/// Publish what the track measured (bitrate, jitter) into the catalog rendition, filling only
/// the fields its config didn't supply.
/// Cut the current group at `end` without finishing the track.
pub fn cut(&mut self, end: Option<moq_net::Timestamp>) -> crate::Result<()> {
self.track.cut(end)?;
Expand Down
2 changes: 0 additions & 2 deletions rs/moq-mux/src/codec/vp8/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ impl Import {
self.track.abort(err);
}

/// Publish what the track measured (bitrate, jitter) into the catalog rendition, filling only
/// the fields its config didn't supply.
/// Cut the current group at `end` without finishing the track.
pub fn cut(&mut self, end: Option<moq_net::Timestamp>) -> crate::Result<()> {
self.track.cut(end)?;
Expand Down
2 changes: 0 additions & 2 deletions rs/moq-mux/src/codec/vp9/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ impl Import {
self.track.abort(err);
}

/// Publish what the track measured (bitrate, jitter) into the catalog rendition, filling only
/// the fields its config didn't supply.
/// Cut the current group at `end` without finishing the track.
pub fn cut(&mut self, end: Option<moq_net::Timestamp>) -> crate::Result<()> {
self.track.cut(end)?;
Expand Down
Loading
Loading