Skip to content

fix(net): an ordered read waits on a time start's history lookup - #9639

Merged
kixelated merged 5 commits into
mainfrom
quest/m1/relayed-refused-fill-gap
Nov 26, 2026
Merged

kixelated merged 5 commits into
mainfrom
quest/m1/relayed-refused-fill-gap

Conversation

@kixelated

@kixelated kixelated commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Claims quest/m1/relayed-refused-fill-gap.md. Lands only the lookup-hold fix. The quest stays, rewritten to the remaining L work, which starts on top of moq-dev/moq#9626's wire.

Problem

An ordered reader on a track with a history handler (track::Requests), whose time start comes before every group held, handed out a later group while the time's history lookup was still out. If the lookup then found a lower group, the reader never returned it and hung. Example: ranges [Time(10)..20, Time(66)..], live group 66, and history holding group 10.

The same early hand-out hid the gap the quest is about: the relayed reader's Err(10..21) is the publisher's own NotFound answer, which the direct reader skipped past.

Approach

  • Window::unresolved_in (was waiting_in) also yields time starts still being looked up, so Cursor::poll_time_start holds a later group until the lookup answers.
  • Window::floor is None while a lookup is out. A dropped lookup can resolve to the held group just below the lookup's floor, so neither the groups in range nor that floor bound it.
  • Same change in JS (Window.unresolvedIn, Window.floor). JS also checks the time start before passing a stale buffered group, which advanced the cursor past the looked-up group (Rust's stale skip keeps the gap's start, so it already held).
  • The quest is rewritten to the work that remains, with the maintainer's decisions in its Plan.

Impact

  • No public API or wire change.
  • Behavior: an ordered reader on a track with a history handler waits for a pending time-start lookup before handing out a later group, in Rust and JS.

Decisions

  • Scope: ✅ this PR lands only the lookup-hold hang fix, sized S, and keeps the quest rewritten (rejected: building it all here now).
  • Local readers and the history handler: ✅ ask the handler, narrowed to ranges whose start a history lookup placed (rejected: ask nothing, unanswered means empty). Left to the quest.
  • The time's own key after an empty lookup: ✅ excluded everywhere, so the range starts one past the time, in Rust and JS (rejected: include it everywhere). Left to the quest.
  • A range with dropped keys: ✅ the publisher answers it with a start, not "no group to deliver", so a copy waits for those drops, built on feat(net): lite-07 settles every start without a timer, naming plain-reset groups in a drop #9626's wire (rejected: the copy waits on every key). Left to the quest.

Answers: first, then the maintainer's /quest-run round on 2026-11-25.

Alternatives

  • Fixing the copy to drop its NotFound gap (the quest's original plan): rejected, since the publisher itself reports that gap once asked.
  • Using the lookup's floor as the window floor: fails fill: a time start just past a held group, dropped, starts at that group, where a dropped lookup resolves below its floor.

Caused by

  • moq-dev/moq#7310 - added time-start lookups through the history handler, but the ordered read's time-start hold covered only starts waiting on the groups held (found by person)

Validation

  • New waiting_time_start::a_looked_up_time_start_reads_before_a_held_later_group (Rust) and a looked-up time start reads before a held later group (JS). Each failed before the fix: the Rust one read Ok(66) first and hung, and the JS one returned group 66 before the lookup. JS a stale group waits behind a looked-up time start (from review round 1) passed the stale group 66 and returned 5000 before the lookup.
  • cargo test -p moq-net --all-features: all pass. bun test in js/net: 3901 pass. just check passes.

Follow-ups

Models

  • Size: S
  • Implementer: Claude Code, claude-opus-5-5, unknown
  • Implementer: Claude Code, claude-opus-5-5, unknown (iterate, S)

(Written by Claude Opus 5.5)

Review

Rewritten by quest review after each round.

  • Head: 09482ff

  • Base: origin/main at 542a34a

  • Risk: medium, A mistake could make ordered subscription reads in the JS and Rust net crates hand out groups in the wrong order or stall on a time start's history lookup, reaching consumers of the next release cut; it is a fix that keeps the public API and wire format, and a revert undoes it fully, so it is not high.

  • Classified: medium by Claude Code, claude-haiku-5-5, low effort, session a1ef7b33-a887-4608-a229-91da57fe3c4a

  • Risk file: bb7b1c0de60b

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

  • Session: 01a2153c-20be-7db0-b7e2-fef36cf717c2, round 2

  • Score: 10/10, The JavaScript ordered reader now preserves pending history results when a later buffered group expires, and the follow-up introduces no 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 5dc138d:

    • Fixed: medium, js/net/src/track.ts:6504: Check pending history lookups before skipping stale groups; At js/net/src/track.ts:6672, the reader checks the unresolved history start under its own budget before advancing past the stale group, and the regression test at js/net/src/ordered.test.ts:824 covers group 10 arriving after group 66 expires.

kixelated and others added 2 commits November 25, 2026 13:35
A time start before every group held is looked up through the track's
history handler. The ordered read held a later group only for a time
start waiting on the groups held, so it handed out the later group first
and never returned the one the lookup found. It now holds for a pending
lookup too, and the window reports no floor until the lookup answers.

Rewrites quest/m1/relayed-refused-fill-gap.md to the decision that
remains.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title A relayed reader reports a refused fill as a gap a direct reader never sees fix(net): an ordered read waits on a time start's history lookup Nov 25, 2026
@kixelated

Copy link
Copy Markdown
Collaborator Author

Maintainer decision (/quest-run, 2026-11-25):

  • ✅ Ask the handler: a local Rust reader whose time range resolves through the history handler asks it for keys with no group held, as relay copies and JS already do, so direct, relayed, and JS readers deliver the same items (rejected: copies ask nothing, which loses history groups; treating an unanswered request as empty, which hides real loss and still leaves readers disagreeing). Reason: what a subscription delivers must not depend on the path it takes.

(Written by Opus 5.5 with high)

…n relayed-refused-fill-gap

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated

Copy link
Copy Markdown
Collaborator Author

Maintainer decisions (/quest-run, 2026-11-25):

(Written by Opus 5.5 with high)

kixelated and others added 2 commits November 25, 2026 16:19
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…me start

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review November 26, 2026 00:37
@kixelated
kixelated added this pull request to the merge queue Nov 26, 2026
@coderabbitai

coderabbitai Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

JavaScript and Rust windows now report time starts awaiting history lookups as unresolved and withhold the floor while lookups remain outstanding. Rust polling now checks unresolved starts. New tests cover ordered reads that receive an earlier group from a fill. The quest note records reader behavior and decisions related to refused fills.

Merge Risk: Minimal · up to 09482

Ordered reads now wait for a pending history lookup of an earlier time start before handing out a later group, which fixes a hang and a hidden lower group. The change is small, adds no public API or wire change, and is covered by new regression tests. No merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: an ordered read now waits on a time start's history lookup. It is specific to the fix in the js/net and rs/moq-net ordered-read code, and the changeset matches it.
Description check Passed The description states the problem, the approach (Window::unresolved_in and Window::floor changes in Rust and JS), the scope decisions, and the regression tests. All of these match the changeset, so t…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description states the problem, the approach (Window::unresolved_in and Window::floor changes in Rust and JS), the scope decisions, and the regression tests. All of these match the changeset, so the description is clearly related to it.

Finishing Touches

Simplify code

  • Commit to this branch
  • Create a new PR
  • 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

Recent review info

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: 16160f67-f6bc-4041-9aa6-ba0f68966ac5
Commits

Reviewing files that changed from the base of the PR and between 351ad20 and 09482ff.

Files selected for processing: 7

  • js/net/src/ordered.test.ts
  • js/net/src/track.ts
  • js/net/src/window.ts
  • quest/m1/relayed-refused-fill-gap.md
  • rs/moq-net/src/model/subscription/window.rs
  • rs/moq-net/src/model/track.rs
  • rs/moq-net/tests/integration/waiting_time_start.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

Merged via the queue into main with commit 28d8eb8 Nov 26, 2026
9 checks passed
@kixelated
kixelated deleted the quest/m1/relayed-refused-fill-gap branch November 26, 2026 00:55
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