From 0d27706e55c306e17fce862890bd375fb90bda06 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 7 Nov 2026 07:38:37 -0800 Subject: [PATCH] test(net): quarantine the lite-07 empty-window reply flake and plan its fix Co-Authored-By: Claude Opus 5.5 --- js/net/src/lite/publisher.test.ts | 4 ++- quest/m0/test-flakes-2/README.md | 7 +++++ quest/m0/test-flakes-2/lite07-reply-fin.md | 34 ++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 quest/m0/test-flakes-2/lite07-reply-fin.md diff --git a/js/net/src/lite/publisher.test.ts b/js/net/src/lite/publisher.test.ts index 27a6d4495a6..24326aa9da0 100644 --- a/js/net/src/lite/publisher.test.ts +++ b/js/net/src/lite/publisher.test.ts @@ -1056,7 +1056,9 @@ test("lite-07 refuses an update retiring an unknown Range ID", async () => { // A bounded window that resolves empty has no group to answer it, so the publisher answers it // at once. The stream stays open for an update until the subscriber FINs, and the publisher // FINs in reply. -test("lite-07 answers a bounded window that resolves empty and FINs in reply", async () => { +// Quarantined: a subscriber FIN during the reply write's budget yield resets the stream. +// Investigation: quest/m0/test-flakes-2/lite07-reply-fin.md. +test.skip("lite-07 answers a bounded window that resolves empty and FINs in reply", async () => { const version = Version.DRAFT_07; const sub = await servedSubscription({ version, diff --git a/quest/m0/test-flakes-2/README.md b/quest/m0/test-flakes-2/README.md index fbecd6ad01b..ee8c5685d00 100644 --- a/quest/m0/test-flakes-2/README.md +++ b/quest/m0/test-flakes-2/README.md @@ -140,6 +140,12 @@ the case's microtask drain. [moq-dev/moq#8000](https://github.com/moq-dev/moq/pu stubbed that budget, merging after the quarantine was written. The case was re-enabled in [moq-dev/moq#8110](https://github.com/moq-dev/moq/pull/8110). +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). +A subscriber FIN during the reply write's budget yield resets the stream. It is +quarantined with `test.skip` until its child fixes it. + Public API: none. Wire: none. ## Required @@ -149,3 +155,4 @@ Public API: none. Wire: none. - [The datagram-end close follow-up](/quest/m0/test-flakes-2/datagram-end-close.md) - investigate whether duplicate SETUP can override an accepted lite-06 SUBSCRIBE_END during shutdown - [moq-transcode's idle-rung cancel test survives load](/quest/m0/test-flakes-2/transcode-idle-rung-cancel.md) - `cancelling_an_idle_rung_reports_cancel` stops seeing `serve` return before its abort lands - [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 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-reply-fin.md b/quest/m0/test-flakes-2/lite07-reply-fin.md new file mode 100644 index 00000000000..66e7450c50e --- /dev/null +++ b/quest/m0/test-flakes-2/lite07-reply-fin.md @@ -0,0 +1,34 @@ +# [S] A lite-07 reply FINs instead of resetting when the subscriber FINs mid-write + +## Goal + +When a lite-07 subscriber FINs its subscription stream while the publisher's +reply write is yielding on the shared write budget, the publisher still FINs +in reply instead of resetting with Cancel. `js/net/src/lite/publisher.test.ts`'s +"lite-07 answers a bounded window that resolves empty and FINs in reply" +passes under `--rerun-each 200`, and its `test.skip` is removed. + +## Plan + +Planned 2026-11-07 (maintainer, /quest-complete) from +[moq-dev/moq#7670](https://github.com/moq-dev/moq/pull/7670)'s validation: +the test fails on main 12 times in 200 under `bun test --rerun-each 200`. It +is quarantined with `test.skip` until this quest fixes it, per AGENTS.md. + +The bug is in the product, not the test. `Writer.write` +(`js/net/src/stream.ts`) yields on the shared write budget after its bytes +are already queued. During that yield, `SubscriptionControls.response` +(`js/net/src/lite/publisher.ts`) takes the subscriber's clean FIN as +overriding the blocked write, so the publisher resets the stream. +[moq-dev/moq#8047](https://github.com/moq-dev/moq/pull/8047) fixed the same +yield's race for opened group streams only. + +Candidate fixes: + +- a clean FIN no longer overrides a reply write, and only an error does; +- `Writer.write` yields before handing its bytes over, not after. + +Prefer the one that also covers every other `Writer.write` caller whose peer +can FIN during the yield. Check whether the Rust publisher has the same +ordering. Prove the fix with a test that forces the yield, not with repeated +runs.