Skip to content

fix(net): a front read through another front places time starts through it - #9401

Queued
kixelated wants to merge 7 commits into
mainfrom
quest/m1/nested-front-time-start
Queued

kixelated wants to merge 7 commits into
mainfrom
quest/m1/nested-front-time-start

Conversation

@kixelated

@kixelated kixelated commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Finishes quest/m1/nested-front-time-start.md and deletes it.

Problem

When a front's route is another front, the outer reader can't place a time start through it. a_raised_start_behind_an_inner_front_hands_out_nothing_past_its_end showed the bug: a range 7..=7 moved under the resume point never placed, and the read stayed pending after every group landed. Two gaps cause it:

  • Rust track::Subscriber::resolved_ranges returned None for every range of a front's reader, so the outer Reader::window never learned where the inner front placed a range. (JS already forwarded it through ResumeSource.resolved.)
  • A backfill's may_land check never looked at the copies the inner front still kept. JS hooks.mayLand returned false for any front's reader, which has no producer, so the backfill was let go before the group holding the time landed. Rust Copy::retains asked the inner front's track::Consumer, which forwards only to its serving copy, so it missed a group that a copy the inner front replaced could still land.

A third gap showed up in review: a recovered group read through a nested front. The JS mayLand forward also reaches Recover's refusal check. Rust Recover reads the rest of a group, and judges a refused fetch, through track::Consumer::poll_group. That never forwarded a front's track to its serving copy, so through a nested front Rust neither saw the group land nor reached a verdict.

Approach

  • Rust resolution: removed resolved_ranges. It differed from resolved_keys only in that arm, so every caller now uses resolved_keys, which forwards to the inner reader's window.
  • Rust may_land: new crate-private track::Subscriber::may_land. A plain cursor answers from its track. A front's reader answers through resume::Subscriber::may_land: true while any copy it still keeps may land the group, clamped to where that copy starts and under its cap. Copy::retains asks through Copy::may_land, which uses the subscriber once the copy has answered, as Copy::skipped_in already does.
  • Rust poll_group: track::Consumer::poll_group now forwards a front's track to its serving copy, as may_land, skipped_in, and fetch_group already do. Its only callers are Recover's three sites.
  • JS: new ResumeSource.mayLand, implemented by Reader the same way. hooks.mayLand forwards to it for a front's reader, and that covers Recover's refusal check too.
  • Tests:
    • Renamed and extended the quest's test, in Rust and JS: a_raised_start_behind_an_inner_front_places_through_it now asserts the read hands out [7], places at 7..8, and ends.
    • Added a_backfill_through_an_inner_front_waits_on_a_copy_it_replaced, plus its JS mirror. The inner front moves to a copy whose feed starts past a late group (start_at(9)), and the late group lands only on the copy it replaced.
    • Added a_short_group_a_nested_replacement_lacks_reads_on_once_it_lands, plus its JS mirror. A short group whose replacement is a front refuses the fetch of the rest, then lands there whole (the read continues) or closed at the same frame (the read ends there).

Public API: none. Wire: none.

Decisions

Choices I made without asking, for review:

  • Folded resolved_ranges into resolved_keys rather than adding a forward to it, since they were otherwise identical.
  • floor passes through unchanged to each kept copy, as the existing serving-copy forward did. Each copy's own floor clamps where the range starts instead (Copy::start).
  • The replaced-copy test uses a late group, not a time start. The time-start version of that scenario also fails on a single front with no nesting, which puts it outside this quest. It is planned as a follow-up below.
  • The new JS Recover wait is intended (Pullfrog's thread). A refusal is a verdict only once the serving subscription will not deliver the group either. For a nested front, that subscription is the inner front's reader, which delivers from any copy it keeps. Before this PR, JS ended such a read with the refusal while the group could still land. Rust waited, but never read the group once it landed. I fixed the Rust side here, because without it the two languages disagree on this path.
  • Rust's refusal verdict for a nested front looks only at the inner front's serving copy (Consumer::poll_group), while JS asks every copy the inner front keeps. Both wait while the serving copy may land the group, and both read on once it does. They differ only when a copy the inner front replaced could land a group its serving copy never will. There Rust ends the read with the refusal while JS waits, and may yet read the group on. Reaching Rust's reader-level copies from Recover would mean restructuring how Recover reads, for that corner case. That is left as is; it isn't a follow-up quest.

Validation

  • Before: the extended a_raised_start_behind_an_inner_front_places_through_it failed in both Rust and JS, reading [] instead of [7]. With only the resolution forward, the Rust test passed.
  • Each change is load-bearing:
    • The replaced-copy test fails in Rust when Copy::may_land reverts to self.track.may_land (the serving-only forward). It fails in JS when Reader.mayLand asks only the serving copy.
    • The nested recovery test fails in JS with the pre-PR hooks.mayLand (false for a front's reader). It fails in Rust on main's resume.rs and track.rs (the read stays pending after the group lands) and without the poll_group forward.
    • Every new test passes with its change, in both languages.
  • Second, independent check: the resume model (readers_match_the_logical_track) passes seeds 1–8 at 1024 cases each on the first head, and seeds 1–4 at 1024 after the poll_group forward. It models no nested fronts, but it covers Copy::retains and Recover, which every copy now reaches through these paths.
  • Suites: cargo nextest run -p moq-net --all-features passed 4231. bun test in js/net passed 3585.
  • Lint and checks: just check passes.
  • Real surface: nested fronts exist only inside the in-process origin model, which these unit tests drive directly. No binary exposes the behavior separately.

Caused by

  • moq-dev/moq#5929 - added resolved_ranges, which answered nothing for a front's reader, so an outer front never learned an inner front's placement (found by reviewer on moq-dev/moq#9278).
  • moq-dev/moq#6141 - added the JS hooks.mayLand, which answered false for a front's reader, letting a backfill through an inner front go before its group landed (found by reviewer on moq-dev/moq#9278).
  • Rust Recover through a nested front: track::Consumer::poll_group has never forwarded a front's track to its serving copy, through every rename back past moq-dev/moq#8638, so no single PR introduced it (found by reviewer: Pullfrog on this PR).

Follow-ups

  • quest/m1/unplaced-start-keeps-replaced-copy.md - found while testing this PR. A front's reader whose time start is still unplaced lets go of a replaced copy that may yet land the group holding that time, so the read hangs. This happens on a single front, and a nested front inherits it. No open decisions.

Overlap

resume-model-placement (moq-dev/moq#9389), resume-model-route-close, resume-route-mutants, and js-resume-model-received also touch resume.rs and resume.ts. This diff touches only Copy::retains' two may_land calls, the new may_land methods, the resolved_ranges call sites, Consumer::poll_group, and new tests, so expect textual conflicts at most. moq-dev/moq#9316 has not landed yet, and this diff doesn't touch subscription starts.

Models

Size: M
Implementer: Claude, claude-opus-5-5, unknown effort (arm B)
Implementer: Claude, claude-opus-5-5, unknown effort (iterate, M, arm B)

🤖 Generated with Claude Code

(Written by Claude Opus 5.5)

Review

Rewritten by quest review after each round.

  • Head: 491911a

  • Base: origin/main at 2dfd5e8

  • Risk: medium, This changes shipped Rust (`rs/moq-net`) and JS (`js/net`) resume behavior, a bug fix that could leave a subscriber reading a front's copy wrongly or stalling where it previously ended, for relay and client users of fronted tracks, and a revert fully undoes it; the public API and wire format are unchanged (the touched `resolved_ranges`/`resolved_keys`/`may_land` items are `pub(super)`/`pub(crate)`/internal JS hooks), so it is not high.

  • Classified: medium by Claude Code, claude-haiku-5-5, low effort, session 330a116e-64bc-4670-8799-5917d4a13ae3

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

  • Session: 01a2031e-8cac-7362-bcb9-b7371c2cb2a4, round 3

  • Score: 8/10, The merge preserves the previously reviewed branch changes and reveals no actionable integration regression, though builds and tests were not run as instructed.

  • Rounds: 3; first round 0; findings 0: fixed 0, refuted 0, open 0

  • Findings: none

kixelated and others added 5 commits November 22, 2026 03:07
…nd waits on its kept copies

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hat front keeps

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title A front served by another front places a time start through it fix(net): a front read through another front places time starts through it Nov 22, 2026
@kixelated
kixelated marked this pull request as ready for review November 22, 2026 12:01
@coderabbitai

coderabbitai Bot commented Nov 22, 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 5 minutes.

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: 54c6458e-d5bc-4540-a93c-5d2e44b6067d
Commits

Reviewing files that changed from the base of the PR and between fd59727 and 491911a.

Files selected for processing: 8

  • js/net/src/internal.ts
  • js/net/src/resume.test.ts
  • js/net/src/resume.ts
  • js/net/src/track.ts
  • quest/m1/nested-front-time-start.md
  • quest/m1/unplaced-start-keeps-replaced-copy.md
  • rs/moq-net/src/model/resume.rs
  • rs/moq-net/src/model/track.rs
  • 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
kixelated enabled auto-merge November 22, 2026 12:02

@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 critical issues. One side effect worth a look, inline.

Approach: sound. The PR forwards resolution and may_land through the inner front's reader instead of answering None or false for it, and it asks every copy the inner front keeps, not only its serving copy. That fixes the cause in both languages and follows the same pattern as the existing skipped_in forward.

Reviewed changes

I reviewed all 8 files. That covers the Rust and JS forwarding changes, the two mirrored tests, and the quest file swap.

  • resolved_ranges folded into resolved_keys: every resume.rs call site now gets the inner front's placement, so the outer Reader::window learns where a nested range placed.
  • track::Subscriber::may_land / resume::Subscriber::may_land: a front's reader asks each kept copy, clamped by Copy::start and Copy::end. It takes the inner reader lock while the outer one is held, the same lock order as skipped_in.
  • Copy::may_land: Copy::retains now asks through the ready subscriber and falls back to the track while pending.
  • JS Reader.mayLand / hooks.mayLand: these mirror the Rust forward, using the same floor and backfill clamp and the same copyEnd.
  • Tests: the renamed placement test now asserts [7], 7..8, and a clean end. The new replaced-copy test pins down the case the serving-only forward missed.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using claude-opus-5-5 | 𝕏

Comment thread js/net/src/track.ts Resolved
@moq-bot
moq-bot Bot disabled auto-merge November 22, 2026 12:05
@moq-bot

moq-bot Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

quest land watch: ended this pull request's pick, disarming its auto-merge, since its head 9b0fb20 is held by finding by pullfrog[bot]: This forward also reaches a third caller that the PR doesn't mention: the Recover refusal path in resume.ts (`hooks. (#9401 (comment)). Push a fix, or answer each by a thread reply or a comment linking its review or decision, then land it again.

(written by quest land watch)

…rving copy

A front's track::Consumer::poll_group forwards to its serving copy, as may_land and
fetch_group do, so a refused fetch through a nested front waits for the group there
and reads it on; pinned in Rust and JS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pullfrog[bot]
pullfrog Bot previously approved these changes Nov 22, 2026

@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.

Reviewed changes

I reviewed the delta since 9b0fb20. It answers the earlier Recover thread by fixing the Rust side and pinning both languages with a test.

  • Forwarded track::Consumer::poll_group to the serving copy: a front's track now answers from self.serving(), as ask and fetch_group already do. Rust Recover therefore reads a group that lands on a nested front's serving copy, where before it waited forever.
  • Added a_short_group_a_nested_replacement_lacks_reads_on_once_it_lands (Rust + JS): the replacement is a nested front and the fetch of the rest is refused. The read then continues once the group lands whole, or ends where that copy closed it.

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

@kixelated
kixelated added this pull request to the merge queue Nov 22, 2026
Any commits made after this event will not be merged.
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 22, 2026
@moq-bot

moq-bot Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

quest land watch: the merge queue removed this pull request at 7b4fd0b because it conflicts with main (merge_conflict).

The land fixer works on it in the background, and the watcher re-enqueues it at the back of the queue once it is fixed or judged flaky, or hands it back here with what it needs.

(written by quest land watch)

…-time-start

# Conflicts:
#	js/net/src/resume.test.ts
@moq-bot

moq-bot Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

quest land watch: Another session holds this pull request, so the watcher stops acting on it and leaves it to that session: the hold ends the pick, and a maintainer enqueues it again once that session is done.

(written by quest land watch)

@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.

Reviewed changes

The only change since 7b4fd0b merges origin/main into the branch.

  • Merged origin/main: the range-diff shows only shifted context around a test that main added to js/net/src/resume.test.ts. The PR's Rust and JS forwarding changes and its tests are the same as already reviewed.

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

@kixelated
kixelated added this pull request to the merge queue Nov 22, 2026
Any commits made after this event will not be merged.

This branch has not been deployed

No deployments
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