diff --git a/js/net/src/lite/subscriber.test.ts b/js/net/src/lite/subscriber.test.ts index 78aa961838..b4012c01a1 100644 --- a/js/net/src/lite/subscriber.test.ts +++ b/js/net/src/lite/subscriber.test.ts @@ -2985,16 +2985,20 @@ test("a stale drop is recorded under the narrowest budget asked on lite-07", asy await opened(0); await answerTrackInfo(streams[0], version); const stream = await opened(1); + const sent = new Reader(stream.outbound, undefined, version); + expect(await sent.u53()).toBe(StreamId.Subscribe); + await Subscribe.decode(sent, version); await stream.reading; - await drainReactions(); if (!entry) throw new Error("no subscription"); expect(entry.staleBudget).toBe(500); + // Each update is sent only once the previous write is credited, which may take tasks, so wait + // for it on the wire: the budget narrows before its update is written. track.update({ delay: { max: Duration.millis(5000) } }); - await drainReactions(); + expect((await SubscribeUpdate.decode(sent, version)).maxDelay).toBe(5000); expect(entry.staleBudget).toBe(500); track.update({ delay: { max: Duration.millis(200) } }); - await drainReactions(); + expect((await SubscribeUpdate.decode(sent, version)).maxDelay).toBe(200); expect(entry.staleBudget).toBe(200); } finally { responses.mockRestore(); diff --git a/quest/m0/test-flakes-3/js-stale-budget.md b/quest/m0/test-flakes-3/js-stale-budget.md deleted file mode 100644 index c067c39429..0000000000 --- a/quest/m0/test-flakes-3/js-stale-budget.md +++ /dev/null @@ -1,20 +0,0 @@ -# [S] A JS lite-07 stale drop narrows its budget every run - -## Goal - -`js/net`'s `a stale drop is recorded under the narrowest budget asked on lite-07` -(`src/lite/subscriber.test.ts`) passes every run. - -## Plan - -Seen 2026-11-18 while validating -[moq-dev/moq#9128](https://github.com/moq-dev/moq/pull/9128), on a base that -touched no JS: run alone with `bun test src/lite/subscriber.test.ts -t 'stale drop -is recorded under the narrowest'` from `js/net`, it failed 4 of 5 runs. The second -narrowing (`track.update({ delay: { max: 200ms } })`) leaves `entry.staleBudget` at -500 after `drainReactions()`. The update reaches the subscriber (`subscribe update` -is logged), so either the narrowing is applied after the drain returns, or the -entry it narrows is not the one the test holds. Find which and fix that, not the -drain. - -Public API: none. Wire: none.