Skip to content

js/net's reset Announce Stream test closes the session under load - #9024

Merged
kixelated merged 2 commits into
mainfrom
quest/m0/test-flakes-3/js-announce-reset
Nov 17, 2026
Merged

kixelated merged 2 commits into
mainfrom
quest/m0/test-flakes-3/js-announce-reset

Conversation

@kixelated

@kixelated kixelated commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Finishes quest/m0/test-flakes-3/js-announce-reset.md (deleted here).

Summary

The "a reset Announce Stream closes moq-lite-07 with PROTOCOL_VIOLATION" test timed out under a loaded just check (moq-dev/moq#8996). It is a test race, not a js/net bug.

Trace. The test writes the stream type byte and an ANNOUNCE_REQUEST, then resets at once. Readers.next() first polls acceptBudget, which yields once 4 ms of host CPU time passed without yielding, so it does so far more often under load. If it yields, the reset reaches the mock stream before the client reads the type byte; a reset discards what is unread, so the read fails with a plain reset. A stream of unknown type is not known to be an Announce Stream, and could as well be a Group Stream reset on purpose, so the session correctly stays open and the test waits for a close that never comes. Real QUIC and WebTransport drop unread data on a reset the same way, so no js/net change can tell them apart. The reset path itself (#runAnnounce) closes with PROTOCOL_VIOLATION whenever the stream was identified.

Fix (test only). The test now answers the client's AUTH, then waits for the ANNOUNCE_OK that answers its request, which proves the stream was identified, and only then resets.

Validation

  • Reproduced deterministically: with acceptBudget.poll mocked to yield three times, the old test times out and the other nine violation cases pass.
  • Same mock with the new test: all ten pass.
  • bun test src/lite/connection.test.ts --rerun-each 5 under 64 CPU burners: 375 pass. The old test never failed this way in 40 reruns under the same load, since bun's time slice rarely lands there; the forced yield is the reliable reproduction.
  • biome check, tsc --noEmit, quest check: clean.

Caused by

  • moq-dev/moq#8835 - added the test without waiting for the stream to be identified, so a reset could overtake the type byte (found by check).

Public API: none. Wire: none.

Models

Size: S
Implementer: Claude, claude-sonnet-5-5, unknown effort (arm B)

Review

Rewritten by quest review after each round.

  • Head: b71863d

  • Base: origin/main at 2dcb5f8

  • Risk: medium, the base has no RISK.md to name what is always high or customer-facing, so every change is medium

  • Classified: medium by default

  • Reviewer: Codex, gpt-6.1-sol, medium effort

  • Session: 01a1eb04-0464-7bc3-8e92-d1a0707ca3a0, round 1

  • Score: 9/10, The test waits for ANNOUNCE_OK before resetting, removing timing dependence; source review found no actionable defects, with tests intentionally not run.

  • Rounds: 1; first round 0; findings 0: fixed 0, refuted 0, open 0

  • Findings: none

kixelated and others added 2 commits November 17, 2026 11:31
…d it

A reset discards what the peer has not read. Under CPU load the accept loop
yields (acceptBudget) before reading the new stream, so the reset can overtake
the stream type byte, and a stream of unknown type is not known to be an
Announce Stream. Wait for the ANNOUNCE_OK that answers the request first.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review November 17, 2026 19:38

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Approach: sound. The hang came from the test, not from js/net. A reset that overtakes the unread type byte leaves the stream unidentified, so the session correctly stays open. The fix waits for ANNOUNCE_OK before resetting, which proves the client has read the type byte, and it changes no production code.

Reviewed changes

I reviewed the rewritten violation case and the deletion of its quest file.

  • Auth handshake in the test: the test accepts the client's Auth stream and grants AuthOk(all, all), because the client sends nothing on its Announce Stream until its credential is granted. Before the client opens Auth, it opens no other bidi stream that Stream.accept could pick up instead: Probe opens only on a subscribe, and GOAWAY only on leave.
  • Waits for ANNOUNCE_OK before the reset: a Readers loop skips any other uni stream and asserts that the first message on the client's Announce Stream is { status: "ok" }. If the client ever sent a different first message, the test would fail loudly instead of hanging.
  • Quest file removed: quest/m0/test-flakes-3/js-announce-reset.md is deleted because the quest is finished.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@coderabbitai

coderabbitai Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The reset-stream test now completes the peer’s authentication exchange, sends an Announce request, and checks for an Announce response with status ok before resetting the writer. It closes the Readers collection afterward. The planning document about the test timeout was removed.

Merge Risk: Minimal · up to b7186

This is a test-only change that makes a timing-sensitive reset test deterministic, with no public API or wire changes. It carries no meaningful merge risk.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the reset Announce Stream test now closes the session under load. The PR waits for ANNOUNCE_OK before resetting, so the test no longer races the stream type byte. The …
Description check Passed The description states the purpose and cause of the test flake, the test-only fix, validation steps, and the commit that introduced the issue. It relates directly to the changes in connection.test.ts …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the reset Announce Stream test now closes the session under load. The PR waits for ANNOUNCE_OK before resetting, so the test no longer races the stream type byte. The title is specific and matches the changeset, though it frames the fix as a closing behavior and omits the race fix itself.

Full details: Description check

Explanation

The description states the purpose and cause of the test flake, the test-only fix, validation steps, and the commit that introduced the issue. It relates directly to the changes in connection.test.ts and the deleted planning document.

Finishing Touches

Simplify code

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 145633ea-5382-43b9-9634-b0771b89efa8
Commits

Reviewing files that changed from the base of the PR and between 2dcb5f8 and b71863d.

Files selected for processing: 2

  • js/net/src/lite/connection.test.ts
  • quest/m0/test-flakes-3/js-announce-reset.md
Files with no reviewable changes: 1

  • quest/m0/test-flakes-3/js-announce-reset.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

@kixelated
kixelated added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit 22da19e Nov 17, 2026
10 checks passed
@kixelated
kixelated deleted the quest/m0/test-flakes-3/js-announce-reset branch November 17, 2026 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant