diff --git a/js/net/src/integration.test.ts b/js/net/src/integration.test.ts index c870da42db7..577898ad8c7 100644 --- a/js/net/src/integration.test.ts +++ b/js/net/src/integration.test.ts @@ -501,9 +501,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([ @@ -521,15 +521,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 b035a89b3be..9df44a09644 100644 --- a/quest/m0/test-flakes-2/README.md +++ b/quest/m0/test-flakes-2/README.md @@ -159,16 +159,18 @@ closed, left no finished record, so the final catalog snapshot started the rendition again and replayed a group on its held pad. A failure now counts as the track's end, fixed by [moq-dev/moq#8160](https://github.com/moq-dev/moq/pull/8160). +`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, /quest-complete): `js/net`'s http:// fingerprint tests, whose slow real fetch lets the WebTransport hedge timer fire on the host clock, seen in [moq-dev/moq#8163](https://github.com/moq-dev/moq/pull/8163)'s CI. -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. - 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 `--rerun-each 200`, found in [moq-dev/moq#7670](https://github.com/moq-dev/moq/pull/7670). @@ -181,5 +183,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 - [The http:// fingerprint tests survive a slow fetch](/quest/m0/test-flakes-2/fingerprint-host-clock.md) - a fingerprint fetch slower than the 500 ms hedge no longer trips the host-clock guard -- [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.