Repository navigation
test(net): count only the client's yield as a datagram end's routing - #9238
Merged
kixelated merged 2 commits intoNov 21, 2026
Conversation
…gram-tracks-end-keeps-the-2.md Quest-Claim: 4e50e0120235a1b3
The close-after-end test spied on every yieldNow in the process, so the publisher's yield, or an earlier test's session woken by a late host timer, tripped it before the client took the end. Tag the client's tasks with AsyncLocalStorage and count only theirs, and drop the lite-06 skip. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated
marked this pull request as ready for review
November 20, 2026 19:35
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 30 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Approach: sound. It fixes the spy's cause, since it only counts yields made inside the client's async context. It doesn't add timing slack to hide the flake.
Reviewed changes
Reviewed the full diff of 3 files.
- Client-scoped yield spy —
js/net/src/lite/datagram-tracks.test.tsruns the client'sconnect,consume, anddatagramscalls inside anAsyncLocalStorage. TheyieldNowspy now resolvesreceivedonly whenclientTask.getStore()is set. A publisher yield or a stray yield from an earlier test's session can no longer trigger the abort early. - Skip removed — the
skipIf(alpn === ALPN_06)is gone, so the test runs for all three ALPNs again. - Quest cleanup — the resolved flaky quest and its now-empty epic README are deleted.
claude-sonnet-5-5 | 𝕏
kixelated
deleted the
quest/m0/flaky/a-session-close-right-after-a-datagram-tracks-end-keeps-the-2
branch
November 21, 2026 00:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes the flaky
@moq/nettestmoq-lite-06: a session close right after a datagram track's end keeps the endat its root cause and removes its skip. Finishes quest/m0/flaky/a-session-close-right-after-a-datagram-tracks-end-keeps-the-2.md and deletes the now-emptyquest/m0/flakyepic (the land watcher recreates it for the next disabled test).Root cause
The test aborts the client while its subscriber waits a host task to route the datagrams that arrived with the track's end. To find that moment it spied on
clock.yieldNowand aborted at the first call anywhere in the process afterdatagrams.finish(). Other yields share that function: the publisher's (lite/publisher.ts:1828, after a SUBSCRIBE_UPDATE), and an earlier test's session that resumes on a late host timer (a timer armed by an ended test fails nobody,clock/src/host.ts:13). Under CI load one of those landed first, so the abort hit while the client's subscription was still running, before it took the end. The CI logs show exactly that:subscribe error: id=1 ... error=remote error: 0(the subscription body threw) instead ofsubscribe close, then(fail)in about 3ms.The production behavior is fine. The spy just observed the wrong yield.
Change
js/net/src/lite/datagram-tracks.test.ts: the client'sconnect,consume, anddatagramscalls run inside anAsyncLocalStoragecontext, and the spy counts only a yield made in that context. By elimination, the end routing (lite/subscriber.ts:3145) is then the only client yield the spy can count afterfinish():#routeHeldnever runs, because the test sends no datagram.AuthSession's yield happens only at setup.The lite-06 skip is gone, so all three versions run again.
Validation
clock.yieldNow()injected right beforedatagrams.finish(), the old test fails all three versions with the CI signature (subscribe error ... remote error: 0,(fail)in about 3ms). The fixed test passes with the same injection.Promise.race([this.#datagramsRouted(id), this.#quic.closed...])), both the old and the fixed test fail all three versions.own) atsubscriber.ts:3145.datagram-tracks.test.tsfile passed 300 reruns (12,000 tests, 0 failures).a4fa80a747, with 2,100 isolated reruns, 8 parallel full-suite runs, and fuzzed host-task ordering. CI's full-workspace load is what exposes the stray yield.just checkpassed.Caused by
yieldNowspy, which any other session's or the publisher's yield trips (found by queue)Public API
None. Test-only change.
Follow-ups
None.
Models
Size: S
Implementer: Claude Code, claude-opus-5-5, unknown effort (arm A)
Review
Rewritten by
quest reviewafter each round.Head: d2b27f3
Base: origin/main at bc9ff0d
Risk: low,
Only a test and quest documentation change, so a mistake could disrupt contributors’ test runs without affecting consumers or deployed peers, and a revert fully undoes it.Classified: low by Codex, gpt-6.1-sol, low effort, session
01a1fa74-89e6-7c93-bbb8-9ee9249eafccReviewer: Codex, gpt-6.1-sol, medium effort
Session:
01a1fa74-9ab5-7bd0-8ebc-b69cd959c627, round 1Score: 9/10,
The focused change prevents unrelated publisher or prior-session yields from triggering test synchronization, with no actionable defects found by source inspection, though tests were not run as instructed.Rounds: 1; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none