Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion quest/m0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ edge, which embeds moq-relay; it moved there on 2026-09-28.
- [Release credential leaks](/quest/m0/security-audit/README.md) - tokens stay out of logs and outbound HTTP clients verify their peer, on `main` and `release`
- [Interop and Video pass on main](/quest/m0/interop-green/README.md) - the scheduled Interop and Video workflows pass, so red means a new break
- [Release shutdown backport](/quest/m0/ffi-shutdown-backport.md) - `release` publishes a non-breaking moq-ffi with an async `drain()` and qmux sessions on the QUIC stream limit
- [Backport @moq/flate bounds](/quest/m0/backport-flate-budget.md) - `@moq/flate` on `release` stops inflating past its cap and stops pinning pako scratch
- [Backport audio groupDuration](/quest/m0/backport-audio-group-duration.md) - `@moq/publish` 0.5.4 on `release` can pack several Opus frames per group, making Cloudflare's relay drop audio less often
- [Backport the SETUP-path and iroh-key fixes](/quest/m0/backport-security-fixes.md) - `release` refuses a conflicting SETUP Path and keeps persisted iroh keys private, in one patch release
- [CI cost and latency](/quest/m0/ci/README.md) - cloud CI runs only in a batched merge gate as one `just ci` pass per batch, expensive checks run nightly and gate `release`, caches move to R2, and runners are chosen last
Expand Down
23 changes: 0 additions & 23 deletions quest/m0/backport-flate-budget.md

This file was deleted.

1 change: 0 additions & 1 deletion quest/m1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ removed).
- [moq-transport carries no epoch](/quest/m1/ietf-epoch-cut.md) - Rust and JS moq-transport sessions stop negotiating MoQ Epoch, so every moq-transport hop is epochless; the draft stays
- [moq-quic's API improves on quinn's](/quest/m1/quic-api/README.md) - moq-quic and both QUIC drivers ship one mirrored API: `send::`/`recv::` namespaces, one error per direction, consuming terminal operations, plain configs, no quinn baggage
- [On-demand JavaScript FETCH](/quest/m1/js-fetch-on-demand.md) - browser publishers answer IETF FETCH for evicted or uncached groups through the JS ranges request surface
- [Rust FETCH parity](/quest/m1/ietf-fetch-parity.md) - Rust finishes an answered joining FETCH's head, refuses a lost head with DOES_NOT_EXIST, and sends no timestamps without TIMESCALE, as the JS publisher does
- [Rust cancels an unclaimed fill head when a subscription ends](/quest/m1/ietf-fill-end-cancel.md) - SUBSCRIPTION_ENDED cancels, not finishes, a fill no group was sent for, as in JS
- [SUBSCRIBE honors the properties opt-out](/quest/m1/subscribe-timestamps.md) - the Rust publisher sends untimed objects to a SUBSCRIBE that declines Track Properties, and the Rust subscriber asks for them when it needs timestamps
- [A resumed untimed copy keeps DYNAMIC_GROUPS](/quest/m1/ietf-dynamic-groups-resume.md) - opting out of properties on a draft-22 resume no longer forgets DYNAMIC_GROUPS
Expand Down
55 changes: 0 additions & 55 deletions quest/m1/ietf-fetch-parity.md

This file was deleted.

7 changes: 4 additions & 3 deletions quest/m1/ietf-publisher-unknown-range.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ than only an eviction. `NotFound` and `Old` map to `0x10C`. Decide in the PR
whether `Unsupported` and `NotFetchable` mean "unknown" too, or need their own
handling, and record the reason.

Decided 2026-10-28 (maintainer): it starts after the three quests below land,
since each edits the same publisher. The third was IETF fill timeout, which
Decided 2026-10-28 (maintainer): it starts after the quests below land,
since each edits the same publisher. Rust FETCH parity, also listed then,
landed in [moq-dev/moq#6999](https://github.com/moq-dev/moq/pull/6999). A
third was IETF fill timeout, which
[moq-dev/moq#7194](https://github.com/moq-dev/moq/pull/7194) dropped for
[one group](https://github.com/moq-dev/moq/pull/7204), which edited the same
paths and has landed. A FETCH or fill now lists at most one group, so this
Expand All @@ -34,5 +36,4 @@ Public API: none. Wire: none; the marker exists in both drafts.

## Required

- [Rust FETCH parity](/quest/m1/ietf-fetch-parity.md) - edits the same FETCH answer path
- [SUBSCRIBE honors the properties opt-out](/quest/m1/subscribe-timestamps.md) - edits the same publisher
10 changes: 3 additions & 7 deletions quest/m1/ietf-withdraw-credit.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,12 @@ flow-control credit pins a withdrawn advertisement.

Decided 2026-10-28 (maintainer): its own quest rather than part of
[one request lease](/quest/m2/ietf-request-lease.md), since a peer making us
hold state is a hostile-peer bound to fix now; it waits for
[Rust FETCH parity](/quest/m1/ietf-fetch-parity.md) only because that PR edits
the same file. Use #7016's pattern: buffer each message and flush it inside
hold state is a hostile-peer bound to fix now; it waited for Rust FETCH parity
([moq-dev/moq#6999](https://github.com/moq-dev/moq/pull/6999)) only because
that PR edits the same file. Use #7016's pattern: buffer each message and flush it inside
the wait that already watches for withdrawal, and reset the stream rather
than FIN it when withdrawn before the message fully left.

Test with a peer that never grants send credit, on drafts 18 and 22.

Public API: none. Wire: none.

## Required

- [Rust FETCH parity](/quest/m1/ietf-fetch-parity.md) - edits `publisher.rs`, so this follows it
6 changes: 5 additions & 1 deletion quest/m2/ietf-join-after-finish.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ It flakes the pinned-pass interop `tail` cells with a Rust publisher, about
one run in six (seen 2026-10-22 while landing
[moq-dev/moq#6407](https://github.com/moq-dev/moq/pull/6407)): the tail test
finishes its track before SUBSCRIBE_OK, so PUBLISH_DONE follows within
milliseconds. The relay's settle grace (about a second) ends long before the
milliseconds. A FETCH that already had FETCH_OK being reset with its
subscription is not the cause: it has finished since
[moq-dev/moq#6999](https://github.com/moq-dev/moq/pull/6999), and neither
lifetime failed in six runs of the draft-18 Rust-publisher `tail` cells on
2026-10-28. The relay's settle grace (about a second) ends long before the
10 s registration wait refuses the FETCH, and the empty subscription stream
for the Largest group then becomes an empty group, which `rust -> rust` and
`rust -> js-native-*` read as "empty group".
Expand Down
130 changes: 91 additions & 39 deletions rs/moq-net/src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1841,7 +1841,7 @@ pub(crate) struct RequestVerdict {

/// Why a request token did not authorize its request: the error whose code the peer is
/// sent, and the reason phrase with it, which the acceptor chose when it refused.
#[derive(Debug)]
#[derive(Debug, Clone)]
pub(crate) struct Refusal {
pub error: Error,
pub reason: String,
Expand Down Expand Up @@ -1961,6 +1961,58 @@ struct Held {
/// The token of the renewal being verified, until the serve loop applies its verdict.
renewing: Option<kio::Shared<Issue>>,
clock: crate::time::Deadlines,
/// Why the request ended, once it has. A channel, so every clone waiting on the grant
/// wakes when [`RequestGrant::end`] latches it.
ended: kio::Producer<Option<Refusal>>,
}

impl Held {
/// See [`RequestGrant::poll_ended`].
fn poll_end(&mut self, waiter: &kio::Waiter) -> Poll<Refusal> {
loop {
// The acceptor granted a renewal the serve loop has yet to apply: it takes over rather
// than the request ending between the two, whether the old grant lapsed or dropped.
// Watched, so a request that abandons the renewal, such as one cancelled while a
// joined FETCH outlives it, falls back to the old grant's end.
let handover = self.renewing.as_ref().is_some_and(|issue| {
issue
.poll(waiter, |issue| match granted(issue) {
true => Poll::Pending,
false => Poll::Ready(()),
})
.is_pending()
});
if self.deadline.poll(waiter).is_ready() {
if handover {
return Poll::Pending;
}
return Poll::Ready(Refusal::new(Error::Expired, "request token expired"));
}
match self.verdict.poll_reply(waiter) {
Poll::Ready(None) if handover => return Poll::Pending,
Poll::Ready(None) => {
return Poll::Ready(Refusal::new(
Error::Session(SessionError::Unauthorized),
"grant dropped",
));
}
Poll::Ready(Some(Reply::Grant(grant))) => {
if !self.kind.covers(&grant, self.path.as_str()) {
return Poll::Ready(Refusal::new(Error::Unauthorized, "request token no longer granted"));
}
self.deadline.set(grant.expires);
self.grant = grant;
// Re-poll: the new deadline may already have lapsed, or another reply may
// be waiting.
continue;
}
Poll::Ready(Some(Reply::Refuse { code, reason })) => {
return Poll::Ready(Refusal::new(Error::Session(code), &reason));
}
Poll::Pending => return Poll::Pending,
}
}
}
}

impl RequestGrant {
Expand Down Expand Up @@ -1990,6 +2042,7 @@ impl RequestGrant {
hold,
renewing: None,
clock: clock.clone(),
ended: kio::Producer::new(None),
}))))
}

Expand Down Expand Up @@ -2039,47 +2092,37 @@ impl RequestGrant {
Ok(())
}

/// End the grant with `refusal`, waking every clone still watching it, unless it already
/// ended. A refused renewal ends the request without the grant ending itself, so the serve
/// loop calls this to end anything else serving under the grant, such as a joining FETCH
/// that outlives its subscription.
pub(crate) fn end(&self, refusal: Refusal) {
latch(&self.held().ended, refusal);
}
Comment thread
kixelated marked this conversation as resolved.
Resolved
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

/// Resolve with the refusal that ends the request: the deadline lapsing
/// ([`Error::Expired`]), the acceptor revoking or dropping the grant (its code and
/// reason), or an acceptor-side update that no longer covers the request
/// ([`Error::Unauthorized`]). A covering update, such as a lowered expiry, is folded in and
/// polling continues. Never resolves while the grant still stands.
pub(crate) fn poll_ended(&self, waiter: &kio::Waiter) -> Poll<Refusal> {
let mut held = self.held();
loop {
// The acceptor granted a renewal the serve loop has yet to apply: it takes over rather
// than the request ending between the two, whether the old grant lapsed or dropped.
let handover = held.renewing.as_ref().is_some_and(granted);
if held.deadline.poll(waiter).is_ready() {
if handover {
return Poll::Pending;
}
return Poll::Ready(Refusal::new(Error::Expired, "request token expired"));
}
match held.verdict.poll_reply(waiter) {
Poll::Ready(None) if handover => return Poll::Pending,
Poll::Ready(None) => {
return Poll::Ready(Refusal::new(
Error::Session(SessionError::Unauthorized),
"grant dropped",
));
}
Poll::Ready(Some(Reply::Grant(grant))) => {
if !held.kind.covers(&grant, held.path.as_str()) {
return Poll::Ready(Refusal::new(Error::Unauthorized, "request token no longer granted"));
}
held.deadline.set(grant.expires);
held.grant = grant;
// Re-poll: the new deadline may already have lapsed, or another reply may
// be waiting.
continue;
}
Poll::Ready(Some(Reply::Refuse { code, reason })) => {
return Poll::Ready(Refusal::new(Error::Session(code), &reason));
}
Poll::Pending => return Poll::Pending,
}
let held = &mut *self.held();
// Latched, as each acceptor reply is read once: every clone watching the grant sees
// the same end, whichever polled first.
let latched = match held.ended.poll_ref(waiter, |ended| match &**ended {
Some(ended) => Poll::Ready(ended.clone()),
None => Poll::Pending,
}) {
Poll::Ready(Ok(ended)) => Some(ended),
// Never closed: the grant owns its only producer.
Poll::Ready(Err(_)) | Poll::Pending => None,
};
if let Some(ended) = latched {
return Poll::Ready(ended);
}
let ended = std::task::ready!(held.poll_end(waiter));
latch(&held.ended, ended.clone());
Poll::Ready(ended)
}

/// Run `body`, everything a request does once admitted, until it finishes or `grant`
Expand All @@ -2095,6 +2138,15 @@ impl RequestGrant {
}
}

/// Record `refusal` as why a request grant ended, unless an earlier end already is.
fn latch(ended: &kio::Producer<Option<Refusal>>, refusal: Refusal) {
if let Ok(mut ended) = ended.write()
&& ended.is_none()
{
*ended = Some(refusal);
}
}

/// Run `body` until it finishes, or until `ended` resolves first, which drops `body` wherever
/// it waits.
///
Expand Down Expand Up @@ -2124,10 +2176,10 @@ fn live(clock: &crate::time::Deadlines, kind: RequestKind, path: &str, grant: &G
kind.covers(grant, path) && grant.expires.is_none_or(|expires| expires > clock.now())
}

/// Whether the acceptor granted the token behind `issue` and still holds the grant.
fn granted(issue: &kio::Shared<Issue>) -> bool {
let issue = issue.read();
!issue.done && issue.outbox.iter().any(|reply| matches!(reply, Reply::Grant(_)))
/// Whether the acceptor granted the token behind `issue` and still holds the grant, for a
/// request still waiting to apply it.
fn granted(issue: &Issue) -> bool {
issue.peer.is_none() && !issue.done && issue.outbox.iter().any(|reply| matches!(reply, Reply::Grant(_)))
}

/// A grant issued to one of the peer's tokens, which the session enforces. Dropping it
Expand Down
Loading
Loading