Repository navigation
test(net): the JS stale-budget test waits for each update on the wire - #9164
Conversation
Quest-Claim: 1e7572ef290b82ae
The fake stream credits a write in a later task, and the update loop sends the next SUBSCRIBE_UPDATE only after the previous write resolves, so one drained task did not cover the narrowing. Decode each update instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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 1 minute. 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. |
|
Merge pick (maintainer away, granted the coordinator merges it confidently recommends): ✅ /quest-merge (test-only fix, standing pick). (Written by Claude Opus 5.5 with high) |
There was a problem hiding this comment.
✅ No new issues found.
Approach: sound — the test now waits on the decoded wire update instead of assuming a fixed number of tasks, the same pattern the neighbouring test at subscriber.test.ts:2871 uses.
Reviewed changes
- Stale-budget test synchronization —
js/net/src/lite/subscriber.test.tsdecodes the SUBSCRIBE and each SUBSCRIBE_UPDATE fromstream.outboundand checksentry.staleBudgetafter each update is on the wire; this also makes the widening check meaningful. - Quest file removal — deletes
quest/m0/test-flakes-3/js-stale-budget.md, which this PR completes.
claude-sonnet-5-5 | 𝕏

js/net'sa stale drop is recorded under the narrowest budget asked on lite-07now passes every run. It finishes the questquest/m0/test-flakes-3/js-stale-budget.md, which this PR deletes.Cause
The narrowing was applied late. It was not applied to some other entry. The fake stream credits each write in a later task (a
MessageChannelmessage, standing in for transport credit), and#runSubscriptionUpdatesreads the nexttrack.updateonly after the previousstream.writer.writeresolves. The widening update's write was often still waiting for credit when the test calleddrainReactions()after the narrowing. That single drained task then returned withstaleBudgetstill at 500. Instrumented runs applied the narrowing one or two tasks after the drain.The subscriber behaves correctly: it narrows the budget before writing the update that asks for the narrower bound. The test assumed a fixed number of tasks.
Change
The test now decodes the SUBSCRIBE and then each SUBSCRIBE_UPDATE from the subscribe stream, the way neighbouring tests do. It checks the budget once each update is on the wire. The widening check (budget stays 500) is now meaningful too, because it runs after the widening update was actually sent, not possibly before the loop saw it. The drain count is unchanged; the test now waits on an event instead.
Validation
bun test src/lite/subscriber.test.ts -t 'stale drop is recorded under the narrowest'. The whole file passes (176 pass).entry.staleBudget = Math.min(...)line insubscriber.tsfails the test (Received: 500).just checkpasses.Caused by
drainReactions(), although the update loop waits for write credit that arrives in a task (found by check)Impact
Public API: none. Wire: none. Test-only.
Decisions
None.
Follow-ups
None.
Models
Size: S
Implementer: Claude Code, claude-opus-5-5, medium effort
(Written by Claude Opus 5.5 with medium)
🤖 Generated with Claude Code
Review
Rewritten by
quest reviewafter each round.Head: e892c7b
Base: origin/main at 61e4a38
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:
01a1f308-d5f7-7513-8a7d-6d8a67b75f30, round 1Score: 10/10,
The narrowly scoped change fixes test synchronization by waiting for decoded wire updates without changing production behavior; no defects were found, and tests were not run as instructed.Rounds: 1; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none