Repository navigation
test(net): a peer's listing churn yields to the host's tasks, unquarantined - #8800
Conversation
Quest-Claim: 388bbf4f1dc20bc6
…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>
…d budget's slice start Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ 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.tsstubsperformance.nowto 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.mdis deleted, as the quest is finished.
claude-sonnet-5-5 | 𝕏
|
No actionable comments were generated in the recent review. WalkthroughThe 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:
|

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 listingBudgetyields 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 instream.test.tsalready 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
while :; do :; doneburners on a 32-core host, against 372 ms unloaded.bun testruns ofjs/net(3341 tests) under 48 burners, 0 failures.listingBudget.poll()withundefinedinlite/subscriber.tsfails the test (ranFirstfalse), so it still catches a listing loop that never yields.just checkpasses.Choices made without the maintainer (AFK)
Budget: the stream accept flood tests already use this stub, and the budget deliberately reads host CPU time, not the installed clock.listingBudgetper test (the accept tests swap in a fresh one): with everynow()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
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 reviewafter 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 mediumClassified: medium by default
Reviewer: Codex, gpt-6.1-sol, medium effort
Session:
01a1dee0-c2ac-7d83-8d64-a61c2df9ed32, round 2Score: 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:
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.