Skip to content

test(net): the JS stale-budget test waits for each update on the wire - #9164

Merged
kixelated merged 2 commits into
mainfrom
quest/m0/test-flakes-3/js-stale-budget
Nov 19, 2026
Merged

kixelated merged 2 commits into
mainfrom
quest/m0/test-flakes-3/js-stale-budget

Conversation

@kixelated

@kixelated kixelated commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

js/net's a stale drop is recorded under the narrowest budget asked on lite-07 now passes every run. It finishes the quest quest/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 MessageChannel message, standing in for transport credit), and #runSubscriptionUpdates reads the next track.update only after the previous stream.writer.write resolves. The widening update's write was often still waiting for credit when the test called drainReactions() after the narrowing. That single drained task then returned with staleBudget still 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

  • Before: the test failed on most runs alone (the quest saw 4 of 5). With instrumentation, the narrowing landed 1 or 2 tasks after the drain.
  • After: 10 of 10 runs pass alone with bun test src/lite/subscriber.test.ts -t 'stale drop is recorded under the narrowest'. The whole file passes (176 pass).
  • Mutation: removing the entry.staleBudget = Math.min(...) line in subscriber.ts fails the test (Received: 500).
  • just check passes.

Caused by

  • moq-dev/moq#8908 - wrote the test to wait for each update with a single 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 review after 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 medium

  • Classified: medium by default

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

  • Session: 01a1f308-d5f7-7513-8a7d-6d8a67b75f30, round 1

  • Score: 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

kixelated and others added 2 commits November 19, 2026 00:43
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>
@kixelated kixelated changed the title A JS lite-07 stale drop narrows its budget every run test(net): the JS stale-budget test waits for each update on the wire Nov 19, 2026
@kixelated
kixelated marked this pull request as ready for review November 19, 2026 09:01
@coderabbitai

coderabbitai Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

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: 62522495-a021-4702-8282-db8549a3f91e
Commits

Reviewing files that changed from the base of the PR and between 61e4a38 and e892c7b.

Files selected for processing: 2

  • js/net/src/lite/subscriber.test.ts
  • quest/m0/test-flakes-3/js-stale-budget.md
  • 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

@kixelated

Copy link
Copy Markdown
Collaborator Author

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)

@kixelated
kixelated enabled auto-merge November 19, 2026 09:01

@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 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.ts decodes the SUBSCRIBE and each SUBSCRIBE_UPDATE from stream.outbound and checks entry.staleBudget after 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.

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

@kixelated
kixelated added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit af7ab31 Nov 19, 2026
10 checks passed
@kixelated
kixelated deleted the quest/m0/test-flakes-3/js-stale-budget branch November 19, 2026 09:44
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