From f52603c6e6e532fea65a125d7e8515b94415d307 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 7 Nov 2026 14:36:16 -0800 Subject: [PATCH 1/2] chore(quest): claim quest/m0/test-flakes-2/lite07-relative-start.md Quest-Claim: cc0b5826ed76c34d From 919b3c456665f5541112f442b5e32ceff09b0a65 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 7 Nov 2026 14:42:46 -0800 Subject: [PATCH 2/2] fix(net): a relative start settles its window before asking fills Co-Authored-By: Claude Opus 5.5 --- js/net/src/integration.test.ts | 12 ++++++--- js/net/src/track.ts | 3 +++ quest/m0/test-flakes-2/README.md | 11 ++++---- .../m0/test-flakes-2/lite07-relative-start.md | 27 ------------------- 4 files changed, 17 insertions(+), 36 deletions(-) delete mode 100644 quest/m0/test-flakes-2/lite07-relative-start.md diff --git a/js/net/src/integration.test.ts b/js/net/src/integration.test.ts index b2e42dca32b..aa3f9859ebb 100644 --- a/js/net/src/integration.test.ts +++ b/js/net/src/integration.test.ts @@ -505,9 +505,9 @@ test("integration: lite-07 serves sparse and relative ranges", async () => { // so counts neither in the largest it reports nor where the copy resolves the start. The copy reports // the publisher's start, where a reader waiting on each group in sequence starts. Mirrors the Rust // `a_relative_start_reports_the_publishers_start_over_a_frameless_newest_group`. -// Quarantined: once on main, the start resolved to 0 instead of the publisher's 5. -// Investigation: quest/m0/test-flakes-2/lite07-relative-start.md. -test.skip("integration: lite-07 reports a relative start over a frameless newest group", async () => { +// The newest group lands before the reader asks, as it can under load: a sibling reads it, so the +// reader's own window has yet to settle on it when it asks where it starts. +test("integration: lite-07 reports a relative start over a frameless newest group", async () => { const pair = createMockTransportPair(Lite.ALPN_07_WIP); const origin = new OriginProducer(); const [client, server] = await Promise.all([ @@ -525,15 +525,19 @@ test.skip("integration: lite-07 reports a relative start over a frameless newest const newest = producer.appendGroup(); const remote = wireOf(client).consume(Path.from("test")); - const reader = remote.track("video").subscribe({ delay: { max: null }, ranges: [{ start: { relative: 0n } }] }); + const subscription = { delay: { max: null }, ranges: [{ start: { relative: 0n } }] }; + const reader = remote.track("video").subscribe(subscription); + const sibling = remote.track("video").subscribe(subscription); try { // Accepting the track subscribes it upstream, whose answer resolves the start. await reader.info(); + expect((await sibling.recvGroup())?.sequence).toBe(5n); expect(await reader.start()).toBe(5n); newest.writeFrame({ payload: new Uint8Array([5]) }); newest.finish(); expect((await reader.recvGroup())?.sequence).toBe(5n); } finally { + sibling.close(); reader.close(); remote.close(); broadcast.close(); diff --git a/js/net/src/track.ts b/js/net/src/track.ts index 1d6f689f9d4..541a8832107 100644 --- a/js/net/src/track.ts +++ b/js/net/src/track.ts @@ -3134,6 +3134,9 @@ export class Subscriber { }; hooks.sourceStart = (subscriber) => { if (subscriber.#resume) return subscriber.#resume.start(); + // A relative anchor still pending reads every group, so a fill asked below would claim + // the history it never names. Mirrors the Rust `cursor.sync()` in `poll_start`. + subscriber.#settle(); const producer = subscriber.#state.producer; const start = producer && sourceStart(producer); if (start === "pending") return start; diff --git a/quest/m0/test-flakes-2/README.md b/quest/m0/test-flakes-2/README.md index c428ee10b0c..d74282c2829 100644 --- a/quest/m0/test-flakes-2/README.md +++ b/quest/m0/test-flakes-2/README.md @@ -153,10 +153,12 @@ skipped the timing report. A TERM landing after a lane forked but before hung. The exit trap now waits again, and cancellation reads the job table, fixed by [moq-dev/moq#8138](https://github.com/moq-dev/moq/pull/8138). -Added 2026-11-07 (maintainer, /quest-complete): `js/net`'s lite-07 -relative-start integration test, which failed once on main in -[moq-dev/moq#8165](https://github.com/moq-dev/moq/pull/8165)'s baseline run. -It is quarantined with `test.skip` until its child fixes it. +`js/net`'s lite-07 relative-start integration test, which failed once on main in +[moq-dev/moq#8165](https://github.com/moq-dev/moq/pull/8165)'s baseline run, +read a start of 0 when the newest group landed before the reader asked: its +window had yet to settle the relative anchor, so it asked a fill from group 0. +`start()` now settles the window first, as the Rust `poll_start` does, fixed by +[moq-dev/moq#8197](https://github.com/moq-dev/moq/pull/8197). Added 2026-11-07 (maintainer's standing rule that flakes join this epic): `js/net`'s lite-07 empty-window reply test, which fails on main 12/200 under @@ -170,5 +172,4 @@ Public API: none. Wire: none. - [Fallback playback](/quest/m0/test-flakes-2/ietf22-fallback.md) - a browser viewer follows a fallback within the media lane's bound without dropping its session - [moq-gst's sink-restart pad test survives load](/quest/m0/test-flakes-2/gst-sink-restart-pads.md) - `a_moqsink_restart_keeps_pads_when_caps_arrive_at_different_times` keeps its pads under load -- [A lite-07 relative start resolves to the publisher's start every time](/quest/m0/test-flakes-2/lite07-relative-start.md) - `js/net`'s frameless-newest-group integration test stops reading a start of 0, and its `test.skip` is removed - [A lite-07 reply FINs instead of resetting when the subscriber FINs mid-write](/quest/m0/test-flakes-2/lite07-reply-fin.md) - `js/net`'s empty-window reply test passes under `--rerun-each 200`, fixed in the publisher diff --git a/quest/m0/test-flakes-2/lite07-relative-start.md b/quest/m0/test-flakes-2/lite07-relative-start.md deleted file mode 100644 index 10484be39d3..00000000000 --- a/quest/m0/test-flakes-2/lite07-relative-start.md +++ /dev/null @@ -1,27 +0,0 @@ -# [S] A lite-07 relative start resolves to the publisher's start every time - -## Goal - -A lite-07 subscription whose relative start counts back from a frameless -newest group always reports the publisher's start. `js/net/src/integration.test.ts`'s -"integration: lite-07 reports a relative start over a frameless newest group" -passes reliably under load, and its `test.skip` is removed. - -## Plan - -Planned 2026-11-07 (maintainer, /quest-complete) from -[moq-dev/moq#8165](https://github.com/moq-dev/moq/pull/8165)'s validation: -in a baseline run on unchanged main, `reader.start()` returned `0n` where the -test expects the publisher's `5n`. It is quarantined with `test.skip` until -this quest fixes it, per AGENTS.md. - -Reproduce it first, under load or with `bun test --rerun-each`, and find -which side reports 0: the copy resolving the start before the publisher's -answer arrives, or the publisher counting back from the frameless newest -group. Fix it at that cause, not in the test. Check the Rust mirror, -`a_relative_start_reports_the_publishers_start_over_a_frameless_newest_group` -(`rs/moq-net/tests/integration/range_anchors.rs`), for the same ordering. -Prove the fix with a test that forces the losing order, not with repeated -runs. - -Public API: none. Wire: none.