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
2 changes: 1 addition & 1 deletion js/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Every reactive component in `watch`/`publish` follows one shape:

# Web components

Plain custom elements on `@moq/signals`, no framework. Attributes are the public API and mirror into signals in `attributeChangedCallback`. An invalid attribute value warns and falls back; never throw. Booleans reflect as bare attributes. Attributes with a unit take one (`delay="100ms"`), since `parseFloat("30s")` is 30. Create the `Effect` in `connectedCallback`, close it in `disconnectedCallback`. Styles import as `?inline` into a `ShadowRoot`. The `./element`, `./ui`, `./support` subpaths are side-effectful and not re-exported from the main entry.
Plain custom elements on `@moq/signals`, no framework. Attributes are the public API and mirror into signals in `attributeChangedCallback`. An invalid attribute value is refused, never replaced by a default: the property setter throws, and the element surfaces the error instead of running with a fallback. Booleans reflect as bare attributes. Attributes with a unit take one (`delay="100ms"`), since `parseFloat("30s")` is 30. Create the `Effect` in `connectedCallback`, close it in `disconnectedCallback`. Styles import as `?inline` into a `ShadowRoot`. The `./element`, `./ui`, `./support` subpaths are side-effectful and not re-exported from the main entry.

# Conventions

Expand Down
8 changes: 6 additions & 2 deletions quest/m0/ci/nix-cache-verify.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@ Then confirm it, and record the numbers in the PR that closes this:
38897397428: every workload spent 12-14 minutes building
`uniffi-bindgen-go`, `uniffi-bindgen-cpp` and `quest` before entering the
dev shell, because Cachix had no copy.
- The next `moq-relay-v*` or `moq-cli-v*` tag pushes from all three
`release-nix.yml` legs, and `nix run github:moq-dev/moq/<tag>#moq-relay
- The first `moq-relay-v*` or `moq-cli-v*` tag cut after `release` carries
`release-nix.yml` pushes from all three legs, and `nix run github:moq-dev/moq/<tag>#moq-relay
--accept-flake-config` substitutes on a clean machine.
Tags are cut from `release`, which still has `cachix.yml` and `cache.yml`
and no `release-nix.yml`, so the 2026-10-23 tags (`moq-relay-v0.17.8`,
`moq-cli-v0.14.8`) ran Cachix push and never reached `nix.moq.dev`. The
next cut from `main` fixes that; confirm its first tag's run.
- Both bucket sizes after a month, against the 30-day expiry in
`infra/nix/lifecycle.json`. A path expires 30 days after its upload even
while CI still reads it. If a dev-shell push is restored, look for jobs
Expand Down
6 changes: 6 additions & 0 deletions quest/m1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,16 @@ arithmetic, DASH init readiness, dot-only names) and ffprobe segment
conformance; the audit's segment-finalization redesign is folded into
Catalog HLS field.

Added 2026-10-24 (maintainer-requested pre-cut audit of main): remote
crashes and amplification in media and RTMP parsing, lite announce bounds,
JS track terminal causes, browser element teardown, and smaller Rust/JS
divergences, under one epic; its redesign proposals went to m2.

## Required

- [moq-congestion](/quest/m1/congestion/README.md) - one QUIC congestion-control crate with a transport-independent trait, run by `moq-quic` and published for noq
- [Release audit findings](/quest/m1/release-audit/README.md) - resolve newly identified resource, parser, playback, and interoperability risks before the cut
- [Pre-cut audit findings](/quest/m1/cut-audit/README.md) - fix the crashes, hostile-input costs, and correctness bugs the 2026-10-24 audit of main found
- [Cancelled moq-transport requests stop](/quest/m1/ietf-request-cancel.md) - a cancelled request releases its state even when the peer withholds credit
- [Empty segments refused](/quest/m1/empty-segments.md) - `room//cam` fails loud instead of naming `room/cam`
- [In-band auth](/quest/m1/auth/README.md) - a session tells its peer what it may publish and subscribe to, unions tokens presented in band, and fails loud on an out-of-scope publish
Expand Down
10 changes: 10 additions & 0 deletions quest/m1/buffered-ascending.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ Implementation:
every reply decodes from its first frame, plain and barge-in, with no
overflow.

### Runtime mode switch (2026-10-24 pre-cut audit)

Changing `buffer` at runtime does not switch the audio ring's mode:
`js/watch/src/audio/decoder.ts:293` captures `sync.out.buffered` once when it
builds the worklet, and `#order()` (`:679`) peeks it once per attempt, so
going from live to buffered after playback started leaves `Backpressure`
and the worklet `Init` live (future-dated TTS audio is shed), and the
reverse leaves a live player in play-through. Key the ring and `Order` on
`sync.out.buffered`: rebuild the ring, or post a mode message plus a reset.

## Required

- [Finalize moq-lite-07](/quest/m1/lite07-finalize.md) - an ascending request is served newest-first until lite-07 negotiates by default
Expand Down
15 changes: 15 additions & 0 deletions quest/m1/cluster-routing/routes.md
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,21 @@ continues to rank feasible transit routes; report it. This may
split at start (Rust and draft, then JS), as long as both land in one
release.

### Mint an epoch for every route (2026-10-24 pre-cut audit)

The epochless instance machinery keeps drawing fixes (35d935f428,
3655358c2f, c39780f952, 29e74a26b7, a7acf21e2a, ef2511e101, aa0d915867,
0f4f81f9ed, f0fcbefd66, 4c8ab3ca41, 001482144f, 07127f8f5b), as does front
splice, park, and linger in `serve_front` (166f9e87bc, 3b4ad5bf02,
88848954db, 24b9177b6e, 0e1995017d, 732101ed1e, 00d27780dd, 37b49d8042).
Proposal for this quest to weigh: mint an epoch on the receiving side at
ingest or local announce when a peer sends none, so `Instance` collapses to
`Epoch`. That deletes the `Instance::Route(generation)` renewals,
`restarted_since`, the held-restart Release for epochless routes, and
Selection retirement, leaving Follow's same-epoch Update/Restart split as
the only takeover rule. `Route::epoch` stops being optional (a breaking
API change); no wire change.

## Required

- [Stamp routing identities](/quest/m1/cluster-routing/stamp.md) - every session's own identity is stamped by its receiver, never self-named
Expand Down
98 changes: 98 additions & 0 deletions quest/m1/cut-audit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Pre-cut audit findings

## Goal

Resolve the bugs and hostile-input costs found by the 2026-10-24 pre-cut
audit of main before main is promoted to release. This epic's own work, once
every child has merged: re-run the reproductions the children record against
the release candidate and hand the result to the
[release cut](/quest/m2/release/cut.md).

## Plan

The maintainer asked for an extensive audit of main for bugs and
improvements before the cut, with attention to high-churn areas that need a
redesign. The audit ran at
[151a529670](https://github.com/moq-dev/moq/commit/151a529670) in eight
areas: the moq-net track and resume model, origin and sessions with kio,
moq-transport, moq-lite with its codecs and fuzzing, `js/net` with
`js/qmux`, moq-mux with hang in both languages, the browser media packages,
and the runtimes and binaries (moq-tokio, moq-uring, the relay's non-auth
paths, moq-cli, moq-rtmp, moq-gst, moq-transcode, moq-audio, moq-video). It
skipped what the 2026-10-22 to 24 audits already covered (release-to-main,
relay security, clustering, linger, moq-quic, moq-hls, the external API
audit, bindings and OBS), and every finding was checked against the quest
tree and the open PRs.

This was risk-based source review with targeted reproductions in throwaway
tests, not a line-by-line pass; TS import/export beyond spot checks was not
covered. Each child says whether its finding was reproduced or
source-inferred and whether it is new on main or inherited from release.
Children are ordered by severity: remotely reachable crashes and
amplification first, then correctness and privacy, then bounded costs and
cleanups.

Churn context: main landed about 2,400 commits in the 30 days before the
audit, 823 of them fixes, concentrated in `rs/moq-net` (`model/track.rs` 85
fix commits, `ietf/subscriber.rs` 69, `ietf/publisher.rs` 53,
`lite/subscriber.rs` 51, `model/resume.rs` 46) and `js/net`. The audit's
redesign proposals for the churning mechanisms are in m2, since each is
internal and can ship after the cut:
[resume as producer replacement](/quest/m2/resume-redesign.md),
[moq-transport request leases](/quest/m2/ietf-request-lease.md),
[group heads filled in place](/quest/m2/ietf-fill-refill.md),
[one relay serve path](/quest/m2/relay-serve-path.md),
[moqsrc pad actors](/quest/m2/moqsrc-pad-actor.md), and
[publish rendition identity](/quest/m2/publish-publication.md). Other
redesign evidence went into the quests that already own the mechanism:
[subscribe ranges](/quest/m1/subscribe-ranges/README.md),
[drop set](/quest/m1/drop-set.md),
[per-origin routes](/quest/m1/cluster-routing/routes.md),
[drafts 14-17 removal](/quest/m1/ietf-drop/d14-17.md), and
[buffered playback](/quest/m1/buffered-ascending.md). The audit recommends
leaving JS-only redesigns of `js/net` to [rs2ts](/quest/m2/rs2ts/README.md).

## Required

- [AMF0 decoding costs no more than the bytes a peer sent](/quest/m1/cut-audit/rtmp-amf0-budget.md) - one RTMP message can no longer allocate ~56x its size before auth
- [One fMP4 sample resolver](/quest/m1/cut-audit/fmp4-sample-resolver.md) - zero-size samples cannot cost gigabytes, and `base_data_offset` input imports or is refused
- [A malformed avc1 codec string is refused](/quest/m1/cut-audit/avc1-codec-panic.md) - no catalog reader panics on a non-ASCII profile
- [A compressed announce path never outgrows its literal form](/quest/m1/cut-audit/announce-path-bytes.md) - lite-07 announce compression cannot build multi-MiB paths
- [Removing a media element releases its devices](/quest/m1/cut-audit/element-teardown.md) - camera, mic, screen share, and GPU are released on removal
- [A route too large to re-encode is skipped](/quest/m1/cut-audit/announce-reencode.md) - one oversized route never resets a downstream announce stream
- [Audio buffers are sized by data a publisher sent](/quest/m1/cut-audit/audio-catalog-alloc.md) - a hostile audio catalog cannot make viewers allocate gigabytes
- [A reserved group survives a route returning](/quest/m1/cut-audit/reserved-route-return.md) - a route flip A to B to A no longer panics a peeked reader
- [JS tracks end clean only on a deliberate finish](/quest/m1/cut-audit/js-close-cause.md) - local close, violations, and unanswered requests end with errors
- [A malformed lite message closes the session](/quest/m1/cut-audit/announce-decode-complete.md) - a bad ANNOUNCE body no longer jams its stream
- [Withdrawing a moq-transport FETCH or TRACK_STATUS ends it](/quest/m1/cut-audit/ietf-withdraw-resolve.md) - withdrawal during resolution releases the request
- [JS moq-transport sessions close on peer violations](/quest/m1/cut-audit/js-ietf-violations.md) - right close codes, no unhandled rejection, bounded reflected namespaces
- [A media hole in the player keeps the timeline](/quest/m1/cut-audit/watch-audio-hole.md) - a skipped group re-primes decoders without flushing audio or re-anchoring sync
- [A camera broadcast stays announced across unmute](/quest/m1/cut-audit/publish-announce-latch.md) - viewers do not restart on every device flap
- [Muted and volume are independent](/quest/m1/cut-audit/watch-volume-mute.md) - `<moq-watch volume="0.8" muted>` starts muted at 0.8
- [A description-less AAC rendition means one thing](/quest/m1/cut-audit/aac-description-less.md) - every player and exporter agrees on the frame format
- [A malformed MKV track fails the import](/quest/m1/cut-audit/mkv-import-errors.md) - no silently missing tracks or collapsed timestamps
- [RTMP sessions follow one strict path](/quest/m1/cut-audit/rtmp-session-strict.md) - idle sockets, repeated requests, rewinds, and stalled servers are handled
- [The export jitter buffer admits only frames due within its window](/quest/m1/cut-audit/jitter-admission.md) - a fast track is backpressured, not buffered without bound
- [Peer-driven receive loops yield on a per-message budget](/quest/m1/cut-audit/peer-loop-budget.md) - small-message floods cannot monopolize a session driver
- [The JS gap ledger costs O(log n)](/quest/m1/cut-audit/js-ledger.md) - sparse arrivals no longer cost quadratic main-thread CPU
- [Removing a stale front is O(1)](/quest/m1/cut-audit/weak-cache-remove.md) - a restart wave is linear under the origin lock
- [One bad rendition never leaves the player with nothing](/quest/m1/cut-audit/watch-source-robust.md) - malformed audio and conflicting video filters degrade gracefully
- [@moq/flate stops inflating at its budget](/quest/m1/cut-audit/flate-budget.md) - unless the compression migration deletes it first
- [JS JSON and MSF readers refuse what Rust refuses](/quest/m1/cut-audit/js-json-strict.md) - invalid UTF-8 and malformed MSF init refs fail in both
- [Media element attributes reflect their state](/quest/m1/cut-audit/element-attributes.md) - attributes track property and UI changes before the API ships
- [Rust and JS accept the same catalogs](/quest/m1/cut-audit/catalog-parity.md) - one strictness, per rendition, with a shared fixture corpus
- [Lite datagrams obey one size limit](/quest/m1/cut-audit/datagram-size.md) - no datagram one hop accepts is dropped by the next for size
- [Every relay runtime honors or refuses each listen setting](/quest/m1/cut-audit/uring-listen-config.md) - io_uring stops ignoring preferred addresses
- [The Unix-socket allowlist is checked first](/quest/m1/cut-audit/uds-allowlist-first.md) - refused local users never reach the qmux parser
- [A route's terminal state is one phase](/quest/m1/cut-audit/route-phase.md) - three resume flags collapse into one check
- [Lite's version gates, refusals, and draft text agree](/quest/m1/cut-audit/lite-wire-nits.md) - small wire and draft mismatches fixed
- [Small @moq/net divergences from Rust are fixed](/quest/m1/cut-audit/js-net-cleanups.md) - lite-04 probes, group consumers, accept deadlines, empty JSON
- [Signals and the encoded preview keep their promises](/quest/m1/cut-audit/js-media-cleanups.md) - `Computed.close()` and the encoded preview behave as documented

## Related

- [Release audit findings](/quest/m1/release-audit/README.md) - the 2026-10-22 audit this one follows
- [Untrusted media parsers have fuzz targets](/quest/m2/media-fuzz.md) - would have caught the media parser findings here
- [Announce interest streams share one route table](/quest/m2/announce-interest-memory.md) - the audit's inherited announce memory finding
- [A parked read of a resumed group reads its budget without re-syncing](/quest/m2/recover-budget.md) - measure-first resume cost
- [Transcode rungs scale off the runtime](/quest/m2/transcode-rungs.md) - the audit's transcode findings
33 changes: 33 additions & 0 deletions quest/m1/cut-audit/aac-description-less.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# [S] A description-less AAC rendition means one thing everywhere

## Goal

An `mp4a.40.*` catalog entry with no `description` has one defined frame
format, written in the hang draft, and every player and exporter (JS watch,
moqsrc, moq-audio, TS export) decodes it the same way.

## Plan

Found by the 2026-10-24 pre-cut audit at 151a529670. Source-inferred and
spot-verified, inherited.

Today `rs/moq-gst/src/source/imp.rs:1769` advertises `stream-format=adts`,
`js/watch/src/audio/decoder.ts:488` configures WebCodecs with no description
(which WebCodecs reads as ADTS), `rs/moq-audio/src/aac.rs:68` synthesizes an
AudioSpecificConfig and decodes the frames as raw, and
`rs/moq-mux/src/container/ts/export.rs:3823` treats them as raw and adds
ADTS headers. Whichever form a publisher sends, half the consumers break.

Decision for the maintainer, with a recommendation:

1. **ADTS (recommended).** Matches WebCodecs, the browser path most viewers
use. moq-audio parses ADTS headers and TS export passes the frames
through.
2. Raw access units. JS and moqsrc must synthesize a description.

State the choice in `drafts/draft-lcurley-moq-hang.md` and add a test per
consumer with a description-less fixture. Check which first-party
publishers emit description-less AAC today, so none starts producing the
other form.

Public API: none. Wire: a format clarification in the hang draft.
38 changes: 38 additions & 0 deletions quest/m1/cut-audit/announce-decode-complete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# [S] A malformed lite message closes the session instead of jamming its stream

## Goal

A lite ANNOUNCE body whose fields run past its own declared length closes the
session with PROTOCOL_VIOLATION, as JS already does, instead of leaving the
announce stream waiting for bytes that will never come. Lite fuzzing asserts
that no complete body ever decodes as `Short`, and covers the lite-07 TRACKS
and AUTH decoders.

## Plan

Found by the 2026-10-24 pre-cut audit at 151a529670. Codec half reproduced
(`decode_slice` returns `Short` for `[0,1,5,..]` on lite-06/07 and `[1,1]` on
lite-05); the jam is source-inferred. Inherited.

`lite::Announce::decode` (`rs/moq-net/src/lite/announce.rs:340-381`) decodes
the lite-06+ body and the legacy body inside `buf.sub(size)` without
`DecodeError::complete`, unlike `message.rs` and `tracks.rs`. A Hop Count
larger than the hops that follow returns `Short`; `Reader::poll_with_sized`
(`coding/reader.rs:147`) then grows its window a byte at a time, and
`lite/error.rs:34` deliberately never maps `Short` to a violation. Every
later announcement re-runs the failed decode until FIN.

- Decode both bodies with `.map_err(DecodeError::complete)`, or through
`message::decode_with`. Grep the lite and IETF codecs for any other `sub()`
body decoded without it.
- In `fuzz.rs` `roundtrip`, assert `Err(Short)` implies the decoder needed
more bytes than it was given, so this class fails the fuzzer.
- Add `lite_wire` arms for `Tracks`/`TracksEvent` and
`Auth`/`AuthOk`/`AuthError`/`AuthReply`, all peer-received lite-07
decoders with no target today.

Public API: none. Wire: none.

## Related

- [Wire fuzz coverage](/quest/m2/wire-fuzz-coverage.md) - the remaining decoder and unsafe targets
43 changes: 43 additions & 0 deletions quest/m1/cut-audit/announce-path-bytes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# [S] A compressed announce path never outgrows its literal form

## Goal

A lite-07 ANNOUNCE_START whose base/keep compression resolves to a path
longer than one literal ANNOUNCE_START body could carry closes the session
with PROTOCOL_VIOLATION, in Rust and `@moq/net`. A peer can no longer turn a
12-byte message into a multi-MiB path that the decoder, the origin, and every
forwarded copy hold.

## Plan

Found by the 2026-10-24 pre-cut audit at
[151a529670](https://github.com/moq-dev/moq/commit/151a529670). Source-inferred,
inherited from release (worse there under its 64 MiB message cap). Reachable
only while `moq-lite-07-wip` is negotiated, which
[Finalize moq-lite-07](/quest/m1/lite07-finalize.md) turns on by default.

`Live::resolve_path` (`rs/moq-net/src/lite/compress.rs:48`) bounds a
resolved suffix only by `Path::MAX_PARTS` (32). Thirty-two STARTs that each
keep the previous suffix and append a ~64 KiB segment build a ~2 MiB suffix;
every later START with `keep=31` copies it again for about 12 wire bytes, up
to `Limits::announces` times. `origin.rs` `create_withheld` (about line 2176)
claims a path it accepts "can be re-encoded when forwarded" but checks parts
only. JS `AnnounceHistory` (`js/net/src/lite/announce.ts:383`) has the same
parts-only check.

- No new constant: the bound is the existing literal one. A resolved suffix,
and the prefix joined with it, must fit in a literal ANNOUNCE_START body
under `MAX_MESSAGE_SIZE`. Compression never expresses a path the literal
form could not.
- Enforce the same byte bound in `create_withheld`, so a locally created
route is never one this wire cannot forward.
- Extend the `announce_stream` fuzz target to assert every resolved path
encodes as a literal START.
- Add the receiver rule to `drafts/draft-lcurley-moq-lite.md` (lite-07 is
unpublished, so this changes no published version).

Public API: none. Wire: one receiver rule in the lite-07 draft.

## Related

- [A route too large to re-encode is skipped](/quest/m1/cut-audit/announce-reencode.md) - the same size bound on the send side
Loading
Loading