From c49c672d3f8b6e6c2f53a57e10580314c440dd13 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 13 Nov 2026 16:42:59 -0800 Subject: [PATCH 1/2] chore(quest): claim quest/m1/live-history-demand.md Quest-Claim: a7854af5a06e5812 From eca3fd7d35cd43e8c9c2b6d0592c657b42285469 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 13 Nov 2026 17:15:45 -0800 Subject: [PATCH 2/2] test(js/net): a reader without ranges keeps a history reader's floor The demand [{}] reaches back to the oldest group, as Rust's Range::oldest() default does, so it covers any history floor. Deletes the quest. Co-Authored-By: Claude Opus 5.5 --- js/net/src/track.test.ts | 25 +++++++++++++++++++++++++ quest/m1/live-history-demand.md | 22 ---------------------- 2 files changed, 25 insertions(+), 22 deletions(-) delete mode 100644 quest/m1/live-history-demand.md diff --git a/js/net/src/track.test.ts b/js/net/src/track.test.ts index 51d1cb4c65d..2d575375f15 100644 --- a/js/net/src/track.test.ts +++ b/js/net/src/track.test.ts @@ -11,6 +11,7 @@ import { rescale } from "./rescale.ts"; import { Timescale, Timestamp } from "./time.ts"; import { authoredInfo, Subscription, Producer as TrackProducer } from "./track.ts"; import { unwanted } from "./util/demand.ts"; +import { LIVE, rangesStart } from "./window.ts"; const enc = new TextEncoder(); const dec = new TextDecoder(); @@ -633,6 +634,30 @@ test("multiple subscriber options aggregate like Rust", async () => { expect(await none).toBeUndefined(); }); +// A reader without ranges reads from the oldest group, as Rust's `Range::oldest()` default does, +// so beside a history reader the union still reaches the history floor and below it. A reader that +// asks for the live edge alone keeps the history reader's floor as its own range. +test("a reader without ranges keeps a history reader's floor", () => { + const producer = new TrackProducer("test"); + const history = producer.subscribe({ ranges: [{ start: { absolute: 5n }, end: { absolute: 9n } }] }); + const plain = producer.subscribe(); + expect(producer.subscription.peek()?.ranges).toEqual([{}]); + expect(rangesStart(producer.subscription.peek()?.ranges ?? [])).toBeUndefined(); + + plain.close(); + history.close(); + + const other = new TrackProducer("test"); + const kept = other.subscribe({ ranges: [{ start: { absolute: 5n }, end: { absolute: 9n } }] }); + const live = other.subscribe({ ranges: [LIVE] }); + expect(other.subscription.peek()?.ranges).toEqual([ + { start: { absolute: 5n }, end: { absolute: 9n } }, + { start: { relative: 0n } }, + ]); + live.close(); + kept.close(); +}); + test("each reader reads only its own ranges, whatever the union asks for", () => { const producer = new TrackProducer("test"); const sparse = producer.subscribe({ diff --git a/quest/m1/live-history-demand.md b/quest/m1/live-history-demand.md deleted file mode 100644 index 1ef4cbd9010..00000000000 --- a/quest/m1/live-history-demand.md +++ /dev/null @@ -1,22 +0,0 @@ -# [S] A JS live reader keeps a history reader's floor - -## Goal - -When a JS track has a live reader with no `ranges` and a history reader at the -same time, the subscription's demand still reaches back to the history -reader's floor. Settle with a test whether it does. Fix it if it doesn't, or -delete this quest if the test shows it already does. - -## Plan - -Decided 2026-11-13 (maintainer, /quest-run follow-up from -[moq-dev/moq#8643](https://github.com/moq-dev/moq/pull/8643)): ✅ m1 (rejected: m0, m2). - -Unverified. A scratch test during #8643 gave a demand of `[{}]` for that pair, -which looks like an open live range with no floor. Start from a test that -pins the demand the pair should produce, and compare with Rust's equivalent. -[moq-dev/moq#8616](https://github.com/moq-dev/moq/pull/8616) (lite-07 FETCH -single-group only) rewrote how JS keeps fill and demand ranges apart -(`LiveRanges.edit`), so check against that code. - -Public API: none expected. Wire: none.