Skip to content

test(net): a peer's listing churn yields to the host's tasks, unquarantined - #8800

Merged
kixelated merged 3 commits into
mainfrom
quest/m0/test-flakes-3/listing-yield
Nov 15, 2026
Merged

kixelated merged 3 commits into
mainfrom
quest/m0/test-flakes-3/listing-yield

Conversation

@kixelated

@kixelated kixelated commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Finishes quest/m0/test-flakes-3/listing-yield.md and deletes it.

Summary

js/net's "a flood of a peer's listing churn yields to the host's tasks" was skipped after timing out at 5 s under load. Its cause: the listing Budget yields only once 4 ms of real CPU time pass, so the test flooded 40,002 TRACKS events to be sure a slice ran out. Decoding that took 372 ms alone and 1.1 to 2.2 s under 48 CPU burners, enough to time out in a loaded full run.

The test now stubs performance.now (the host CPU clock the budget reads) to advance 5 ms per call, exactly as the stream accept flood tests in stream.test.ts already do, so every 32nd check yields regardless of load. The flood shrinks to 2,050 events, still dozens of slices, and the test is unskipped. No code under test changed, and the assertion is unchanged.

Public API: none. Wire: none.

Validation

  • Reproduced: the original test (unskipped) took 1.1 to 2.2 s in 5 isolated runs under 48 while :; do :; done burners on a 32-core host, against 372 ms unloaded.
  • After: 212 to 468 ms in 5 isolated runs under the same load; 10 full bun test runs of js/net (3341 tests) under 48 burners, 0 failures.
  • Mutation check: replacing listingBudget.poll() with undefined in lite/subscriber.ts fails the test (ranFirst false), so it still catches a listing loop that never yields.
  • just check passes.

Choices made without the maintainer (AFK)

  • Stubbed the CPU clock in the test rather than injecting a clock into Budget: the stream accept flood tests already use this stub, and the budget deliberately reads host CPU time, not the installed clock.
  • Did not isolate the shared module-level listingBudget per test (the accept tests swap in a fresh one): with every now() call advancing 5 ms, any 32 consecutive polls include a yield whatever state an earlier test left, so exporting it for the test was not worth it.

Caused by

  • moq-dev/moq#6158 - added the test sized to outlast the budget's 4 ms slice on real CPU time, so it slowed with host load (found by check)

Models

Size: S
Implementer: Claude, claude-opus-5-5, unknown effort (arm A)

🤖 Generated with Claude Code

(Written by Claude Opus 5.5)

Review

Rewritten by quest review after each round.

  • Head: 0f9be04

  • Base: origin/main at 52732a0

  • 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: 01a1dee0-c2ac-7d83-8d64-a61c2df9ed32, round 2

  • Score: 10/10, The updated clock initialization fixes the startup-dependent failure, and the incremental change introduces no new findings.

  • Rounds: 2; first round 1 (medium 1); findings 1 (medium 1): fixed 1, refuted 0, open 0

  • Findings: none

  • The last round's findings, at 33dfccc:

    • Fixed: medium, js/net/src/lite/tracks.test.ts:259: Preserve the budget's existing clock epoch when stubbing time; The head initializes fakeNow from the real host.now() before installing the spy, preserving the clock epoch used by the shared budget's existing slice start.

kixelated and others added 2 commits November 15, 2026 02:18
…flood to real time

The listing-churn yield test flooded 40k events so the budget's 4 ms CPU
slice would pass on real time, which took 1-2 s under 48 CPU burners and
timed out in loaded full runs. Stub performance.now as the stream accept
flood test does, so every 32nd check yields, and shrink the flood to 2k
events. Unquarantine it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title A peer's listing churn yields to the host's tasks, unquarantined test(net): a peer's listing churn yields to the host's tasks, unquarantined Nov 15, 2026
…d budget's slice start

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review November 15, 2026 11:10
@kixelated
kixelated enabled auto-merge November 15, 2026 11:11

@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.

Reviewed changes

Reviewed the full diff of the two changed files.

  • Unquarantined listing-yield test: js/net/src/lite/tracks.test.ts stubs performance.now to advance 5 ms per call, seeded from the real clock. Every budget check then passes a slice, so the yield no longer depends on host load. The flood shrinks from 20,000 to 1,024 churn pairs and the test is unskipped.
  • Spy cleanup: the file's existing afterEach(() => mock.restore()) undoes the spy, so it can't leak into other tests.
  • Quest file removed: quest/m0/test-flakes-3/listing-yield.md is deleted, as the quest is finished.

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

@kixelated
kixelated added this pull request to the merge queue Nov 15, 2026
@coderabbitai

coderabbitai Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The flood-yield test is enabled and its churn loop is reduced to 1,024 iterations. The test advances the stubbed host CPU clock by 5 per read and checks that a queued task runs before the final listing event. The related quest document is removed.

Merge Risk: Minimal · up to 0f9be

This change only re-enables and stabilizes a test and removes a planning document. It does not alter production behavior, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the listing-churn test in js/net is unquarantined, and its churn now yields to host tasks. It also uses the conventional test(net): prefix. The title is specific and m…
Description check Passed The description states that it finishes and deletes the quest doc, and it explains the cause (real CPU time budget and a large flood), the fix (stubbed performance.now at 5 ms per call, a smaller 2,05…
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 listing-churn test in js/net is unquarantined, and its churn now yields to host tasks. It also uses the conventional test(net): prefix. The title is specific and matches the changeset.

Full details: Description check

Explanation

The description states that it finishes and deletes the quest doc, and it explains the cause (real CPU time budget and a large flood), the fix (stubbed performance.now at 5 ms per call, a smaller 2,050-event flood, test unskipped), and validation. It matches the changeset, which unskips the test and deletes listing-yield.md.

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: 99d4c558-cb31-430e-9751-89ee9276ab7d
Commits

Reviewing files that changed from the base of the PR and between cbb742c and 0f9be04.

Files selected for processing: 2

  • js/net/src/lite/tracks.test.ts
  • quest/m0/test-flakes-3/listing-yield.md
Files with no reviewable changes: 1

  • quest/m0/test-flakes-3/listing-yield.md

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

Merged via the queue into main with commit 31a5d6b Nov 15, 2026
5 checks passed
@kixelated
kixelated deleted the quest/m0/test-flakes-3/listing-yield branch November 15, 2026 11:32
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