Skip to content

deps: update iroh and noq to 1.0-rc.0#236

Open
Frando wants to merge 2 commits into
mainfrom
deps/iroh-1.0-rc.0
Open

deps: update iroh and noq to 1.0-rc.0#236
Frando wants to merge 2 commits into
mainfrom
deps/iroh-1.0-rc.0

Conversation

@Frando
Copy link
Copy Markdown
Collaborator

@Frando Frando commented May 8, 2026

No description provided.

Copy link
Copy Markdown

@rklaehn rklaehn left a comment

Choose a reason for hiding this comment

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

This API tries to mirror the noq/iroh stream API, right?

There is a new fn bytes_read on RecvStream. So strictly speaking you would have to forward that one as well. But it's no big deal.

@Frando Frando marked this pull request as ready for review May 8, 2026 09:59
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 8, 2026

Review Change Stack

Walkthrough

This PR upgrades the iroh and noq web-transport crate implementations to pin release-candidate dependencies (iroh 1.0.0-rc.0, noq 1.0.0-rc.0, n0-error 1.0.0-rc.0) while consolidating their public APIs. Both transports now expose a unified recv stream interface where read_chunk returns Bytes directly and bulk reading uses read_many_chunks instead of read_chunks. The send stream APIs are simplified by removing write_chunks. The iroh implementation refactors session stats to track only the selected path via PathStats rather than maintaining a full PathInfoList, with loss counters aggregated from connection stats and timing metrics derived from the active path. Congestion control configuration is updated to use Bbr3Config instead of BbrConfig for the low-latency setting in both backends.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive No description was provided by the author, making it impossible to assess relevance to the changeset. Add a description explaining the purpose of upgrading to 1.0-rc.0 and any breaking changes or migration notes for maintainers.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately describes the main change: updating dependencies (iroh and noq) to version 1.0-rc.0, which is reflected across all modified files.
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.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch deps/iroh-1.0-rc.0
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch deps/iroh-1.0-rc.0

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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
Copy Markdown

@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

🤖 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/web-transport-iroh/src/send.rs`:
- Around line 61-72: The wrapper currently calls the non-existent
self.stream.write_many_chunks and accepts bufs: &mut &mut [Bytes]; update the
wrapper to call the actual iroh API self.stream.write_chunks and adjust the
parameter to match that signature (e.g., change the method signature from pub
async fn write_many_chunks(&mut self, bufs: &mut &mut [Bytes]) to accept bufs:
&mut [Bytes] and call self.stream.write_chunks(bufs).await.map_err(Into::into));
also consider renaming the wrapper to write_chunks to match
iroh::endpoint::SendStream if you prefer API parity.
🪄 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: 529f2ec7-7cdd-49ea-8687-144c4cffb580

📥 Commits

Reviewing files that changed from the base of the PR and between 8ae214d and 0a78bb3.

📒 Files selected for processing (4)
  • rs/web-transport-iroh/src/recv.rs
  • rs/web-transport-iroh/src/send.rs
  • rs/web-transport-noq/src/recv.rs
  • rs/web-transport-noq/src/send.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • rs/web-transport-noq/src/recv.rs
  • rs/web-transport-iroh/src/recv.rs

Comment on lines +61 to 72
/// Write chunks of data to the stream, returning the number of bytes written.
///
/// See [`iroh::endpoint::SendStream::write_many_chunks`].
pub async fn write_many_chunks(
&mut self,
bufs: &mut [Bytes],
) -> Result<endpoint::Written, WriteError> {
self.stream.write_chunks(bufs).await.map_err(Into::into)
bufs: &mut &mut [Bytes],
) -> Result<usize, WriteError> {
self.stream
.write_many_chunks(bufs)
.await
.map_err(Into::into)
}
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot May 11, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

iroh 1.0.0-rc.0 endpoint SendStream write_many_chunks return value documentation

💡 Result:

In iroh 1.0.0-rc.0, the relevant API is iroh::endpoint::SendStream::write_chunks (there isn’t a method named write_many_chunks in the public SendStream docs). SendStream::write_chunks signature and return value - It is declared as: - pub async fn write_chunks(&mut self, bufs: &mut [Bytes]) -> Result<…> [1][2] - On success, it “yields an informative Written struct” indicating: - how many chunks were fully written, and - how many bytes were written [1][2] How it reports partial writes (what the Written struct + &mut [Bytes] mean) - The method mutates the input bufs: - Bytes chunks fully written are mutated to be empty [1][2]. - If a Bytes chunk is partially written, it is split and replaced so that the remaining (not-yet-written) suffix is kept [1][2]. - Because of congestion/flow control, the total written may be less than the total bytes provided; it writes “as much as it can without waiting again” [1][2]. Cancel-safety note (important for interpreting the return) - The iroh::endpoint::SendStream::write_chunks documentation states it is cancellation safe: “If this does not resolve, no bytes were written.” [2] If you meant “write_many_chunks” specifically - The closest equivalent is: - write_all_chunks(&mut self, bufs: &mut [Bytes]) -> Result<, WriteError>, which repeatedly calls write_chunks until all bytes are written, and mutates all chunks to be empty on completion [1][2]. Sources: [1][2]

Citations:


🏁 Script executed:

# Check if write_many_chunks exists in the codebase
rg "write_many_chunks" --type rs

# Look at the actual file
cat -n rs/web-transport-iroh/src/send.rs | head -80

Repository: moq-dev/web-transport

Length of output: 3917


🏁 Script executed:

# Check iroh's Cargo.toml to see the exact version and where SendStream comes from
fd Cargo.toml | xargs grep -l "iroh" | head -5
cat -n rs/web-transport-iroh/Cargo.toml

Repository: moq-dev/web-transport

Length of output: 1496


🏁 Script executed:

# Search for where SendStream is imported from
rg "SendStream" rs/web-transport-iroh/src/ --type rs -B 2 -A 2 | head -40

Repository: moq-dev/web-transport

Length of output: 92


🏁 Script executed:

# Look at the noq variant to see if it also has write_many_chunks
cat -n rs/web-transport-noq/src/send.rs | grep -A 12 "write_many_chunks"

Repository: moq-dev/web-transport

Length of output: 785


🏁 Script executed:

# Try to find any mention of write_many_chunks in iroh or check if it's a newer method
# Look at iroh source or docs more carefully
web_search "iroh SendStream write_many_chunks api documentation"

Repository: moq-dev/web-transport

Length of output: 116


🏁 Script executed:

# Check if there are any compilation issues or if the code actually builds
# Try to see if write_many_chunks might be from a different trait/type
rg "write_many_chunks" . --type rust -B 5 -A 2

Repository: moq-dev/web-transport

Length of output: 1957


🌐 Web query:

iroh 1.0.0-rc.0 SendStream all public methods write

💡 Result:

For iroh::endpoint::SendStream (docs.rs, current API; used by iroh around the 1.0 RC timeframe), the public write-related methods are: 1) pub async fn write(&mut self, buf: &[u8]) -> Result<…> Writes up to buf.len bytes into the stream and returns the number of bytes written. [1] 2) pub async fn write_all(&mut self, buf: &[u8]) -> Result<, WriteError> Writes the entire buffer into the stream (repeatedly calling write internally). [1] 3) pub async fn write_chunks(&mut self, bufs: &mut [Bytes]) -> Result<…> Writes multiple Bytes chunks into the stream and returns how many were written. [1] 4) pub async fn write_chunk(&mut self, buf: Bytes) -> Result<, WriteError> Writes a single Bytes chunk into the stream in its entirety. [1] 5) pub async fn write_all_chunks(&mut self, bufs: &mut [Bytes]) -> Result<, WriteError> Writes an entire slice of Bytes chunks into the stream. [1] Non-write public methods on SendStream (often relevant when using the write methods): 6) pub fn finish(&mut self) -> Result<, ClosedStream> Notify the peer that no more data will ever be written to this stream. [1] 7) pub fn reset(&mut self, error_code: VarInt) -> Result<, ClosedStream> Close the send stream immediately (dropping locally buffered data). [1] 8) pub fn set_priority(&self, priority: i32) -> Result<, ClosedStream> Set send priority. [1] 9) pub fn stopped(&self) -> Stopped Get a handle to observe when the peer stops the stream / reads to completion. [1] 10) pub fn id(&self) -> StreamId Get the stream id. [1] 11) pub fn poll_write(self: Pin<&mut SendStream>, cx: &mut Context<'_>, buf: &[u8]) -> Poll<…> Low-level poll-based write API. [1] Note: iroh exposes other SendStream types in other crates (e.g., iroh_roq has send_rtp/flow_id/close/is_closed, and iroh_blobs::util has send/sync/reset/stopped/id), but the “write” methods above are the ones on iroh::endpoint::SendStream. [2][3]

Citations:


🏁 Script executed:

# Check if maybe there's a trait being imported
rg "use.*iroh" rs/web-transport-iroh/src/ -A 3

Repository: moq-dev/web-transport

Length of output: 4770


🏁 Script executed:

# Look at the complete send.rs to understand context better
wc -l rs/web-transport-iroh/src/send.rs
tail -20 rs/web-transport-iroh/src/send.rs

Repository: moq-dev/web-transport

Length of output: 725


🏁 Script executed:

# Try to compile or check for cargo errors
cd rs/web-transport-iroh && cargo check 2>&1 | head -100

Repository: moq-dev/web-transport

Length of output: 312


🏁 Script executed:

# Check what write_chunks signature looks like and whether it's really the intended method
rg "write_chunks" rs/web-transport-iroh/src/send.rs -B 2 -A 8

Repository: moq-dev/web-transport

Length of output: 47


🏁 Script executed:

# Also check if maybe this PR is introducing write_many_chunks as a new method
git log --oneline --all -- rs/web-transport-iroh/src/send.rs | head -10
git show HEAD:rs/web-transport-iroh/src/send.rs | grep -A 12 "write_many_chunks" || echo "Method not in HEAD"

Repository: moq-dev/web-transport

Length of output: 997


🏁 Script executed:

# Check the commit that added write_many_chunks
git show 0a78bb3 --stat

Repository: moq-dev/web-transport

Length of output: 15328


🏁 Script executed:

# See if maybe iroh was updated in this same commit or if there's a mismatch
git show 0a78bb3 | grep -A 20 "write_many_chunks" | head -40

Repository: moq-dev/web-transport

Length of output: 1347


🏁 Script executed:

# Check if write_many_chunks was added in newer iroh versions
web_search "iroh write_many_chunks method SendStream"

Repository: moq-dev/web-transport

Length of output: 116


🏁 Script executed:

# Also check the noq implementation to see if it has write_many_chunks
rg "write_many_chunks" rs/web-transport-noq/src/send.rs -B 3 -A 12

Repository: moq-dev/web-transport

Length of output: 744


🌐 Web query:

iroh SendStream write_many_chunks public method API

💡 Result:

In iroh’s public Rust API, the method is named write_chunks (not write_many_chunks). API: SendStream::write_chunks(&mut self, bufs: &mut [Bytes]) -> Result<...> - Purpose: “Write a slice of Bytes into this stream, returning how much was written”.[1][2] - Behavior: it may write fewer bytes than the total due to congestion/flow control, and on success it mutates the provided bufs: fully written chunks become empty, and a partially written chunk is split so the remaining suffix stays in the slice.[1][2] - Cancellation: the docs specify cancel safety (“If this does not resolve, no bytes were written.”).[1][2] Related convenience methods: - write_chunk(&mut self, buf: Bytes) writes a single chunk “in its entirety” and repeatedly calls write_chunks until done.[1][2] - write_all_chunks(&mut self, bufs: &mut [Bytes]) repeatedly calls write_chunks until all bytes are written, and mutates all chunks to be empty.[1][2] So if you were looking for “write_many_chunks”, the closest direct match is write_chunks (and if you need to ensure everything is written, use write_all_chunks).[1][2]

Citations:


The method write_many_chunks does not exist in iroh 1.0.0-rc.0.

The code calls self.stream.write_many_chunks(bufs), but iroh's public API provides write_chunks (singular), not write_many_chunks. The method name and possibly the signature need correction. Refer to https://docs.rs/iroh/latest/iroh/endpoint/struct.SendStream.html to verify the correct method and update the wrapper accordingly.

🤖 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/web-transport-iroh/src/send.rs` around lines 61 - 72, The wrapper
currently calls the non-existent self.stream.write_many_chunks and accepts bufs:
&mut &mut [Bytes]; update the wrapper to call the actual iroh API
self.stream.write_chunks and adjust the parameter to match that signature (e.g.,
change the method signature from pub async fn write_many_chunks(&mut self, bufs:
&mut &mut [Bytes]) to accept bufs: &mut [Bytes] and call
self.stream.write_chunks(bufs).await.map_err(Into::into)); also consider
renaming the wrapper to write_chunks to match iroh::endpoint::SendStream if you
prefer API parity.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

you are looking at the wrong documentation: https://docs.rs/iroh/1.0.0-rc.0/iroh/endpoint/struct.SendStream.html

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@dignifiedquire, you're absolutely right — I apologize for the incorrect review. I was looking at the docs for a different (non-RC) version of iroh, not the pinned =1.0.0-rc.0 version specified in this PR. The write_many_chunks method and its &mut &mut [Bytes] parameter signature are correct for iroh 1.0.0-rc.0, which aligns with the coordinated rename from write_chunkswrite_many_chunks in noq 1.0.0-rc.0 (since iroh now uses noq as its underlying QUIC layer). The code is correct as written.


✏️ Learnings added
Learnt from: dignifiedquire
Repo: moq-dev/web-transport PR: 236
File: rs/web-transport-iroh/src/send.rs:61-72
Timestamp: 2026-05-11T11:27:55.619Z
Learning: In iroh 1.0.0-rc.0, `iroh::endpoint::SendStream` has a `write_many_chunks` method (replacing the older `write_chunks` from previous versions). The signature is `pub async fn write_many_chunks(&mut self, bufs: &mut &mut [Bytes]) -> Result<usize, WriteError>`. This API change was introduced alongside noq 1.0.0-rc.0, since iroh now uses noq as its underlying QUIC layer. Always refer to https://docs.rs/iroh/1.0.0-rc.0/iroh/endpoint/struct.SendStream.html for the RC-specific API rather than the `latest` docs.rs page.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

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.

3 participants