Skip to content

fix(net): a fetch stream states the track's publisher priority - #7790

Merged
kixelated merged 5 commits into
mainfrom
fix/ietf-fetch-publisher-priority
Nov 4, 2026
Merged

kixelated merged 5 commits into
mainfrom
fix/ietf-fetch-publisher-priority

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

Replaces moq-dev/moq#7583 by @kkroo (Omar Ramadan). Thank you! That PR's branch lives on the organization-owned fork Blockcast/moq, and GitHub doesn't let maintainers push to organization-owned forks, so it couldn't be brought up to date in place. This branch keeps kkroo's two commits and their authorship unchanged, and adds merges of main on top.

Problem

A moq-transport fetch stream's first object carries the Publisher Priority that every later object inherits. Both publishers hardcoded it as 0, the most urgent value on the lower-first wire, regardless of the track's priority:

  • Rust ietf/publisher.rs wrote Some(0).
  • JS FetchFrame.encode wrote 0.

Subgroup headers, datagrams and FETCH_OK all state to_wire(track.priority). So a fetched object disagreed with the FETCH_OK above it, every fetch outranked every group stream, and a relay or peer ranking by publisher priority couldn't tell a catalog fetch from a video one.

Approach

The track's wire priority now reaches every fetch writer through the existing priority::to_wire/toWire:

  • Rust: write_fetch_group (draft-22 fill) resolves the priority from the track it fills. write_fetched_group (standalone and joining FETCH) reads it from the fetched group's track info.
  • JS: FetchWriter takes the priority and hands it to FetchFrame, which now requires priority. It comes from FetchAnswer, RunFill and the joining subscription's Joinable.

Merging main brought in the single-group FETCH and fill rewrite, so the fix was re-applied onto it:

  • Every caller of the Rust fetch writers now passes prior_group = None. That dead multi-group plumbing (fetch_position, FetchPrior::Group, the prior_group parameters) is removed, so write_fetch_group takes the priority without a too_many_arguments exemption.
  • The priority tests fetch one group.

Tests

  • Rust a_standalone_fetch_states_the_track_priority (drafts 18, 20 and 22) and a_fill_states_the_track_priority: model priority 72 must put wire 55 on the first object and nothing on the rest.
  • JS a FETCH states the track's priority on its first object (every draft), and the FetchFrame byte test at priority 55.
  • The Rust and JS joining-FETCH tests used to assert 0 next to a FETCH_OK stating 127; both now expect 127.
  • kkroo's second commit pins the converted subscriber priority that a draft-22 fill's cache forks read at, which no test covered.
  • Reverting the fix to a hardcoded 0 fails three Rust and three JS tests.

Verification

  • cargo test -p moq-net --lib: 2905 pass.
  • bun test src/ietf in js/net: 590 pass.
  • tsc, clippy -D warnings, cargo fmt and biome are clean.
  • just test interop --tail --versions moq-transport-18,moq-transport-22: every lane passes (CLI FETCH, late join via joining FETCH and fill, finite tails), Rust, Node and Bun in both directions.

Impact

  • Wire: a fetch stream's first object now carries the track's Publisher Priority instead of 0, from both the Rust and JS publishers. This isn't breaking: the field was always present; only its value changes.
  • API: JS FetchFrame (ietf/object.ts) takes a required priority in its constructor.

Alternatives

Omitting the priority on the first object isn't possible: there's no prior object to inherit it from.

Follow-ups

None. The subscriber doesn't read FETCH_OK's priority, by design since moq-dev/moq#4974: it learns a track's priority from SUBSCRIBE_OK or TRACK_STATUS_OK before any FETCH.

Review

  • Reviewer: quest review --base origin/main, Codex gpt-6.1-sol, medium effort (round 1).
  • Head: 863cfbc01902214354f361bdbe2c318382a51143.
  • Findings: none.

🤖 Generated with Claude Code

HangPlayerEngineer and others added 5 commits October 28, 2026 13:38
The first object on a moq-transport fetch stream carries the Publisher
Priority every later object inherits. Both publishers hardcoded it as 0,
the most urgent value, whatever the track's priority, while subgroup
headers, datagrams and FETCH_OK all state the track's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The two remaining moq-transport priority crossings without a test are the
forks a draft-22 fill reads the cache through: the SUBSCRIBE fill's
snapshot and the fork an update's fill holds. Replacing either
fromWire(msg.subscriberPriority) with the bare wire byte left every test
green. Every other crossing, Rust and JS, already fails under that
mutation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Re-apply the fetch stream's publisher priority onto main's single-group
FETCH and fill: JS threads it through FetchWriter, and Rust drops the
prior_group plumbing every caller now passes as None, so write_fetch_group
takes the priority without a too_many_arguments exemption. The priority
tests now fetch one group.

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

coderabbitai Bot commented Nov 4, 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 1 minute.

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: 9a278919-a55f-4fac-91cf-0b3fbad92967
Commits

Reviewing files that changed from the base of the PR and between 55d5a14 and 863cfbc.

Files selected for processing: 7
  • js/net/src/ietf/fetch.test.ts
  • js/net/src/ietf/ietf.test.ts
  • js/net/src/ietf/join.test.ts
  • js/net/src/ietf/object.ts
  • js/net/src/ietf/publisher.test.ts
  • js/net/src/ietf/publisher.ts
  • rs/moq-net/src/ietf/publisher.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 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review by review (OpenAI)

Reviewed head: 863cfbc.

No actionable finding. Rust and JS carry the converted track publisher priority into standalone, joining and fill FETCH writers, with the first object stating it and later objects inheriting it. The removed Rust multi-group state is unused by the current single-group fetch and fill paths; the nondefault-priority and conversion tests cover those changes.

Verification: static GitHub inspection of both publishers, wire encoding, call sites and tests. I did not run the tests or interoperability lanes.

(Written by review (OpenAI))

@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

  • Fetch stream priority in Rust: write_fetch_group resolves the track's Publisher Priority from track.info() and write_fetched_group from FetchedGroup.info, both through priority::to_wire, so the first fetch object states the same byte FETCH_OK and subgroup headers do.
  • Dead multi-group plumbing removed: FetchPrior::Group, fetch_position, and the prior_group parameters are gone, since the publisher now serves a single group per fetch stream. The subscriber's multi-group reader support is untouched, so third-party multi-group fetches still decode.
  • Fetch stream priority in JS: FetchFrame requires priority and writes it on the first object; FetchWriter passes it through from FetchAnswer, Joinable, and RunFill, all sourced from toWire(info.priority).
  • Tests: Rust and JS standalone/fill priority tests, the joining-FETCH expectations moved from 0 to 127, and two JS tests pinning that a fill's cache fork uses the converted subscriber priority.

I ran the full JS src/ietf suite (590 pass, 0 fail, including the new tests). Rust could not be built here because libspa-sys needs libpipewire-0.3, which is absent outside the Nix dev shell, so the Rust changes were validated by reading; the new logic is a direct conversion on values the surrounding code already uses.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

@kixelated
kixelated added this pull request to the merge queue Nov 4, 2026
Merged via the queue into main with commit 04c1fcf Nov 4, 2026
6 checks passed
@kixelated
kixelated deleted the fix/ietf-fetch-publisher-priority branch November 4, 2026 03:00
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