Repository navigation
fix(minimald::rpc::CreateSession): communicate an error if the session name is not unique - #381
Conversation
…n name is not unique
📝 WalkthroughWalkthroughThis PR introduces an ChangesRPC Error Response Wrapper
Sessions Actor Error Type Refactoring
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
crates/minimald/src/rpc.rs (1)
67-103: Drop the redundantDebug + PartialEqbounds fromErrorable<S>
Errorableis declared aspub enum Errorable<S: std::fmt::Debug + PartialEq>, but its methods (unwrap/ok/err) and itsFrom<Result<T, E>>impl don’t rely onDebug/PartialEq. SinceErrorablealready derivesDebug,PartialEq, andEq, the required trait bounds are naturally enforced only when those trait impls are used—so the declaration-level bounds unnecessarily restrict everyErrorable<T>.♻️ Proposed fix
-pub enum Errorable<S: std::fmt::Debug + PartialEq> { +pub enum Errorable<S> { Ok(S), Err { error: String }, } -impl<S: std::fmt::Debug + PartialEq> Errorable<S> { +impl<S> Errorable<S> { pub fn unwrap(self) -> S { match self { Self::Ok(s) => s, Errorable::Err { error } => panic!("unwrap of error value: {error}"), } } @@ -impl<T: std::fmt::Debug + PartialEq, E: ToString> From<Result<T, E>> for Errorable<T> { +impl<T, E: ToString> From<Result<T, E>> for Errorable<T> { fn from(value: Result<T, E>) -> Self { match value { Err(e) => Self::Err { error: e.to_string(), }, Ok(t) => Self::Ok(t), } } }🤖 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/rpc.rs` around lines 67 - 103, The enum declaration imposes unnecessary type bounds: remove "S: std::fmt::Debug + PartialEq" from "pub enum Errorable<S>" so the enum itself is generic over S without those constraints, and adjust the impl blocks accordingly (the inherent impl impl<S> Errorable<S> and the From<Result<T, E>> impl should not require Debug+PartialEq on S; keep the From impl generic as "impl<T, E: ToString> From<Result<T, E>> for Errorable<T>"). Ensure references to Errorable::Ok/Err, unwrap, ok, err, and the From<Result<T, E>> remain unchanged.
🤖 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/rpc.rs`:
- Around line 67-103: The enum declaration imposes unnecessary type bounds:
remove "S: std::fmt::Debug + PartialEq" from "pub enum Errorable<S>" so the enum
itself is generic over S without those constraints, and adjust the impl blocks
accordingly (the inherent impl impl<S> Errorable<S> and the From<Result<T, E>>
impl should not require Debug+PartialEq on S; keep the From impl generic as
"impl<T, E: ToString> From<Result<T, E>> for Errorable<T>"). Ensure references
to Errorable::Ok/Err, unwrap, ok, err, and the From<Result<T, E>> remain
unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e3723a4d-661b-4627-a1c3-e960dba7045b
📒 Files selected for processing (5)
crates/minimald/src/exec.rscrates/minimald/src/rpc.rscrates/minimald/src/session.rscrates/minimald/src/sessions.rscrates/minimald/src/sftp.rs
Fixes that cheeky no-error-but-didnt-create-a-session we saw during the demo.
Summary by CodeRabbit
Release Notes
Bug Fixes
New Features