Skip to content

refactor(sessions::paths): move paths to own crate - #276

Merged
twitchyliquid64 merged 1 commit into
mainfrom
tom/paths-move
Jun 1, 2026
Merged

refactor(sessions::paths): move paths to own crate#276
twitchyliquid64 merged 1 commit into
mainfrom
tom/paths-move

Conversation

@twitchyliquid64

@twitchyliquid64 twitchyliquid64 commented Jun 1, 2026

Copy link
Copy Markdown
Member

The diffbase includes #275 which hasnt merged yet cuz slow, but otherwise this is a mechanical change to move sessions::paths (which is bigggg and we want to use it everywhere) to its own crate.

Summary by CodeRabbit

  • Refactor

    • Consolidated path handling into a dedicated crate and simplified imports across the workspace.
    • Removed previous re-exports for clearer module boundaries.
  • Documentation

    • Updated crate docs and examples to reference the new paths crate and revised import patterns.

@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a new top-level paths crate and workspace wiring, rewires imports in minimald and sessions to use paths, and migrates SFTP and test harness code to use SessionId for session identification.

Changes

SessionId and paths crate refactoring

Layer / File(s) Summary
Paths crate extraction and workspace wiring
crates/paths/Cargo.toml, crates/paths/src/lib.rs, Cargo.toml
Add crates/paths to workspace and workspace.dependencies; update crate docs/doctests and macro internals to reference paths directly.
minimald manifests and import rewires
crates/minimald/Cargo.toml, crates/minimald/src/main.rs, crates/minimald/src/rpc.rs, crates/minimald/src/server.rs, crates/minimald/src/session.rs, crates/minimald/src/sessions.rs
Add paths as a workspace dependency for minimald and update imports to use paths::{...} instead of sessions::paths.
sessions crate manifest and lib surface changes
crates/sessions/Cargo.toml, crates/sessions/src/lib.rs, crates/sessions/src/lifecyclehook.rs, crates/sessions/src/patches.rs, crates/sessions/src/store.rs
Add paths workspace dependency to sessions, remove pub mod paths; export, and update internal imports and docs/comments to reference paths directly.
SFTP handler and test harness SessionId integration
crates/minimald/src/sftp.rs, crates/minimald/src/test_harness.rs
Parse MINIMAL_SESSION_ID into SessionId, look up sessions with SessionKeyPredicate::Id(session_id), and update SFTP test helpers and TestClient::open_sftp() to use SessionId.

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • evanspearman
  • norrietaylor

Poem

🐇 I hopped the workspace, carried paths in my paws,
I traded UUIDs for tidy SessionId laws.
Imports now point cleanly where types belong,
SFTP and tests hum a simpler song.
A tiny rabbit clap — hop, patch, and applause!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: extracting the sessions::paths module into its own standalone crate.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Caution

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

⚠️ Outside diff range comments (1)
crates/sessions/src/lib.rs (1)

23-37: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Missing constructor from Uuid.

SessionId only provides nil() and parse_str(), but there's no way to create one from an existing Uuid. Callers that generate fresh IDs (e.g., Uuid::new_v4()) would have to do an inefficient string round-trip.

Consider adding a constructor and/or From<Uuid> impl:

Suggested additions
 impl SessionId {
+    /// Creates a new session ID from an existing UUID.
+    #[must_use]
+    pub fn new(id: Uuid) -> Self {
+        Self(id)
+    }
+
     #[must_use]
     pub fn nil() -> Self {
         Self(Uuid::nil())
     }

And optionally:

impl From<Uuid> for SessionId {
    fn from(id: Uuid) -> Self {
        Self(id)
    }
}
🤖 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/sessions/src/lib.rs` around lines 23 - 37, SessionId lacks a
constructor from an existing Uuid which forces callers to stringify/parse; add a
simple constructor (e.g., pub fn from_uuid(id: Uuid) -> Self or pub fn new(id:
Uuid) -> Self) to SessionId and implement impl From<Uuid> for SessionId { fn
from(id: Uuid) -> Self { Self(id) } } so callers can directly wrap
Uuid::new_v4() without a string round-trip; update references to use the new
constructor instead of parse_str where appropriate (symbols: SessionId,
parse_str, nil, From<Uuid>).
🤖 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.

Outside diff comments:
In `@crates/sessions/src/lib.rs`:
- Around line 23-37: SessionId lacks a constructor from an existing Uuid which
forces callers to stringify/parse; add a simple constructor (e.g., pub fn
from_uuid(id: Uuid) -> Self or pub fn new(id: Uuid) -> Self) to SessionId and
implement impl From<Uuid> for SessionId { fn from(id: Uuid) -> Self { Self(id) }
} so callers can directly wrap Uuid::new_v4() without a string round-trip;
update references to use the new constructor instead of parse_str where
appropriate (symbols: SessionId, parse_str, nil, From<Uuid>).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cde5a729-1da7-42c0-b71c-5921fb4cde16

📥 Commits

Reviewing files that changed from the base of the PR and between 960aad3 and dfb4a3c.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (16)
  • Cargo.toml
  • crates/minimald/Cargo.toml
  • crates/minimald/src/main.rs
  • crates/minimald/src/rpc.rs
  • crates/minimald/src/server.rs
  • crates/minimald/src/session.rs
  • crates/minimald/src/sessions.rs
  • crates/minimald/src/sftp.rs
  • crates/minimald/src/test_harness.rs
  • crates/paths/Cargo.toml
  • crates/paths/src/lib.rs
  • crates/sessions/Cargo.toml
  • crates/sessions/src/lib.rs
  • crates/sessions/src/lifecyclehook.rs
  • crates/sessions/src/patches.rs
  • crates/sessions/src/store.rs
✅ Files skipped from review due to trivial changes (4)
  • crates/paths/Cargo.toml
  • crates/minimald/src/session.rs
  • crates/minimald/src/main.rs
  • crates/sessions/src/lifecyclehook.rs
🚧 Files skipped from review as they are similar to previous changes (11)
  • crates/minimald/src/server.rs
  • Cargo.toml
  • crates/minimald/Cargo.toml
  • crates/sessions/src/patches.rs
  • crates/paths/src/lib.rs
  • crates/sessions/Cargo.toml
  • crates/minimald/src/test_harness.rs
  • crates/minimald/src/rpc.rs
  • crates/minimald/src/sftp.rs
  • crates/minimald/src/sessions.rs
  • crates/sessions/src/store.rs

@twitchyliquid64
twitchyliquid64 enabled auto-merge (rebase) June 1, 2026 19:25
@twitchyliquid64
twitchyliquid64 merged commit 7e9869d into main Jun 1, 2026
9 checks passed
@twitchyliquid64
twitchyliquid64 deleted the tom/paths-move branch June 1, 2026 19:35
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.

2 participants