From 8ac4be1b4a4aae7058717cfd286184bc6029deed Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 24 Oct 2026 22:33:59 -0700 Subject: [PATCH 01/11] quest: plan the 2026-10-24 pre-cut audit findings Adds the m1 pre-cut audit epic (34 fixes from an eight-area audit of main at 151a529670), ten m2 quests for the redesigns behind the highest-churn mechanisms and inherited costs, and audit evidence in the quests that already own subscribe ranges, the drop set, per-origin routes, the drafts 14-17 removal, and buffered playback. Co-Authored-By: Claude Opus 5.5 --- quest/m1/README.md | 6 ++ quest/m1/buffered-ascending.md | 10 ++ quest/m1/cluster-routing/routes.md | 15 +++ quest/m1/cut-audit/README.md | 98 +++++++++++++++++++ quest/m1/cut-audit/aac-description-less.md | 33 +++++++ .../m1/cut-audit/announce-decode-complete.md | 38 +++++++ quest/m1/cut-audit/announce-path-bytes.md | 43 ++++++++ quest/m1/cut-audit/announce-reencode.md | 37 +++++++ quest/m1/cut-audit/audio-catalog-alloc.md | 33 +++++++ quest/m1/cut-audit/avc1-codec-panic.md | 26 +++++ quest/m1/cut-audit/catalog-parity.md | 42 ++++++++ quest/m1/cut-audit/datagram-size.md | 31 ++++++ quest/m1/cut-audit/element-attributes.md | 29 ++++++ quest/m1/cut-audit/element-teardown.md | 41 ++++++++ quest/m1/cut-audit/flate-budget.md | 26 +++++ quest/m1/cut-audit/fmp4-sample-resolver.md | 45 +++++++++ quest/m1/cut-audit/ietf-withdraw-resolve.md | 34 +++++++ quest/m1/cut-audit/jitter-admission.md | 41 ++++++++ quest/m1/cut-audit/js-close-cause.md | 48 +++++++++ quest/m1/cut-audit/js-ietf-violations.md | 43 ++++++++ quest/m1/cut-audit/js-json-strict.md | 28 ++++++ quest/m1/cut-audit/js-ledger.md | 28 ++++++ quest/m1/cut-audit/js-media-cleanups.md | 24 +++++ quest/m1/cut-audit/js-net-cleanups.md | 49 ++++++++++ quest/m1/cut-audit/lite-wire-nits.md | 43 ++++++++ quest/m1/cut-audit/mkv-import-errors.md | 39 ++++++++ quest/m1/cut-audit/peer-loop-budget.md | 37 +++++++ quest/m1/cut-audit/publish-announce-latch.md | 31 ++++++ quest/m1/cut-audit/reserved-route-return.md | 43 ++++++++ quest/m1/cut-audit/route-phase.md | 26 +++++ quest/m1/cut-audit/rtmp-amf0-budget.md | 35 +++++++ quest/m1/cut-audit/rtmp-session-strict.md | 58 +++++++++++ quest/m1/cut-audit/uds-allowlist-first.md | 20 ++++ quest/m1/cut-audit/uring-listen-config.md | 32 ++++++ quest/m1/cut-audit/watch-audio-hole.md | 49 ++++++++++ quest/m1/cut-audit/watch-source-robust.md | 28 ++++++ quest/m1/cut-audit/watch-volume-mute.md | 20 ++++ quest/m1/cut-audit/weak-cache-remove.md | 32 ++++++ quest/m1/drop-set.md | 11 +++ quest/m1/ietf-drop/d14-17.md | 8 ++ quest/m1/subscribe-ranges/README.md | 21 ++++ quest/m2/README.md | 10 ++ quest/m2/announce-interest-memory.md | 39 ++++++++ quest/m2/ietf-fill-refill.md | 38 +++++++ quest/m2/ietf-request-lease.md | 61 ++++++++++++ quest/m2/media-fuzz.md | 27 +++++ quest/m2/moqsrc-pad-actor.md | 26 +++++ quest/m2/publish-publication.md | 27 +++++ quest/m2/recover-budget.md | 32 ++++++ quest/m2/relay-serve-path.md | 37 +++++++ quest/m2/resume-redesign.md | 83 ++++++++++++++++ quest/m2/transcode-rungs.md | 32 ++++++ 52 files changed, 1793 insertions(+) create mode 100644 quest/m1/cut-audit/README.md create mode 100644 quest/m1/cut-audit/aac-description-less.md create mode 100644 quest/m1/cut-audit/announce-decode-complete.md create mode 100644 quest/m1/cut-audit/announce-path-bytes.md create mode 100644 quest/m1/cut-audit/announce-reencode.md create mode 100644 quest/m1/cut-audit/audio-catalog-alloc.md create mode 100644 quest/m1/cut-audit/avc1-codec-panic.md create mode 100644 quest/m1/cut-audit/catalog-parity.md create mode 100644 quest/m1/cut-audit/datagram-size.md create mode 100644 quest/m1/cut-audit/element-attributes.md create mode 100644 quest/m1/cut-audit/element-teardown.md create mode 100644 quest/m1/cut-audit/flate-budget.md create mode 100644 quest/m1/cut-audit/fmp4-sample-resolver.md create mode 100644 quest/m1/cut-audit/ietf-withdraw-resolve.md create mode 100644 quest/m1/cut-audit/jitter-admission.md create mode 100644 quest/m1/cut-audit/js-close-cause.md create mode 100644 quest/m1/cut-audit/js-ietf-violations.md create mode 100644 quest/m1/cut-audit/js-json-strict.md create mode 100644 quest/m1/cut-audit/js-ledger.md create mode 100644 quest/m1/cut-audit/js-media-cleanups.md create mode 100644 quest/m1/cut-audit/js-net-cleanups.md create mode 100644 quest/m1/cut-audit/lite-wire-nits.md create mode 100644 quest/m1/cut-audit/mkv-import-errors.md create mode 100644 quest/m1/cut-audit/peer-loop-budget.md create mode 100644 quest/m1/cut-audit/publish-announce-latch.md create mode 100644 quest/m1/cut-audit/reserved-route-return.md create mode 100644 quest/m1/cut-audit/route-phase.md create mode 100644 quest/m1/cut-audit/rtmp-amf0-budget.md create mode 100644 quest/m1/cut-audit/rtmp-session-strict.md create mode 100644 quest/m1/cut-audit/uds-allowlist-first.md create mode 100644 quest/m1/cut-audit/uring-listen-config.md create mode 100644 quest/m1/cut-audit/watch-audio-hole.md create mode 100644 quest/m1/cut-audit/watch-source-robust.md create mode 100644 quest/m1/cut-audit/watch-volume-mute.md create mode 100644 quest/m1/cut-audit/weak-cache-remove.md create mode 100644 quest/m2/announce-interest-memory.md create mode 100644 quest/m2/ietf-fill-refill.md create mode 100644 quest/m2/ietf-request-lease.md create mode 100644 quest/m2/media-fuzz.md create mode 100644 quest/m2/moqsrc-pad-actor.md create mode 100644 quest/m2/publish-publication.md create mode 100644 quest/m2/recover-budget.md create mode 100644 quest/m2/relay-serve-path.md create mode 100644 quest/m2/resume-redesign.md create mode 100644 quest/m2/transcode-rungs.md diff --git a/quest/m1/README.md b/quest/m1/README.md index 00e5bcfbdc2..ea00f4f5da6 100644 --- a/quest/m1/README.md +++ b/quest/m1/README.md @@ -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 diff --git a/quest/m1/buffered-ascending.md b/quest/m1/buffered-ascending.md index 7edeec56866..8a1d709abc0 100644 --- a/quest/m1/buffered-ascending.md +++ b/quest/m1/buffered-ascending.md @@ -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 diff --git a/quest/m1/cluster-routing/routes.md b/quest/m1/cluster-routing/routes.md index 189428bd1c9..4475ac65fbf 100644 --- a/quest/m1/cluster-routing/routes.md +++ b/quest/m1/cluster-routing/routes.md @@ -639,6 +639,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 - [Identity proof](/quest/m1/cluster-routing/identity.md) - proven own identities and subject-qualified forwarded ones diff --git a/quest/m1/cut-audit/README.md b/quest/m1/cut-audit/README.md new file mode 100644 index 00000000000..c640791d198 --- /dev/null +++ b/quest/m1/cut-audit/README.md @@ -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) - `` 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 diff --git a/quest/m1/cut-audit/aac-description-less.md b/quest/m1/cut-audit/aac-description-less.md new file mode 100644 index 00000000000..1ee0d458942 --- /dev/null +++ b/quest/m1/cut-audit/aac-description-less.md @@ -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. diff --git a/quest/m1/cut-audit/announce-decode-complete.md b/quest/m1/cut-audit/announce-decode-complete.md new file mode 100644 index 00000000000..b4591952838 --- /dev/null +++ b/quest/m1/cut-audit/announce-decode-complete.md @@ -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 diff --git a/quest/m1/cut-audit/announce-path-bytes.md b/quest/m1/cut-audit/announce-path-bytes.md new file mode 100644 index 00000000000..ef8a86615ad --- /dev/null +++ b/quest/m1/cut-audit/announce-path-bytes.md @@ -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 diff --git a/quest/m1/cut-audit/announce-reencode.md b/quest/m1/cut-audit/announce-reencode.md new file mode 100644 index 00000000000..3fc30eb0720 --- /dev/null +++ b/quest/m1/cut-audit/announce-reencode.md @@ -0,0 +1,37 @@ +# [S] A route too large to re-encode is skipped, not fatal to the stream + +## Goal + +When a relay cannot re-encode one route for a downstream announce stream +(the downstream's shorter prefix or an extra hop pushes the message past the +encode cap), that downstream simply does not see that route. Its other +routes keep flowing, and asking again does not fail the same way. The same +holds for moq-transport's namespace advertisement. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. Reproduced: announcing +`"x/" + "a"*65530` on the lite test harness ended the downstream announce +task. New on main: [moq-dev/moq#4820](https://github.com/moq-dev/moq/pull/4820) +lowered the message cap from 64 MiB to 64 KiB. + +`AnnounceRun::start` (`rs/moq-net/src/lite/publisher.rs:1194`) calls +`stream.writer.buffer(..)?`; `EncodeError::TooLarge` +(`lite/announce.rs:297`) propagates to `AnnounceServe::poll` (about line +906), which aborts the whole stream. Cluster peers and `moq ls` ask for the +root prefix, so one hostile publisher withdraws every route a relay sends +them. On lite-06+ the encoder has already spent an announce id. + +- `outgoing()` returns `None` for a route this wire cannot carry, like a + reflected or overlong hop chain. Encode before assigning the id. +- Never abort an announce stream for one route. +- Check the IETF publisher's namespace encoding against its 4096-byte limit + (`ietf/namespace.rs:66`) for the same failure, and fix it the same way. +- A test announces a near-cap suffix under a short downstream prefix and + asserts the sibling routes still arrive. + +Public API: none. Wire: none. + +## Related + +- [A compressed announce path never outgrows its literal form](/quest/m1/cut-audit/announce-path-bytes.md) - the receive-side bound diff --git a/quest/m1/cut-audit/audio-catalog-alloc.md b/quest/m1/cut-audit/audio-catalog-alloc.md new file mode 100644 index 00000000000..62234bb1fd2 --- /dev/null +++ b/quest/m1/cut-audit/audio-catalog-alloc.md @@ -0,0 +1,33 @@ +# [S] Audio buffers are sized by data a publisher sent, not by its catalog + +## Goal + +A publisher cannot crash its viewers by declaring a huge sample rate or +channel count in an audio catalog. moq-audio's resampler and playback ring +are sized from the first decoded packet and the output device, so a PCM +rendition declaring 4 GHz and 8 channels allocates nothing it has not been +sent. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. Source-inferred and +spot-verified, inherited. Reaches `moq play`, the bindings, and moqsrc +through moq-audio. + +- `rs/moq-audio/src/decode/consumer.rs:173` sizes the resampler window as + `rate * 20 / 1000` frames and `resample.rs:87` allocates + `channels * chunk_frames` f32 twice (the wrapper and rubato): about 5 GB + for the example. +- The playback ring (`playback/sink.rs:516`, amplified by + `rs/moq-cli/src/play/media.rs:512`) is sized at + `in_rate * (latency + 3 s)`, about 100 GB, so the allocation aborts. +- The AAC AudioSpecificConfig escape (a 16.7M rate) gives about 400 MB per + sink. `decode/backend/pcm.rs:17` trusts the catalog too. + +Fix direction, with no rate-cap constant: a fixed frame count for the +resampler window, the resampler and ring built from the first decoded packet +(so data actually received pays for the channel count), and the playback +ring sized from the device side. A test builds a decoder from the hostile +catalog and asserts no allocation before data arrives. + +Public API: none. Wire: none. diff --git a/quest/m1/cut-audit/avc1-codec-panic.md b/quest/m1/cut-audit/avc1-codec-panic.md new file mode 100644 index 00000000000..f8570329171 --- /dev/null +++ b/quest/m1/cut-audit/avc1-codec-panic.md @@ -0,0 +1,26 @@ +# [XS] A malformed avc1 codec string is refused, not a panic + +## Goal + +A catalog whose `avc1`/`avc3` codec string has a non-ASCII or non-hex +profile part fails to parse with `Error::InvalidCodec` in every Rust +catalog reader, instead of panicking on a string slice. No catalog reader +across the C ABI can be made to abort by a publisher. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. Reproduced, inherited. + +`rs/hang/src/catalog/video/h264.rs:50` checks `part.len() != 6` in bytes and +then slices `&part[0..2]`, so `"avc1.aé123"` (6 bytes) panics inside `é`. +It runs on every catalog deserialize through `VideoCodec: FromStr`, +including the moq-mux hang and MSF consumers +(`rs/moq-mux/src/catalog/msf/consumer.rs:283`), so moq-hls, moq-cli, +moq-gst, moq-ffi, and moq-c are exposed. The relay does not parse catalogs. + +Check each byte is an ASCII hex digit before slicing (this also refuses the +leading `+` that `from_str_radix` accepts). Audit the other codec string +parsers for any slice before an ASCII check; the audit found H.265, VP9, +AV1, and AAC already safe. Add the input to the catalog parse tests. + +Public API: none. Wire: none. diff --git a/quest/m1/cut-audit/catalog-parity.md b/quest/m1/cut-audit/catalog-parity.md new file mode 100644 index 00000000000..4eb9cc5295a --- /dev/null +++ b/quest/m1/cut-audit/catalog-parity.md @@ -0,0 +1,42 @@ +# [M] Rust and JS accept the same catalogs + +## Goal + +A catalog that one language accepts, the other accepts, and a malformed +known-codec rendition is refused per rendition in both, so a browser never +plays what moq-cli, moqsrc, and HLS refuse, or the reverse. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. Reproduced with probes +in both languages, inherited. + +| Input | JS | Rust | +|---|---|---| +| `codec:"avc1.6400"` | accepts | refuses | +| `codedWidth:5000000000` | accepts | refuses (u32) | +| legacy `video:[{track,config}]` | accepts | refuses | +| `container:{}` | refuses | accepts as Unknown | + +`sampleRate:0` and `numberOfChannels:0` pass both and fail later in +`Timescale::new`. Rust: `rs/hang/src/catalog/video/codec.rs:62`, +`video/mod.rs:192`, `audio/mod.rs:136`, `container.rs:88`. JS: +`js/hang/src/catalog/video.ts:129,146,229`, `audio.ts:110`, +`container.ts:15`. + +Decision for the maintainer, with a recommendation: **strict and per +rendition (recommended)**. Both languages validate codec strings and +dimension ranges the same way, refuse zero rates and channel counts, drop +the legacy array form in Rust's direction (or keep it in both), and skip a +malformed rendition while keeping the rest of the catalog. The alternative +is to keep each parser and only document the differences. Add a shared +fixture corpus both test suites load, so a future divergence fails CI. + +Also check the container consumer's skip measurement: Rust measures newest +content minus the next group's start (`rs/moq-mux/src/container/consumer.rs:576`), +JS from the oldest unread frame (`js/hang/src/container/consumer.ts:401`). +They may diverge on a backlog join (unverified); align them if a test shows +it. + +Public API: stricter catalog acceptance in one or both languages. Wire: a +stricter catalog contract, stated in `drafts/draft-lcurley-moq-hang.md`. diff --git a/quest/m1/cut-audit/datagram-size.md b/quest/m1/cut-audit/datagram-size.md new file mode 100644 index 00000000000..87b10bbc211 --- /dev/null +++ b/quest/m1/cut-audit/datagram-size.md @@ -0,0 +1,31 @@ +# [S] Lite datagrams obey one size limit on every hop + +## Goal + +A lite datagram that one hop accepts is never silently dropped by the next +for its size. Rust and `@moq/net` send and accept datagram bodies under the +same limit the draft states. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. Source-inferred, +inherited. + +The draft says a publisher MUST NOT send a datagram body over 1200 bytes and +a receiver MUST drop one. The code sends anything up to +`session.max_datagram_size()` (`rs/moq-net/src/lite/publisher.rs:3619`, JS +`js/net/src/lite/publisher.ts:1632`) and accepts larger bodies on receive +(near `lite/subscriber.rs:1391`, JS `datagram_stream.ts`). Over a hop with a +larger QUIC limit we send and accept a 1300-byte body that a relay then +cannot forward onto a 1200-byte hop, so it vanishes mid-path. +[E2EE](/quest/m2/e2ee/README.md) sizes its plaintext on the 1200 cap. + +Decision for the maintainer, with a recommendation: + +1. **Enforce 1200 end to end (recommended).** Cap sends at the smaller of + 1200 and the transport limit, and drop larger bodies on receive, in both + languages. Predictable across any path, matches the draft and E2EE. +2. Relax the draft to a per-hop limit and size E2EE per hop. Larger + datagrams on good paths, at the cost of silent mid-path loss. + +Public API: none. Wire: none (option 1 matches the draft as written). diff --git a/quest/m1/cut-audit/element-attributes.md b/quest/m1/cut-audit/element-attributes.md new file mode 100644 index 00000000000..0a408f0c1a4 --- /dev/null +++ b/quest/m1/cut-audit/element-attributes.md @@ -0,0 +1,29 @@ +# [S] Media element attributes reflect their state + +## Goal + +`` and `` reflect state changed through properties +or the built-in UI back to their attributes, so `[muted]` selectors, +attribute-diffing frameworks, and a later `setAttribute` behave. Invalid +attribute values warn instead of being ignored. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. Source-inferred, +inherited. Public element API, so it lands before the cut. + +- Nothing reflects on publish (`js/publish/src/element.ts:337`, `:483-529`). + When the built-in UI unmutes via the property, the `muted` attribute stays, + so a later `setAttribute("muted", "")` hits the `oldValue === newValue` + early return and the mic stays live. +- On watch, `captions`, `announced`, and `catalog-format` do not reflect + (the UI writes `controls.text.target` in `ui/components/captions.ts:58`), + and `parseCatalogFormat` (`watch/src/element.ts:109`) silently ignores an + invalid value. +- `MoqWatch` exposes `broadcast`, `video`, `audio`, `renderer`, and `sync` + as reassignable fields; make them `readonly`. + +Add reflection effects as watch already does for its other attributes. + +Public API: additive reflection; `readonly` fields reject reassignment. +Wire: none. diff --git a/quest/m1/cut-audit/element-teardown.md b/quest/m1/cut-audit/element-teardown.md new file mode 100644 index 00000000000..9c9af5ceb8d --- /dev/null +++ b/quest/m1/cut-audit/element-teardown.md @@ -0,0 +1,41 @@ +# [S] Removing a media element releases its devices + +## Goal + +Removing `` stops its camera, microphone, screen capture, +AudioContext, and preview, so the browser's recording indicator turns off. +Removing `` releases its decoded frames and WebGPU device. A +screen share picked after its run was torn down is stopped. No element is +pinned in memory by its own cleanup registry. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. Privacy for publish. + +- **Publish keeps capturing** (source-inferred, inherited): + `disconnectedCallback` (`js/publish/src/element.ts:333`) only flips + `#enabled`, which gates the connection and broadcast; sources are gated on + `#videoEnabled`/`#audioEnabled` (`:197`, `:379`), so camera, mic, capture, + the audio worklet, and the preview keep running after an SPA unmounts the + element. +- **Watch keeps GPU state** (source-inferred; the GPUDevice part is new on + main, `js/video` is absent on release): the last decoded `VideoFrame` + (`js/watch/src/video/decoder.ts:212`), the renderer's clone, and the + `GPUDevice` (`js/video/src/renderer.ts:150`) survive disconnect. +- **The registry backstop never fires** (reproduced under bun, 1000 of 1000 + targets never finalized): `cleanup.register(this, this.signals)` + (`publish/src/element.ts:188`, `watch/src/element.ts:229`) holds the + Effect strongly, and its closures capture `this`. Delete both registries. +- **Late screen share** (source-inferred, inherited): + `js/publish/src/source/screen.ts:87` never stops a stream the user picks + after `effect.race` returned undefined (a source switch or close while the + picker is open, realistic in Firefox). Stop the pending promise's tracks + in a cleanup, as `camera.ts:135` does. + +Gate source, capture, preview, and renderer surface on `#enabled`, and clear +the decoder frame when the broadcast is disabled. Writes coalesce per +microtask, so a DOM move costs nothing. The UI elements +(`watch/src/ui/element.ts:59`) already follow the `js/AGENTS.md` +connected/disconnected rule. + +Public API: none (behavior: capture stops on disconnect). Wire: none. diff --git a/quest/m1/cut-audit/flate-budget.md b/quest/m1/cut-audit/flate-budget.md new file mode 100644 index 00000000000..c2d48e532f0 --- /dev/null +++ b/quest/m1/cut-audit/flate-budget.md @@ -0,0 +1,26 @@ +# [XS] @moq/flate stops inflating at its budget + +## Goal + +If `@moq/flate` still ships at the cut, its decoder stops inflating as soon +as output passes its budget and returns tightly sized frames, like +`js/net/src/flate/decoder.ts` and Rust, so a compressed track's publisher +cannot burn seconds of main-thread CPU or pin 64 KiB per tiny frame. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. Reproduced with the +decoder logic copied, inherited. + +`js/flate/src/codec.ts:113-124` only sets `#tooLarge` in `onData`, so pako +inflates the whole slice first (a 510 KB slice inflated 512 MiB in 1.76 s); +every group gets a fresh decoder. `:141-146` returns a view into pako's +64 KiB chunk for a single-chunk result, so 8192 retained tiny frames pin +about 512 MiB. Reached via `hangz` (`js/watch/src/broadcast.ts:360`) and +`js/hang/src/timeline.ts:76`. + +Port the `js/net` decoder's behavior (throw inside `onData`, copy tight). +If [compressed tracks migration](/quest/m1/compress/migrate.md) deletes +`js/flate` before this starts, delete this quest instead. + +Public API: none. Wire: none. diff --git a/quest/m1/cut-audit/fmp4-sample-resolver.md b/quest/m1/cut-audit/fmp4-sample-resolver.md new file mode 100644 index 00000000000..444e1852fbe --- /dev/null +++ b/quest/m1/cut-audit/fmp4-sample-resolver.md @@ -0,0 +1,45 @@ +# [M] One fMP4 sample resolver for import and decode + +## Goal + +The fMP4 importer and the CMAF subscriber decode resolve samples through +one resolver that enforces non-empty, in-bounds, disjoint, and correctly +based samples. A moof of field-less truns can no longer cost gigabytes and +hundreds of thousands of groups, and ffmpeg output that uses +`base_data_offset` (the common `frag_keyframe+empty_moov` pipe recipe) +imports or is refused with a typed error instead of failing on a bogus +range. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. + +- **Zero-size samples** (reproduced; per-sample fan-out new on main from + [moq-dev/moq#6250](https://github.com/moq-dev/moq/pull/6250)): a moof of + 1000 field-less truns of 4096 entries with tfhd default size 0 is 4.1M + samples in 16 KB, since mp4-atom 0.16.2 materializes 4096 entries for a + trun without per-entry fields. Through import it took 6.3 GB RSS, 66-81 s + of CPU, and about 720k groups. Paths: + `rs/moq-mux/src/container/fmp4/import.rs:1052` (`with_capacity(total_samples)`), + `:1095-1128` (a 0-byte sample passes), `fmp4/sample.rs:87` + (`Claimed::take` returns early on empty), `import.rs:1380` (each sync + sample opens a group), and the subscriber-side `Wire::decode` + (`fmp4/mod.rs:533`), reached by any Rust subscriber of a cmaf track. +- **`base_data_offset`** (reproduced with ffmpeg 9.0.2, inherited): + `import.rs:1049-1069` and `fmp4/text.rs:72` treat the absolute file offset + as an mdat-relative one, failing the first fragment with + `SampleRangeOutOfBounds`. Resolve it against the moof's absolute position + with a per-source byte counter, or refuse it with a typed error as + `decode()` does at `mod.rs:523`. + +Fix: refuse zero-size media samples in the shared resolver, so each sample +costs at least one input byte, and make field-less truns bounded by design +in mp4-atom (refuse, or store a count) instead of its 4096 constant. The two +sample loops have drifted through repeated fixes +([moq-dev/moq#5078](https://github.com/moq-dev/moq/pull/5078), +[moq-dev/moq#6379](https://github.com/moq-dev/moq/pull/6379), +[moq-dev/moq#6686](https://github.com/moq-dev/moq/pull/6686)); one resolver +is a net deletion. If the mp4-atom change needs a release, land the +resolver here and track the bump separately. + +Public API: possibly a new `fmp4::Error` variant. Wire: none. diff --git a/quest/m1/cut-audit/ietf-withdraw-resolve.md b/quest/m1/cut-audit/ietf-withdraw-resolve.md new file mode 100644 index 00000000000..23b6c7330a8 --- /dev/null +++ b/quest/m1/cut-audit/ietf-withdraw-resolve.md @@ -0,0 +1,34 @@ +# [XS] Withdrawing a moq-transport FETCH or TRACK_STATUS ends it while it resolves + +## Goal + +A peer that withdraws a FETCH or TRACK_STATUS while its broadcast is still +resolving (a dynamic route, or a slow upstream on a relay) releases the +request stream, its stream credit, the origin front, and the upstream +request at once, as SUBSCRIBE does since +[moq-dev/moq#6643](https://github.com/moq-dev/moq/pull/6643) and as JS +already does. A locally closed session settles a waiting fill head instead of +dropping it unfinished. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. Inherited. + +- Reproduced: the `withdrawn_during` harness (`ietf/publisher.rs` about line + 11919) adapted to FETCH and TRACK_STATUS on drafts 18 and 22 left the serve + pending 5 simulated seconds after the withdrawal in all four cases. The + resolutions at `rs/moq-net/src/ietf/publisher.rs:2693` (standalone FETCH) + and `:3174` (TRACK_STATUS) are wrapped only in `gate.guard`. Resolve + through `self.until_withdrawn(&mut stream, ..)` inside the guard, like + SUBSCRIBE at about line 1267, and extend `withdrawn_during` to both. +- Source-inferred: `State::close` (`ietf/subscriber.rs:239`) drains + `subscribes` but not a `Fill::Ready` head, so the group producer drops + unfinished and readers see `Error::Dropped`. `abort` and + `remove_subscribe` already cancel it; `close` does the same. + +Public API: none. Wire: none. + +## Related + +- [Cancelled moq-transport requests stop](/quest/m1/ietf-request-cancel.md) - the subscriber side of the same lifecycle +- [moq-transport request leases](/quest/m2/ietf-request-lease.md) - the structural fix for this class diff --git a/quest/m1/cut-audit/jitter-admission.md b/quest/m1/cut-audit/jitter-admission.md new file mode 100644 index 00000000000..61d07960f77 --- /dev/null +++ b/quest/m1/cut-audit/jitter-admission.md @@ -0,0 +1,41 @@ +# [M] The export jitter buffer admits only frames due within its window + +## Goal + +The TS, MKV, and FLV exports' jitter buffer stays bounded by construction: +a track is read only while its next frame is due within the delay plus its +lead, so a track whose timestamps outrun real time is held back in its +source as backpressure instead of queued without bound beside an honest +track. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. Reproduced, new on main +(`jitter.rs` is not on release). + +`full()` (`rs/moq-mux/src/jitter.rs:1058`) reports a track full only once +its front frame is due, so future frames are always read and queued; +`bound()` (`:692`) gates only generation decisions; and the drift check +(`:517`) measures the steadiest track. With a 500 ms delay, audio at 1x and +video at 3x, the buffer grew linearly from 500 frames at 20 s to 3,006 at +120 s with no error. A fast track alone does fail, so one bad track stays +unbounded while an honest one sits beside it. Affects `ts/export.rs:442`, +`mkv/export.rs:485`, and the FLV export. + +Make admission the bound: a track is full once its front frame is due later +than now plus delay plus its lead. No frame-count cap. Alternatively charge +a track whose lead keeps growing as a source fault. + +Then evaluate the larger simplification: about a dozen fixes to the export +clock (f85547ffd0, 5d5974f083, 3fdf46160b, e84ffb3de3, a1465d0d00, +11bfa30461, 3cf978cdbf, 493d8eee99, 7a3890cd30, 3b77d23015, 7c4c48d08b, +41f3087e3c) each added a rule about which frames count. With admission as +the single invariant, check whether acquisition, the leapt/lagging arms, +and some of the nine tuning constants can go. Land what the measurement +supports; record what it does not. + +Public API: none. Wire: none. + +## Related + +- [TS fidelity and recovery](/quest/m1/ts-reliability/README.md) - the import side's state ownership diff --git a/quest/m1/cut-audit/js-close-cause.md b/quest/m1/cut-audit/js-close-cause.md new file mode 100644 index 00000000000..c6914a9d9ed --- /dev/null +++ b/quest/m1/cut-audit/js-close-cause.md @@ -0,0 +1,48 @@ +# [S] JS tracks end clean only on a deliberate finish + +## Goal + +In `@moq/net`, a received track or group ends cleanly only when its +publisher deliberately finished it. A local session close, a reload, a peer +protocol violation, or a request the publisher never answered ends the +affected tracks and open groups with an error, as Rust does, so players and +resumed readers recover instead of treating truncation as a finish. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. All three reproduced. + +- **Local close truncates open groups** (inherited behavior, new hook): + `track.ts:1761` closes every cached group with `abort === undefined` when + `hooks.releaseTrack` (`track.ts:819`, called from `lite/subscriber.ts:1803` + and `ietf/subscriber.ts:977`) or the public `Producer.close()` runs. A + group with frame 1 still in flight reads as complete, and a resumed + reader's `Recover` never refills it. Rust `track::Producer::close` + (`rs/moq-net/src/model/track.rs:3046`) aborts open groups with a session + cancel; the JS hook's doc claims to mirror it. Abort open groups with a + cancel error and keep finished groups readable. +- **A lite protocol violation ends tracks cleanly** (new on main, from + [moq-dev/moq#5550](https://github.com/moq-dev/moq/pull/5550) and + [moq-dev/moq#5279](https://github.com/moq-dev/moq/pull/5279)): + `lite/connection.ts:365` and `:198` call the public `abort()`, which closes + the subscriber with no error and empties `#subscribes`, so the later + `close(fatal ?? closeError)` at `:307` does nothing. Add a private + `#fail(err)` that closes the subscriber with the error before closing the + transport; the public `abort()` stays clean. +- **An unanswered request ends clean and empty** (inherited): + `broadcast.ts:152` calls `request.reject()` with no error, and + `track.ts:387` turns that into a clean end at `{0,0}`. Reject with a + Dropped-coded error, matching Rust's `model/broadcast.rs:752`, and make + `Request.reject(err: Error)` require its argument. + +The audit traced a family of earlier fixes to the same root: `close()` with +no argument means clean at every layer, and each cancellation source tears +down separately (b99cad9d5c, c83c141166, 2704e10e20, 7f75925ac5, +097dc1ee62, 333d963760). Prefer one session-level terminal cause that every +teardown path reads over three more point fixes, if it stays small; the +larger JS restructure is not worth it ahead of +[rs2ts](/quest/m2/rs2ts/README.md). + +Public API: breaking. `Request.reject` requires an error (callers pass one), +and `Producer.close()` aborts groups still open. Wire: a rejected request's +error code changes. diff --git a/quest/m1/cut-audit/js-ietf-violations.md b/quest/m1/cut-audit/js-ietf-violations.md new file mode 100644 index 00000000000..396d2c0bb07 --- /dev/null +++ b/quest/m1/cut-audit/js-ietf-violations.md @@ -0,0 +1,43 @@ +# [S] JS moq-transport sessions close on peer violations and bound reflected namespaces + +## Goal + +A JS moq-transport session closes with the violation's code when the peer +breaks the protocol, as Rust does, never leaves an unhandled rejection +behind a reset SUBSCRIBE_TRACKS, and bounds the namespace entries a peer can +make it hold with the same announce slots Rust uses. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. Skip anything that only +affects drafts 14-17 or 19-21; [moq-transport 18 and 22 only](/quest/m1/ietf-drop/README.md) +deletes them (including the control-stream adapter's request-ID stall the +audit also found). + +- **Reflected NAMESPACE entries take no slot** (source-inferred, new on main + from [moq-dev/moq#5932](https://github.com/moq-dev/moq/pull/5932)): + `js/net/src/ietf/subscriber.ts:641` stores a reflected entry in `live` + without an `#announced` slot. A peer that learned our Hop ID from SETUP + can grow `live` without bound. Take the slot for every live + advertisement before deciding, as Rust does + (`rs/moq-net/src/ietf/subscriber.rs:1449`, test + `a_reflected_namespace_holds_an_announce_slot`), and release it on + NAMESPACE_DONE or stream end. +- **Unhandled rejection** (reproduced under Bun, new on main): + `ietf/publisher.ts:2347` derives `this.#quic.closed.then(() => "closed")` + with no rejection handler; a SUBSCRIBE_TRACKS reset early leaves it + unobserved when the transport later dies. In Node or Bun hosts that kills + the process by default. Handle both outcomes, as line 1676 does. + SUBSCRIBE_TRACKS is under a week old; read the rest of its JS path while + there. +- **Violations close with the wrong code** (source-inferred, inherited), all + through the existing `#fail`/`#violated` path: + - `ietf/subscriber.ts:1281` closes a duplicate track alias with code 0; + Rust uses the Duplicate code (`subscriber.rs:3423`). + - `ietf/connection.ts:501` closes cleanly on an unsolicited + PUBLISH_NAMESPACE; Rust returns ProtocolViolation. + - `ietf/connection.ts:445` aborts only the stream when REQUEST_UPDATE is a + bidi stream's first message; Rust closes the session with + `UnexpectedStream`. + +Public API: none. Wire: only the close code the peer sees. diff --git a/quest/m1/cut-audit/js-json-strict.md b/quest/m1/cut-audit/js-json-strict.md new file mode 100644 index 00000000000..0dc6f59d8cd --- /dev/null +++ b/quest/m1/cut-audit/js-json-strict.md @@ -0,0 +1,28 @@ +# [XS] JS JSON and MSF readers refuse what Rust refuses + +## Goal + +`@moq/json` and `@moq/msf` refuse the same malformed input Rust does, so a +browser and a Rust reader never disagree about one catalog. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. JS side reproduced, +Rust side source-inferred. The UTF-8 handling is inherited; the strict parse +pass ([moq-dev/moq#5941](https://github.com/moq-dev/moq/pull/5941)) is new +on main. + +- `js/json/src/parse.ts:3` uses a default `TextDecoder`, which replaces + invalid UTF-8, strips a BOM, and accepts lone surrogates; + `serde_json::from_slice` rejects all three. Use + `new TextDecoder("utf-8", { fatal: true, ignoreBOM: true })` and check + `isWellFormed()` in the existing walk (`:15`). +- `js/msf/src/catalog.ts:153-179` accepts a missing or non-inline `initRef`, + an `initRef` conflicting with `initData`, and duplicate keys (last wins); + `rs/moq-msf/src/lib.rs:339-365` refuses each. Mirror the three checks. + +Public API: none. Wire: none. + +## Related + +- [MSF duplicate init](/quest/m1/msf-duplicate-init.md) - the repeated `initDataList` id in the same reader diff --git a/quest/m1/cut-audit/js-ledger.md b/quest/m1/cut-audit/js-ledger.md new file mode 100644 index 00000000000..89a034c6bd9 --- /dev/null +++ b/quest/m1/cut-audit/js-ledger.md @@ -0,0 +1,28 @@ +# [S] The JS gap ledger costs O(log n) per sparse arrival + +## Goal + +`@moq/net`'s gap `Ledger` handles sparse arrivals in O(log gaps) and expires +in O(1) when nothing is due, like Rust's since +[moq-dev/moq#6287](https://github.com/moq-dev/moq/pull/6287). A sparse or +hostile publisher can no longer drive quadratic main-thread CPU, and a sweep +benchmark shows the flat slope. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. Reproduced, inherited +(main widened it to every track). + +`js/net/src/ledger.ts:38-85` rebuilds its array in `account` off the in-order +fast path, and `expire` rebuilds it on every arrival because `tail.ts:109` +calls it unconditionally. It runs per datagram (`lite/subscriber.ts:1714`), +per group stream (`:1592`), and from `track.ts:1637`. Sequences 0, 2, 4, ... +within `maxDelay` measured 81 ms for 2k arrivals, 460 ms for 8k, and 12.1 s +for 32k. + +Mirror the Rust ledger: sorted runs with binary search, and a cached +earliest-fold instant so `expire` returns at once when nothing is due. Add a +sweep to `js/net/bench/` over arrival count. Verify in Chromium per the +repository's browser benchmark path. + +Public API: none. Wire: none. diff --git a/quest/m1/cut-audit/js-media-cleanups.md b/quest/m1/cut-audit/js-media-cleanups.md new file mode 100644 index 00000000000..60f7e7cb789 --- /dev/null +++ b/quest/m1/cut-audit/js-media-cleanups.md @@ -0,0 +1,24 @@ +# [S] Signals and the encoded preview keep their promises + +## Goal + +`Computed.close()` resets its value as `js/AGENTS.md` and its doc promise, +and `` survives bitrate changes and errors +instead of blanking or stopping for good. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. Source-inferred, +inherited. + +- `js/signals/src/index.ts:1193` closes a `Computed` but keeps its last + value and never notifies, so an outside holder keeps a stale derived value + (documented otherwise at `:1153`). Set it to undefined after closing, or + fix the docs if a consumer depends on the current behavior. +- `js/publish/src/preview.ts:231-264` rebuilds its encoder and decoder on any + `encoder.out.resolved` change, which includes the grant bitrate sampled + every 100 ms, so the preview blanks until the next keyframe; any error + closes it permanently. Key the rebuild on codec and size, apply bitrate + with `configure()`, and recover on the next change after an error. + +Public API: none. Wire: none. diff --git a/quest/m1/cut-audit/js-net-cleanups.md b/quest/m1/cut-audit/js-net-cleanups.md new file mode 100644 index 00000000000..a3cda75846a --- /dev/null +++ b/quest/m1/cut-audit/js-net-cleanups.md @@ -0,0 +1,49 @@ +# [S] Small @moq/net divergences from Rust are fixed + +## Goal + +`@moq/net` matches Rust on four small behaviors the pre-cut audit found: +lite-03/04 sessions get probe estimates, a group's `consume()` starts at +frame 0, `Connection.accept()` has the same handshake deadline and +close-on-failure as `connect()`, and an empty JSON frame fails instead of +reading as EOF. Dead code found alongside is gone. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. + +- **No PROBE on lite-03/04** (reproduced, inherited): + `js/net/src/lite/subscriber.ts:1753` waits on `#peerProbeLevel`, but + lite-03/04 have no SETUP stream, so it never resolves and ABR gets no + estimates on moq-lite-04, which is in the default list. Gate on + `hasSetupStream(version)` like Rust (`rs/moq-net/src/lite/subscriber.rs:1453`). + Add a two-`Connection` test; the unit tests build `Subscriber` without + `peerSetup`, which hid this. +- **`group.Producer.consume()` shares a cursor** (reproduced, inherited): + `group.ts:269` returns `makeConsumer(this.#state)`, so a later reader + starts where an earlier one left off. Return an independent handle, as + `mirror()` does; `#cachedLargest` (`track.ts:1262`) needs only + `frameCount`. +- **`Connection.accept()` has no deadline** (source-inferred, inherited): + `connection/accept.ts` waits forever for SETUP and leaves the transport + open on a malformed one. Reuse `connectTransport`'s race-and-close, with + additive `timeout`/`signal` options, matching Rust's `server.rs` + `Error::Timeout`. +- **Empty JSON frame reads as EOF** (reproduced, inherited): `group.ts:993` + and `track.ts:2821` treat an empty frame as end of stream, so `zod.read` + stops silently; `group.Consumer.readBool` skips validation. Fail loud. +- **Dead code:** the `timescale` Signal wait in `lite/subscriber.ts:1615` + and `:1705` can never block (it is set before the entry registers); make + it a plain number. `Reload.announced()` and `stats()` + (`connection/reload.ts:660`) appeared to have only test consumers (the + public `Connection` in `pool.ts` has its own), and `announced()` registers + a root cleanup per call that is never released, the pile-up `pool.ts:341` + already fixed. Confirm no other consumer, then delete both; otherwise fix + the leak. + +Public API: `accept()` gains optional `timeout`/`signal`; `Reload.announced()` +and `stats()` are removed if `Reload` is exported. Wire: none. + +## Related + +- [JS reload config](/quest/m1/js-reload-config.md) - the other `Reload` change before the cut diff --git a/quest/m1/cut-audit/lite-wire-nits.md b/quest/m1/cut-audit/lite-wire-nits.md new file mode 100644 index 00000000000..fde495704b9 --- /dev/null +++ b/quest/m1/cut-audit/lite-wire-nits.md @@ -0,0 +1,43 @@ +# [S] Lite's version gates, refusals, and draft text agree + +## Goal + +The lite code and `drafts/draft-lcurley-moq-lite.md` agree on which version +carries each message and parameter, malformed values that today decode and +vanish are refused, and the one refuse-only constant in lite's parameter +decoding is gone. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670, all source-inferred. + +- **UNAUTHORIZED (0x3B)** is sent on lite-05/06 (`rs/moq-net/src/lite/error.rs:281`, + no version gate), as [In-band auth](/quest/m1/auth/README.md) decided + ([moq-dev/moq#5004](https://github.com/moq-dev/moq/pull/5004)), but the + draft's changelog lists it under lite-07 only. Fix the draft. +- **Implementation (0x6) SETUP parameter** is parsed on lite-05/06 + (`lite/setup.rs:283`, JS `js/net/src/lite/setup.ts:286`), where those + drafts call it unknown and ignored, so a non-UTF-8 value from an old peer + becomes a protocol violation. Gate it on lite-07 like `has_ietf()`. New on + main ([moq-dev/moq#6520](https://github.com/moq-dev/moq/pull/6520)). +- **SUBSCRIBE_DROP with start > end + 1** decodes and is dropped as an empty + range (`lite/subscribe.rs:543-556`). Refuse it with `InvalidValue`, in Rust + and JS. +- **`MAX_PARAMS = 64`** (`lite/parameters.rs:5`) exists only because the + duplicate check is a linear scan. Use a set and delete the constant; the + 64 KiB SETUP bound already limits the count. +- **Draft text:** the Fetch section mentions an "implicit" Subscribe ID that + FETCH does not have, and the `(s)`/`(b)` notations are never defined. +- **Partial groups (decision):** a lite subscription GROUP with + `frame_start > 0` is cached as a group tail (`lite/subscriber.rs:1033`) so a + front can continue a group across routes, while `rs/moq-net/AGENTS.md` + says never to emit or accept partial groups, except for moq-transport + passthrough. Recommendation: keep the code, since resume depends on it, + and ask the maintainer to add route continuation to that rule's + exceptions. Agents never edit `AGENTS.md` unprompted, so leave this under + `## Decisions needed` if the maintainer has not answered. + +Validate with `just drafts check`. + +Public API: none. Wire: the Implementation gate and the DROP refusal change +what lite-05/06 peers may send without error; no encoding changes. diff --git a/quest/m1/cut-audit/mkv-import-errors.md b/quest/m1/cut-audit/mkv-import-errors.md new file mode 100644 index 00000000000..0bf1210e80c --- /dev/null +++ b/quest/m1/cut-audit/mkv-import-errors.md @@ -0,0 +1,39 @@ +# [S] A malformed MKV track fails the import instead of vanishing + +## Goal + +The MKV importer fails loud on a malformed track, a duplicate track +number, or an invalid timestamp, instead of publishing a catalog that +silently lacks the track or carries collapsed timestamps. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670, source-inferred. + +- `handle_tracks` (`rs/moq-mux/src/container/mkv/import.rs:338`) logs and + skips every `add_track` error except an allowlist (`InvalidSubtitle`, + `InvalidAspect`, `ValueOutOfRange`). `InvalidColour` + ([moq-dev/moq#5846](https://github.com/moq-dev/moq/pull/5846)), a malformed + avcC/hvcC, or a missing AAC CodecPrivate drops the video track and the + catalog goes out audio-only. Every validation fix has had to extend the + allowlist by hand ([moq-dev/moq#6532](https://github.com/moq-dev/moq/pull/6532)). + Return `Ok` only for an unsupported role or codec, decided where the error + is raised, and propagate everything else; delete the allowlist. +- A duplicate `TrackNumber` (`:452`) replaces the earlier track. Refuse it. +- `cluster_timestamp as i64 + block.timestamp` (`:533`) can overflow (a + wrap in release builds, misreported as `NegativeBlockTimestamp`), and + `TimestampScale = 0` (`:289`) collapses every timestamp to 0. Use + `checked_add_signed` and refuse a zero scale. +- While in moq-mux codecs: `codec/vp9/mod.rs:140` computes + `(r.read(16)? + 1) as u16`, so a 65536 dimension becomes 0 in the catalog. + Use `u32`, like the catalog field. + +Decision for the maintainer: MKV and FLV (`flv/import.rs` about lines 215, +302, 359, 431) drop unsupported codecs by design, which contradicts +`rs/moq-mux/AGENTS.md` ("Reject an unsupported codec ... with a typed +Error"). Recommendation: keep dropping unsupported codecs in container +imports (a file with a subtitle or an exotic audio track should still +import its video) and ask the maintainer to scope that rule to codec +importers. Leave it under `## Decisions needed` if unanswered. + +Public API: none. Wire: none. diff --git a/quest/m1/cut-audit/peer-loop-budget.md b/quest/m1/cut-audit/peer-loop-budget.md new file mode 100644 index 00000000000..f2a43d186ea --- /dev/null +++ b/quest/m1/cut-audit/peer-loop-budget.md @@ -0,0 +1,37 @@ +# [S] Peer-driven receive loops yield on a per-message budget + +## Goal + +A peer streaming small messages at line rate (SUBSCRIBE_UPDATEs, announces, +datagrams, or moq-transport PADDING) cannot keep a session's driver busy +until its source runs dry. Every peer-driven receive loop yields on a +per-message `kio::coop::Budget`, as lite's probe, padding, and TRACKS loops +already do, and a burst of updates that change nothing does no work. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. Source-inferred, +inherited. + +The lite session is one `Driver::poll`, so a loop that never yields starves +the session's other arms (accept, PROBE, other prefixes) and its worker. +Loops without a per-message budget: + +- `RequestServe::poll_requester` (`rs/moq-net/src/lite/publisher.rs:1770`): + the budget at about line 1640 is charged once per outer loop. Each 9-byte + SUBSCRIBE_UPDATE runs `TrackRun::update` (about line 3771), which wakes + every in-flight group task, re-ranks, and on a relay republishes upstream, + even when nothing changed. +- The announce prefix loop (`lite/subscriber.rs:1782`) and `DatagramRecv` + (`lite/subscriber.rs:1403`). +- moq-transport's draft-18+ PADDING drain (`rs/moq-net/src/ietf/session.rs:1146`) + awaits ready chunks in a loop; lite added a budget for the same reason in + [moq-dev/moq#6233](https://github.com/moq-dev/moq/pull/6233). Share one + padding drain between lite and IETF. + +Charge the budget per message. For updates, each replaces the last: keep +only the newest (and the largest `wanted_group`) and skip the steer write +when nothing changed. A test floods each loop and asserts a sibling arm +still makes progress. + +Public API: none. Wire: none. diff --git a/quest/m1/cut-audit/publish-announce-latch.md b/quest/m1/cut-audit/publish-announce-latch.md new file mode 100644 index 00000000000..9ee1045e6b6 --- /dev/null +++ b/quest/m1/cut-audit/publish-announce-latch.md @@ -0,0 +1,31 @@ +# [S] A camera broadcast stays announced across unmute and device swaps + +## Goal + +Once `` has announced a camera broadcast, unmuting, unhiding, +picking another device, or a capture retry does not unannounce and +re-announce it, so viewers do not stop and restart on each flap. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. Source-inferred, +inherited. + +`js/publish/src/announce.ts:37-44`: on unmute, `audioEnabled` flips true at +once but the Microphone source stays undefined until `getUserMedia` +resolves, so `ready`, `live`, and `announcing` go false and the broadcast +unannounces until the mic arrives. The same happens on unhide, a device +change, and each retry backoff. `announcing.peek()` bypasses only `settled`, +not `ready`. `announce.test.ts` (about line 211) keeps `source` set, which a +real source never does during a swap, so it passes. + +Once announced, latch on the selection (a source chosen and the element +connected), not on momentary track presence; keep the partial-broadcast +guard for the first announce only. Fix the test to clear the source during +the swap. + +Public API: none. Wire: none. + +## Related + +- [Drop announce="never"](/quest/m1/publish-announce-never.md) - the same attribute's other change before the cut diff --git a/quest/m1/cut-audit/reserved-route-return.md b/quest/m1/cut-audit/reserved-route-return.md new file mode 100644 index 00000000000..6fc900f42c4 --- /dev/null +++ b/quest/m1/cut-audit/reserved-route-return.md @@ -0,0 +1,43 @@ +# [S] A reserved group survives a route returning to an earlier copy + +## Goal + +A resumed reader that peeked a group keeps that reservation when its route +flips A to B and back to A, and its next take returns the reserved group +instead of panicking at `resume.rs`'s `unreachable!("the peek reserved a +group")`. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. Reproduced, new on main +(release's splice design has no peek path). + +A reservation lives in two places: `Reader.peeked` (a `Candidate`) and the +copy cursor's `Cursor.peeked`. On a return to copy A, `Reader::sync` +(`rs/moq-net/src/model/resume.rs:958-990`) reuses A's copy, raises its floor, +and calls `set_range` (`model/track.rs:7013`), which clears the cursor's +reservation while `Reader.peeked` survives. If the reserved group was evicted +meanwhile, or sits below the new floor, the take hits `unreachable!` (about +`resume.rs:1250`) or the `assert_eq!` after it. In production the peek path +runs when a route copy is itself a front's logical track (origin-to-origin +chaining), and the flip must land between peek and take; the panic is +contained to the session by b685511410. + +The audit's reproduction, a unit test for `resume.rs`'s test module: build a +nested logical track, write group 0 on copy A and drain it, write and finish +group 2, `poll_peek_group` it, abort group 2 with `Error::Evicted`, serve +copy B, serve copy A again, then take with both `poll_next_group` and +`poll_recv_group`. It panics in both orders. + +Fix direction: the `Candidate` carries the reserved `group::Consumer` itself, +plus a cursor step that commits the sequence, so a take never re-queries a +cursor that `set_range` or `update` may have reset. That deletes the +`unreachable!`/`assert_eq!` pair. The narrower alternative is a `set_range` +that keeps a reservation still inside its new bounds. + +Public API: none. Wire: none. + +## Related + +- [One route phase](/quest/m1/cut-audit/route-phase.md) - the other small resume fix ahead of the cut +- [Resume as producer replacement](/quest/m2/resume-redesign.md) - the redesign that deletes the two-level reservation diff --git a/quest/m1/cut-audit/route-phase.md b/quest/m1/cut-audit/route-phase.md new file mode 100644 index 00000000000..1b08c7591b5 --- /dev/null +++ b/quest/m1/cut-audit/route-phase.md @@ -0,0 +1,26 @@ +# [XS] A route's terminal state is one phase + +## Goal + +The resume route's "no front will replace this copy" state is one `Phase` +enum with a single `terminal()` check, so no call site can test the wrong +subset of flags again. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. Source-inferred, new on +main. + +`Route.end`, `Route.concluded`, and the kio producer's `is_closed()` all mean +the route is done, and the call sites in `rs/moq-net/src/model/resume.rs` +(about lines 210, 309, 324, 1650, 1704, and `Fetching::poll` via `end()`) +each combine a different subset. 109235732c fixed a stalled read spinning +forever because `Recover::wants` lacked `is_closed()`; `poll_changed`'s +closure still omits it and relies on kio returning Ready once closed. + +Replace the three with one phase (for example Serving, Parked, Between, +Concluded, Ended(result)), set in `Drop for Producer` too, and route every +check through `terminal()`. Behavior-preserving; the existing resume tests +are the guard. + +Public API: none. Wire: none. diff --git a/quest/m1/cut-audit/rtmp-amf0-budget.md b/quest/m1/cut-audit/rtmp-amf0-budget.md new file mode 100644 index 00000000000..a665f8b5984 --- /dev/null +++ b/quest/m1/cut-audit/rtmp-amf0-budget.md @@ -0,0 +1,35 @@ +# [S] AMF0 decoding costs no more than the bytes a peer sent + +## Goal + +An RTMP peer cannot make a listener allocate more memory for decoded AMF0 +values than a small constant factor of the message bytes it already paid +for under the connection's assembly budget. One 16 MiB message of Null bytes +no longer allocates about 940 MB before connect or auth. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. Source-inferred and +spot-verified, inherited. Reachable on any host running +`moq import rtmp --listen`. + +`amf0::deserialize` (`rs/moq-rtmp/src/rml/amf0/deserialization.rs:18`) +pushes one `Amf0Value` (56 bytes) per input value, so a type-18 data message +of 16,777,215 `0x05` bytes (accepted under `MAX_ASSEMBLY_BYTES`, 64 MiB) +becomes 16.7M values, then is discarded. It is reached from +`rml/messages/message_payload.rs:57` for message types 15, 17, 18, and 20 +via `ServerSession::handle_input`. Object properties amplify about 25x. + +Fix direction, bounded by design rather than a value-count constant: +decode commands lazily into the typed fields the session actually reads +(command name, transaction id, the few `connect`/`publish`/`play` fields), +and skip the rest by length, or charge each decoded node against the +connection's assembly budget. A test feeds the Null-byte message and asserts +the decode's peak allocation stays within a small multiple of the input. + +Public API: none. Wire: none. + +## Related + +- [AMF0 exact reads](/quest/m1/rtmp-amf0-exact-reads.md) - the truncated-string fix in the same decoder +- [RTMP sessions follow one strict path](/quest/m1/cut-audit/rtmp-session-strict.md) - the session layer above this decoder diff --git a/quest/m1/cut-audit/rtmp-session-strict.md b/quest/m1/cut-audit/rtmp-session-strict.md new file mode 100644 index 00000000000..d6739d5c038 --- /dev/null +++ b/quest/m1/cut-audit/rtmp-session-strict.md @@ -0,0 +1,58 @@ +# [M] RTMP sessions follow one strict path + +## Goal + +An RTMP connection, accepted or dialed, moves through one linear path +(handshake, connect, one stream, one publish or play) and refuses anything +off it. A peer can no longer hold a listener's pending slots with idle +sockets, grow per-session state by repeating requests, replace a live +broadcast through a publish on a stream it never created, or freeze a +broadcast with a timestamp rewind; a stalled server no longer hangs the +client forever. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670, all source-inferred +and inherited. The chunk layer is well bounded after a run of fixes +(f7433105d9, 4040d338ef, 0bd28eb165, 529d2101d6, 16875d620b, b0eca5022f); +the permissive vendored `ServerSession` above it is not. + +- **Idle sockets lock out encoders:** `rs/moq-rtmp/src/server.rs:64` and + `:348` stop accepting while 128 handshakes are pending, so an attacker + re-opening 128 silent connections every 15 s blocks every encoder. Keep + accepting, evict the oldest pending handshake, and give C0/C1 a short + deadline of its own. This replaces a constant whose only effect is a + refusal. +- **Requests held for the session's life:** + `rml/sessions/server/mod.rs:534`, `:926`, and `:968` add to + `outstanding_requests` (and `active_streams` on `createStream`); the pumps + at `server.rs:1265` ignore those events and never remove them, and nothing + is written back, so repeating `connect` with a 64 KB `app` grows state 1:1 + with no backpressure. Refuse a second `connect` as a protocol error and + answer requests the gateway will not act on with `reject_request`. +- **Publish on a never-created stream** (`rml/sessions/server/mod.rs:846`): + `Publish::accept` replaces the live broadcast under a fresh epoch before + `accept_publish_request` fails, and the `Publisher` drops without + `abort`, so subscribers see `Error::Dropped`. Validate the stream id in + the session layer and reply `_error`. +- **Timestamp rewind freezes instead of ending:** `server.rs:1247` and + `dial.rs:411` log a warning per frame on `TimestampRewind` and keep the + connection, while `doc/bin/rtmp.md:39` says the push ends. Treat a rewind + as fatal and abort the push, so the encoder's reconnect publishes a new + epoch; per-tag demux faults stay non-fatal. +- **Client deadlines:** `dial.rs` has no deadline on connect/handshake + (about lines 109-160) or `await_event` (440-478), and no media idle bound + in `pull_media` (371-395). Reuse the server's request and idle budgets. + +A strict linear state machine with typed command decoding removes the first +three by construction and shrinks the vendored surface; prefer it over three +point fixes. Note that every handshake runs inside `Server::accept`'s +`FuturesUnordered`, so a future rml panic would take down the listener; +none is reachable today. + +Public API: none. Wire: none (refusals reply `_error`). + +## Related + +- [AMF0 decoding costs no more than the bytes a peer sent](/quest/m1/cut-audit/rtmp-amf0-budget.md) - the decoder under this session layer +- [RTMP client errors](/quest/m2/rtmp-client-error.md) - `_error` reporting on the client diff --git a/quest/m1/cut-audit/uds-allowlist-first.md b/quest/m1/cut-audit/uds-allowlist-first.md new file mode 100644 index 00000000000..076d1d1f455 --- /dev/null +++ b/quest/m1/cut-audit/uds-allowlist-first.md @@ -0,0 +1,20 @@ +# [XS] The Unix-socket allowlist is checked before any peer bytes are parsed + +## Goal + +A local user outside a Unix-socket listener's allowlist is refused on its +peer credentials before the server parses a single byte from it. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. Source-inferred, +inherited; local only. + +`rs/moq-tokio/src/server.rs:1355` makes the socket `0o666`, and the +allowlist check (`allow.permits`, about line 1516) runs only after +`within(deadline, pending)` has run `qmux::uds::accept` +(`unix.rs:356-372`), so any local user reaches the qmux negotiation parser. +Read `peer_cred` and check the allowlist first, then negotiate. A test +connects as a refused credential and asserts no negotiation runs. + +Public API: none. Wire: none. diff --git a/quest/m1/cut-audit/uring-listen-config.md b/quest/m1/cut-audit/uring-listen-config.md new file mode 100644 index 00000000000..b726a04b1a5 --- /dev/null +++ b/quest/m1/cut-audit/uring-listen-config.md @@ -0,0 +1,32 @@ +# [S] Every relay runtime honors or refuses each listen setting + +## Goal + +A relay listen setting a runtime cannot deliver refuses to start, as +`doc/bin/relay/config.md` promises, on the io_uring workers as on tokio. +Each runtime maps `listen::Config` by exhaustive destructuring, so a new +field fails to compile until every runtime decides what to do with it. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. Source-inferred, +inherited. + +`Workers::bind` (`rs/moq-relay/src/uring.rs:135-265`) refuses +`listen.lb.id` but never reads `preferred_v4`/`preferred_v6`, and +moq-uring's `quic::server::Config` has no such knob (compare tokio's +`rs/moq-tokio/src/quic/backend.rs:796`). So `--runtime-io-uring +--listen-preferred-v4 192.0.2.1:443` starts cleanly and no client ever +migrates. The shared stream server uses `init_streams()` (`relay.rs:268`), +which skips `validate_stream_only`, so nothing refuses it. + +Refuse both fields in `Workers::bind` (or implement them), and destructure +`listen::Config` with no `..` in every runtime mapping (`uring.rs`, +`rs/moq-tokio/src/server.rs:424`, `websocket.rs:66`). + +Public API: none. Wire: none. Config: an ignored combination now refuses to +start; note it in `doc/bin/relay/`. + +## Related + +- [One relay serve path](/quest/m2/relay-serve-path.md) - removes the duplicated mapping this quest guards diff --git a/quest/m1/cut-audit/watch-audio-hole.md b/quest/m1/cut-audit/watch-audio-hole.md new file mode 100644 index 00000000000..feed0d322f0 --- /dev/null +++ b/quest/m1/cut-audit/watch-audio-hole.md @@ -0,0 +1,49 @@ +# [M] A media hole in the player keeps the timeline + +## Goal + +When `` skips a group (a max-delay skip or a hole timeout), audio +and video treat it as a hole on the same timeline: the decoder re-primes, +the audio ring keeps the PCM already decoded, and the shared `Sync` clock +keeps its anchor. Only a real new timeline (a declared end followed by a +later group, or a new instance) re-anchors, as Rust's `moq-audio` already +behaves. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. Source-inferred, +inherited (release resets on container `discontinuity` the same way). + +With 20 ms audio groups under congestion, one lost group runs +`#onRead` (`js/watch/src/audio/decoder.ts:891`) -> `Terminal` gap -> +`#restart()` (`audio/terminal.ts:57`): `this.sync.reset()` bumps the epoch, +dropping every decoded video frame parked in `Sync.wait` (`sync.ts:304`), +and `this.reset()` zeroes the worklet ring (`ring-buffer.ts:216`). 20 ms of +loss throws away a floor of valid PCM and re-stalls playback; video skips its +in-flight frames. Rust's `rs/moq-audio/src/decode/consumer.rs:513` resets +codec prediction only and plays silence through the hole. +`decoder.test.ts:1182` asserts the flush (with an 840 ms gap) and changes +with the fix. + +- Make the container read distinguish a hole from a new timeline, in + `@moq/hang`'s consumer if that is where the distinction is known. +- On a hole: `decoder.reset()`/`configure()` (Chrome stamps output from its + first input) and re-prime the `Terminal` epoch; keep the ring (it is + timestamp-indexed) and `Sync`. Apply the same to video's `#onBreak` + (`video/decoder.ts:606`, `:691`). +- Each decoder has near-identical legacy and CMAF read loops + (`audio/decoder.ts:522-664`, `video/decoder.ts:589-728`); fold each into + one loop over the container format first if that makes the change land + once instead of twice. + +The audit traced about a dozen watch fixes to resets of the shared clock and +ring (8b6abc0a13, 69b0538326, 1696858a0f, 177e92c755, 1a98a3aea7, +076cfb7500, c09e14995a, 4311a7c9a7, 8b83bb5f8a, d6e4f47238, 41906d97e0); +with only a new timeline re-anchoring, most reset call sites should go. + +Public API: none. Wire: none. + +## Related + +- [A/V clock](/quest/m1/av-clock.md) - the video-skip half, and the audio playhead driving `Sync` +- [Buffered playback subscribes in ascending order](/quest/m1/buffered-ascending.md) - the buffered-mode half of the same timeline diff --git a/quest/m1/cut-audit/watch-source-robust.md b/quest/m1/cut-audit/watch-source-robust.md new file mode 100644 index 00000000000..97209867463 --- /dev/null +++ b/quest/m1/cut-audit/watch-source-robust.md @@ -0,0 +1,28 @@ +# [S] One bad rendition never leaves the player with nothing + +## Goal + +A malformed audio rendition is skipped like an unsupported one, leaving its +siblings available, and conflicting video selection filters fall back to a +rendition instead of a black screen. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. Source-inferred, +inherited. + +- `js/watch/src/audio/source.ts:94-115` probes each rendition with + `AudioDecoder.isConfigSupported` inside `try/finally` with no `catch`. A + rendition with `codec: ""` (the schema allows it) rejects with TypeError, + the spawn fails, `available` is never published, and a stale previous + value survives. Catch per rendition as `video/source.ts:278` does, and + consider sharing one probe loop with video's support cache (audio + re-probes every rendition on every catalog update). +- `video/source.ts:339` and `:384`: the element always sets a dimension + target and the probe a bitrate target; `byBitrate` drops renditions + without `bitrate` and `byDimensions` those without coded size, so with + partial metadata the rankings can share no name and `#select` returns + undefined, clearing the frame. On conflict fall back to the first ranking's + best rendition, never to nothing. + +Public API: none. Wire: none. diff --git a/quest/m1/cut-audit/watch-volume-mute.md b/quest/m1/cut-audit/watch-volume-mute.md new file mode 100644 index 00000000000..0585364a589 --- /dev/null +++ b/quest/m1/cut-audit/watch-volume-mute.md @@ -0,0 +1,20 @@ +# [XS] Muted and volume are independent on the watch element + +## Goal + +`` starts muted, and unmuting plays at 0.8, in +either attribute or property order. Muting no longer rewrites `volume`. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. Reproduced, inherited. + +Two effects in `js/watch/src/element.ts:259-273` write each other's signal +in the same flush: setting `volume` then `muted` in one tick ends unmuted at +0.5, losing both. Delete the coupling; the `Emitter` already takes `muted` +and `volume` separately, so apply `muted ? 0 : volume` at the gain node. A +test sets both in each order in one tick. + +Public API: behavior change (muting no longer zeroes the `volume` +attribute or property, and a zero volume no longer reports as muted); worth +making before the cut. Wire: none. diff --git a/quest/m1/cut-audit/weak-cache-remove.md b/quest/m1/cut-audit/weak-cache-remove.md new file mode 100644 index 00000000000..ef737536c48 --- /dev/null +++ b/quest/m1/cut-audit/weak-cache-remove.md @@ -0,0 +1,32 @@ +# [XS] Removing a stale front is O(1) under the origin lock + +## Goal + +A restart wave over F paths (an upstream relay reconnecting with a new +epoch) costs O(F) total work under the origin lock, not O(F²). A benchmark +swept over fronts and restarting paths shows a flat per-request cost, and +front wakes happen after the origin's locks drop. + +## Plan + +Found by the 2026-10-24 pre-cut audit at 151a529670. Source-inferred, +inherited. + +`Consumer::request` (`rs/moq-net/src/model/origin.rs:6491`) calls +`state.fronts.remove(&key)` whenever a live front resolved on a non-current +instance, which is the first request on every path after an epoch change. +`WeakCache::remove` (`model/weak_cache.rs:121`) runs `ring.retain`, a scan of +every front holding clones of live handles, while the global origin lock is +held. `get` and `remove_if` are already O(1), with gc bounded by +`GC_PROBE`. + +- Drop the scan: let the bounded gc retire the stale ring slot, or let the + following `insert` supersede it. Keep the guarantee that a removed entry's + handle is not pinned indefinitely. +- Extend `benches/origin.rs` with a sweep over fronts times restarting paths. +- While there: `AnnounceProducer::retract` (`origin.rs` about line 2793) and + `DriverState::teardown` (about line 2944) resolve front requests while + holding the table and server locks; collect them and resolve after the + guards drop, as `update_if` already does. + +Public API: none (`WeakCache` is crate-internal). Wire: none. diff --git a/quest/m1/drop-set.md b/quest/m1/drop-set.md index 222fecffd40..021a5ba5924 100644 --- a/quest/m1/drop-set.md +++ b/quest/m1/drop-set.md @@ -220,6 +220,17 @@ Public API: none. Wire: lite-07 SUBSCRIBE_DROP (unpublished) gains `Max Age` and the widening and ordering rules above; published versions are unchanged. +### CPU per drop (2026-10-24 pre-cut audit) + +Besides memory, run fragmentation costs CPU today, new on main: every +SUBSCRIBE_DROP bumps `drops_revision`, and each reader's `DropCursor::next` +rescans the overlapping runs (`rs/moq-net/src/model/track.rs` about lines +5574-5609), so N fragmented runs and R downstream readers cost O(R*N) per +6-byte DROP. JS `insertDrop` (`js/net/src/internal.ts:136`) copies the whole +run array once for the track and once per sink (`track.ts:914`). The +replacement keeps the per-cursor walk incremental in both languages, with a +benchmark swept over runs and readers. + ## Required - [A widened max age re-offers cached groups](/quest/m1/resolved-demand.md) - the re-offer path this extends to reported groups diff --git a/quest/m1/ietf-drop/d14-17.md b/quest/m1/ietf-drop/d14-17.md index 07b3f969685..719abbe9a49 100644 --- a/quest/m1/ietf-drop/d14-17.md +++ b/quest/m1/ietf-drop/d14-17.md @@ -52,6 +52,14 @@ Public API (breaking, `!`): and `limits.*.requests` are removed (`rs/moq-relay/src/limits.rs`). They only sized the 14-16 request window. Migration: delete the setting; an old config fails loudly instead of being ignored. + Removing it also resizes the draft-18+ request-ID history: `Spent` + (`rs/moq-net/src/ietf/control.rs:200`) keeps every skipped peer request + ID as a run and closes with INTERNAL_ERROR past `with_history(limits.window())` + (`ietf/session.rs:412`, `window() = 2*(announces+requests)`), a constant + whose only effect is a refusal (found by the 2026-10-24 pre-cut audit, + new on main). Decide it here: replace `Spent` with a per-parity + high-water mark (on draft 18+ each request owns its stream, and only + `Publisher::joins` is keyed by request ID), or size it explicitly. - `--version`/`--connect-version` stop accepting `moq-transport-14`..`17`. The CLI derives its names from `Version::names()`, so only examples change. - Wire: four ALPNs and SETUP-negotiated draft-14 are no longer offered. diff --git a/quest/m1/subscribe-ranges/README.md b/quest/m1/subscribe-ranges/README.md index fcd21b4bbc1..1de5a929f0a 100644 --- a/quest/m1/subscribe-ranges/README.md +++ b/quest/m1/subscribe-ranges/README.md @@ -93,6 +93,27 @@ This line owns the end-to-end test: a relay with a sparse cache answers a wide past range plus live in both orders, over lite-07 and moq-transport, with every sequence delivered or dropped. +### Delete the old start bookkeeping (2026-10-24 pre-cut audit) + +Lite `TrackRun`'s fixes cluster on where a subscription starts and what it +is owed or dropped (e713c30991, 36f82ac450, 35fa44f6bf, e1b5d2741f, +f235fcfcbd, df0bd5c36f, 342445f251, 06765f4c1a, 4927167904, f52848d634, +0513c07369, 5ad3652871). That state spans about eight fields (`floor`, +`cap`, `start`, `first`, `skipped`, `served`, `start_frame`, `end_frame`), +plus `cursor_floor` and a pre-06 re-pin branch, encoding three wire +generations of "start". When ranges land: + +- Move what each cursor is owed and what was dropped into the model, so + `TrackRun` only translates it into SUBSCRIBE_START/DROP/END per version; + delete `skipped`, `served`, `first`, and the pre-06 branches rather than + layering lite-07 ranges on top. +- On lite-07, where every sequence is accounted for by a stream, a datagram, + or a DROP, the subscriber's end is "owed range covered and no stream + active", with no grace period; keep `Settle`'s grace for lite-05/06 and + moq-transport behind one version predicate. +- Lite-07 is unpublished, so sending a fresh START per update can remove the + `requested == start` gate (`lite/subscriber.rs` about line 7366). + ## Required - [Fetch as a range](/quest/m1/subscribe-ranges/fetch-range.md) - `fetch_group` becomes a one-range subscription that ends once its range is accounted for diff --git a/quest/m2/README.md b/quest/m2/README.md index 40037322742..558588f173c 100644 --- a/quest/m2/README.md +++ b/quest/m2/README.md @@ -107,6 +107,16 @@ lite-07; bitrate enforcement is not part of this release. - [WebGPU HDR](/quest/m2/webgpu-hdr.md) - HDR renditions play as HDR where the browser and display can show it, and tone-map to SDR elsewhere - [HLS restart drain cutoff](/quest/m2/hls-restart-drain-cutoff.md) - a moq-hls recording of a replaced run finishes at a finite boundary while the successor starts at once - [Wire fuzz coverage](/quest/m2/wire-fuzz-coverage.md) - the audited moq-net decoders have targets that assert an invariant, and the unsafe peer input reaches runs under Miri +- [Untrusted media parsers have fuzz targets](/quest/m2/media-fuzz.md) - fMP4, MKV, FLV, TS, Annex-B, catalog, and AMF0 parsing fuzzed with a bounded-work invariant +- [Resume as producer replacement](/quest/m2/resume-redesign.md) - route changes replace the writer of one track state, deleting the per-reader resume path in Rust and JS +- [moq-transport requests end through one lease](/quest/m2/ietf-request-lease.md) - every IETF request ends through one polled lease, and the two 18k-line files split by mechanism +- [A moq-transport group head fills its hole in place](/quest/m2/ietf-fill-refill.md) - fills and joining FETCHes write into the tail's group, deleting the `Fill` handoff +- [Announce interest streams share one route table](/quest/m2/announce-interest-memory.md) - per-stream announce cost follows what is in flight, not every route +- [One relay serve path for every runtime](/quest/m2/relay-serve-path.md) - io_uring serves through the shared `Connection::serve` and config mapping +- [A parked read of a resumed group reads its budget without re-syncing](/quest/m2/recover-budget.md) - measure, then drop the per-frame reader sync +- [Transcode rungs scale off the runtime and keep bounded state](/quest/m2/transcode-rungs.md) - resize on encoder threads, memoize rungs by shape, one writer per rung track +- [moqsrc owns each rendition pad in one actor](/quest/m2/moqsrc-pad-actor.md) - pad lifecycle stops racing across restarts +- [@moq/publish owns rendition identity in one publication](/quest/m2/publish-publication.md) - one map per broadcast replaces five - [One port](/quest/m2/one-port/README.md) - one UDP port carries QUIC, SRT, and WebRTC media through an embedder hook, and one TCP port carries HTTP, RTMP, and RTMPS - [qmux receive leases](/quest/m2/qmux-receive-lease.md) - WebSocket, TCP, and WebRTC sessions bound incomplete messages by their receive window, at a per-session cost the maintainer picks - [QUIC caps](/quest/m2/rate-quic.md) - paced MAX_DATA credit in and a capped pacer out hold a QUIC session to its token's bitrate diff --git a/quest/m2/announce-interest-memory.md b/quest/m2/announce-interest-memory.md new file mode 100644 index 00000000000..83673f3ac08 --- /dev/null +++ b/quest/m2/announce-interest-memory.md @@ -0,0 +1,39 @@ +# [M] Announce interest streams share one route table + +## Goal + +An announce-interest stream (lite ANNOUNCE_PLEASE or moq-transport +SUBSCRIBE_NAMESPACE) costs memory and CPU proportional to what it has in +flight, not to every route under its prefix. A subscriber opening thousands +of root-prefix streams on a relay holding N routes no longer makes it hold +thousands of times N entries, and a benchmark swept over streams and routes +shows per-stream cost flat in N. + +## Plan + +From the 2026-10-24 pre-cut audit at 151a529670. Source-inferred, not +measured; inherited (release's `lite/publisher.rs:659` has the same +per-stream `origin.announced()`). + +Each stream runs `origin.announced()` (`rs/moq-net/src/lite/publisher.rs` +about line 968, with no `Slots` acquire), materializing its own +`TableCursor.current`, `OriginConsumerState` pending/due/delivered entries, +and the `AnnounceRun` live map (`model/origin.rs` `register_cursor` about +line 5075, `Consumer::announced` about 6116). On lite-05/06, `init()` also +encodes the whole initial set before the first flush. Only QUIC stream +credit bounds the count (`DEFAULT_MAX_STREAMS = 10_000`), so the worst case +is about 10k times N times a few hundred bytes. Incoming announces are +bounded by `session::Limits`; outgoing interest streams are not. + +Bound it by design, not with a cap: cursors walk a shared, refcounted table +snapshot lazily, materializing only what is in flight and gated on stream +write credit; lite-05/06 encodes its initial set incrementally under +`poll_flush`, as lite-07 does. The IETF SUBSCRIBE_NAMESPACE handler follows +the same pattern and gets the same fix. + +Public API: none. Wire: none. + +## Related + +- [Announced snapshots](/quest/m2/performance-survey/announced-snapshots.md) - the HTTP listing's copy of the same table +- [Cluster routing](/quest/m1/cluster-routing/README.md) - reshapes the route table this walks diff --git a/quest/m2/ietf-fill-refill.md b/quest/m2/ietf-fill-refill.md new file mode 100644 index 00000000000..1bc84d3c830 --- /dev/null +++ b/quest/m2/ietf-fill-refill.md @@ -0,0 +1,38 @@ +# [M] A moq-transport group head fills its hole in place + +## Goal + +A moq-transport fill (draft 22) or joining FETCH (draft 18) writes a group's +missing head into the same group the subscription's tail is writing, over a +disjoint object range, instead of the 7-state `Fill` claim, park, and install +handoff between two producers. + +## Plan + +From the 2026-10-24 pre-cut audit at 151a529670. Internal only. + +Group stitching across two streams drew repeated fixes: +[#3308](https://github.com/moq-dev/moq/pull/3308), +[#3325](https://github.com/moq-dev/moq/pull/3325), +[#3562](https://github.com/moq-dev/moq/pull/3562), +[#3727](https://github.com/moq-dev/moq/pull/3727), +[#6251](https://github.com/moq-dev/moq/pull/6251), +[#6348](https://github.com/moq-dev/moq/pull/6348), +[#6407](https://github.com/moq-dev/moq/pull/6407), plus +[headless groups](/quest/m2/ietf-headless-group.md) and +[join after finish](/quest/m2/ietf-join-after-finish.md). The `Fill` enum +and its handoff (`rs/moq-net/src/ietf/subscriber.rs` about lines 273-396 +and 4712-4862) exist only because the model has one producer per group. + +Once [front eviction](/quest/m1/unbounded-groups/front-eviction.md) lets a +group be refilled in place, the head is a refill of the group's leading +hole, which also keeps a tail whose head never arrives, as the headless +group quest decided. Joining at the next group instead was considered and +rejected: it costs a GOP of startup and drops objects already received. + +Public API: none. Wire: none. + +## Required + +- [Front eviction](/quest/m1/unbounded-groups/front-eviction.md) - in-place refill of a group's holes +- [moq-transport requests end through one lease](/quest/m2/ietf-request-lease.md) - restructures the same files first diff --git a/quest/m2/ietf-request-lease.md b/quest/m2/ietf-request-lease.md new file mode 100644 index 00000000000..0a9b6a0c333 --- /dev/null +++ b/quest/m2/ietf-request-lease.md @@ -0,0 +1,61 @@ +# [L] moq-transport requests end through one lease + +## Goal + +Every moq-transport request on both sides of `rs/moq-net/src/ietf/` owns +its stream and every way it can end (peer withdrawal, gate denial, validity, +track close, session close, grant end) behind one lease polled first on each +wake. Request bodies become plain awaits, a new await cannot miss a +terminal, and `publisher.rs`/`subscriber.rs` split by mechanism into modules +under about 2k production lines each. + +## Plan + +From the 2026-10-24 pre-cut audit at 151a529670. Internal only. + +**Why.** The dominant source of repeated IETF fixes is a request missing +one terminal at one await: +[#2993](https://github.com/moq-dev/moq/pull/2993), +[#3004](https://github.com/moq-dev/moq/pull/3004), +[#4658](https://github.com/moq-dev/moq/pull/4658), +[#4711](https://github.com/moq-dev/moq/pull/4711), +[#4918](https://github.com/moq-dev/moq/pull/4918), +[#5654](https://github.com/moq-dev/moq/pull/5654), +[#5998](https://github.com/moq-dev/moq/pull/5998), +[#6061](https://github.com/moq-dev/moq/pull/6061), +[#6237](https://github.com/moq-dev/moq/pull/6237), +[#6409](https://github.com/moq-dev/moq/pull/6409), +[#6433](https://github.com/moq-dev/moq/pull/6433), +[#6643](https://github.com/moq-dev/moq/pull/6643), plus the open +[cancel quest](/quest/m1/ietf-request-cancel.md) and the +[withdraw fix](/quest/m1/cut-audit/ietf-withdraw-resolve.md). Each request +is a long `async fn` whose every `kio::wait` closure re-lists the right +subset of about 46 terminal checks; the two files hold 227 `pin!` sites +against lite's 31, a pattern `rs/AGENTS.md` calls a smell. + +**Sketch.** A per-request `Lease` owns the stream and every terminal behind +one `poll_ended(waiter) -> Poll`. `request::run(lease, body)` polls +the lease first on every wake, drops the body future on any `Ending` (RAII +releases its state), then writes what that ending owes: REQUEST_ERROR, +PUBLISH_DONE, or a cancel/reset. `crate::auth::until` +(`ietf/publisher.rs` about line 1485) already does this for the grant; +widen it. `until_withdrawn` and the per-step closures go away. + +**Split.** Extend the existing `subscriber/{namespaces,tracks}.rs` pattern: +`publisher/{subscribe,fetch,namespaces,serve}.rs` and +`subscriber/{alias,announce,subscribe,ingest,fetch}.rs`. Each file today is +about 6k production lines and 12k test lines, with production code after +the test modules. Tests move with their module; the `ScriptedSession` +session tests go to `tests/integration/` per `rs/AGENTS.md`. The split cuts +merge conflicts; the lease is the lever on fix count. + +Consider the same shape for lite's request machines, where the audit found +"abandoned, revoked, or retired before the answer" re-implemented in +`TrackInfoFetch`, `Establish`, `FetchServeRun`, and `TracksRecv`. + +Public API: none. Wire: none. + +## Required + +- [moq-transport 18 and 22 only](/quest/m1/ietf-drop/README.md) - deletes about 2,950 production lines and the adapter first +- [Cancelled moq-transport requests stop](/quest/m1/ietf-request-cancel.md) - lands the last point fix this replaces diff --git a/quest/m2/media-fuzz.md b/quest/m2/media-fuzz.md new file mode 100644 index 00000000000..be7370876ec --- /dev/null +++ b/quest/m2/media-fuzz.md @@ -0,0 +1,27 @@ +# [M] Untrusted media parsers have fuzz targets + +## Goal + +The media parsers reachable from untrusted publishers (fMP4 import and CMAF +decode, the MKV, FLV, and TS importers, the Annex-B splitters, and hang +catalog parsing) run under nightly fuzz targets that assert bounded work +and allocation per input byte, not just "no panic". + +## Plan + +From the 2026-10-24 pre-cut audit at 151a529670. `rs/moq-mux` and `rs/hang` +have no fuzz targets; only `rs/moq-net/fuzz` and `rs/moq-quic/fuzz` exist, +and [wire fuzz coverage](/quest/m2/wire-fuzz-coverage.md) puts media +importers out of scope. The audit's +[zero-size sample](/quest/m1/cut-audit/fmp4-sample-resolver.md) and +[avc1 panic](/quest/m1/cut-audit/avc1-codec-panic.md) findings are the kind +`cargo fuzz` finds in minutes; they are reachable through RTMP, SRT, HLS, +and fMP4 ingest and through catalog subscription. Include RTMP's AMF0 +decoder too, after [its budget fix](/quest/m1/cut-audit/rtmp-amf0-budget.md). + +Add a fuzz crate per package, or one shared media target crate, seeded from +the existing fixtures. Assert a work and allocation bound proportional to +input size. Wire the targets into the nightly gate next to moq-net's, and +replay committed regressions in the merge gate. + +Public API: none. Wire: none. diff --git a/quest/m2/moqsrc-pad-actor.md b/quest/m2/moqsrc-pad-actor.md new file mode 100644 index 00000000000..948b6d23e46 --- /dev/null +++ b/quest/m2/moqsrc-pad-actor.md @@ -0,0 +1,26 @@ +# [M] moqsrc owns each rendition pad in one actor + +## Goal + +moqsrc's per-rendition pad lifecycle (stream-start, caps, segment, EOS, +retire) is owned by one actor per pad driven by a single command stream, so +restarts and reconnects stop racing over shared pad state. + +## Plan + +From the 2026-10-24 pre-cut audit at 151a529670. Internal only; no bug was +found in the current state. + +Repeated fixes land on pad ownership across restarts and reconnects in +`rs/moq-gst/src/source/imp.rs`: e83f490a44, 83ae631068, 1b5fba232a, +6559065b8c, 8ba01b91f4, a0929c90b3, b9e91f2c65, abf3fc43f7, plus three +test-race fixes. The state is spread across `Pads`/`Slot` (an owner +`tokio::Mutex` plus `retiring`/`listed`), `Finished`, `Follower`, the +`ReaderHandle` `live` flag, and per-reader cancel watches. + +One actor per rendition pad owns the `gst::Pad` and its events and takes +play, idle, and retire commands from one stream. Keep the existing moqsrc +tests as the guard, and add a restart-under-reconnect test that interleaves +commands. + +Public API: none. Wire: none. diff --git a/quest/m2/publish-publication.md b/quest/m2/publish-publication.md new file mode 100644 index 00000000000..9597f71cdd7 --- /dev/null +++ b/quest/m2/publish-publication.md @@ -0,0 +1,27 @@ +# [M] @moq/publish owns rendition identity in one publication + +## Goal + +`@moq/publish` keeps each network broadcast's renditions in one publication +object mapping catalog id to kind, name, track, and owner, so renames, +replacements, and resets are structural instead of kept in agreement across +five maps and per-encoder state. + +## Plan + +From the 2026-10-24 pre-cut audit at 151a529670. Internal only. + +Rendition identity fixes keep landing in `js/publish` (e24828a601, +fe311b3d34, 2938e78f77, 3791aecce3, 6e06a956b0, 644789413d, b32b7a7421, +d0337260a6). The state is spread over five name-keyed maps in `Broadcast` +(`#kinds`, `#names`, `#replacements`, `#served`, `#listed`), plus a +per-Broadcast `#advertised` WeakMap and three failure layers in each +encoder. Replace them with one publication object per network broadcast, +mirroring Rust's identity rules from +[Rust identity enforcement](/quest/m1/catalog-identity-rs.md). + +Public API: none. Wire: none. + +## Required + +- [Rust identity enforcement](/quest/m1/catalog-identity-rs.md) - settles the identity contract this mirrors diff --git a/quest/m2/recover-budget.md b/quest/m2/recover-budget.md new file mode 100644 index 00000000000..841a8afb3fd --- /dev/null +++ b/quest/m2/recover-budget.md @@ -0,0 +1,32 @@ +# [S] A parked read of a resumed group reads its budget without re-syncing + +## Goal + +A pending read of an open group handed out by a resumed reader checks its +expiry budget without locking the reader and re-running its route sync, so +relay fanout through fronts pays no per-frame, per-viewer sync. A benchmark +of resumed readers shows the per-read cost flat in the number of copies. + +## Plan + +From the 2026-10-24 pre-cut audit at 151a529670. Source-inferred, not +benchmarked; new on main. Measure first, and delete this quest if the cost +does not show. + +Every Pending read of an open group goes +`poll_expired_if_blocked` -> `poll_expiry` (`rs/moq-net/src/model/group.rs:2692`) +-> `Recover::poll_budget` (`model/resume.rs:1868`), which locks the +`Reader` and runs `sync`: `learn_end` over every copy (each taking its track +lock), `subscription.poll_ref`, and a route state read, only to read a +`Duration`. On a relay every downstream subscription to a front track goes +through this path. + +Publish the reader's budget through the existing preferences channel (or an +atomic) for `Recover` to read, and keep `sync` on the reader's own poll path. + +Public API: none. Wire: none. + +## Related + +- [Group expiry contention](/quest/m2/perf/kio-channel-contention/group-expiry.md) - the track lock on the same read path +- [Resume as producer replacement](/quest/m2/resume-redesign.md) - deletes this path entirely diff --git a/quest/m2/relay-serve-path.md b/quest/m2/relay-serve-path.md new file mode 100644 index 00000000000..d6f2ec4c246 --- /dev/null +++ b/quest/m2/relay-serve-path.md @@ -0,0 +1,37 @@ +# [M] One relay serve path for every runtime + +## Goal + +The relay serves a session through one `Connection::serve` on every +runtime, and one `listen::Config` to `moq_net::Server` mapping in moq-tokio +serves the tokio, WebSocket, and io_uring listeners, so a lifecycle or +config fix lands once instead of drifting between runtimes. + +## Plan + +From the 2026-10-24 pre-cut audit at 151a529670. Internal only. + +`uring::serve_request` (`rs/moq-relay/src/uring.rs:803-926`) re-implements +`Connection::serve` (`connection.rs:90-164`) step for step (admit, QUIC +limits, stats, limits, origins, `preparing`, `serve()`, a drain-bounded +`ok()`, spawn the driver, supervise), and `Workers::bind` re-implements the +config mapping also found at `rs/moq-tokio/src/server.rs:424` and +`websocket.rs:66`. Fixes patching exactly this gap: 58eaa6afd5 +(listen.extensions), 8a13d58910 (MTU), 6bd1306d6e (SETUP tokens), +1f56330d21 (handshake deadline), d17b84ee7f (drain across handshakes), +4576bb1231 (admission bound), c11192c7e6, 67df70012d. +[Every runtime honors or refuses each listen setting](/quest/m1/cut-audit/uring-listen-config.md) +is the next instance. + +Implement the sealed `incoming::Sealed` for a uring `Request` whose +`Driver` runs on the worker handle, with admission hopping to the shared +runtime through `Lifecycle::shared`, so one `Connection::serve` serves +every runtime. Export one config mapping from moq-tokio and use it at all +three sites. Do this before the io_uring packaging work publishes the +duplicated path. + +Public API: none. Wire: none. + +## Related + +- [io_uring relay package](/quest/m2/relay-io-uring-package.md) - ships the path this unifies diff --git a/quest/m2/resume-redesign.md b/quest/m2/resume-redesign.md new file mode 100644 index 00000000000..ba01104c11a --- /dev/null +++ b/quest/m2/resume-redesign.md @@ -0,0 +1,83 @@ +# [XL] Resume as producer replacement on one track + +## Goal + +A route change under a front replaces the producer writing into the +front's one logical track state, instead of every reader merging route +copies through its own cursors. Readers become plain cursors, the +`Inner::Resume` path and its per-reader copy bookkeeping are deleted in Rust +and `js/net`, and a benchmark swept over readers and route flaps shows the +cost no longer grows with readers times copies. + +## Plan + +From the 2026-10-24 pre-cut audit at 151a529670. Internal only: no public API +or wire change, so it can ship after the cut. The audit recommended after +the cut, not before: a rewrite now would discard the large resume test +corpus right before release. Ask the maintainer whether to move it into m1 +instead, since release still ships the older splice design and nearly all +of `resume.rs` is new at this cut. + +**Why.** Main replaced release's splice design with per-reader route copies +in 0382d309f4 (2026-10-04). Since then about 30 of 58 commits to +`rs/moq-net/src/model/resume.rs` were fixes, rising to about 10 a week, and +production code grew from 1,004 to 1,989 lines (`track.rs` from 4,203 to +7,626, partly features). The fixes cluster on state one logical reader keeps +in several owners, which must be kept in agreement by hand: + +- where the reader is (`Reader.groups/window`, `Copy.floor/from/resolved`, + cursor bounds, `Delivered.floor`): fd59eb18a5, 9f1fc92fe3, 35fa44f6bf, 81d8a6313c, 137de79100 +- what was handed out (logical and per-copy `delivered`, `Reader.newest/out`, + the two-level peek): 323fda277f, bfbaa0b46d, 342445f251, 3602a8af9a +- whether a replaced copy is still needed (`Copy::retains` asking another + layer's cursor): 9b1b81a496, 5e6c452305, 9bba359f6b, 2fbaa59428 +- route failure versus content verdict: 39eacc807a, 109235732c, eb6ac57cb7, 5c31208409 +- end agreement and budget/expiry: 25532eacc8, a602360c99, 097dc1ee62, f52848d634, b59fcefde3, e33fe24cc3 + +Every `track::Consumer`/`Subscriber` method has two implementations (26 +`Inner::Resume` arms, 11 `serving()` delegations), so each feature (ranges, +anchors, fills, compression, largest, drops, start, live) is written twice +and drifts. `js/net/src/resume.ts` (1,786 lines) mirrors it, and the +[resume-floor](/quest/m1/resume-floor.md), [resume-drops](/quest/m1/resume-drops.md), +and [resume-compress](/quest/m1/resume-compress.md) quests are each a place +the two paths diverged. + +**Sketch.** + +1. Route copies become successive writers into the logical `TrackState`, + the only cache. Same-epoch routes carry identical content, so a later + writer's duplicate sequence is dropped or kept as the slot's backup. The + old writer keeps feeding below the new writer's first group and is + released once the logical cache covers that span or the aggregate budget + passes, judged once per track by `drifted`, not per reader. +2. The upstream request is already the union of readers' resume points + (`Producer::subscription`), so per-reader copy cursors are local overhead. +3. Readers become plain cursors: delete `Inner::Resume`, `Reader`, `Copy`, + `Retain`, `Candidate`, per-reader datagram dedupe (dedupe once on insert), + and per-reader `learn_end`. +4. `Recover` attaches to the slot, not a handed-out group: continuing a + group whose copy failed is the in-place refill that + [front eviction](/quest/m1/unbounded-groups/front-eviction.md) builds. + +Hard constraint from the splice era: two caches sharing one group handle +caused expiry bugs (f9b7982e01, 6c2b733bbb) and boundary churn (06bcadd06c, +b9398f7459, 68c73349a3). Session copies under a front must stop caching for +themselves and only feed the logical track. + +Land it in Rust first, then mirror `js/net` unless +[rs2ts](/quest/m2/rs2ts/README.md) has replaced it. Extend +`benches/origin.rs` with the reader times flap sweep before starting, to +measure the change. + +Public API: none. Wire: none. + +## Required + +- [Front eviction](/quest/m1/unbounded-groups/front-eviction.md) - the in-place refill `Recover` folds into +- [Release cut](/quest/m2/release/cut.md) - wait for the release in flight to ship + +## Related + +- [A reserved group survives a route returning](/quest/m1/cut-audit/reserved-route-return.md) - a pre-cut fix this deletes +- [One route phase](/quest/m1/cut-audit/route-phase.md) - a pre-cut fix this deletes +- [Recover reads its budget without a sync](/quest/m2/recover-budget.md) - a per-frame cost this deletes diff --git a/quest/m2/transcode-rungs.md b/quest/m2/transcode-rungs.md new file mode 100644 index 00000000000..008718bff50 --- /dev/null +++ b/quest/m2/transcode-rungs.md @@ -0,0 +1,32 @@ +# [M] Transcode rungs scale off the runtime and keep bounded state + +## Goal + +moq-transcode resizes frames on its encoder threads, not on tokio workers, +a flapping source size neither re-probes encoders serially nor grows state +forever, and a rung's live and fetch paths stop being two writers to one +track. + +## Plan + +From the 2026-10-24 pre-cut audit at 151a529670. Source-inferred, partly +speculative until transcode faces untrusted publishers. + +- `Frame::resize` (CPU bilinear, plus the CUDA `download_i420` fallback) + runs inline on the rung task (`rs/moq-transcode/src/rung.rs:395` live, + `:815` fetch), so sources times rungs times 30 fps pins runtime threads. + Scale inside `encode::Sink` on the encoder's own thread. +- Each catalog edit to `coded_width`/`coded_height` mints new rung names + and runs a real encoder `probe()` serially inside `select!` + (`lib.rs:181`, `pipeline.rs:141`); every new name stays in `active` and in + every cursor's `seen` map, and `next_update` scans the whole map per wake + (`active.rs:176-211`, `:347-357`). Memoize rung entries by shape and drop + retired entries that never encoded a frame (`active::Consumer` stops + reporting them; document it). +- Live and fetch writing one track forces the duplicate skip, retirement + draining fetches, and open-group logic (824179a3a1, 1131b80386, + 4ae871c947, 1c7e17f93b). The comment at `rung.rs:369` calls merging them a + tracked follow-up, but no quest existed; this is it. Merge them, or + delete the comment with the reason they stay apart. + +Public API: `active::Consumer` reports fewer renditions. Wire: none. From 0420e384105d230cbdad944bda357bedd266347a Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 24 Oct 2026 22:36:17 -0700 Subject: [PATCH 02/11] quest: drop the merged resume-compress link Co-Authored-By: Claude Opus 5.5 --- quest/m2/resume-redesign.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/quest/m2/resume-redesign.md b/quest/m2/resume-redesign.md index ba01104c11a..f9e0725fbdc 100644 --- a/quest/m2/resume-redesign.md +++ b/quest/m2/resume-redesign.md @@ -38,9 +38,9 @@ Every `track::Consumer`/`Subscriber` method has two implementations (26 `Inner::Resume` arms, 11 `serving()` delegations), so each feature (ranges, anchors, fills, compression, largest, drops, start, live) is written twice and drifts. `js/net/src/resume.ts` (1,786 lines) mirrors it, and the -[resume-floor](/quest/m1/resume-floor.md), [resume-drops](/quest/m1/resume-drops.md), -and [resume-compress](/quest/m1/resume-compress.md) quests are each a place -the two paths diverged. +[resume-floor](/quest/m1/resume-floor.md) and [resume-drops](/quest/m1/resume-drops.md) +quests, like the compress check [moq-dev/moq#6460](https://github.com/moq-dev/moq/pull/6460) +just landed, are each a place the two paths diverged. **Sketch.** From 71bb942d3355cdc821f9a47b49c81f6d6a5154db Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 24 Oct 2026 22:41:16 -0700 Subject: [PATCH 03/11] quest: release tags reach nix.moq.dev only after the next cut Co-Authored-By: Claude Opus 5.5 --- quest/m0/ci/nix-cache-verify.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/quest/m0/ci/nix-cache-verify.md b/quest/m0/ci/nix-cache-verify.md index 16818bfe36a..0935c10a1da 100644 --- a/quest/m0/ci/nix-cache-verify.md +++ b/quest/m0/ci/nix-cache-verify.md @@ -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/#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/#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 From 057233af2d4908409db231c90c7732658fb8f697 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 24 Oct 2026 22:42:02 -0700 Subject: [PATCH 04/11] quest: element attributes refuse invalid values instead of warning Co-Authored-By: Claude Opus 5.5 --- quest/m1/cut-audit/element-attributes.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/quest/m1/cut-audit/element-attributes.md b/quest/m1/cut-audit/element-attributes.md index 0a408f0c1a4..3ef39ee333a 100644 --- a/quest/m1/cut-audit/element-attributes.md +++ b/quest/m1/cut-audit/element-attributes.md @@ -4,8 +4,11 @@ `` and `` reflect state changed through properties or the built-in UI back to their attributes, so `[muted]` selectors, -attribute-diffing frameworks, and a later `setAttribute` behave. Invalid -attribute values warn instead of being ignored. +attribute-diffing frameworks, and a later `setAttribute` behave. An invalid +attribute value is refused loudly, never silently replaced by a default: +the property setter throws, and an invalid value from markup surfaces as an +error the page can observe while the element does not run with a defaulted +configuration. ## Plan @@ -19,7 +22,9 @@ inherited. Public element API, so it lands before the cut. - On watch, `captions`, `announced`, and `catalog-format` do not reflect (the UI writes `controls.text.target` in `ui/components/captions.ts:58`), and `parseCatalogFormat` (`watch/src/element.ts:109`) silently ignores an - invalid value. + invalid value. Refuse it per root `AGENTS.md` (fail loud: supported or + refused), and apply the same rule to every enumerated attribute on both + elements. - `MoqWatch` exposes `broadcast`, `video`, `audio`, `renderer`, and `sync` as reassignable fields; make them `readonly`. From e7656f33bc3f7c7dc60de7793b92b4a72ee7067d Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 24 Oct 2026 22:45:17 -0700 Subject: [PATCH 05/11] quest: jitter admission judges the newest queued frame Co-Authored-By: Claude Opus 5.5 --- quest/m1/cut-audit/jitter-admission.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/quest/m1/cut-audit/jitter-admission.md b/quest/m1/cut-audit/jitter-admission.md index 61d07960f77..f9590ab10de 100644 --- a/quest/m1/cut-audit/jitter-admission.md +++ b/quest/m1/cut-audit/jitter-admission.md @@ -3,8 +3,8 @@ ## Goal The TS, MKV, and FLV exports' jitter buffer stays bounded by construction: -a track is read only while its next frame is due within the delay plus its -lead, so a track whose timestamps outrun real time is held back in its +a track is read only while its newest queued frame is due within the delay +plus its lead, so a track whose timestamps outrun real time is held back in its source as backpressure instead of queued without bound beside an honest track. @@ -22,8 +22,12 @@ video at 3x, the buffer grew linearly from 500 frames at 20 s to 3,006 at unbounded while an honest one sits beside it. Affects `ts/export.rs:442`, `mkv/export.rs:485`, and the FLV export. -Make admission the bound: a track is full once its front frame is due later -than now plus delay plus its lead. No frame-count cap. Alternatively charge +Make admission the bound: a track is full once its newest queued frame (the +back of its queue, or the frame about to be admitted) is due later than now +plus delay plus its lead. Judging the front frame would not work: in the +scenario above the oldest video frame stays near its deadline while newer +frames pile up behind it, and `Stream::fill` keeps reading while +`jitter.full(name)` is false. No frame-count cap. Alternatively charge a track whose lead keeps growing as a source fault. Then evaluate the larger simplification: about a dozen fixes to the export From 8c8eace50eb2ed9c16e3f3bfa81db0b4c16b13e8 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 24 Oct 2026 22:49:03 -0700 Subject: [PATCH 06/11] quest: request-ID history keeps reordered admission Co-Authored-By: Claude Opus 5.5 --- quest/m1/ietf-drop/d14-17.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/quest/m1/ietf-drop/d14-17.md b/quest/m1/ietf-drop/d14-17.md index 719abbe9a49..6c0905b040b 100644 --- a/quest/m1/ietf-drop/d14-17.md +++ b/quest/m1/ietf-drop/d14-17.md @@ -57,9 +57,15 @@ Public API (breaking, `!`): ID as a run and closes with INTERNAL_ERROR past `with_history(limits.window())` (`ietf/session.rs:412`, `window() = 2*(announces+requests)`), a constant whose only effect is a refusal (found by the 2026-10-24 pre-cut audit, - new on main). Decide it here: replace `Spent` with a per-parity - high-water mark (on draft 18+ each request owns its stream, and only - `Publisher::joins` is keyed by request ID), or size it explicitly. + new on main). Decide it here. Request streams can arrive out of + allocation order (`modern_requests_reject_reuse_and_wrong_parity` accepts + 4, 0, then 2), so a plain high-water mark that treats lower IDs as spent + would close legitimate sessions. The real choice is between keeping reuse + detection, with `Spent`'s memory bounded by design rather than a refusal + constant, or dropping reuse detection below the high-water mark, argued + on behavior: on draft 18+ each request owns its stream, and the only state + keyed by request ID is `Publisher::joins`, which a reuse confuses only for + the reusing peer's own joining FETCHes. - `--version`/`--connect-version` stop accepting `moq-transport-14`..`17`. The CLI derives its names from `Version::names()`, so only examples change. - Wire: four ALPNs and SETUP-negotiated draft-14 are no longer offered. From 2dae5b1dfcd942bdfe138a9a9bcc97349efe9ef0 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sun, 25 Oct 2026 09:05:21 -0700 Subject: [PATCH 07/11] quest: refuse invalid element attributes and keep the GOAWAY cutoff The maintainer decided refusal wins over js/AGENTS.md's warn-and-fall-back rule; update the rule and record it in the element-attributes plan. The d14-17 request-ID choice must keep GOAWAY's smallest-unprocessed cutoff. Co-Authored-By: Claude Opus 5.5 --- js/AGENTS.md | 2 +- quest/m1/cut-audit/element-attributes.md | 4 ++++ quest/m1/ietf-drop/d14-17.md | 6 +++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/js/AGENTS.md b/js/AGENTS.md index 7e4c60a154c..e4175f71ceb 100644 --- a/js/AGENTS.md +++ b/js/AGENTS.md @@ -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 diff --git a/quest/m1/cut-audit/element-attributes.md b/quest/m1/cut-audit/element-attributes.md index 3ef39ee333a..f3a87ea3fda 100644 --- a/quest/m1/cut-audit/element-attributes.md +++ b/quest/m1/cut-audit/element-attributes.md @@ -30,5 +30,9 @@ inherited. Public element API, so it lands before the cut. Add reflection effects as watch already does for its other attributes. +Decided by the maintainer (2026-10-25): refusing invalid attributes wins +over `js/AGENTS.md`'s former warn-and-fall-back rule, which now requires +refusal. Existing fallbacks on both elements are bugs under this quest. + Public API: additive reflection; `readonly` fields reject reassignment. Wire: none. diff --git a/quest/m1/ietf-drop/d14-17.md b/quest/m1/ietf-drop/d14-17.md index 6c0905b040b..7c3d70dff04 100644 --- a/quest/m1/ietf-drop/d14-17.md +++ b/quest/m1/ietf-drop/d14-17.md @@ -65,7 +65,11 @@ Public API (breaking, `!`): constant, or dropping reuse detection below the high-water mark, argued on behavior: on draft 18+ each request owns its stream, and the only state keyed by request ID is `Publisher::joins`, which a reuse confuses only for - the reusing peer's own joining FETCHes. + the reusing peer's own joining FETCHes. Either choice keeps GOAWAY's + cutoff: `Control::goaway` names the smallest unprocessed ID from the + missing runs (`goaway_freezes_request_admission_at_current_progress` + accepts 0 and 4 and expects 2), so the lowest gap must still be tracked, + or a coarser cutoff argued on behavior, and that regression kept. - `--version`/`--connect-version` stop accepting `moq-transport-14`..`17`. The CLI derives its names from `Version::names()`, so only examples change. - Wire: four ALPNs and SETUP-negotiated draft-14 are no longer offered. From 885a01eb6d515c94b372e2057bc93f4cce108d3b Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sun, 25 Oct 2026 09:15:42 -0700 Subject: [PATCH 08/11] quest: keep a bounded grace for lite-07 datagram holes Co-Authored-By: Claude Opus 5.5 --- quest/m1/subscribe-ranges/README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/quest/m1/subscribe-ranges/README.md b/quest/m1/subscribe-ranges/README.md index 1de5a929f0a..a2a401b77ed 100644 --- a/quest/m1/subscribe-ranges/README.md +++ b/quest/m1/subscribe-ranges/README.md @@ -107,10 +107,14 @@ generations of "start". When ranges land: `TrackRun` only translates it into SUBSCRIBE_START/DROP/END per version; delete `skipped`, `served`, `first`, and the pre-06 branches rather than layering lite-07 ranges on top. -- On lite-07, where every sequence is accounted for by a stream, a datagram, - or a DROP, the subscriber's end is "owed range covered and no stream - active", with no grace period; keep `Settle`'s grace for lite-05/06 and - moq-transport behind one version predicate. +- On lite-07 a stream or a DROP accounts for every sequence except one sent + only as a datagram, which can be lost unseen + (`a_lost_datagram_delays_the_end` in `tests/integration/track_tail.rs`). + So the subscriber's end is "owed range covered and no stream active", + except that a hole a datagram may have left still settles within a bounded + grace; only reliable accounting of datagram sequences could remove that. + Keep `Settle`'s full grace for lite-05/06 and moq-transport behind one + version predicate. - Lite-07 is unpublished, so sending a fresh START per update can remove the `requested == start` gate (`lite/subscriber.rs` about line 7366). From 35e9884bd59f283ca91b8c7b02b8020329366dfd Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sun, 25 Oct 2026 10:45:55 -0700 Subject: [PATCH 09/11] quest: point resume-redesign at #6758 now that resume-drops finished Co-Authored-By: Claude Opus 5.5 --- quest/m2/resume-redesign.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/quest/m2/resume-redesign.md b/quest/m2/resume-redesign.md index f9e0725fbdc..5eebda87da9 100644 --- a/quest/m2/resume-redesign.md +++ b/quest/m2/resume-redesign.md @@ -38,9 +38,10 @@ Every `track::Consumer`/`Subscriber` method has two implementations (26 `Inner::Resume` arms, 11 `serving()` delegations), so each feature (ranges, anchors, fills, compression, largest, drops, start, live) is written twice and drifts. `js/net/src/resume.ts` (1,786 lines) mirrors it, and the -[resume-floor](/quest/m1/resume-floor.md) and [resume-drops](/quest/m1/resume-drops.md) -quests, like the compress check [moq-dev/moq#6460](https://github.com/moq-dev/moq/pull/6460) -just landed, are each a place the two paths diverged. +[resume-floor](/quest/m1/resume-floor.md) quest, the resumed JS drops fix +[moq-dev/moq#6758](https://github.com/moq-dev/moq/pull/6758), and the compress check +[moq-dev/moq#6460](https://github.com/moq-dev/moq/pull/6460) are each a place the two +paths diverged. **Sketch.** From 655c863e76723994902dd3492425c33cc942a1a9 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sun, 25 Oct 2026 13:06:11 -0700 Subject: [PATCH 10/11] quest: cite the PRs that finished msf-duplicate-init and js-reload-config Co-Authored-By: Claude Opus 5.5 --- quest/m1/cut-audit/js-json-strict.md | 2 +- quest/m1/cut-audit/js-net-cleanups.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/quest/m1/cut-audit/js-json-strict.md b/quest/m1/cut-audit/js-json-strict.md index 0dc6f59d8cd..8d863db0ce6 100644 --- a/quest/m1/cut-audit/js-json-strict.md +++ b/quest/m1/cut-audit/js-json-strict.md @@ -25,4 +25,4 @@ Public API: none. Wire: none. ## Related -- [MSF duplicate init](/quest/m1/msf-duplicate-init.md) - the repeated `initDataList` id in the same reader +- [moq-dev/moq#6773](https://github.com/moq-dev/moq/pull/6773) - refused malformed `initDataList` references in every MSF reader diff --git a/quest/m1/cut-audit/js-net-cleanups.md b/quest/m1/cut-audit/js-net-cleanups.md index a3cda75846a..5e92b416741 100644 --- a/quest/m1/cut-audit/js-net-cleanups.md +++ b/quest/m1/cut-audit/js-net-cleanups.md @@ -46,4 +46,4 @@ and `stats()` are removed if `Reload` is exported. Wire: none. ## Related -- [JS reload config](/quest/m1/js-reload-config.md) - the other `Reload` change before the cut +- [moq-dev/moq#6756](https://github.com/moq-dev/moq/pull/6756) - the other `Reload` change before the cut, now landed From 718fe11a551554786fb9ba1cff8d1849cb93a514 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sun, 25 Oct 2026 14:35:37 -0700 Subject: [PATCH 11/11] quest: cite the PR that finished resume-floor Co-Authored-By: Claude Opus 5.5 --- quest/m2/resume-redesign.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quest/m2/resume-redesign.md b/quest/m2/resume-redesign.md index 5eebda87da9..e6a0bb53069 100644 --- a/quest/m2/resume-redesign.md +++ b/quest/m2/resume-redesign.md @@ -37,8 +37,8 @@ in several owners, which must be kept in agreement by hand: Every `track::Consumer`/`Subscriber` method has two implementations (26 `Inner::Resume` arms, 11 `serving()` delegations), so each feature (ranges, anchors, fills, compression, largest, drops, start, live) is written twice -and drifts. `js/net/src/resume.ts` (1,786 lines) mirrors it, and the -[resume-floor](/quest/m1/resume-floor.md) quest, the resumed JS drops fix +and drifts. `js/net/src/resume.ts` (1,786 lines) mirrors it, and the resume floor fix +[moq-dev/moq#6759](https://github.com/moq-dev/moq/pull/6759), the resumed JS drops fix [moq-dev/moq#6758](https://github.com/moq-dev/moq/pull/6758), and the compress check [moq-dev/moq#6460](https://github.com/moq-dev/moq/pull/6460) are each a place the two paths diverged.