Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
5c22634
chore(quest): claim quest/m1/refuse-route.md
kixelated Nov 13, 2026
9681b3a
wip(net): a refused forwarded route withdraws the route, not the session
kixelated Nov 13, 2026
1e6fec8
test(net): session fixtures for refused routes and claims
kixelated Nov 13, 2026
93feb3a
test(net): a route at the hop limit is never forwarded
kixelated Nov 13, 2026
2d7c1f9
feat(stats): count the routes and claims a node refuses
kixelated Nov 13, 2026
b3c58eb
feat(js/net): a refused forwarded route withdraws the route, not the …
kixelated Nov 13, 2026
2077fc8
docs(draft): route content a relay refuses withdraws, and finish the …
kixelated Nov 13, 2026
6ed657b
test(net): cover a refused ANNOUNCE_RESTART
kixelated Nov 13, 2026
8648942
fix(net): refuse root claims, refused floors, and resolved paths like…
kixelated Nov 14, 2026
305da0c
fix(js/net): a route refused once live leaves its last floor as it was
kixelated Nov 14, 2026
441a83f
fix(js/net): a route refused once live re-checks cached consumes, as …
kixelated Nov 14, 2026
c1d4e7b
feat(net): a refused claim goes offline, its route's floors certifyin…
kixelated Nov 14, 2026
3f73435
fix(js/net): a claim ends only where the newest certifying floor with…
kixelated Nov 14, 2026
cf49d65
fix(js/net): an uncertified withdrawal still ends unless a refusal is…
kixelated Nov 14, 2026
b7aa6a4
fix(js/net): tell an end from offline with the views shows() weighs
kixelated Nov 14, 2026
91bd305
Merge branch 'base' into pr-8672
Nov 14, 2026
1bc219c
fix(net): disambiguate announce refusal type after base merge
Nov 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion doc/concept/stats.md
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ should prefer the canonical name and fall back to the legacy one.
"sessions_refused": { "refused": 0, "unavailable": 0, "request": 0, "forbidden": 0, "membership": 0, "expired": 0 },
"sessions_failed": { "idle_timeout": 1, "transport": 0, "application": 0, "expired": 0 },
"announces_peak": 40, "subscriptions_peak": 900,
"wire_tx": 2048, "wire_rx": 1024
"wire_tx": 2048, "wire_rx": 1024, "routes_refused": 0
}
}
```
Expand Down Expand Up @@ -481,6 +481,12 @@ goes down while the label has a session; in the totals and presence tracks it
never goes down while the track lives. Summing
nodes or labels takes the largest.

`routes_refused` counts the routes and claims that the label's moq-lite-07
sessions forwarded and the relay refused, such as a route with a flag this
release does not know. The relay withdraws each one and keeps the session, so a
neighbour on a newer release costs only that route. A rising count during a
rollout means the releases disagree on route content.

### Counters

Every counter is a cumulative, monotonic unsigned integer. A rate is the
Expand Down
38 changes: 26 additions & 12 deletions drafts/draft-lcurley-moq-lite.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Any broadcasts and subscriptions are transparently proxied by the CDN behind the
A Broadcast is a collection of Tracks named by a path.
This corresponds to a MoqTransport's "track namespace".
A path is a sequence of non-empty segments joined by `/` (0x2F), so it never starts or ends with `/` or contains two in a row; the empty path has no segments and prefixes every path.
A `\` (0x5C) escapes the `\` or `/` that follows it, as a MoqTransport namespace field holding either is spelled; a path with any other `\` is a PROTOCOL_VIOLATION.
A `\` (0x5C) escapes the `\` or `/` that follows it, as a MoqTransport namespace field holding either is spelled; a path with any other `\` is a PROTOCOL_VIOLATION, or in a claim refused (see [Refused Content](#refused-content)).
A continuous stream is named by an Instance, carried on its claims (see [ANNOUNCE_START](#announce-start)): a path and an Instance name one Broadcast, and a publisher MUST NOT serve different content under the same pair.
Within one Instance, group sequences never restart and never name two different groups, so claims sharing it serve the same bytes; two Instances are independent streams, never stitched together.
A publisher that starts its group sequences over, such as a restarted process, uses a new Instance, while replicas of the same content share one.
Expand Down Expand Up @@ -437,7 +437,7 @@ An ANNOUNCE_UPDATE or ANNOUNCE_RESTART atomically replaces a claim while keeping
The subscriber MUST close the session with a PROTOCOL_VIOLATION if it receives a message referencing a Route ID or Announce ID that was never assigned or already retired, a ROUTE_START for an origin node that already has a live route on the stream, an ANNOUNCE_START for a prefix its route already claims, or any message before ANNOUNCE_OK.
When the stream is closed, the subscriber MUST assume that every route and claim on it is gone.

A broadcast path has at most 32 segments and at most 4,096 bytes; a receiver MUST close the session with a PROTOCOL_VIOLATION on a longer one, including one resolved by [Compression](#announce-compression).
A broadcast path has at most 32 segments and at most 4,096 bytes; a receiver MUST close the session with a PROTOCOL_VIOLATION on a longer one, except in a claim, which it refuses instead (see [Refused Content](#refused-content)), including one resolved by [Compression](#announce-compression).
A claim covers a path when its prefix is a leading run of the path's segments; matching is per path segment, so a prefix never matches half a segment, and equality is byte-by-byte within each segment.
A publisher answering a request stream presents, per route, each claim inside the requested prefix and only the most specific claim at or above it, at the requested prefix itself (an empty suffix), which is exactly the covered set the subscriber may see.
When that most specific covering claim changes, such as when it is withdrawn and a broader one still covers the request, the publisher moves the presented claim to the new one with an ANNOUNCE_UPDATE or ANNOUNCE_RESTART, and ends it only when no claim of the route covers the requested prefix.
Expand Down Expand Up @@ -466,7 +466,20 @@ The receiver resolves the base against the claims live when the message arrives,
The base need not share the new claim's route.
A publisher MAY always send a `Path Base` of 0.

The subscriber MUST close the session with a PROTOCOL_VIOLATION if a non-zero `Path Base` names an Announce ID that was never assigned or already retired, a `Path Keep` is non-zero with a `Path Base` of 0 or exceeds the base's segments, or the resolved path breaks its own rules.
The subscriber MUST close the session with a PROTOCOL_VIOLATION if a non-zero `Path Base` names an Announce ID that was never assigned or already retired, or a `Path Keep` is non-zero with a `Path Base` of 0 or exceeds the base's segments.
A resolved path that breaks its own rules, or a base whose path the subscriber refused, refuses the claim (see [Refused Content](#refused-content)).

#### Refused Content {#refused-content}
Route messages carry content the publisher may only have forwarded: a route's Node ID, Seqno, Flags, and Hops, a claim's path, Instance, and Lite-06 Chain, and a warm route's path, Instance, Carrier Index, and Hops.
A newer version or release may send such content that an older receiver cannot use, so a receiver that refuses it withdraws only the route or claim it describes and keeps the session, as BGP treats a malformed attribute as a withdrawal ({{?RFC7606}}).
This specification marks each such value "refused"; the receiver skips the rest of the message's body, and SHOULD log and count each refusal so a refused route is never silently missing.

- A refused ROUTE_START still assigns its Route ID, and a refused ROUTE_UPDATE keeps it; either leaves the receiver no route, so its claims go offline as on ROUTE_END. The messages naming the Route ID stay valid, and a later ROUTE_UPDATE the receiver can use makes the route usable again, with the claims its last floor certified. A route to Node ID 0 stays refused.
- A refused ANNOUNCE_START still assigns its Announce ID, and a refused ANNOUNCE_UPDATE or ANNOUNCE_RESTART keeps it; the claim goes offline at its route's next floor, which is not an ANNOUNCE_END. A claim whose path was refused stays refused; any other comes back with a later ANNOUNCE_RESTART the receiver can use. Its origin withdrew nothing, so while a route has a live claim the receiver refused, the receiver takes the route's floors as certifying nothing, and a relay forwards no withdrawal for the claim.
- A refused WARM_START still assigns its Warm ID.

Only the publisher's own framing and stream state close the session: a message that does not decode within its Message Length, such as an RTT flag without its RTT, and a message naming an id that was never assigned or already retired, or breaking the stream's order, as above.
A relay never forwards content a peer would refuse for the relay's own part in it: a route that arrives with 32 Hops is unusable, so the relay's Hop never takes one past 32.

#### Hidden Paths {#hidden}
A claim is hidden from a request when a segment of its path below the requested prefix starts with `.` (0x2E).
Expand Down Expand Up @@ -959,7 +972,7 @@ moq-lite-07 uses the leading-ones encoding of [moqt]: the number of leading 1 bi
Most messages are prefixed with a variable-length integer indicating the number of bytes in the message payload that follows.
This length field does not include the length of the varint length itself.

A message on the Setup Stream or any bidirectional stream that fails to decode, such as one whose fields disagree with its Message Length or carry a value this specification forbids, MUST close the session with a PROTOCOL_VIOLATION.
A message on the Setup Stream or any bidirectional stream that fails to decode, such as one whose fields disagree with its Message Length or carry a value this specification forbids, MUST close the session with a PROTOCOL_VIOLATION, except content a route message forwards, which the receiver refuses (see [Refused Content](#refused-content)).
Resetting only the stream would let the peer repeat the violation on the next one.
A stream that ends or is reset before its message completes only terminates that stream, except on the Setup and Auth Streams.
A GROUP or FRAME that fails to decode resets only its Group or Fetch Stream, and a STREAM_TYPE the negotiated version does not define resets only its stream (see [STREAM_TYPE](#stream_type)).
Expand Down Expand Up @@ -1217,26 +1230,26 @@ Set to 0x6 to indicate a ROUTE_START message.

**Node ID**:
The origin node, as the publisher names it on this session.
0 is a PROTOCOL_VIOLATION.
0 is refused (see [Refused Content](#refused-content)).

**Seqno**:
The origin's sequence number of the route, which only the origin advances.
2^64-1 is a PROTOCOL_VIOLATION.
2^64-1 is refused.

**Metric**:
The publisher's metric to the origin node, 0 when it is the origin.

**Flags**:
A bit field: 0x1 when the route is down-only (see [Routing](#routing)), and 0x2 when an RTT follows.
Any other bit set is a PROTOCOL_VIOLATION.
Any other bit set is refused, rather than ignored: a later version may give a bit a meaning that changes the route, or a field ahead of the Hops.

**RTT**:
The publisher's RTT to the origin node in milliseconds (see [Routing](#routing)), 0 when it is the origin.
Present only when Flags has 0x2 set, and absent when the publisher has none.

**Hop Count**:
The number of Hop IDs that follow.
More than 32 is a PROTOCOL_VIOLATION.
More than 32 is refused.

**Hop ID**:
The route's Hops (see [Routing](#routing)), in order, the publisher's own last.
Expand Down Expand Up @@ -1377,7 +1390,7 @@ A claim never changes its Route ID.

**Instance**:
The stream the claim serves (see [Broadcast](#broadcast)): non-empty UTF-8 text.
An empty or non-UTF-8 Instance is a PROTOCOL_VIOLATION.
An empty or non-UTF-8 Instance is refused (see [Refused Content](#refused-content)).
A relay forwards the Instance unchanged.

**Minted**:
Expand All @@ -1398,7 +1411,7 @@ A relay forwards it unchanged; the cost of a path through the claim is the Annou

**Lite-06 Chain**:
The moq-lite-06 Hop ID list a claim arrived with where its origin node learned it over moq-lite-06, encoded as that list: a count, then each Hop ID.
A publisher sends it, as the message's last field, only to a peer that sent the [Lite-06 Chain Parameter](#lite06-chain-parameter), and only when the claim has one; a received empty chain is a PROTOCOL_VIOLATION.
A publisher sends it, as the message's last field, only to a peer that sent the [Lite-06 Chain Parameter](#lite06-chain-parameter), and only when the claim has one; a received chain that is empty, or names a Hop ID twice, is refused.
A relay forwards it unchanged, and translating the claim for a moq-lite-06 peer sends it followed by a Hop ID standing for the claim's origin node.
A node MUST NOT serve a claim whose chain names itself, by its own Hop ID or one standing for its Node ID, or whose translated chain would exceed its hop limit.

Expand Down Expand Up @@ -1538,11 +1551,11 @@ What pulling the copy cost the publisher, 0 when it is the copy's carrier (see [

**Carrier Index**:
The position of the copy's carrier among the Hop IDs that follow, 0 for the first.
A value not below `Hop Count` is a PROTOCOL_VIOLATION.
A value not below `Hop Count` is refused (see [Refused Content](#refused-content)).

**Hop Count**:
The number of Hop IDs that follow.
More than 32 is a PROTOCOL_VIOLATION.
More than 32 is refused.

**Hop ID**:
The copy's Hops (see [Warm Routes](#warm-routes)), in order, the publisher's own last.
Expand Down Expand Up @@ -2473,6 +2486,7 @@ An application-specific payload.
- FRAME leads with `Payload Length`, the payload size plus one, in place of the trailing `Message Length`; 0 is malformed.
- A publisher SHOULD drop a datagram rather than block when the transport has no room for it, where it previously sent one only if the congestion controller could transmit it immediately.
- Added an optional `Subscriber Max Age` to FETCH, encoded as milliseconds plus one with zero meaning absent. It can tighten, but never relax, `Publisher Max Age`.
- A receiver refuses forwarded route content it cannot use, such as an unknown route flag, more than 32 Hops, or an invalid claim path or Instance, withdrawing only that route or claim rather than closing the session ([Refused Content](#refused-content)). A refused claim goes offline, and its route's floors certify nothing while it holds one.

## moq-lite-06

Expand Down
51 changes: 32 additions & 19 deletions js/net/src/lite/announce.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ test("the route layer round-trips on draft-07", async () => {
).rejects.toThrow();
});

test("the route layer refuses the last seqno and Node ID 0", async () => {
test("the route layer refuses the last seqno, Node ID 0, unknown flags, and too many hops", async () => {
const v = Version.DRAFT_07;
const last = { seqno: ROUTE_MAX, metric: 0n, downOnly: false, rtt: undefined, hops: [] };
await expect(
Expand Down Expand Up @@ -453,24 +453,35 @@ test("the route layer refuses the last seqno and Node ID 0", async () => {
await w.u62(0n);
await w.u8(0);
});
await expect(decodeAnnounceBroadcast(new Reader(undefined, zero, v), v)).rejects.toThrow(ProtocolViolation);
// What the sender only forwarded is refused, the message decoded all the same, so the receiver
// withdraws the route and keeps the stream.
const decode = (wire: Uint8Array) => decodeAnnounceBroadcast(new Reader(undefined, wire, v), v);
expect(await decode(zero)).toEqual({
status: "refused",
message: { kind: "routeStart", node: 0n },
reason: "node",
});
const maxed = await forged(async (w) => {
await w.u62(1n);
await w.u62(ROUTE_MAX);
await w.u62(0n);
await w.u8(0);
});
await expect(decodeAnnounceBroadcast(new Reader(undefined, maxed, v), v)).rejects.toThrow(ProtocolViolation);
// A flag no version defines, and the RTT flag without its field.
for (const flags of [4, 2]) {
const flagged = await forged(async (w) => {
expect(await decode(maxed)).toEqual({
status: "refused",
message: { kind: "routeStart", node: 1n },
reason: "seqno",
});
// A flag no version defines is refused, and the RTT flag without its field is malformed.
const flagged = (flags: number) =>
forged(async (w) => {
await w.u62(1n);
await w.u62(0n);
await w.u62(0n);
await w.u8(flags);
});
await expect(decodeAnnounceBroadcast(new Reader(undefined, flagged, v), v)).rejects.toThrow();
}
expect(await decode(await flagged(4))).toMatchObject({ status: "refused", reason: "flags" });
await expect(decode(await flagged(2))).rejects.toThrow();
// More hops than a route may carry, refused before reading them.
const overHops = await forged(async (w) => {
await w.u62(1n);
Expand All @@ -479,7 +490,7 @@ test("the route layer refuses the last seqno and Node ID 0", async () => {
await w.u8(0);
await w.u53(ROUTE_MAX_HOPS + 1);
});
await expect(decodeAnnounceBroadcast(new Reader(undefined, overHops, v), v)).rejects.toThrow(ProtocolViolation);
expect(await decode(overHops)).toMatchObject({ status: "refused", reason: "hops" });
});

test("the subscriber's replies round-trip on draft-07", async () => {
Expand Down Expand Up @@ -532,23 +543,25 @@ test("AnnounceHistory rejects a keep longer than the base", () => {
test("AnnounceHistory keeps segments split at an escaped slash", () => {
const history = new AnnounceHistory();
history.start({ suffix: Path.from("a\\/b") });
// The kept `a\` is half an escape, which the rest completes or nothing does.
// The kept `a\` is half an escape, which the rest completes, or nothing does and the path is
// refused, its id assigned all the same.
const suffix = history.start({ suffix: Path.from("c"), pathBase: { distance: 1n, keep: 1 } });
expect(suffix).toBe(Path.from("a\\/c"));
expect(() => history.start({ suffix: Path.empty(), pathBase: { distance: 1n, keep: 1 } })).toThrow(
ProtocolViolation,
);
expect(history.start({ suffix: Path.empty(), pathBase: { distance: 1n, keep: 1 } })).toBeUndefined();
expect(history.next).toBe(3n);
});

test("AnnounceHistory rejects a resolved path past the byte limit", () => {
test("AnnounceHistory refuses a resolved path past the byte limit", () => {
const history = new AnnounceHistory();
history.start({ suffix: Path.from("x".repeat(Path.MAX_BYTES - 2)) });
// `head/y` is exactly the limit, and one byte more is refused.
// `head/y` is exactly the limit, and one byte more is refused as content: the id is assigned,
// a base naming it is refused too, and its end is no violation.
const suffix = history.start({ suffix: Path.from("y"), pathBase: { distance: 1n, keep: 1 } });
expect(suffix.length).toBe(Path.MAX_BYTES);
expect(() => history.start({ suffix: Path.from("yz"), pathBase: { distance: 1n, keep: 1 } })).toThrow(
ProtocolViolation,
);
expect(suffix?.length).toBe(Path.MAX_BYTES);
expect(history.start({ suffix: Path.from("yz"), pathBase: { distance: 1n, keep: 1 } })).toBeUndefined();
expect(history.start({ suffix: Path.from("z"), pathBase: { distance: 1n, keep: 1 } })).toBeUndefined();
expect(history.end(2n)).toBeUndefined();
expect(() => history.end(2n)).toThrow(ProtocolViolation);
});

test("a keep without a base is a violation on draft-07", async () => {
Expand Down
Loading