Skip to content

feat: add Session::path() to the transport trait; restore qmux path parameter#271

Closed
kixelated wants to merge 1 commit into
mainfrom
claude/transport-path-trait
Closed

feat: add Session::path() to the transport trait; restore qmux path parameter#271
kixelated wants to merge 1 commit into
mainfrom
claude/transport-path-trait

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

Summary

Adds a way for a generic consumer to read the request path a peer connected to, uniformly across transports, via a new trait method — and restores qmux's in-band path parameter so qmux carries one too.

This is the prerequisite for moq#1954 (moq-lite-05 PATH): with Session::path(), moq-net reads the path from the transport where it carries one (WebTransport's CONNECT :path, the qmux path param) and only falls back to its own in-band SETUP for raw QUIC — instead of guessing by URL scheme.

What changed

  • web-transport-trait: new fn path(&self) -> Option<&str> default method (returns None), companion to protocol(). The request path the peer connected to, for transports that carry one.
  • qmux: reverts feat(qmux): remove the in-band path transport parameter #266 to restore the in-band path transport parameter, the Config::path() builders (tcp/uds/tls), and Session::path(), and wires it through the trait impl. The 0.3.1 version/changelog are kept as-is (the revert is code-only).
  • web-transport-quinn / -quiche / -noq: return the CONNECT request's url path.
  • web-transport-iroh: returns the HTTP/3 request path; None for a raw iroh session (no CONNECT).

Notes for review

  • path() is a defaulted trait method, so it's non-breaking for existing Session impls.
  • For raw QUIC (no in-band path mechanism) path() stays None, which is the signal moq-net uses to send its SETUP PATH instead.
  • The qmux revert restores both the wire parameter and its round-trip / duplicate / utf8 tests.

Follow-up

These crates need a release (web-transport-trait, qmux, and the four backends) before moq#1954 can drop its local [patch] and bump to them.

🤖 Generated with Claude Code

…aram

Add `fn path(&self) -> Option<&str>` to `web_transport_trait::Session`
(companion to `protocol()`): the request path the peer connected to, for
transports that carry one. Lets a generic consumer (moq-net) read the
path uniformly instead of guessing by URL scheme.

- web-transport-trait: new `path()` default method (returns None).
- qmux: revert #266 to restore the in-band `path` transport parameter,
  `Config::path()` builders (tcp/uds/tls), and `Session::path()`; wire it
  through the trait impl. Keeps the 0.3.1 version/changelog.
- web-transport-quinn/quiche/noq: return the CONNECT request's url path.
- web-transport-iroh: return the HTTP/3 request path; None for raw iroh.

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

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

Sorry @kixelated, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

A new path() method is added to the web_transport_trait::Session trait with a default None return. The qmux wire protocol gains a path transport parameter (a new field in TransportParams, with encoding, decoding, duplicate detection, and UTF-8 validation). Session and SessionState gain a peer_path OnceLock that is set when peer transport parameters arrive, exposed via a new Session::path() getter. The Config struct gains a path field wired into to_transport_params, and TCP, TLS, and UDS config types each gain a path() builder method. The JavaScript qmux layer explicitly rejects any received path parameter over WebSocket. All four Rust web-transport backends (iroh, noq, quiche, quinn) implement path() by returning the request URL path.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding Session::path() and restoring qmux path handling.
Description check ✅ Passed The description is directly related to the changes and accurately outlines the affected crates and behavior.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch claude/transport-path-trait

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.

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@rs/qmux/src/error.rs`:
- Around line 54-55: The public qmux::Error enum is being extended with a new
InvalidPath variant, which changes the exhaustive match surface for downstream
users. Either avoid exposing this as a new public variant in Error, or update
the crate version/changelog to reflect the breaking API change before shipping.
Locate the change in the Error enum in error.rs and keep the public error
surface stable if this release is meant to remain non-breaking.

In `@rs/qmux/src/proto/params.rs`:
- Around line 31-39: `TransportParams` now exposes a new public `path` field,
which is a breaking API change for downstream construction and exhaustive
matching. Either update the qmux version/changelog to reflect the breaking
change, or adjust the API shape in `TransportParams` to remain
backward-compatible (for example by avoiding a new public field on the struct).
Use the `TransportParams` definition in `params.rs` as the place to make the
change and ensure the release notes/versioning match the public API change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9034193e-e4a0-492f-a3c6-bc9abf3a80bd

📥 Commits

Reviewing files that changed from the base of the PR and between 6c7d1e5 and 8669777.

📒 Files selected for processing (15)
  • js/qmux/src/frame.test.ts
  • js/qmux/src/frame.ts
  • rs/qmux/src/config.rs
  • rs/qmux/src/error.rs
  • rs/qmux/src/proto/params.rs
  • rs/qmux/src/session.rs
  • rs/qmux/src/tcp.rs
  • rs/qmux/src/tls.rs
  • rs/qmux/src/uds.rs
  • rs/qmux/tests/negotiation.rs
  • rs/web-transport-iroh/src/session.rs
  • rs/web-transport-noq/src/session.rs
  • rs/web-transport-quiche/src/connection.rs
  • rs/web-transport-quinn/src/session.rs
  • rs/web-transport-trait/src/lib.rs

Comment thread rs/qmux/src/error.rs
Comment on lines +54 to +55
#[error("invalid path: {0:?}")]
InvalidPath(String),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Adding a new public Error variant is a semver break.

qmux::Error is public, so downstream exhaustive matches stop compiling once InvalidPath exists. The PR objectives say qmux stays at 0.3.1 with no changelog/version update, so this ships a breaking API change as a non-breaking release. Either bump the crate version/changelog or preserve the existing public error surface.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@rs/qmux/src/error.rs` around lines 54 - 55, The public qmux::Error enum is
being extended with a new InvalidPath variant, which changes the exhaustive
match surface for downstream users. Either avoid exposing this as a new public
variant in Error, or update the crate version/changelog to reflect the breaking
API change before shipping. Locate the change in the Error enum in error.rs and
keep the public error surface stable if this release is meant to remain
non-breaking.

Comment on lines +31 to +39

/// Requested resource path, for transports without a URL of their own.
///
/// QMux-specific (ID 0x2b9a4c1f6e3d8052). WebTransport over HTTP/3 and
/// WebSocket carry the path in the request line (`:path` / the WS URL);
/// TCP, TLS, and Unix sockets have no such field, so a client that needs to
/// address a specific resource sends it here. `None` (the default) omits the
/// parameter entirely, keeping peers that never set a path byte-identical.
pub path: Option<String>,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

TransportParams gained a public field without a version bump.

Because TransportParams is public, adding path breaks downstream code that constructs or pattern-matches the struct exhaustively. With qmux intentionally left at 0.3.1, this is another breaking API change that needs a version/changelog update or a non-breaking API shape.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@rs/qmux/src/proto/params.rs` around lines 31 - 39, `TransportParams` now
exposes a new public `path` field, which is a breaking API change for downstream
construction and exhaustive matching. Either update the qmux version/changelog
to reflect the breaking change, or adjust the API shape in `TransportParams` to
remain backward-compatible (for example by avoiding a new public field on the
struct). Use the `TransportParams` definition in `params.rs` as the place to
make the change and ensure the release notes/versioning match the public API
change.

@kixelated

Copy link
Copy Markdown
Collaborator Author

Closing: we're keeping PATH purely at the MoQ layer instead. A raw iroh (or raw QUIC) session carries no request URI, so every moq-transport/moq-lite client must be able to send PATH in the MoQ SETUP anyway — which makes a transport-level Session::path() redundant and the wrong abstraction. The qmux path parameter goes away with it.

(Written by Claude Opus 4.8)

@kixelated kixelated closed this Jun 30, 2026
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