Repository navigation
fix(net): read lower buffered groups across route copies - #6019
Conversation
Co-Authored-By: GPT-6.1-Sol <noreply@openai.com>
Co-Authored-By: GPT-6.1-Sol <noreply@openai.com>
Co-Authored-By: GPT-6.1-Sol <noreply@openai.com>
Co-Authored-By: GPT-6.1-Sol <noreply@openai.com>
|
Checkpoint: source The quest remains unfinished on one explicit maintainer decision: compare the lowest next deliverable head across copies (implemented, recommended to preserve Rust direct arrival order), or select the lowest buffered sequence anywhere, as the literal Goal/JS wording suggests. The old-copy (written by GPT-6.1-Sol) |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughSubscriber cursors now support non-consuming peeks for arrival-order and sequence-order reads. Resumed readers use peeks to select and retain the lowest deliverable group across route copies, then consume that reserved group. The changes add regression tests and benchmarks for both reader modes. The quest milestone and its related documentation links were removed. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8a1e506d5a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Port the peek/take reservation onto per-subscriber ranges (#5929): a widening's owed group stays owed until a taking read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The peek-aware next_owed from #6019 keeps returning a group::Handle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Problem
A resumed Rust track reads the serving route first. If an old copy buffers group 1 and its replacement buffers group 2, sequence reads drop group 1 and arrival reads return 2 before 1.
Approach
Peek each ready copy with the existing floor, cap and drift checks, then take its lowest next group, mirroring JS
Reader.#lowest. Ties favor newer copies so their first delivery still bounds replaced copies. Reserve the exact consumer and cursor position: eviction may abort that group, but cannot substitute a later group. Nested selection pins its chosen route copy with the existing lease. Local bounds invalidate reservations. Genuine lower groups arriving later remain deliverable in arrival order.This finishes
/quest/m1/resume-ordered.md, so the quest and its three references are deleted.Decisions
Which group does a resumed arrival read offer first when copies disagree? (old copy holds
[3, 1]in arrival order, serving copy offers[2])Reader.#lowest; JS only differs because its per-copy buffer is sequence-sorted. Offers 2 first.Declined Codex finding r4321978659: selection does not wait on a copy whose SUBSCRIBE is still pending. It holds no reader-visible group, and waiting would block live delivery on a replaced peer; this is unchanged from serving-first selection.
Picked by an unattended iterate round with no maintainer input; it is behavior only, with no API shape or wire impact.
Impact
Alternatives
Serving-first reads lose a buffered lower group in sequence order. Sharing peek/read cursor rules avoids a second bounds/drift implementation. A reusable reservation-slot trial showed no consistent timing gain (median 1.011x the retained implementation across 30 shapes), so it was dropped.
Validation
[2](sequence) and[2, 1](arrival), instead of[1, 2].origin/maintwice. moq-dev/moq#5924 merged cleanly. moq-dev/moq#5929 replaced parked groups with ranges a widening owes; the reservation now sits on top of it: a peek leaves an owed group owed, and only a taking read consumes it (peeking_keeps_a_re_offered_group_owed, which returns group 2 on the second peek without the fix).just checkpasses on the merged head: 7,692 native tests plus the minimal, capture/playback and play suites. One earlier run hitietf::publisher::tests::a_draft_16_cancel_ahead_of_the_answer_ends_only_its_request, new on main from moq-dev/moq#6051. It fails 1 in 30 runs locally, and it exercises namespace announcements, not track reads.The existing overlap benchmark now measures both orders across readers {1, 8, 32, 256}, buffered groups {1, 64, 1024}, and copies {1, 2, 8, 32}: 30 measured shapes, including single-copy cases. Same harness and CPU/worker bounds against baseline
cdff3c8f9; 10 samples, 0.2s target measurement, 0.1s warmup. Whole-drain medians:This is a measured correctness cost, not a speedup: selection examines competing copies and reserves exact candidates. The cost is per handed-out group (about 1 us per group per reader in the single-copy case), not per frame. These sequential short runs share a host with other bounded builds; timing differences are indicative only.
Follow-ups
Resume-reorder moq-dev/moq#6003 is independent and is not incorporated.
Originally written by GPT-6.1-Sol.
(Written by Claude Opus 5.5)
🤖 Generated with Claude Code