diff --git a/doc/concept/standard.md b/doc/concept/standard.md index 995ca11e6df..917e0db5cc0 100644 --- a/doc/concept/standard.md +++ b/doc/concept/standard.md @@ -37,7 +37,7 @@ subset drops. What a peer actually observes against this implementation: - **Refused, not fatal.** A legal request this stack does not serve is rejected on its own and the session stays up: the fetch forms above get `NOT_SUPPORTED`. Range Filters get `INVALID_FILTER` on draft 19 and later because the advertised filter limit is zero. On draft 21 and later, namespaces whose first tuple field is exactly `.` or `.session` get `DOES_NOT_EXIST` before application lookup; other dot prefixes still reach the application. Subscription updates accept priority, negotiated subscriber max age, and delivery timeouts; Rust also renews request tokens and judges `NEW_GROUP_REQUEST` as a join (see dynamic groups below). Other supported-but-unimplemented preferences end that subscription; a `TRACK_PROPERTY_FILTER` there closes the session with `PROTOCOL_VIOLATION`, since it belongs only to `SUBSCRIBE_TRACKS`. On draft 18 and later a namespace update may change its prefix; suffixes after the acknowledgement are relative to that new prefix. - **Objects and datagrams.** Only subgroup 0 is accepted: a stream for any other subgroup, whether its header gives the ID or takes it from the first Object ID, is stopped and the session stays up. Rust relays preserve Object IDs, gaps, object properties, FIRST\_OBJECT, and END\_OF\_GROUP status objects between moq-transport peers for subgroup 0, including across a moq-lite-07 hop between two relays that negotiate the [ietf](/draft/moq-ietf) extension. Datagrams retain their IDs, properties, priority, and status. Plain Rust readers and moq-lite peers see consecutive frames and normal datagram payloads; JavaScript supports only normal datagrams at Object ID 0. A malformed datagram closes the session; a relayed one the downstream draft cannot carry is dropped. A relayed Timestamp leaves in the units the downstream response declares, and is dropped where it declares none (drafts 14 through 16), as for a plain frame; an immutable one that would change or vanish is refused. On a timed track the frame holds each object's time, so a mutable Timestamp that only repeats the immutable one is not restated; a status object has no frame, so it keeps its Timestamp among its properties. Only property 0x10 is read as a Timestamp. Property 0x06 stays opaque and keeps its value regardless of timestamp units; it is dropped across the draft-19 boundary, or refused when immutable, because draft 19 assigns it to SUBGROUP\_DELIVERY\_TIMEOUT. From draft 15, a status object carrying properties is refused, and one relayed from draft 14 leaves without them. Draft 14 allows them, but an END\_OF\_TRACK carrying properties ends the subscription as unsupported, since a track end has nowhere to keep them. A `FETCH` carries the END\_OF\_GROUP object on drafts 14 and 15; later drafts have no FETCH status, so their response ends at the last frame. A group cannot resume across route changes by frame ordinal once Object IDs skip ahead of the ordinals on either route; recovery refuses it instead of splicing different objects. - **Dynamic groups.** A track advertises `DYNAMIC_GROUPS` when its publisher sets a refresh ratio, and a track received with `DYNAMIC_GROUPS` gets a ratio of 0. A `NEW_GROUP_REQUEST` (draft 15 and later) counts as one more subscriber joining, which a `SUBSCRIBE` already is: it asks for a new group only when the newest group's bytes after its first frame exceed the ratio times the first frame. Joins coalesce until the asked-for group arrives. A Rust relay sends `NEW_GROUP_REQUEST` upstream, on the `SUBSCRIBE` or in a `REQUEST_UPDATE`, once a join wants a group past the newest it holds; a relay holding nothing yet asks for none. On a track without a ratio, an update carrying one ends the subscription with `UPDATE_FAILED`. On drafts 15 and 16, whose `TRACK_STATUS` answer has no room for it, a relay copy first learned from `TRACK_STATUS` (a fetch-only reader) does not advertise it to later subscribers. A moq-lite-07 hop (`moq-lite-07-wip`, opt-in) carries the same demand natively: the ratio in `TRACK_INFO` and the asked-for group in `SUBSCRIBE_UPDATE`. Earlier moq-lite versions carry neither, so a track received over one never refreshes. -- **Priority.** Higher is served first. This stack's priorities run from -128 to 127 with 0 unset, and go out on the IETF wire, which ranks lower first, as `127 - priority`: an unset priority is IETF 127, and an absent IETF priority is 0. A relay's upstream subscription carries the highest priority its subscribers ask for and updates it as they come and go; its group order stays as the `SUBSCRIBE` asked, since no draft lets an update change it. +- **Priority.** Higher is served first. This stack's priorities run from -128 to 127 with 0 unset, and go out on the IETF wire, which ranks lower first, as `127 - priority`: an unset priority is IETF 127. An omitted subscriber or publisher priority reads as the drafts' default of IETF 128, one step below unset, so a relay forwards it unchanged. A relay's upstream subscription carries the highest priority its subscribers ask for and updates it as they come and go; its group order stays as the `SUBSCRIBE` asked, since no draft lets an update change it. - **Size.** An object extension block larger than 64 KiB ends that subgroup stream. The session stays up. This cap is ours, not the draft's. Several project drafts extend the IETF wire without breaking it, since `SETUP` diff --git a/js/net/src/ietf/ietf.test.ts b/js/net/src/ietf/ietf.test.ts index e3231756f45..abb7d9239b2 100644 --- a/js/net/src/ietf/ietf.test.ts +++ b/js/net/src/ietf/ietf.test.ts @@ -2045,6 +2045,15 @@ test("Subscribe v20: decodes every legal parameter", async () => { expect(msg.propertiesWanted).toBe(false); }); +// From draft-15 an omitted SUBSCRIBER_PRIORITY means 128, not the unset 127, so a relay +// forwards it unchanged. +test("Subscribe: an omitted SUBSCRIBER_PRIORITY is 128", async () => { + for (const version of [Version.DRAFT_15, Version.DRAFT_16, Version.DRAFT_18, Version.DRAFT_20, Version.DRAFT_22]) { + const msg = await decodeVersioned(framed([...TRACK_HEAD, 0x00]), Subscribe.Subscribe.decode, version); + expect(msg.subscriberPriority).toBe(128); + } +}); + // INCLUDE_PROPERTIES is a uint8: one raw byte with no Length. test("Subscribe v20: INCLUDE_PROPERTIES is a uint8", async () => { const msg = new Subscribe.Subscribe({ diff --git a/js/net/src/ietf/object.ts b/js/net/src/ietf/object.ts index 4631aa6b966..edd66969248 100644 --- a/js/net/src/ietf/object.ts +++ b/js/net/src/ietf/object.ts @@ -2,7 +2,7 @@ import { ProtocolViolation, StreamCode, Stream as StreamError } from "../error.t import { asIetf, type Cursor, type Reader, Writer } from "../stream.ts"; import { type Timescale, Timestamp } from "../time.ts"; import { U64 } from "../util/u64.ts"; -import { ABSENT_WIRE } from "./priority.ts"; +import { DEFAULT_WIRE } from "./priority.ts"; import { type IetfVersion, Version } from "./version.ts"; // Implementation limit for object extension blocks, independent of the IETF draft. @@ -235,7 +235,7 @@ export class Group { const trackAlias = await r.u62(); const groupId = await r.u53(); const subGroupId = flags.hasSubgroup ? await r.u53() : 0; - const publisherPriority = hasPriority ? await r.u8() : ABSENT_WIRE; + const publisherPriority = hasPriority ? await r.u8() : DEFAULT_WIRE; return new Group({ trackAlias, groupId, subGroupId, publisherPriority, flags }); } diff --git a/js/net/src/ietf/priority.test.ts b/js/net/src/ietf/priority.test.ts index 04ff32b0787..f35ba559a72 100644 --- a/js/net/src/ietf/priority.test.ts +++ b/js/net/src/ietf/priority.test.ts @@ -1,7 +1,7 @@ import { expect, test } from "bun:test"; import * as Lite from "../lite/priority.ts"; import { infoDefaults } from "../track.ts"; -import { ABSENT_WIRE, fromWire, toWire } from "./priority.ts"; +import { DEFAULT_WIRE, fromWire, toWire } from "./priority.ts"; test("IETF priority is lower first", () => { expect(fromWire(0)).toBe(127); @@ -27,7 +27,8 @@ test("IETF mirrors moq-lite", () => { } }); -test("an unset track priority goes out as the absent byte", () => { +// An omitted priority is the drafts' 128, one step below the unset 127, so it forwards unchanged. +test("an unset track priority goes out as 127 and an omitted one reads as -1", () => { expect(toWire(infoDefaults().priority)).toBe(127); - expect(fromWire(ABSENT_WIRE)).toBe(0); + expect(fromWire(DEFAULT_WIRE)).toBe(-1); }); diff --git a/js/net/src/ietf/priority.ts b/js/net/src/ietf/priority.ts index 991475e0ed3..fabb94750ad 100644 --- a/js/net/src/ietf/priority.ts +++ b/js/net/src/ietf/priority.ts @@ -3,13 +3,17 @@ * `ietf::priority`. * * moq-transport ranks lower first, so the wire carries `127 - priority`: the unset priority 0 - * goes out as 127, and an absent priority decodes as 0. + * goes out as 127, and an omitted priority decodes as -1, one step below it. * * @module */ -/** The wire byte for the unset priority 0, which an absent priority stands for. */ -export const ABSENT_WIRE = 127; +/** + * The IETF priority an omitted SUBSCRIBER_PRIORITY or DEFAULT_PUBLISHER_PRIORITY stands for, as + * the drafts define both, and the byte for a message that must carry a priority it was not given. + * It reads as -1, so a relay forwards an omitted priority as 128, not as the unset 127. + */ +export const DEFAULT_WIRE = 128; /** Convert an IETF priority byte into the model's higher-first priority. */ export function fromWire(priority: number): number { diff --git a/js/net/src/ietf/properties.ts b/js/net/src/ietf/properties.ts index 2f7d91fa61a..5d2f2065635 100644 --- a/js/net/src/ietf/properties.ts +++ b/js/net/src/ietf/properties.ts @@ -30,7 +30,7 @@ export interface Properties { /// `undefined` declares no timeline, so the track and its objects are untimed. timescale?: Timescale; - /// Publisher priority for a group header without its priority flag. The wire default is 127, the unset priority 0. + /// Publisher priority for a group header without its priority flag. Omitted, it is the wire default 128, priority -1. priority?: number; /// The publisher's preference for prioritizing groups within a subscription, diff --git a/js/net/src/ietf/publisher.ts b/js/net/src/ietf/publisher.ts index e0da55c89b1..0207bd43dca 100644 --- a/js/net/src/ietf/publisher.ts +++ b/js/net/src/ietf/publisher.ts @@ -48,7 +48,7 @@ import * as Message from "./message.ts"; import * as Namespace from "./namespace.ts"; import { FetchFrame, Frame, Group as GroupMessage } from "./object.ts"; import { Parameters } from "./parameters.ts"; -import { fromWire, toWire } from "./priority.ts"; +import { DEFAULT_WIRE, fromWire, toWire } from "./priority.ts"; import * as Properties from "./properties.ts"; import { Publish, PublishDone, PublishDoneStatus } from "./publish.ts"; import { @@ -2581,7 +2581,7 @@ export class Publisher { requestId: id, trackNamespace: namespace, trackName: name, - subscriberPriority: defaults.subscriberPriority ?? 127, + subscriberPriority: defaults.subscriberPriority ?? DEFAULT_WIRE, groupOrder: defaults.groupOrder === GroupOrder.Ascending ? "ascending" : "descending", filter: defaults.subscriptionFilter, propertiesWanted: defaults.includeProperties ?? true, diff --git a/js/net/src/ietf/subscribe.ts b/js/net/src/ietf/subscribe.ts index cc04b87f1a8..7144cee8faa 100644 --- a/js/net/src/ietf/subscribe.ts +++ b/js/net/src/ietf/subscribe.ts @@ -7,7 +7,7 @@ import * as Filter from "./filter.ts"; import * as Message from "./message.ts"; import * as Namespace from "./namespace.ts"; import { type MessageLocation, MSG_PARAM_FORWARD, MSG_PARAM_SUBSCRIBER_PRIORITY, Parameters } from "./parameters.ts"; -import { ABSENT_WIRE } from "./priority.ts"; +import { DEFAULT_WIRE } from "./priority.ts"; import * as Properties from "./properties.ts"; import { type IetfVersion, Version } from "./version.ts"; @@ -221,7 +221,7 @@ export class Subscribe { } // v15+: fields are in parameters const params = await Parameters.decode(r, version, "subscribe"); - const subscriberPriority = params.subscriberPriority ?? ABSENT_WIRE; + const subscriberPriority = params.subscriberPriority ?? DEFAULT_WIRE; const groupOrder = decodeGroupOrder(params.groupOrder ?? GroupOrder.Descending); // FILL_PARAMETERS and INCLUDE_PROPERTIES are draft-20 additions, and the Range @@ -460,7 +460,7 @@ export class SubscribeUpdate { await w.u62(0n); // start_group await w.u62(0n); // start_object await w.u62(0n); // end_group - await w.u8(this.parameters.subscriberPriority ?? ABSENT_WIRE); + await w.u8(this.parameters.subscriberPriority ?? DEFAULT_WIRE); await w.bool(this.parameters.forward ?? true); await this.parameters.encode(w, version, [MSG_PARAM_SUBSCRIBER_PRIORITY, MSG_PARAM_FORWARD]); } else { diff --git a/js/net/src/ietf/subscribe_tracks.test.ts b/js/net/src/ietf/subscribe_tracks.test.ts index c66fe798922..1c7b9dcfe71 100644 --- a/js/net/src/ietf/subscribe_tracks.test.ts +++ b/js/net/src/ietf/subscribe_tracks.test.ts @@ -351,6 +351,19 @@ test("PUBLISH carries listing defaults and honors INCLUDE_PROPERTIES", async () expect(publish.parameters?.subscriptionFilter).toEqual({ kind: "relative", groups: 2n }); }); +// An omitted SUBSCRIBER_PRIORITY is the drafts' 128, so the PUBLISH restates 128, not the unset 127. +test("PUBLISH restates an omitted listing priority as 128", async () => { + const version = Version.DRAFT_22; + const fx = fixture(version); + const listing = await fx.list("room", false, new Parameters()); + await ok(listing, version); + const broadcast = fx.origin.createBroadcast(Path.from("room/live")); + broadcast.announce(); + broadcast.createTrack("later"); + const { publish } = await fx.offered(); + expect(publish.parameters?.subscriberPriority).toBe(128); +}); + test("an update ends only its listing and frees its prefix", async () => { const version = Version.DRAFT_22; const fx = fixture(version); diff --git a/js/net/src/ietf/subscriber.test.ts b/js/net/src/ietf/subscriber.test.ts index f85eeaf389c..df11eabba47 100644 --- a/js/net/src/ietf/subscriber.test.ts +++ b/js/net/src/ietf/subscriber.test.ts @@ -1226,9 +1226,9 @@ test("a compact END_OF_TRACK at object 5 with properties is subgroup 5, refused } }); -test("older peer without priority property inherits the unset priority", async () => { +test("older peer without priority property inherits the default publisher priority", async () => { const { subscriber, track } = await subscribeTrack(); - expect((await track.info()).priority).toBe(0); + expect((await track.info()).priority).toBe(127 - 128); const group = new GroupMessage({ trackAlias: ALIAS, groupId: 3, @@ -1237,7 +1237,7 @@ test("older peer without priority property inherits the unset priority", async ( flags: { ...groupFlags(true), hasPriority: false }, }); await subscriber.handleGroup(group, new Reader(undefined, encodeObjects([0]), VERSION)); - expect(group.publisherPriority).toBe(127); + expect(group.publisherPriority).toBe(128); track.close(); }); @@ -1351,7 +1351,7 @@ test.each(["acceptance", "timeout"])("returning demand preserves pending setup u if (outcome === "acceptance") { await peer.writer.u53(SubscribeOk.id); await new SubscribeOk({ requestId: request.requestId, trackAlias: ALIAS }).encode(peer.writer, VERSION); - expect(await info).toMatchObject({ priority: 0 }); + expect(await info).toMatchObject({ priority: 127 - 128 }); expect(returned.closed.peek()).toBeUndefined(); } else { jest.advanceTimersByTime(4_000); @@ -1418,7 +1418,7 @@ test("setup abandonment closes before a queued viewer can attach", async () => { const request = await Subscribe.decode(next.reader, VERSION); await next.writer.u53(SubscribeOk.id); await new SubscribeOk({ requestId: request.requestId, trackAlias: ALIAS }).encode(next.writer, VERSION); - expect(await info).toMatchObject({ priority: 0 }); + expect(await info).toMatchObject({ priority: 127 - 128 }); }); test("abandonment cancels once and a late acceptance cannot capture a reused alias", async () => { diff --git a/js/net/src/ietf/subscriber.ts b/js/net/src/ietf/subscriber.ts index 6b0ba746fce..acc2d40d13d 100644 --- a/js/net/src/ietf/subscriber.ts +++ b/js/net/src/ietf/subscriber.ts @@ -57,7 +57,7 @@ import { ObjectIdGap, } from "./object.ts"; import { Parameters } from "./parameters.ts"; -import { ABSENT_WIRE, fromWire, toWire } from "./priority.ts"; +import { DEFAULT_WIRE, fromWire, toWire } from "./priority.ts"; import { type Publish, PublishDone, PublishDoneStatus, publishDoneClean } from "./publish.ts"; import { type AdvertParams, @@ -1243,7 +1243,9 @@ export class Subscriber { // No TIMESCALE (always so on drafts 14-16, which can't carry it) means no timeline, // and the track must not claim one when served onward. timescale: ok.properties.timescale, - priority: fromWire(ok.properties.priority ?? ABSENT_WIRE), + // Drafts 14 and 15 carry only per-subgroup priorities, which the model does not keep, + // so they get the later drafts' default too. + priority: fromWire(ok.properties.priority ?? DEFAULT_WIRE), maxAge: maxCacheDuration === undefined ? undefined : Milli(Number(maxCacheDuration)), // A moq-transport peer may stamp arrival times, and nothing on the wire says it didn't. ietf: version, diff --git a/quest/m1/README.md b/quest/m1/README.md index 80140eb52cc..a3820f24989 100644 --- a/quest/m1/README.md +++ b/quest/m1/README.md @@ -159,7 +159,6 @@ audit's receive-memory, priority, and lease bugs rank ahead of that reshape. - [Peers advertise their implementation and version](/quest/m1/peer-version.md) - moq-net and `@moq/net` send a `name/version` SETUP parameter both ways, and the auth request and session span carry the client's - [Binding peer version](/quest/m1/binding-peer-version.md) - every binding names itself ahead of the Rust core in that parameter - [Calibrate the paired nightly benchmarks](/quest/m1/bench-ci.md) - A/A and deliberately slowed Nightly runs set the paired comparison's threshold, so its regression alerts can be trusted -- [Interop audit](/quest/m1/audit-interop.md) - our interop runner entries match what we ship, and every red interop cell with a moq.dev side is fixed, reported, or noted as down - [Refuse unknown MOQ_* environment variables](/quest/m1/env-unknown.md) - every binary exits at startup naming a `MOQ_*` variable it does not read - [HLS recorder in the CLI](/quest/m1/hls-record-cli.md) - `export hls --output ` records playlists and segments to a directory - [Group storage benchmark](/quest/m1/group-storage-bench.md) - numbers pick the append-only log, a ring buffer, or sorted runs for `GroupState` before either lands diff --git a/quest/m1/audit-interop.md b/quest/m1/audit-interop.md deleted file mode 100644 index ea987aa9df7..00000000000 --- a/quest/m1/audit-interop.md +++ /dev/null @@ -1,126 +0,0 @@ -# [M] Interop audit - -## Goal - -Our moq.dev entries in [englishm/moq-interop-runner](https://github.com/englishm/moq-interop-runner) -match what we ship: the client builds on the latest published moq-tokio and -`@moq/net`, the declared draft versions, and the relay endpoints. Every red -cell with a moq.dev side on and on the -runner's report is classified from its logs and either fixed (ours), -reported upstream (theirs), noted as down, or noted as unsupported (a -feature outside the moq-net API). - -## Plan - -Recurs once per major release (decided 2026-10-21). The PR that finishes -this run also adds the next one with the same file name at the end of the next -milestone's `Required` (m0 to m1, m1 to m2). The successor keeps the Goal -and this paragraph; the rest of its Plan is rewritten with what this run -learned: baselines, results, and what to check first. A successor placed in m2 -also lists the [release cut](/quest/m2/release/cut.md) under `Required`, so it -waits for the release in flight to ship. Only `/quest-delete` ends the -recurrence. Fixes land in the run's PR, one commit each, rather than as follow-ups. -Only a change that needs a maintainer decision (public API, scope) or is -independently landable and too large to review alongside the rest becomes a -follow-up through `/quest-plan`. - -Decided with the maintainer on 2026-10-21: - -- Scope: the relays page (our published Rust, browser, and Bun clients - through every registered public relay), plus every cell of the runner's - report with a moq.dev side: our clients, our docker relay, or - `cdn.moq.dev`, including third-party clients failing against our relay. -- Sync new registry entries. The smoke workflow's upstream runner job runs - the runner's HEAD, so check that newly registered clients and docker-only - relays show up in its [report](https://git.moq.dev/interop-runner/), - and ask upstream for a published image for any it lists as not run. The relays page reads every - remote relay from the registry; give new relays the per-relay config they - need (`publish_path`, `WEBSOCKET_KEYS` in `test/smoke/relays.sh`). -- Standing approval to open PRs on englishm/moq-interop-runner that touch only - the `moq-dev-*` builds and registry entries, and to file reproducer issues - on other implementations' repos. Every post ends with the AI marker. - -Both reports run published packages, so a fix turns green only after it -ships. Verify a fix from `main` instead: `MOQ_BIN=target/debug/moq just -relays --only ` from `test/smoke`, or `test/interop`, pointed at the -failing relay. The relays page's reason column now leads with the last stage -the subscriber reached (connected, SUBSCRIBE sent, SUBSCRIBE_OK, headless -groups), but still read the cell's log before classifying. - -### Check first - -The m0 run (2026-10-22) fixed on `main`, so confirm each turned green once -released: - -- moxygen: the Rust client offered `moq-00` over WebTransport, so moxygen - picked draft-14 over draft-16. That cell passed live from `main`. The - draft-14 QUIC cell stays red until [IETF lazy discovery](/quest/m1/ietf-lazy-discovery.md) - lands: the CLI asks draft-14 for no namespace, so it discovers nothing - from moxygen. A CLI subtree scope was tried and dropped, since it lost - the sibling broadcasts a catalog references. -- js/net dialed `moqt://` as a WebTransport CONNECT with `:scheme: moqt`, - which moq-relay refuses; the runner's moq-dev-js `remote-quic` cells - failed with an empty message. -- `rendezvous-timeout` answered 0x10 instead of TIMEOUT (fixed in - [moq-dev/moq#5616](https://github.com/moq-dev/moq/pull/5616) before this run). -- `invalid RESET_STREAM: 386759528` (WT_SESSION_GONE) now reads as the - session's close. -- js/net writes each control message in one write; red5 parsed SETUP only - from one stream frame, so recheck red5 WebTransport with js-bun. - -Waiting on others: - -- The runner's moq-dev client images were last built 2026-09-03 (the Rust - one reports moq-native 0.19.15). Asked in - [englishm/moq-interop-runner#170](https://github.com/englishm/moq-interop-runner/pull/170), - which also declares drafts 14-22; until a rebuild, moq-dev client cells - test stale code. [#171](https://github.com/englishm/moq-interop-runner/pull/171) - stops the JS client's http fingerprint fetch against non-moq.dev relays. -- Reported: [moqtail/moqtail#450](https://github.com/moqtail/moqtail/issues/450) - (draft-18 never answers SUBSCRIBE), - [openmoq/moqx#852](https://github.com/openmoq/moqx/issues/852) and - [gmarzot/aiomoqt#123](https://github.com/gmarzot/aiomoqt/issues/123) - (STOP_SENDING on one subgroup ends the subscription, as - [facebookexperimental/moxygen#252](https://github.com/facebookexperimental/moxygen/issues/252)), - [yatagai-mm/Moqtopus#2](https://github.com/yatagai-mm/Moqtopus/issues/2) - (closes on a request before SETUP completes), - [meetecho/imquic#42](https://github.com/meetecho/imquic/issues/42) and - [Eyevinn/moqlivemock#157](https://github.com/Eyevinn/moqlivemock/issues/157) - (interop clients drop the URL path), - [meetecho/imquic#43](https://github.com/meetecho/imquic/issues/43) - (drops a data stream whose header spans reads; owned by - [JS subgroup data through imquic](/quest/m1/interop-coverage/js-imquic-objects.md)), - plus moxygen's filter type 250 - ([facebookexperimental/moxygen#225](https://github.com/facebookexperimental/moxygen/issues/225)), - which also fails moqx's client against our relay. -- The JS publisher refuses every FETCH, so every relay that fills a late - joiner with an upstream FETCH (imquic, MOQtail draft-22, moqt-nr draft-22, - aiomoqt, red5) fails `js-web` publishing. Owned by - [JavaScript FETCH](/quest/m1/js-fetch.md); recheck those cells after it - lands before blaming the relay. MOQtail resets that subscription with - error 0. - -Unsupported or down, not worth rechecking unless something changes: -PUBLISH and SUBSCRIBE_TRACKS cases (`publish-track-*`, `namespace-discovery`, -Cloudflare's PUBLISH cases), Cloudflare draft-14 (no SUBSCRIBE_NAMESPACE, per -its feature matrix), Cloudflare draft-16 (needs a provisioned token; dropped -from the relays page), quiche-moq (connect idle timeout), xquic (its docker -relay binds loopback; its clients are raw QUIC only), and moqtopus and -xquic-draft-18 over WebTransport. - -Not yet reported, for lack of a repo or a reproduction: Nokia (moqt-nr) and -MOQtail draft-22 narrowing a downstream join to Next Object with no FILL, -red5 (its repo is not public), and imquic not replaying namespaces to a later -SUBSCRIBE_NAMESPACE (passed on 2026-10-22). - -Open from the m0 run: the JS subscriber still joins unfiltered before -draft-20, so a relay starting mid-group yields headless groups it stops. Next -Group Start would lose a write-once catalog without a joining FETCH, so this -waits on [JavaScript FETCH](/quest/m1/js-fetch.md). - -## Related - -- [Runner teardown](/quest/m3/interop-runner-approval.md) - the runner's moq.dev clients move to the withdrawing `close()` once it ships -- [Moxygen minimal interop](/quest/m1/smoke-moxygen.md) - Moxygen's filter type, waiting upstream -- [JavaScript FETCH](/quest/m1/js-fetch.md) - the JS publisher serves FETCH, which most red `js-web` publisher cells need -- [IETF lazy discovery](/quest/m1/ietf-lazy-discovery.md) - asks for watched prefixes, which the red moxygen draft-14 cell needs diff --git a/quest/m1/interop-coverage/README.md b/quest/m1/interop-coverage/README.md index 6417dceb1c9..5a0880a5e0d 100644 --- a/quest/m1/interop-coverage/README.md +++ b/quest/m1/interop-coverage/README.md @@ -47,5 +47,5 @@ coverage on `main` at `3ab6cbf81d`. ## Related - [Runner client bump](/quest/m2/release/runner-client-bump.md) - after the cut publishes #5083, the runner's Rust client stops stamping every object -- [Interop audit](/quest/m1/audit-interop.md) - classifies the red cells these cases produce +- [Interop audit](/quest/m2/audit-interop.md) - classifies the red cells these cases produce - [moq-transport passthrough](/quest/m1/ietf-extension/README.md) - Moxygen's moq-test conformance through moq-relay diff --git a/quest/m2/README.md b/quest/m2/README.md index 47f27ff201e..7754ede8d5b 100644 --- a/quest/m2/README.md +++ b/quest/m2/README.md @@ -226,3 +226,4 @@ lite-07; bitrate enforcement is not part of this release. - [Artifact size audit](/quest/m2/audit-size.md) - repeat the shipping, native, WASM and browser attribution after the release ships - [Compile time audit](/quest/m2/audit-compile-time.md) - build-time hotspots are measured against the m1 baselines, starting with the transport share now that moq-net compiles once, and the worst are fixed or planned - [Lint override and deprecation audit](/quest/m2/audit-lints.md) - repeat the suppression and deprecation audit after the release ships, starting with clippy on the macOS and Windows targets +- [Interop audit](/quest/m2/audit-interop.md) - our interop runner entries match what we ship, and every red interop cell with a moq.dev side is fixed, reported, or noted as down or unsupported diff --git a/quest/m2/audit-interop.md b/quest/m2/audit-interop.md new file mode 100644 index 00000000000..8b5594f7a1a --- /dev/null +++ b/quest/m2/audit-interop.md @@ -0,0 +1,156 @@ +# [M] Interop audit + +## Goal + +Our moq.dev entries in [englishm/moq-interop-runner](https://github.com/englishm/moq-interop-runner) +match what we ship: the client builds on the latest published moq-tokio and +`@moq/net`, the declared draft versions, and the relay endpoints. Every red +cell with a moq.dev side on and on the +runner's report is classified from its logs and either fixed (ours), +reported upstream (theirs), noted as down, or noted as unsupported (a +feature outside the moq-net API). + +## Plan + +Recurs once per major release (decided 2026-10-21). The PR that finishes +this run also adds the next one with the same file name at the end of the next +milestone's `Required` (m0 to m1, m1 to m2). The successor keeps the Goal +and this paragraph; the rest of its Plan is rewritten with what this run +learned: baselines, results, and what to check first. A successor placed in m2 +also lists the [release cut](/quest/m2/release/cut.md) under `Required`, so it +waits for the release in flight to ship. Only `/quest-delete` ends the +recurrence. Fixes land in the run's PR, one commit each, rather than as follow-ups. +Only a change that needs a maintainer decision (public API, scope) or is +independently landable and too large to review alongside the rest becomes a +follow-up through `/quest-plan`. + +Decided with the maintainer on 2026-10-21: + +- Scope: the relays page (our published Rust, browser, and Bun clients + through every registered public relay), plus every cell of the runner's + report with a moq.dev side: our clients, our docker relay, or + `cdn.moq.dev`, including third-party clients failing against our relay. +- Sync new registry entries. The smoke workflow's upstream runner job runs + the runner's HEAD, so check that newly registered clients and docker-only + relays show up in its [report](https://git.moq.dev/interop-runner/), + and ask upstream for a published image for any it lists as not run. The relays page reads every + remote relay from the registry; give new relays the per-relay config they + need (`publish_path`, `WEBSOCKET_KEYS` in `test/smoke/relays.sh`). +- Standing approval to open PRs on englishm/moq-interop-runner that touch only + the `moq-dev-*` builds and registry entries, and to file reproducer issues + on other implementations' repos. Every post ends with the AI marker. + +Both reports run published packages, so a fix turns green only after it +ships. Verify from `main` instead. For our clients through a third-party +relay, `MOQ_BIN=target/debug/moq just relays --only --publishers rust +--subscribers rust` from `test/smoke`. For a third-party client through our +relay, run its published runner image (`RELAY_URL`, `TLS_DISABLE_VERIFY=1`, +`TESTCASE`) on the host network against a `moq-relay` built from `main`. +For the runner's own cases from `main`, build its `moq-dev-rs` or +`moq-dev-js` client against this checkout; both need small ports to +`main`'s API. Read the cell's log before classifying. + +### Check first + +The m1 run (2026-10-23) read the runner's 2026-10-23 nightly (77 of 139 +moq.dev cells red; clients on moq-tokio 0.19.28 and `@moq/net` 0.4.4, +docker relay moq-relay 0.17.7) and the relays page (40 of 103 red). Most +red cells were already fixed on `main` and wait for the cut, so confirm +each turned green: + +- The runner's clients bumped to the cut, including the API port the + [runner client bump](/quest/m2/release/runner-client-bump.md) describes. + The JS client's `moqt://` dials (m0 fix) then reach every relay serving + WebTransport on that port; a raw-QUIC-only relay stays unsupported, since + JS has no raw QUIC. The JS client's red5 WebTransport cells still time out + connecting, which m0's one-write control messages target. +- `subscribe-namespace-lifecycle`: released JS withdraws a draft-17+ + PUBLISH_NAMESPACE with FIN, which six relays ignore, so it waits for + NAMESPACE_DONE. `main` resets the request + ([moq-dev/moq#5483](https://github.com/moq-dev/moq/pull/5483)) and passes + against Cloudflare draft-18; + [moq-dev/moq#6518](https://github.com/moq-dev/moq/pull/6518) backports it + to `release`. Released Rust never sees the NAMESPACE itself from quic-zig + or moxygen (docker, and draft-14 over raw QUIC); the client built on + `main` passes against both, so it gets no backport: the runner client bump + fixes it. +- Our relay through third-party clients: `rendezvous-timeout` 0x10 + (aiomoqt, imquic, quic-zig, Cloudflare draft-18), the relay stamping a + Timestamp property on every object + ([moq-dev/moq#5083](https://github.com/moq-dev/moq/pull/5083)), and moq-go + refusing a server without RESET_STREAM_AT (moq-quic) are fixed on `main`, + as are xquic's raw-QUIC connection errors (5 of 6 cases pass). An omitted + DEFAULT_PUBLISHER_PRIORITY or SUBSCRIBER_PRIORITY now forwards as 128, not 127. +- Through our relay, Cloudflare's draft-18 `data-subgroup-basic` still + fails on two items reported upstream: + [cloudflare/moq-rs#281](https://github.com/cloudflare/moq-rs/issues/281) + (its SUBSCRIBE_OK claims Largest Object (0, 0) before publishing it, then + refuses the joining FETCH) and + [cloudflare/moq-rs#282](https://github.com/cloudflare/moq-rs/issues/282) + (it fails our relay's END_OF_TRACK). + +Still red from `main`, ours: + +- moq-go's webtransport-go speaks WebTransport draft 15: it requires + SETTINGS_WT_ENABLED (0x2c7cf000) and sends `:protocol webtransport-h3`. + `web-transport-proto` 0.6.2 (moq-dev/web-transport) sends neither and + refuses the new token, so every moq-go cell against our relay fails. +- moq-dev-js `data-subgroup-basic` against libquicr never sees the track + end, while moq-dev-rs passes. Not yet traced. +- moxygen draft-14 over raw QUIC waits on + [IETF lazy discovery](/quest/m1/ietf-lazy-discovery.md), and every + `js-web` publisher cell behind a joining FETCH (imquic, MOQtail draft-22, + aiomoqt, red5) on [JavaScript FETCH](/quest/m1/js-fetch.md). + +Theirs, reported or waiting on others: + +- Reported before and still open: + [moqtail/moqtail#450](https://github.com/moqtail/moqtail/issues/450), + [openmoq/moqx#852](https://github.com/openmoq/moqx/issues/852), + [gmarzot/aiomoqt#123](https://github.com/gmarzot/aiomoqt/issues/123), + [yatagai-mm/Moqtopus#2](https://github.com/yatagai-mm/Moqtopus/issues/2), + [facebookexperimental/moxygen#252](https://github.com/facebookexperimental/moxygen/issues/252), + and [facebookexperimental/moxygen#225](https://github.com/facebookexperimental/moxygen/issues/225) + (filter type 250, which also fails moxygen's and moqx's + `announce-subscribe` against our relay). +- [meetecho/imquic#42](https://github.com/meetecho/imquic/issues/42) is + fixed upstream; imquic's cells against `cdn.moq.dev` wait for the runner + to rebuild its image. + [meetecho/imquic#43](https://github.com/meetecho/imquic/issues/43) + (drops a data stream whose header spans reads) is owned by + [JS subgroup data through imquic](/quest/m1/interop-coverage/js-imquic-objects.md). + [Eyevinn/moqlivemock#157](https://github.com/Eyevinn/moqlivemock/issues/157) + is fixed and green. +- Drafted in this run, posted only if the maintainer approved: Cloudflare's + draft-16 relay forwards END_OF_TRACK as a Normal empty object, so the Rust + subscriber reads an extra object (3, 0); MOQtail draft-18 never forwards + NAMESPACE for a later matching PUBLISH_NAMESPACE; moq-go dials only the + IPv6 address of `cdn.moq.dev` and needs an explicit port in an `https://` + URL; and the runner lists moqxr as not run for lack of a published image. + Search before filing again. +- Not reported, lower value: red5 subscribes the published prefix instead + of the requested tuple namespace (no public repo); moqlivemock's relay + refuses a SUBSCRIBE under an announced prefix; libquicr answers + SUBSCRIBE_OK for an unpublished namespace; xquic ignores our draft-14 + SUBSCRIBE_ERROR, sends `moq-test/interop` as one tuple field, and its + WebTransport never reaches our relay. + +Unsupported or down, not worth rechecking unless something changes: +PUBLISH and SUBSCRIBE_TRACKS cases (`publish-track-*`, `namespace-discovery`, +Cloudflare's PUBLISH cases), relays without namespace discovery, which +moq-net needs before a SUBSCRIBE (Cloudflare draft-14, xquic-draft-18), +quiche-moq (connect idle timeout), xquic's docker relay (binds loopback), +and moqtopus and xquic-draft-18 over WebTransport (raw QUIC only). + +## Required + +- [Release cut](/quest/m2/release/cut.md) - waits for the release in flight to ship + +## Related + +- [Runner client bump](/quest/m2/release/runner-client-bump.md) - the runner's Rust client moves to the cut and its API +- [Runner teardown](/quest/m3/interop-runner-approval.md) - the runner's moq.dev clients move to the withdrawing `close()` once it ships +- [Moxygen minimal interop](/quest/m1/smoke-moxygen.md) - Moxygen's filter type, waiting upstream +- [JavaScript FETCH](/quest/m1/js-fetch.md) - the JS publisher serves FETCH, which most red `js-web` publisher cells need +- [IETF lazy discovery](/quest/m1/ietf-lazy-discovery.md) - asks for watched prefixes, which the red moxygen draft-14 cell needs +- [Interop coverage](/quest/m1/interop-coverage/README.md) - the runner cases whose red cells this audit classifies diff --git a/quest/m2/release/runner-client-bump.md b/quest/m2/release/runner-client-bump.md index 2b36ac3d882..e5cdc9e7946 100644 --- a/quest/m2/release/runner-client-bump.md +++ b/quest/m2/release/runner-client-bump.md @@ -1,4 +1,4 @@ -# [XS] The runner's Rust client stops stamping every object +# [S] The runner's Rust client stops stamping every object ## Goal @@ -17,3 +17,16 @@ this quest once that PR merges. The released client adds the property, which third-party subscribers count as an unexpected extension in `data-subgroup-basic`. The interop audit's standing approval covers PRs touching the `moq-dev-*` builds. + +The cut also breaks the client's source, found porting it to `main` in the +m1 interop audit: a dynamic claim answers through `Request::prepare` and +`Prepared::publish` under a minted epoch, a track without a timescale +refuses timestamped frames, `Subscription` takes `max_delay` instead of a +max age, announcement events are `Start`, `Update`, `Restart`, and `End`, +and `track::Producer::used` is gone. Through moq-relay, the first +subscription under `data-subgroup-basic`'s dynamic claim then fails +`unroutable`: the accepted cold-start reset that +[announce takeover](/quest/m1/announce-takeover.md) removes, so check +whether that has landed before calling it a client bug. The JS client's +announcement check also moves from `"retracted"` to `"end"` when it takes +the cut. diff --git a/rs/moq-net/src/ietf/fetch.rs b/rs/moq-net/src/ietf/fetch.rs index ddb23871a94..2cb61e3ebad 100644 --- a/rs/moq-net/src/ietf/fetch.rs +++ b/rs/moq-net/src/ietf/fetch.rs @@ -311,7 +311,7 @@ impl Message for Fetch<'_> { Ok(Self { request_id, - subscriber_priority: subscriber_priority.unwrap_or(super::priority::ABSENT_WIRE), + subscriber_priority: subscriber_priority.unwrap_or(super::priority::DEFAULT_WIRE), // No preference: the publisher picks the order. group_order: group_order.unwrap_or(GroupOrder::Any), fetch_type, @@ -1085,6 +1085,19 @@ mod tests { } } } + + /// An omitted SUBSCRIBER_PRIORITY is the drafts' 128, not this stack's unset 127. + #[test] + fn test_fetch_omitted_priority_is_128() { + #[rustfmt::skip] + let body = [ + 0x01, // Request ID + 0x02, 0x03, 0x00, // Relative Joining: subscription 3, offset 0 + 0x00, // no parameters + ]; + let fetch = decode_message::(&body, Version::Draft16).unwrap(); + assert_eq!(fetch.subscriber_priority, 128); + } } /// The Object serialization on a fetch stream (draft-20 section 11.4.4), which a fill's diff --git a/rs/moq-net/src/ietf/group.rs b/rs/moq-net/src/ietf/group.rs index 7ddc17b82ca..5fc762771af 100644 --- a/rs/moq-net/src/ietf/group.rs +++ b/rs/moq-net/src/ietf/group.rs @@ -324,7 +324,7 @@ impl Decode for GroupHeader { let publisher_priority = if flags.has_priority { r.u8()? } else { - super::priority::ABSENT_WIRE + super::priority::DEFAULT_WIRE }; let result = Self { diff --git a/rs/moq-net/src/ietf/parameters.rs b/rs/moq-net/src/ietf/parameters.rs index 33adb807efc..2f5cda2eff1 100644 --- a/rs/moq-net/src/ietf/parameters.rs +++ b/rs/moq-net/src/ietf/parameters.rs @@ -560,7 +560,7 @@ macro_rules! encode_params { /// 0x20 => subscriber_priority: Option, /// ); /// // forward: Option and subscriber_priority: Option are now in scope -/// let subscriber_priority = subscriber_priority.unwrap_or(super::priority::ABSENT_WIRE); +/// let subscriber_priority = subscriber_priority.unwrap_or(super::priority::DEFAULT_WIRE); /// ``` macro_rules! decode_params { ($r:expr, $version:expr, $($key:expr => $name:ident: $ty:ty $(where $gate:expr)?),* $(,)?) => { diff --git a/rs/moq-net/src/ietf/priority.rs b/rs/moq-net/src/ietf/priority.rs index 7a3cf596178..197a3f35261 100644 --- a/rs/moq-net/src/ietf/priority.rs +++ b/rs/moq-net/src/ietf/priority.rs @@ -4,11 +4,10 @@ //! `priority + 128`: the IETF byte is always `255 -` the lite byte. The unset priority 0 //! goes out as 127, one step off the draft's usual 128, to keep that. -/// The model priority an absent IETF priority stands for: the unset default. -pub(super) const ABSENT: i8 = 0; - -/// The wire byte of [`ABSENT`], for a message that must carry a priority it was not given. -pub(super) const ABSENT_WIRE: u8 = to_wire(ABSENT); +/// The IETF priority an omitted SUBSCRIBER_PRIORITY or DEFAULT_PUBLISHER_PRIORITY stands for, as +/// the drafts define both, and the byte for a message that must carry a priority it was not given. +/// It reads as model priority -1, so a relay forwards an omitted priority as 128, not as unset 127. +pub(super) const DEFAULT_WIRE: u8 = 128; /// Convert an IETF priority into the model's higher-first priority. pub(super) const fn from_wire(priority: u8) -> i8 { @@ -33,13 +32,12 @@ mod tests { assert!((0u8..u8::MAX).all(|priority| from_wire(priority) > from_wire(priority + 1))); } - /// The unset default goes out as 127, and an absent priority decodes to it. + /// The unset default goes out as 127, and an omitted priority ranks one step below it. #[test] fn unset_is_127() { assert_eq!(to_wire(0), 127); assert_eq!(from_wire(127), 0); - assert_eq!(ABSENT, 0); - assert_eq!(ABSENT_WIRE, 127); + assert_eq!(from_wire(DEFAULT_WIRE), -1); } /// One urgency on both wires: the IETF byte mirrors the moq-lite byte. diff --git a/rs/moq-net/src/ietf/publish.rs b/rs/moq-net/src/ietf/publish.rs index 94f8d0d1849..a388cdec298 100644 --- a/rs/moq-net/src/ietf/publish.rs +++ b/rs/moq-net/src/ietf/publish.rs @@ -422,7 +422,7 @@ impl Message for PublishOk { match version { Version::Draft14 => { w.bool(self.forward); - w.u8(self.subscriber_priority.unwrap_or(super::priority::ABSENT_WIRE)); + w.u8(self.subscriber_priority.unwrap_or(super::priority::DEFAULT_WIRE)); self.group_order.unwrap_or(GroupOrder::Descending).encode(w, version)?; // Same as SUBSCRIBE: the Location an absolute filter carries is dropped on // decode, so encoding one would truncate the message. diff --git a/rs/moq-net/src/ietf/publisher/tracks.rs b/rs/moq-net/src/ietf/publisher/tracks.rs index 5803cec28d4..3527a6d9769 100644 --- a/rs/moq-net/src/ietf/publisher/tracks.rs +++ b/rs/moq-net/src/ietf/publisher/tracks.rs @@ -278,7 +278,7 @@ impl Publisher { prefix: prefix.clone(), forward: msg.forward, params: Params { - priority: msg.subscriber_priority.unwrap_or(crate::ietf::priority::ABSENT_WIRE), + priority: msg.subscriber_priority.unwrap_or(crate::ietf::priority::DEFAULT_WIRE), order: msg.group_order, filter: msg.filter.unwrap_or(Filter::Unfiltered), max_age: None, @@ -2258,6 +2258,22 @@ mod tests { } } + /// An omitted SUBSCRIBER_PRIORITY is the drafts' 128, so each PUBLISH restates 128 rather + /// than this stack's unset 127. + #[moq_clock::test] + async fn a_listing_without_a_priority_states_the_default() { + for version in DRAFTS.into_iter().filter(|version| Filter::is_draft20(*version)) { + let mut h = harness(version); + let mut request = h.request(&listing(false)).await; + assert_eq!(next(&mut request).await.0, ietf::RequestOk::ID, "{version}"); + let mut stream = timeout(Stream::accept(&mut h.peer, version)).await.unwrap(); + assert_eq!(stream.reader.varint().await.unwrap(), ietf::Publish::ID); + let body: ietf::Body = stream.reader.decode().await.unwrap(); + let publish: ietf::Publish = body.message(version).unwrap(); + assert_eq!(publish.subscriber_priority, Some(128), "{version}"); + } + } + /// A forwarding PUBLISH ends with PUBLISH_DONE once its track is no longer listed, here /// because its broadcast's route went, even while the track itself goes on. The track /// has not ended, so neither does the PUBLISH cleanly. diff --git a/rs/moq-net/src/ietf/subscribe.rs b/rs/moq-net/src/ietf/subscribe.rs index df8a7775a0e..1a6e1d60725 100644 --- a/rs/moq-net/src/ietf/subscribe.rs +++ b/rs/moq-net/src/ietf/subscribe.rs @@ -147,7 +147,7 @@ impl Message for Subscribe<'_> { // A zero cap still distinguishes a requested wait from an immediate miss. let rendezvous = rendezvous_timeout.is_some_and(|millis| millis > 0); - let subscriber_priority = subscriber_priority.unwrap_or(super::priority::ABSENT_WIRE); + let subscriber_priority = subscriber_priority.unwrap_or(super::priority::DEFAULT_WIRE); let group_order = group_order.unwrap_or(GroupOrder::Descending); // An absent LOCATION_FILTER means the subscription is unfiltered. let filter = filter.unwrap_or(Filter::Unfiltered); @@ -450,7 +450,7 @@ impl Message for SubscribeUpdate { .encode(w, version)?; self.start_location.encode(w, version)?; w.varint(self.end_group)?; - w.u8(self.subscriber_priority.unwrap_or(super::priority::ABSENT_WIRE)); + w.u8(self.subscriber_priority.unwrap_or(super::priority::DEFAULT_WIRE)); w.bool(self.forward.unwrap_or(true)); encode_params!(w, version, 0x03 => self.authorization_token.clone(), @@ -1139,6 +1139,31 @@ mod tests { assert_eq!(subscribe(&[0x02]).unwrap().filter, Filter::NextObject); } + /// From draft-15 SUBSCRIBER_PRIORITY is a parameter whose omission means 128, not this + /// stack's unset 127, so a relay forwards it unchanged. + #[test] + fn test_subscribe_omitted_priority_is_128() { + for version in [ + Version::Draft15, + Version::Draft16, + Version::Draft17, + Version::Draft18, + Version::Draft19, + Version::Draft20, + Version::Draft21, + Version::Draft22, + ] { + let mut bytes = vec![0x00]; // request_id + if version == Version::Draft17 { + bytes.push(0x00); // required_request_id_delta + } + bytes.extend_from_slice(b"\x01\x0bnonexistent\x0dno-such-track"); // namespace, name + bytes.push(0x00); // no parameters + let msg = decode_message::(&bytes, version).unwrap(); + assert_eq!(msg.subscriber_priority, 128, "{version}"); + } + } + #[test] fn test_subscribe_update_v15_round_trip() { let msg = SubscribeUpdate { diff --git a/rs/moq-net/src/ietf/subscriber.rs b/rs/moq-net/src/ietf/subscriber.rs index 1727bc3f1dc..6723423c8f7 100644 --- a/rs/moq-net/src/ietf/subscriber.rs +++ b/rs/moq-net/src/ietf/subscriber.rs @@ -510,11 +510,11 @@ fn accepted_info(properties: &ietf::Properties, version: Version) -> track::Info .with_compress(properties.compress) .with_timescale(properties.timescale) .with_max_age(properties.max_cache_duration) - .with_priority( - properties - .priority - .map_or(super::priority::ABSENT, super::priority::from_wire), - ) + // Drafts 14 and 15 carry only per-subgroup priorities, which the model does not keep, + // so they get the later drafts' default too. + .with_priority(super::priority::from_wire( + properties.priority.unwrap_or(super::priority::DEFAULT_WIRE), + )) // A publisher answering NEW_GROUP_REQUEST refreshes on any join with a delta to skip; // this session carries the request back to it. .with_refresh(properties.dynamic_groups.then_some(0)); @@ -3468,16 +3468,21 @@ impl Subscriber { && largest_group(&track, largest).is_some_and(|largest| value > largest) && requested.is_none_or(|requested| value > requested) }); - let update = Update { + let mut update = Update { start_location, priority: (priority != sent_priority).then_some(priority), max_age: wanted_max_age.filter(|_| wanted_max_age != sent_max_age), new_group, }; - match update.priority.is_some() || update.max_age.is_some() || update.new_group.is_some() { - true => Poll::Ready(End::Update(update)), - false => Poll::Pending, + if update.priority.is_none() && update.max_age.is_none() && update.new_group.is_none() { + return Poll::Pending; + } + // Draft-14's SUBSCRIBE_UPDATE cannot omit the priority, so it restates the one + // in force rather than resetting it to the omission default. + if self.version == Version::Draft14 { + update.priority = Some(priority); } + Poll::Ready(End::Update(update)) }) .await; @@ -8088,6 +8093,78 @@ mod tests { assert_eq!(update.forward, Some(true)); } + /// Draft-14's SUBSCRIBE_UPDATE cannot omit the priority, so an update for the max age + /// alone restates the unset priority in force instead of the omission default 128. + #[moq_clock::test] + async fn a_draft14_max_age_update_restates_the_priority() { + const VERSION: Version = Version::Draft14; + + let subscribe_ok = message( + ietf::SubscribeOk::ID, + &ietf::SubscribeOk { + request_id: Some(RequestId(0)), + track_alias: 7, + largest: None, + properties: Default::default(), + }, + VERSION, + ); + let session = crate::lite::test_transport::ScriptedSession::new(subscribe_ok); + let log = session.log.clone(); + + let (tasks, _task_set) = crate::util::TaskSet::new(); + let mut subscriber = Subscriber::new( + crate::time::sim(), + crate::driver::Transport::new(session), + crate::origin::Config::new(crate::Hop::new(1).unwrap()).produce(), + Control::new(None, false), + None, + peer::PeerSetup::declared(peer::Peer { + max_age: true, + ..Default::default() + }), + crate::Hop::new(1).unwrap(), + None, + VERSION, + tasks, + Default::default(), + ); + + let producer = crate::broadcast::Info::default().produce(); + let mut dynamic = producer.dynamic(); + let consumer = producer.consume(); + let track = consumer.track("video").unwrap(); + let _short = track.subscribe(track::Subscription::default().with_max_delay(Duration::from_secs(1))); + let request = dynamic.requested_track().await.expect("no track requested"); + let _serving = moq_clock::sim::spawn(async move { + subscriber + .run_subscribe(Path::new("broadcast"), dynamic, None, request) + .await; + }); + settle().await; + + let _long = track.subscribe(track::Subscription::default().with_max_delay(Duration::from_secs(5))); + settle().await; + + let writes = log.writes.lock().unwrap().clone(); + let mut buf = Decoder::new(&writes, VERSION.into()); + let mut updates = Vec::new(); + while !buf.is_empty() { + let type_id = buf.varint().unwrap(); + let size = buf.u16().unwrap() as usize; + let mut body = Decoder::new(buf.slice(size).unwrap(), VERSION.into()); + if type_id == ietf::SubscribeUpdate::ID { + updates.push(ietf::SubscribeUpdate::decode_msg(&mut body, VERSION).unwrap()); + } + } + + let [update] = updates.as_slice() else { + panic!("one update, not {updates:?}"); + }; + assert_eq!(update.max_age, Some(5_000)); + assert_eq!(update.subscriber_priority, Some(super::super::priority::to_wire(0))); + } + /// Establish a subscription on `version`, then drop its last consumer, and hand back /// what the session recorded on the way out. async fn cancel_a_subscription(version: Version) -> crate::lite::test_transport::Log { @@ -8303,7 +8380,8 @@ mod tests { .expect("the subscription is registered"); assert_eq!( track.producer.as_ref().unwrap().publisher_priority(), - priority.map_or(0, super::super::priority::from_wire), + // An omitted priority is the drafts' 128, one step below the unset 127. + priority.map_or(-1, super::super::priority::from_wire), "SUBSCRIBE_OK priority must be committed before alias registration" ); // The answer's largest is known before any group arrives. diff --git a/rs/moq-net/src/ietf/subscriber/tracks.rs b/rs/moq-net/src/ietf/subscriber/tracks.rs index ba49d054842..53881fc05a4 100644 --- a/rs/moq-net/src/ietf/subscriber/tracks.rs +++ b/rs/moq-net/src/ietf/subscriber/tracks.rs @@ -641,7 +641,7 @@ impl Subscriber { request_id, track_namespace: key.0.as_path(), track_name: key.1.as_ref().into(), - subscriber_priority: super::super::priority::ABSENT_WIRE, + subscriber_priority: super::super::priority::DEFAULT_WIRE, // No update can change it, so it takes the order a reader gets by default. group_order: track::Order::default().into(), filter: Filter::NextObject,