Skip to content

Conversation

@kixelated
Copy link
Collaborator

No need to export ietf/lite and force a semver bump every single change.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 12, 2026

Walkthrough

This pull request refactors the moq crate ecosystem to depend on the external bytes crate for buffer operations instead of using internal moq_lite types. Changes include migrating Bytes, Buf, and BufMut imports from moq_lite::coding to the bytes crate across multiple modules. The public API surface is simplified by removing unused exports: the Decode error variant, FetchObject struct, Setup modules, Alpn type, and alpns() function. Internal module visibility is adjusted by making coding, ietf, and lite crate-private while re-exporting the bytes crate publicly. In moq-native, the client architecture shifts from enum-based backend dispatch to per-backend optional fields, and a new public Request type is introduced for server-side session configuration.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Reduce the moq-lite API size' accurately summarizes the main objective of the changeset, which focuses on reducing the public API surface of the moq-lite crate.
Description check ✅ Passed The description 'No need to export ietf/lite and force a semver bump every single change' is directly related to the changeset and explains the motivation for reducing the API surface.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch limit-api

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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
rs/moq-native/src/server.rs (1)

288-298: ⚠️ Potential issue | 🔴 Critical

Bug: close() will always panic due to unconditional unreachable!().

The if let blocks on lines 290–296 do not return after closing the backend, so execution always falls through to unreachable!() on line 297. Compare with tls_info() (line 162) and local_addr() (line 276) which correctly use return inside their if let blocks.

🐛 Proposed fix
 pub fn close(&mut self) {
     #[cfg(feature = "quinn")]
     if let Some(quinn) = self.quinn.as_mut() {
         quinn.close();
+        return;
     }
     #[cfg(feature = "quiche")]
     if let Some(quiche) = self.quiche.as_mut() {
         quiche.close();
+        return;
     }
     unreachable!("no QUIC backend compiled");
 }
🤖 Fix all issues with AI agents
In `@rs/moq-native/src/lib.rs`:
- Around line 44-54: Add a compile-time check to prevent the QuicBackend enum
from being empty when neither QUIC feature is enabled: insert a cfg
compile_error guard before the QuicBackend definition (in
rs/moq-native/src/lib.rs) using #[cfg(not(any(feature = "quinn", feature =
"quiche")))] compile_error!(...) so that the crate fails to compile with a clear
message if neither feature is selected; this references the QuicBackend enum and
ensures at least one of the "quinn" or "quiche" features is enabled.
🧹 Nitpick comments (3)
rs/moq-lite/src/model/time.rs (1)

191-199: Consider documenting the relationship between these methods and the trait impls.

The new encode/decode methods (lines 192–199) duplicate the Encode<V>/Decode<V> trait impls (lines 299–310) but with () hardcoded as the version and Error instead of DecodeError as the error type. This is a reasonable convenience API for callers who don't need versioned encoding, but the coexistence could be confusing to maintainers.

A brief doc comment (e.g., "Version-less convenience wrapper; see also Encode/Decode trait impls") would help clarify intent.

rs/moq-native/src/iroh.rs (1)

189-197: Consider adding a unit test for url_set_scheme.

This function uses string splitting to work around Url::set_scheme restrictions. While the final .parse() validates the result, edge cases (e.g., URLs with userinfo containing :, opaque URLs) could produce surprising results. A few unit tests would provide confidence. As per coding guidelines, Rust tests should be integrated within source files.

rs/moq-lite/src/ietf/parameters.rs (1)

250-298: Prefer removing dead code over commenting it out.

Block comments (/* ... */) around the unused constants and accessors are easy to miss and create visual noise. Consider deleting them outright — they remain recoverable from git history if ever needed again.

Comment on lines 44 to 54
#[derive(Clone, Debug, clap::ValueEnum, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum QuicBackend {
/// [web-transport-quinn](https://crates.io/crates/web-transport-quinn)
#[cfg(feature = "quinn")]
Quinn,

/// [web-transport-quiche](https://crates.io/crates/web-transport-quiche)
#[cfg(feature = "quiche")]
Quiche,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

rg -n 'compile_error|cfg.*any.*quinn.*quiche' --type=rust

Repository: moq-dev/moq

Length of output: 753


🏁 Script executed:

# Find and check the Cargo.toml for moq-native to see feature definitions
find . -name "Cargo.toml" -type f | xargs grep -l "moq-native" | head -5

Repository: moq-dev/moq

Length of output: 161


🏁 Script executed:

# Check the moq-native Cargo.toml directly
cat rs/moq-native/Cargo.toml

Repository: moq-dev/moq

Length of output: 2380


🏁 Script executed:

# Search for QuicBackend usage in the codebase to understand if it's instantiated
rg -n "QuicBackend" --type=rust -A 2 -B 2

Repository: moq-dev/moq

Length of output: 3897


Add compile-time check to ensure at least one QUIC backend is enabled.

The QuicBackend enum can become empty if neither quinn nor quiche features are enabled. Although downstream code using this enum is conditionally compiled to avoid instantiation in such cases, adding an explicit compile-time error in the library definition makes the contract clear and prevents confusing downstream errors. This is especially important for a library where users might construct unusual feature combinations.

Add the following check to rs/moq-native/src/lib.rs:

#[cfg(not(any(feature = "quinn", feature = "quiche")))]
compile_error!("At least one QUIC backend (quinn or quiche) must be enabled");
🤖 Prompt for AI Agents
In `@rs/moq-native/src/lib.rs` around lines 44 - 54, Add a compile-time check to
prevent the QuicBackend enum from being empty when neither QUIC feature is
enabled: insert a cfg compile_error guard before the QuicBackend definition (in
rs/moq-native/src/lib.rs) using #[cfg(not(any(feature = "quinn", feature =
"quiche")))] compile_error!(...) so that the crate fails to compile with a clear
message if neither feature is selected; this references the QuicBackend enum and
ensures at least one of the "quinn" or "quiche" features is enabled.

@kixelated kixelated enabled auto-merge (squash) February 12, 2026 14:35
@kixelated kixelated merged commit c53e67b into main Feb 12, 2026
1 check passed
@kixelated kixelated deleted the limit-api branch February 12, 2026 14:42
@moq-bot moq-bot bot mentioned this pull request Feb 12, 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