Repository navigation
test(net): wait for the widened range's SUBSCRIBE_UPDATE before checking the feed is pending - #9147
Conversation
…ing the feed is pending The lite-07 update loop now measures the SUBSCRIBE's fields (an async encode) before it edits the ranges and declares the feed pending, so one reaction drain no longer reaches the declaration. Read the update off the request stream instead: it is written only after the declaration. 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 3 minutes. 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. |
There was a problem hiding this comment.
✅ No new issues found.
Approach: sound. The test reads the SUBSCRIBE_UPDATE off the request stream, which the update loop writes only after declaring the feed pending. That replaces a fixed number of reaction drains.
Reviewed changes
I reviewed the whole one-file diff in js/net/src/lite/subscriber.test.ts, and checked the helpers it uses against the test file and subscribe.ts.
- Deterministic wait: the test builds a
Readeroverrequest.outbound, consumes theStreamId.Subscribeheader and theSubscribemessage, then awaitsSubscribeUpdate.decode. This follows the existing pattern near line 1364. - Stronger assertions: it now checks
update.removeis[0n]andupdate.rangeshas length 1. The old comment only claimed this. - Imports:
Reader,StreamId,SubscribeandSubscribeUpdateare all already imported, andSubscribeUpdate.removeexists.
I did not run the tests.
claude-sonnet-5-5 | 𝕏
…oq-dev#9160) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Problem
On
main, the@moq/nettest "a widened range's SUBSCRIBE_STARTED resolves the feed's start" fails at its "pending after the update" check (Expected: "pending",Received: 0n). It passes on the commit before moq-dev/moq#9045 and fails from it on. The merge gate selects tests by changed path, so it landed unnoticed, and any PR touchingjs/nethits it.This fixes the planned
lite07-widened-startedfollow-up from moq-dev/moq#9132.Approach
The open question was whether #9045 stopped owing a widened range its own SUBSCRIBE_STARTED (fix the code) or only changed timing (fix the test). Recommendation: fix the test. Evidence:
js/net/src/lite/subscriber.ts, afterentry.live.edit), and Rust does the same (rs/moq-net/src/lite/subscriber.rs,active.declare(producer)on update). So Rust has no gap.await this.#subscribeFields(...), an asyncWriter.collectencode, before that declaration. OneMessageChanneldrain no longer reaches it. With more drains, the unchanged test passes: the feed goes pending, and SUBSCRIBE_STARTED for Range ID 1 resolves the start to 1.The test now reads the SUBSCRIBE_UPDATE off the request stream, which the loop writes only after the declaration, instead of draining reactions a fixed number of times. It also asserts what the old comment only claimed: the update retires Range ID 0 and adds one range, which takes ID 1.
Validation
main: fails atsubscriber.test.ts:2868withReceived: 0n.this.#declare(entry)makes it fail withReceived: 0n, so it still guards the declaration.bun test src/lite/: 901 pass, 0 fail.just checkandjust cipass.Impact
None. Test-only; no public API or wire change.
Alternatives
awaitlands before the declaration.#subscribeFieldssynchronous so one drain suffices: changes production code to suit a test, and the window it closes (a reader seeing the old start until the update is sent) existed before fix(lite): a lite-07 relay asks a covering superset when its ranges' union outgrows one message #9045 too.Follow-ups
None.
Caused by
Models
Size: XS
Implementer: Claude Code, claude-opus-5-5, high effort
🤖 Generated with Claude Code
(Written by Claude Opus 5.5 with high)
Review
Rewritten by
quest reviewafter each round.Head: bea4869
Base: origin/main at a245f60
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:
01a1f15a-28ce-7f80-a6e2-46b24f6db44a, round 1Score: 10/10,
The narrowly scoped synchronization fix waits for SUBSCRIBE_UPDATE and verifies the retired range and replacement; source inspection found no actionable regression, and tests were not run as instructed.Rounds: 1; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none