Skip to content

fix(net): preserve aborted source errors through origins - #4232

Open
kixelated wants to merge 4 commits into
mainfrom
quest/m1/dropped-sources
Open

kixelated wants to merge 4 commits into
mainfrom
quest/m1/dropped-sources

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

Problem

An aborted broadcast loses its cause when an origin front closes or a consumer asks for a track afterward. A still-advertised route can re-request an aborted broadcast instead of reporting its error. IETF PUBLISH_DONE Unauthorized is reported as Remote(1).

Approach

Carry source errors through close events and front termination, exclude the dead source's route from that front's failover, and preserve the cause on late track lookup. Decode PUBLISH_DONE Unauthorized as Error::Unauthorized. Add local/routed regressions and a source-close benchmark.

Impact

  • Public API signatures are unchanged. Rust consumers now observe the original broadcast abort cause and the named Unauthorized terminal status.
  • No wire format or emitted-code changes.

Alternatives

The branch includes merged #4120; do not duplicate the revocation changes owned by #4179. Keep this PR focused on uncovered Rust paths.

Validation

  • Regression tests first reproduced both error losses; the standing-route case timed out waiting on a new source request instead of ending with its cause.
  • nix develop --command just check: passed on main including fix(net): end a track with its session's error when the session dies #4120 (4,478 default-feature Rust tests, 496 additional feature tests, JS tests, docs, formatting, and quest validation).
  • cargo clippy --locked -p moq-net --bench origin -- -D warnings: passed in the Nix shell.
  • Source-close benchmark, routes × consumers: 1×1 = 1.50 µs; 1000×1 = 1.59 µs; 1×100 = 5.37 µs; 1000×100 = 5.04 µs. No additional table-size slope was observed.

Follow-ups

The quest remains open with an explicit dependency on #4179. After it lands, complete the combined mock-session/relay proof and map JS PUBLISH_DONE Unauthorized using #4179's shared error type.

(Written by GPT-6)

@kixelated
kixelated marked this pull request as ready for review September 26, 2026 02:37
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-26T02:40:07.661654Z 2798b3b Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 19 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 94654f96-3619-4f69-893d-94b540b4550f

📥 Commits

Reviewing files that changed from the base of the PR and between b99cad9 and 2798b3b.

📒 Files selected for processing (7)
  • doc/lib/rs/moq-net.md
  • quest/m1/dropped-sources.md
  • rs/moq-net/benches/origin.rs
  • rs/moq-net/src/ietf/publish.rs
  • rs/moq-net/src/model/broadcast.rs
  • rs/moq-net/src/model/front.rs
  • rs/moq-net/src/model/origin.rs

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

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2798b3bf65

ℹ️ 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".

/// How the publisher ended the subscription: cleanly, or with the error its status names.
pub(crate) fn end(&self, version: Version) -> Result<(), crate::Error> {
match self.status_code {
0x1 => Err(crate::Error::Unauthorized),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Map Unauthorized in the TypeScript IETF path too

When an IETF peer sends PUBLISH_DONE status 0x1, this change makes Rust expose Error::Unauthorized, but js/net/src/ietf/subscriber.ts:670-673 still throws a generic Error for the same input. This leaves the Rust and TypeScript implementations with different public terminal semantics; land the shared JS error dependency first or update js/net in this change.

AGENTS.md reference: AGENTS.md:L94-L97

Useful? React with 👍 / 👎.

}
}
self.last_err = Some(Error::Dropped);
self.last_err = Some(err.clone());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Clear stale source errors after successful failover

If source A aborts with Unauthorized, the front records that error here; after successfully attaching source B through another route from the same publisher, attach does not clear it. If B's route is later retracted while B remains live, selected(None) therefore ends the front with A's stale Unauthorized instead of the normal route-loss Dropped, so consumers receive an error from a source they already recovered from. Clear last_err after a successful attachment or otherwise scope it to the failed selection attempt.

Useful? React with 👍 / 👎.

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