Skip to content

fix(moq-net): a lite-07 copy counts a relative start back as its publisher did - #9132

Merged
kixelated merged 4 commits into
mainfrom
quest/m2/time-addressing/rust-relative-start
Nov 19, 2026
Merged

kixelated merged 4 commits into
mainfrom
quest/m2/time-addressing/rust-relative-start

Conversation

@kixelated

@kixelated kixelated commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Finishes quest/m2/time-addressing/rust-relative-start.md: a Rust reader over a lite-07 received copy now resolves a relative range the way @moq/net does after moq-dev/moq#9027.

Summary

  • The copy learns the publisher's live edge. SUBSCRIBE_START's Largest now goes to track::Producer::report_edge, as a moq-transport live join already does, before the copy goes live. A fresh received copy starts Feed::Live { edge: None }, so until now its readers counted a relative start back from whichever group had landed when they first synced.
  • The copy learns where each relative range started. SubStream::report_starts (was report_time_starts) also reports each live range's (back, start, latest) on the copy. latest is SUBSCRIBE_START's Largest, or the copy's latest_live at SUBSCRIBE_STARTED. Each range's edge is recorded only alongside its start, so an update that keeps a range never re-stamps it. A new start-only hook, Holdings::reported_start, returns the reported start while the copy's latest still equals the latest it was counted from. Once a newer group moves the edge, a late join counts over the copy's own groups again. A relative end never takes the report, because a delivery start may sit past the counted group (for example, above budget-stale groups). This mirrors @moq/net's relativeStarts, and @moq/net gets the same start/end split as a mirrored reportedStart hook (review round 1).
  • A capped route that returns already worked in Rust. The return path in Reader::serve rebuilds copy.resolved from the reader's window, so the cap never sticks. Per the quest, this PR pins that with a port of the JS test and leaves Copy::wire unchanged.

Validation

  • Reproduced first: a_sparse_request_counts_its_relative_start_back_as_the_publisher_did (new, tests/integration/range_anchors.rs) asks [{time:1..2}, {relative:2..time:8}] over a lite-07 copy. Before the fix it read 1, 2, 7, 8 and then never ended: the copy resolved relative 2 to group 2 and waited on 3..6, which the publisher never sends. With the fix it reads 1, 2, 7, 8 and ends.
  • a_received_copy_counts_a_relative_start_back_as_its_publisher_did (new, model/track.rs): a copy holding 1, 2, 9 resolves relative 2 to the reported 7, not 1. After group 10 arrives, a later reader counts its own groups.
  • a_returning_route_keeps_the_readers_bounded_end_across_its_cap (new, model/resume.rs): port of the @moq/net test, plus an update that keeps the ranges after the return. It passes on main's code.
  • js/net/src/window.test.ts "a reported start moves a relative start, never a relative end" (new), plus the end assertion in the Rust unit test above: a report of 8 for relative 2 from 9 moves the start, while a relative 2 end stays at the cache's count.
  • Mutation checks: dropping the reported-start lookup in back fails the unit test, and dropping report_edge fails the integration test.
  • The new integration test passed 200 runs over random sim seeds. The full cargo test -p moq-net --features async suite passes (lib 3346, integration 574). just check passes. Its first run had one test rs failure that my output filter hid. It did not recur in a full re-run of just check or in three more cargo nextest run -p moq-net --all-features runs (3925 tests each). After the round-1 fix, just check failed only on:
    • Pre-existing: @moq/net "a widened range's SUBSCRIBE_STARTED resolves the feed's start" (cd js/net && bun test src/lite/subscriber.test.ts -t "a widened range's SUBSCRIBE_STARTED"). It fails the same way with this PR's JS changes reverted: sourceStart reads 0n, where the test expects "pending". It passes on 928d337's parent and fails from moq-dev/moq#9045 on. Follow-up below.
    • Load, not this change: four moq-relay tests (auth_lifetime::* and the relay_killed_mid_group_aborts_then_resumes drill) hit nextest's 60s timeout at load average 45. KIO_DENY_HOST_TIMERS=1 cargo nextest run -p moq-relay then passed in full (471 tests in 4.4s).
  • JS: bun test src/window.test.ts src/integration.test.ts passes (135 tests).

Decisions

Made unattended, all reversible in review:

  • Pinned the capped-route case with a test and did not port JS's keep-first-resolution #wire logic, since Rust's return path already handles the case (the quest allows this).

  • Report the publisher's Largest as the copy's edge (report_edge) on lite-07, matching the moq-transport path. Without it, the reported starts could never match the copy's latest.

  • The reported start feeds only relative starts, through a separate reported_start hook. Relative ends keep counting the cache, in Rust and JS (review round 1).

  • Moved the start report ahead of set_live/set_live_ahead in the SUBSCRIBE_START handler, so no reader resolves between go-live and the report.

  • Follow-up pick (decided 2026-11-19, coordinator, maintainer away, merge granted). late-relative-join: ✅ keep; ✅ count over held groups only when the copy holds every group back to the counted one, otherwise wait for the publisher's report (rejected: always wait, since a coalesced range gets no SUBSCRIBE_STARTED). lite07-widened-started: ✅ keep while moq-dev/moq#9147 is open (rejected: drop, which applies only once test(net): wait for the widened range's SUBSCRIBE_UPDATE before checking the feed is pending #9147 has merged).

Public API / wire impact

None. Everything added is pub(crate), and no wire change.

Caused by

  • moq-dev/moq#6519: let a lite-07 copy resolve relative anchors itself, but counted back over its own cache with no publisher edge or start (found by reviewer, on the JS side in moq-dev/moq#9027).

Follow-ups

  • quest/m1/lite07-widened-started.md (S): the @moq/net widened-range SUBSCRIBE_STARTED test has failed on main since moq-dev/moq#9045. Kept while moq-dev/moq#9147, which fixes it, is open; its Plan names that PR.
  • quest/m2/time-addressing/late-relative-join.md (M): a later reader joining a lite-07 copy that already holds part of the track still resolves its relative start against the cache before SUBSCRIBE_STARTED can report it. Over a copy holding 1 and 2 of 0..9, a second [{relative:2..time:8}] reader reads 1, 2, 7, 8, 3, 4, 5... This predates this PR and affects @moq/net the same way. Kept, with its decision taken as recommended.

Models

Size: S
Implementer: Claude Code, claude-opus-5-5, high effort

(Written by Claude Opus 5.5 with high)

🤖 Generated with Claude Code

Review

Rewritten by quest review after each round.

  • Head: 93ba603

  • 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 medium

  • Classified: medium by default

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

  • Session: 01a1f14c-96ee-7792-869b-8d5ef1ee0677, round 1

  • Score: 9/10, The reported defect is fixed with focused regression coverage and no new actionable regressions; tests were not run as instructed.

  • 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 23258a9:

    • Fixed: medium, rs/moq-net/src/model/track.rs:1136: Keep delivery-start reports out of relative-end resolution; rs/moq-net/src/model/subscription/window.rs:701 uses reported_start only for starts while end() retains cache-only back(), and JS mirrors this separation.

kixelated and others added 2 commits November 18, 2026 16:04
…isher did

A received lite-07 copy holds only part of the track, so counting a relative
start back over its own groups resolved a sparse request to groups the
publisher never sends, and the read never ended. SUBSCRIBE_START's Largest now
sets the copy's live edge, and each live range's reported start resolves a
relative start counted from that edge, as @moq/net does. A route capped while
replaced and returned to already reads on to the reader's end; a test pins it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title Rust resume copies match @moq/net's relative starts and capped ends fix(moq-net): a lite-07 copy counts a relative start back as its publisher did Nov 19, 2026
SUBSCRIBE_START reports where delivery began, which may sit past the group a
range counted back to, such as above groups too stale for the budget. The
report now feeds only a relative start (Holdings::reported_start, mirrored as
reportedStart in @moq/net), so a relative end still counts the groups held.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review November 19, 2026 00:55
@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 4 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: 0ce780d5-f5a5-4c2e-8b78-a8afbd7a9882
Commits

Reviewing files that changed from the base of the PR and between 77dd8fe and 0b5320b.

Files selected for processing: 11

  • js/net/src/track.ts
  • js/net/src/window.test.ts
  • js/net/src/window.ts
  • quest/m1/lite07-widened-started.md
  • quest/m2/time-addressing/late-relative-join.md
  • quest/m2/time-addressing/rust-relative-start.md
  • rs/moq-net/src/lite/subscriber.rs
  • rs/moq-net/src/model/resume.rs
  • rs/moq-net/src/model/subscription/window.rs
  • rs/moq-net/src/model/track.rs
  • rs/moq-net/tests/integration/range_anchors.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

pullfrog[bot]
pullfrog Bot previously approved these changes Nov 19, 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.

Approach: sound. It records the publisher's Largest as the copy's edge and records each relative range's reported start, keyed to the latest group that start was counted from. Only a start, never an end, uses the reported start. This matches the @moq/net fix from #9027 without changing the wire.

Reviewed changes

I reviewed all 3 commits: the Rust and JS holdings split, the lite-07 subscriber's start/edge reporting, and the new tests and quests.

  • Edge reported at SUBSCRIBE_START: on lite-07, report_edge(largest.group) now runs before set_live/set_live_ahead. On a fresh Feed::Live copy it sets the edge. On an idle copy it is a no-op, and answered → go_live(Largest) sets the same edge, so the ordering is safe either way.
  • Per-range edges on SubStream: each range's edge is recorded only alongside its start (Largest at START, the copy's latest_live() at STARTED). edit prunes retired ranges, so an update that keeps a range doesn't re-stamp its edge.
  • report_starts replaces report_time_starts: it now also sends (back, start, latest) triples to track::Producer::relative_starts. At SUBSCRIBE_START it moved ahead of go-live, so no reader can resolve between going live and the report arriving.
  • Holdings::reported_start: a new default-None hook that only start() consults before back. TrackState returns the reported start only while latest still matches, so once a newer group lands the copy counts its own groups again.
  • JS mirror: reportedStart? is split out of back in window.ts/track.ts, so a relative end keeps counting the cache in both languages.
  • Tests and quests: a unit test, an integration test for a sparse time+relative request, a resume test pinning the already-working capped-route return, and a JS window test. The finished quest is deleted and two follow-ups are added.

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

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

Copy link
Copy Markdown
Collaborator Author

✅ /quest-merge

Follow-up answers (coordinator, maintainer away, merge granted):

(Written by Claude Opus 5.5 with medium)

@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

Since the prior review, the new commit only touches quest docs.

  • Recorded follow-up decisions: lite07-widened-started.md and late-relative-join.md now note the 2026-11-19 picks. No code changed.

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 d778edc Nov 19, 2026
8 checks passed
@kixelated
kixelated deleted the quest/m2/time-addressing/rust-relative-start branch November 19, 2026 02:11
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