chore: re-arranged the code in the sessions module to prepare for theclient/daemon split - #427
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughRestructures the ChangesSessions crate module restructure
Sequence Diagram(s)sequenceDiagram
participant App
participant Composer
participant ResolveVars
participant PolicyHooks
participant ExpandPatch
participant EnumerateFiles
App->>Composer: resolve(provenanced_items)
Composer->>ResolveVars: resolve per-domain vars
ResolveVars->>ResolveVars: check policy (ignore/deny/allow)
alt needs approval
ResolveVars->>PolicyHooks: on_var_unapproved(Unapproved)
PolicyHooks-->>ResolveVars: HookResult::Decided or Abort
end
Composer->>ExpandPatch: expand_patch_sources
ExpandPatch->>ExpandPatch: call expand_source(VarLookup)
alt expansion error
ExpandPatch-->>Composer: Err(ExpandError)
end
Composer->>EnumerateFiles: enumerate_patch_files
EnumerateFiles->>EnumerateFiles: walk, canonicalize, compute_dest
alt walk/canonicalize error
EnumerateFiles-->>Composer: Err(ResolveError::PatchWalk)
end
Composer-->>App: Ok(resolved session) or Err
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Possibly related issues
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
crates/sessions/src/wire/mod.rs (1)
1-2: 💤 Low valuePlaceholder module with no content.
This module currently only contains a comment referencing "step 2". Consider adding a brief module-level doc comment (
//!) explaining the intended purpose of wire types, or remove the file until actual content is added to avoid confusion.🤖 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/wire/mod.rs` around lines 1 - 2, The wire/mod.rs file currently contains only a placeholder comment without actual module documentation or content. Replace the existing comment with a module-level doc comment (starting with `//!`) that clearly explains the purpose and responsibility of the wire module, or alternatively remove the file entirely if it is not yet ready for implementation. A proper doc comment should describe what wire types are and how they function within the sessions crate to reduce confusion for future developers.
🤖 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 `@crates/sessions/src/core/policy.rs`:
- Around line 499-503: The `expand_with` method in `PatchPolicy` creates an
unwanted dependency where the core module depends on a client-layer type
`crate::client::composer::SessionVar`. To decouple these modules, create a new
core-owned type or trait in the core module to represent the resolved variable
contract, update the `expand_with` method signature to accept this new core type
instead of `SessionVar`, and then adapt the client-layer code (in
`crate::client::composer`) to convert its `SessionVar` instances to the new core
type before calling `expand_with`.
---
Nitpick comments:
In `@crates/sessions/src/wire/mod.rs`:
- Around line 1-2: The wire/mod.rs file currently contains only a placeholder
comment without actual module documentation or content. Replace the existing
comment with a module-level doc comment (starting with `//!`) that clearly
explains the purpose and responsibility of the wire module, or alternatively
remove the file entirely if it is not yet ready for implementation. A proper doc
comment should describe what wire types are and how they function within the
sessions crate to reduce confusion for future developers.
🪄 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: a97b36bb-1f4c-42e1-a2fb-2e8e2d39cfc8
📒 Files selected for processing (16)
crates/sessions/src/client/composer.rscrates/sessions/src/client/enumerate.rscrates/sessions/src/client/hooks.rscrates/sessions/src/client/mod.rscrates/sessions/src/core/decision.rscrates/sessions/src/core/expansion.rscrates/sessions/src/core/lifecyclehook.rscrates/sessions/src/core/loadout.rscrates/sessions/src/core/mod.rscrates/sessions/src/core/policy.rscrates/sessions/src/core/primitives.rscrates/sessions/src/core/source.rscrates/sessions/src/lib.rscrates/sessions/src/policy.rscrates/sessions/src/vars.rscrates/sessions/src/wire/mod.rs
💤 Files with no reviewable changes (2)
- crates/sessions/src/policy.rs
- crates/sessions/src/vars.rs
twitchyliquid64
left a comment
There was a problem hiding this comment.
I think this is good to go after a cargo clippy --all-targets --fix --allow-dirty -- -D warnings && cargo fmt
0f6b6da to
b71028a
Compare
This is a refactor to prepare for the client/daemon split in session/loadout logic. There are some other minor changes that were required due to some of the moves, but no functional changes.
Summary by CodeRabbit
New Features
Refactor
Breaking Changes