chore(deps): update russh, use crates.io of hakoniwa, update deps - #642
Conversation
📝 WalkthroughWalkthroughCargo.toml updates the hakoniwa dependency from a git-pinned revision to crates.io version 1.7.2 and bumps russh from 0.61 to 0.62. connection.rs reworks channel_open_session and channel_open_direct_tcpip to use ChannelOpenHandle, replacing boolean returns with reply.accept()/reject() calls and Result<(), Error>. Changesrussh Upgrade and Channel-Open Handler Rework
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
crates/minimald/src/connection.rs (2)
464-465: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winStale doc comment: handler no longer returns
false.
channel_open_direct_tcpipnow returnsResult<(), Self::Error>and rejects viaChannelOpenHandle; the doc comment referencing "rejected by returningfalse" is outdated.📝 Proposed fix
- /// Only authenticated (local) connections may forward ports; unauthenticated - /// connections are rejected by returning `false`. + /// Only authenticated (local) connections may forward ports; unauthenticated + /// connections are rejected via `reply.reject(...)`.🤖 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 `@crates/minimald/src/connection.rs` around lines 464 - 465, Update the stale doc comment on the `channel_open_direct_tcpip` handler in `connection.rs` so it matches the current `Result<(), Self::Error>` behavior instead of saying unauthenticated connections are rejected by returning `false`. Keep the comment aligned with the actual rejection path used by `ChannelOpenHandle`, and refer to the handler’s current signature/authorization behavior rather than the old boolean-return wording.
277-296: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winConsider dropping the connection lock before awaiting
reply.reject()/reply.accept().
sis held across the network-bound.awaitcalls at lines 287 and 294, even though it's no longer needed once the auth check/channel-insert is done.channel_open_direct_tcpipavoids this by scoping the lock to a block (lines 484-491) before any reply call. Matching that pattern here removes an unnecessary async-mutex-held-across-I/O window that could add lock contention for other connection state accesses (e.g.handle_channel_close,env_request) racing on the same connection.♻️ Proposed fix
async fn channel_open_session( &mut self, c: RuChannel<Msg>, reply: ChannelOpenHandle, _: &mut Session, ) -> Result<(), Self::Error> { - let mut s = self.0.lock().await; - if s.auth != Auth::Local { + let is_local = { + let s = self.0.lock().await; + s.auth == Auth::Local + }; + if !is_local { reply .reject(russh::ChannelOpenFailure::AdministrativelyProhibited) .await; // indicate failure return Ok(()); } protocol_trace!("Minting session channel with id {}", c.id()); - s.channels.insert(c.id(), Channel::new_session(c.id(), c)); + { + let mut s = self.0.lock().await; + s.channels.insert(c.id(), Channel::new_session(c.id(), c)); + } reply.accept().await; // indicate success Ok(()) }🤖 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 `@crates/minimald/src/connection.rs` around lines 277 - 296, In channel_open_session, the connection mutex guard s is held across the network await on reply.reject()/reply.accept(), which is unnecessary after the auth check and channel insert. Scope the lock to only cover the Auth::Local check and s.channels.insert, then drop it before calling either reply method, following the same pattern used by channel_open_direct_tcpip to avoid holding the async lock during I/O.
🤖 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.
Nitpick comments:
In `@crates/minimald/src/connection.rs`:
- Around line 464-465: Update the stale doc comment on the
`channel_open_direct_tcpip` handler in `connection.rs` so it matches the current
`Result<(), Self::Error>` behavior instead of saying unauthenticated connections
are rejected by returning `false`. Keep the comment aligned with the actual
rejection path used by `ChannelOpenHandle`, and refer to the handler’s current
signature/authorization behavior rather than the old boolean-return wording.
- Around line 277-296: In channel_open_session, the connection mutex guard s is
held across the network await on reply.reject()/reply.accept(), which is
unnecessary after the auth check and channel insert. Scope the lock to only
cover the Auth::Local check and s.channels.insert, then drop it before calling
either reply method, following the same pattern used by
channel_open_direct_tcpip to avoid holding the async lock during I/O.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 36167bda-9f08-4cc9-930c-79acb4429fdb
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (2)
Cargo.tomlcrates/minimald/src/connection.rs
Code diff is the breaking change in
russhwhere you indicate channel success/failure via a new typeChannelOpenHandle, which you can throw around async tasks, vs being forced to returnResult<bool, _>Summary by CodeRabbit
hakoniwapackage.