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
7 changes: 7 additions & 0 deletions quest/m1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ Imported 2026-10-12 from GitHub issues: the 0.17 warm FETCH stall and the
moq-lite malformed-input closes rank just below Dropped sources, and #5347
folded into Dropped sources.

Added 2026-10-12 as PR follow-ups: fake timers for the JS pool
tests (#5355), duration parser defaults (#5350), and cancelled origin
demand (#5214), each ranked beside the work it shares code with.

## Required

- [Interop close logs](/quest/m1/interop-close-log.md) - logging fix landed; delete once the required Interop run is green
Expand Down Expand Up @@ -80,6 +84,7 @@ folded into Dropped sources.
- [Live TS clock validation](/quest/m1/ts-live-clock.md) - resolve the local PCR-rate failure with reproducible timing evidence and CI controls
- [Same-instance TS resume](/quest/m1/ts-same-instance-resume.md) - prove valid continuation and fix the unexpected final exporter failure without weakening identity
- [More tests under load](/quest/m1/test-flakes-2/README.md) - the second round of load-only failures, one quest per flake, fixed at the cause
- [pool.test.ts on fake timers](/quest/m1/js-pool-test-time.md) - js/net's connection pool tests advance Bun's fake timers instead of sleeping or patching `performance.now`
- [Drill mutation gate](/quest/m1/drill-mutation-gate.md) - a PR touching a drill mutation's target runs that mutation's sensitivity check, advisory until the drills run on controlled time
- [Plan: a public model](/quest/m1/model-public-surface.md) - every crate-private model item is made public or unnecessary, so a custom publisher or subscriber builds from the public model alone
- [Pipelined requests](/quest/m1/pipeline-requests/README.md) - SUBSCRIBE and the first FETCH go out with the track-info request at every hop, so first data arrives a round trip sooner per hop
Expand Down Expand Up @@ -157,9 +162,11 @@ folded into Dropped sources.
- [Front deadlines](/quest/m1/front-deadline-index.md) - a front's per-event cost stops growing with its track count: an expiry index and per-track wakes, proven by a churn benchmark
- [io_uring handshake deadline](/quest/m1/listener-deadlines.md) - the io_uring workers apply `listen.timeout` to the handshake
- [Rust papercuts](/quest/m1/papercuts-rs.md) - HTTP refusals are counted, and a `u64::MAX` resume is unbounded
- [Duration parser defaults](/quest/m1/cli-duration-defaults.md) - a moq-tokio duration set in code beats the parser default on a parsed or merged config, zero included, after #5350
- [Front parking](/quest/m1/origin-front-parks.md) - an unroutable request waits on a front instead of re-asking on every route-table move
- [Route wakes](/quest/m1/route-wakes.md) - a route change wakes only the fronts it can move, so pool churn stops scaling with served paths
- [Publish channel count](/quest/m1/publish-audio-channel-count.md) - forcing a channel count on an Audio.Capture stops costing the subscriber gaps of silence
- [Cancelled demand](/quest/m1/js-demand-cancel.md) - a JS requester that leaves before a dynamic handler answers withdraws its origin demand, so a stalled handler holds nothing for it
- [JS request deadline](/quest/m1/js-request-deadline.md) - each JS request, PUBLISH_NAMESPACE included, has one fatal 10 s timer from create to answer and fails fast without stream credit, so nothing queues or retries
- [Rust request credit](/quest/m1/rs-request-credit.md) - a moq-net request fails at once without stream credit instead of waiting
- [qmux no-wait opens](/quest/m1/qmux-no-wait.md) - @moq/qmux rejects an over-limit create when waitUntilAvailable is false, like Chrome
Expand Down
52 changes: 52 additions & 0 deletions quest/m1/cli-duration-defaults.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# [M] A duration set in code beats the parser default

## Goal

On a moq-tokio config built by the command line or merged from settings, a
duration a caller sets in code takes effect, zero included, unless its flag or
env var was actually given. #5350 fixes this for `connect.backoff.timeout`.
The rest still ignore the code: connect `race`, `resolution_delay`, and
`timeout`; `listen.timeout`; QUIC `idle_timeout` and `keep_alive`; backoff
`initial` and `max`; GOAWAY `handover`; and WebSocket `delay`.

## Plan

The cause, from #5350: usage builds `default_value_t` by formatting and
reparsing it, so `CliDuration::fallback` reaches the struct as an explicit
value and `CliDuration::resolve` prefers it over the typed field. And a parse
leaves each `#[usage(skip)]` typed field at `Duration::ZERO`, which `resolve`
reads as unset, so a zero set afterwards looks like no value. Zero is a real
setting for most of these fields: wait forever, disable keep-alive, dial every
address at once, or give WebSocket no head start.

These aren't one-line fixes. Each field's public type changes, and its callers
in moq-c, moq-ffi, moq-gst, moq-relay, and the moq-tokio tests (about 70
sites) follow.

Decided 2026-10-13: give all ten fields #5350's shape. The typed field becomes
`Option<Duration>` (`None` is unset, and `Default` holds the default), the
`*_arg` field loses its parser default, and each field resolves the flag, then
the typed field, then the default. `fallback`, `resolve`, and the `explicit`
bit then have no callers, so delete them (also decided) and leave `CliDuration` as the
humantime parser.

Rejected: fixing usage (jdx/usage, an outside party) to assign
`default_value_t` without the string round-trip. It fixes only the first
half; skipped fields still start at zero, so the zero ambiguity stays.

Start after #5350 merges, since this reuses its `serde_duration::option` and
shape. Like #5350, help no longer prints these flags' defaults, because
usage's `default` sets a parser value; each doc comment states its default.
Use a help-only default instead if usage offers one.

Extend #5350's `a_timeout_set_in_code_beats_the_parser_default` to every field:
a parsed config, a merged round-trip with zero and nonzero values, a given
flag still winning, and a config built in code. It must fail on main.

Public API: breaking, each listed `moq_tokio` field goes from `Duration` to
`Option<Duration>`. The C ABI and FFI records keep their `has_*` flags and
don't change. Wire: none.

## Related

- [#5350](https://github.com/moq-dev/moq/pull/5350) - the backoff timeout fix this generalizes
60 changes: 60 additions & 0 deletions quest/m1/js-demand-cancel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# [S] A cancelled request releases its origin demand

## Goal

In `@moq/net`, a requester that leaves before a dynamic handler answers its
broadcast stops holding the origin's demand for it. Once the last requester
for a path leaves, that path's pending request is withdrawn, and its waiter
count and any stored rejection go with it. Other requesters for the same path
keep waiting. This covers lite SUBSCRIBE, FETCH, and TRACK info, and IETF
SUBSCRIBE.

## Plan

Found in #5214's review and deferred while #5314 rewrote the request path;
#5314 has merged.

The bug: `Consumer.#demand` in `js/net/src/origin.ts` enqueues the path on
its `ServeState`, bumps `demanding`, and waits on `settled` until the handler
answers, the route closes, or a reset releases it. Nothing ends that wait when
the requester leaves. The lite and IETF SUBSCRIBE paths race it with
`untilAborted`, which stops the caller waiting but leaves the promise running,
and lite FETCH and TRACK don't race it at all. So the `pending` request, its
queue entry, and the `demanding` count live until the handler answers, which
may be never. With a stalled handler, a peer that subscribes to distinct paths
and cancels each one grows that state without bound, while #5214's caps hand
the slots back.

`demand` takes an `AbortSignal` on the internal wire interface
(`js/net/src/wire.ts`). On abort the waiter drops its count. The request is
withdrawn the way `ServeState.reset` does, but for one path (out of `pending`
and the queue, finished so a late answer closes its front), only when nobody
else needs it. `demanding` counts wire waiters alone: a local
`Consumer.request()` reaches the same pending request through
`OriginState.route()`, which enqueues without counting, so the withdrawal
must also see that no local request or failover still routes to the path.
Callers pass the signal they already hold (`left.signal`, `hold`, or one tied
to the FETCH stream) instead of wrapping the call in `untilAborted`. Check
Rust's behavior (`Requests::remove_if` and `ServeState::forget` in
`rs/moq-net/src/model/origin.rs`) and match it, including whether a request a
handler has already taken is withdrawn.

Decided 2026-10-13: don't signal the handler that a request it took was
withdrawn. Its late answer just closes its front, and `Request` gets no new
public API; the bound doesn't depend on it.

Regression: a dynamic handler that never answers; for each covered request
(SUBSCRIBE in both protocol families, lite FETCH, and lite TRACK), request
many distinct paths and cancel each before an answer, then check that the
origin holds nothing for them. Also check that a second requester on a shared
path still resolves after the first cancels, both a second peer and a local
`Consumer.request()`, with the handler answering after the peer cancels.
Drive it on events, and use fake timers for any wait. Each case must fail on
main.

Public API: none, since `demand` is internal. Wire: none.

## Related

- [JS request deadline](/quest/m1/js-request-deadline.md) - once a request times out after 10 s, every unanswered one is cancelled, so each would hold demand without this
- [#5214](https://github.com/moq-dev/moq/pull/5214) - the JS session caps whose cancelled slots this finishes releasing
45 changes: 45 additions & 0 deletions quest/m1/js-pool-test-time.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# [S] pool.test.ts on fake timers

## Goal

`js/net/src/connection/pool.test.ts` neither reads the wall clock nor waits on
a real timer. The linger, retry-window, and outage tests advance Bun's fake
timers instead of sleeping or patching `performance.now`, and each still fails
against the bug it was written for.

## Plan

Raised in #5355's review: its own regression moved to fake timers, the rest of
the file did not. Still on real time as of `079d7d8d4`:

- `expired()` waits `linger * 15` real milliseconds, and the longest-linger
test waits 50 ms.
- `waitUntil` polls `Date.now` through real `setTimeout(0)` settles, for up to
1 s, and 15 s in the shared-outage test.
- The shared-outage and private-partial-delay tests speed up the retry window
by monkeypatching `performance.now`, and the shared one sleeps 2 s under a
30 s test timeout.

Decided 2026-10-13: switch to Bun's fake timers now, as a standalone quest,
rather than waiting for `@moq/time`.

Use Bun's `jest.useFakeTimers()`, which also drives `performance.now` (#5355),
as `connect.test.ts`, `js/publish/src/source/retry.test.ts`, and #5355's test
already do. Check that it drives `Date.now` too, or drop the `Date` reads
(left to the implementer, decided 2026-10-13).
Replace `settle`, `waitUntil`, and `expired` with one helper that advances the
clock and drains microtasks; the mock transport's handshake must still finish
inside a drain.

This doesn't wait for `@moq/time`: [JS on @moq/time](/quest/m1/time/js-migrate.md)
already moves every `jest.useFakeTimers` site onto its `Manual` clock, so the
swap there is mechanical, and these tests stop costing seconds and load
sensitivity now. A test that still seems to need a real wait has a cause to
fix, not a wait to widen.

Public API: none. Wire: none.

## Related

- [JS on @moq/time](/quest/m1/time/js-migrate.md) - later moves these fake timers onto the `Manual` clock
- [More tests under load](/quest/m1/test-flakes-2/README.md) - the same rule for tests that have already flaked
Loading