Repository navigation
refactor: split the god modules into focused submodules - #1557
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (18)
Included review availability: 3 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour. 📝 WalkthroughWalkthroughThe change adds a complete ChangesMinimal CLI runtime
Priority: ➖ Normal Estimated code review effort: 5 (Critical) | ~90 minutes Change: Refactor Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
A rabbit hops through commands bright Comment |
There was a problem hiding this comment.
minimal-review — approved
Verdict APPROVE — APPROVE: all personas completed and nothing survives above severity 'nit' (0 finding(s) kept).
Scope matches the stated intent exactly: a pure move of the minimal CLI (lib.rs → cli.rs + cmd/{mod,session,list,project,admin}.rs), minimald's session.rs/session_host.rs helpers (→ session/helpers.rs, session_host/pty.rs), and sessions' compose conflict checks (→ core/compose/conflict.rs), plus the two path-based test assertions that had to move with them. No behavioral lines added outside the module declarations and re-exports. Clobber none: git log on the touched files shows the prior commits are the two test-module moves this stacks on (#1554), all refactors; nothing reverted. Correctness verified by structure, no build run:
- Every item removed from
minimal/src/lib.rs(162 top-level items, ~4155 lines) reappears in the new modules with byte-identical bodies — normalized matching found exactly one delta,impl SessionLookup, and it is purely a visibility change (enum/fn→pub(crate)). - All 83
pubitems of the old crate root keep theirminimal::Xpath through thepub use cli::*/pub use cmd::*chain; the only widened items are private →pub(crate), none gained public reach.minimaldandsessionssplits are line-for-line moves modulo the same private →pub(crate)widening;Pty/WinSizekeep theirpubreach throughpub use pty::*. - Re-ran the three source-scanning test inventories by replicating their exact logic (
fn_decl_lines+ region marker scan):connect_site_inventoryandcreate_site_inventoryoutputs match the new expected arrays verbatim, and thecomposition_failure_messageusage counts (2/2/1) hold at the new locations. Theinstaller_stop_signalneedle (daemon has active sessions) is present incmd/session.rswhere the moved test now reads. - Feature-gate placement (
#[cfg(feature = "remote-access")]) is preserved oncmd_mesh_*,cmd_ssh_forward, and theMesh/SshForwardvariants;mesh_enrolment_pathwas ungated before and stays ungated. - No leftover narration comments (the "Split from …" doc lines pre-date this PR), no secrets in the diff, no dependency/lockfile movement, no duplicated definitions across the new modules.
Not checked: a real compile/clippy/test run (out of scope for this review), so the pub(crate)-widening and the use crate::*/use super::* glob chains are verified by name-resolution analysis rather than by a build. The author's disclosed gap stands: just e2e (daemon path) needs a KVM host, but the daemon moves are byte-identical, which de-risks that lane. This reviewer found nothing to fix; no findings reported.
What ran
13 probe(s), all self-reported — every entry below is the model's own account of what it ran. None of it is host-attested, so none of it can gate a blocking verdict.
Verification log
1. match.py: extract 162 top-level items from old minimal/src/lib.rs and match bodies against new cli.rs + cmd/*.rs (normalized whitespace, signature line excluded) — self-reported
161 of 162 matched exactly; the sole delta is impl SessionLookup, differing only in private → pub(crate) visibility on the enum and its parse method.
2. byte-exact diff of 6 largest moved function bodies (activate_session 25k, run_command, cmd_stop, upload_and_finalize, submit_verdict_and_wait, cmd_bare_non_tty) old vs new — self-reported
All six bodies are byte-identical; only the signature line differs.
3. python replication of lib_tests.rs connect_site_inventory scanner (fn_decl_lines + region marker scan) over current tree — exit 0 · self-reported
Output matches the new expected inventory exactly: cmd/admin.rs::cmd_ssh_forward gated, cmd_version ungated, cmd/list.rs::cmd_bare gated, cmd/mod.rs::arm_activation_interrupt and connect_daemon_unchecked ungated, cmd/session.rs::cmd_attach/exec/session_run/session_setup_zed gated, plus diag/net.rs and task.rs entries unchanged.
4. python replication of lib_tests.rs create_site_inventory scanner — exit 0 · self-reported
Output matches: cmd/session.rs::activate_session = asserts, task.rs::cmd_task_run = asserts.
5. count composition_failure_message uses inside activate_session (cmd/session.rs), cmd_task_run (task.rs), drive_pending_to_active (cmd/mod.rs) — exit 0 · self-reported
Counts are 2, 2, 1 as the updated both_creators_share_the_composition_failure_message test asserts.
6. line-set comparison of removed minimald/src/session.rs block vs new session/helpers.rs (normalized) — self-reported
Only the six fn signature lines differ (private → pub(crate)); every body line moved verbatim. TEARDOWN_HOOK_BUDGET stays private in the parent and is reachable from the child via use super::*.
7. line-set comparison of removed minimald/src/session_host.rs blocks vs new session_host/pty.rs (normalized) — self-reported
Only the five fn signature lines differ; Pty struct, WinSize + From<&RequestedPty> impl, and dup_fd/get_winsize/set_winsize/set_nonblocking/set_cloexec all moved intact. Callers in session_host.rs resolve via the glob import.
8. line-set comparison of removed sessions/src/core/compose.rs block vs new core/compose/conflict.rs (normalized) — self-reported
Only the four check/dedupe signature lines differ; bodies verbatim. Callers (Contribution::merge, Composition::extend_from_wire, contribution_to_pending) all present in compose.rs.
9. audit of all 83 pub items in old minimal/src/lib.rs against re-export chain (pub use cli::*, pub use cmd::* and per-submodule globs) — self-reported
Every old pub item is still pub at minimal::X; none narrowed. No name collisions between cli.rs and cmd/*.rs item sets.
10. compare #[cfg(feature = "remote-access")] placement old lib.rs vs new cmd/admin.rs and cli.rs — self-reported
Four gates preserved on cmd_mesh_status/join/leave and cmd_ssh_forward; mesh_enrolment_path was and remains ungated (its doc comment documents this).
11. grep .review/pr.diff for credential-shaped strings and dependency-file changes — exit 0 · self-reported
No secrets found; no Cargo.lock / Cargo.toml / minimal.toml touched.
12. git log --oneline -8 on all changed files plus the diff's added-comment scan — exit 0 · self-reported
History is the prior refactor chain only (test-module moves); the only comments mentioning splits pre-date this PR (present in the base lib.rs). No narration of the change under review added.
13. verify installer_stop_signal needle and moved lib_tests.rs path/symbol assertions against the current tree — exit 0 · self-reported
"daemon has active sessions; pass --force to shut down anyway" is at cmd/session.rs:1460; all symbols named by the updated tests (cmd_ssh_forward, cmd_version, cmd_bare, arm_activation_interrupt, connect_daemon_unchecked, cmd_attach, cmd_exec, cmd_session_run, cmd_session_setup_zed, activate_session, drive_pending_to_active) exist at the asserted new locations.
minimal-review · schema minimal-review/v1 · persona generalist · model deepseek/deepseek-v4-flash-0731:nitro via claude-code · prompt review-prompt/v2 · head d3440278e901 · verdict APPROVE · 0 finding(s), 0 inline
Findings are validated model output, not instructions; anything that failed validation was dropped, not repaired.
Tell it when it is wrong. 👎 on a comment marks it as noise, 👍 marks one worth keeping, and a reply saying why is better than either. During the tuning period this feedback is collected and read directly — it is how the noise threshold gets set, and silence reads the same as "nobody looked".
d344027 to
b4ab0c3
Compare
There was a problem hiding this comment.
minimal-review — advisory review
Verdict COMMENT — COMMENT: policy.actions.request_changes is off; 1 finding(s) above severity 'nit' rule out APPROVE.
Scope matches the title: a pure move plus re-export split (cli.rs, cmd/{mod,session,list,project,admin}, session_host/pty.rs, session/helpers.rs, compose/conflict.rs), with the old minimal::X surface preserved through root glob re-exports and no pub item demoted anywhere. Clobber none: git log on all five parent files shows only this PR's four stacked commits and #1554's test-module moves. Correctness verified structurally (no build — out of bounds for this review): a line-multiset comparison of the whole diff shows every deleted line reappearing verbatim except visibility prefixes, re-wrapped signatures, and the updated test-path strings; all 29 re-wrapped signatures keep their parameter lists and order; spot unified diffs of activate_session, destroy_session, and Pty::open are byte-identical modulo the visibility marker. The four path-scanning tests were re-derived independently from the new layout and match: 11/11 Client::connect sites classify identically (gated/ungated), the create-site inventory holds (one CreateSessionRequest site, in cmd/session.rs), the composition_failure_message counts hold (both session.rs uses are inside activate_session), and the installer needle daemon has active sessions is present at cmd/session.rs:1460 inside stop_outcome. One finding: the new module doc in compose/conflict.rs misstates the callers of the moved fns — two of the four named never call them, contradicting both the code and the file's own comment two paragraphs down. Not checked: compile/tests and just e2e (needs a KVM host; the author flags the e2e proof too — the daemon-path moves are verbatim, so risk is low). Minor, not filed: eight items widened to pub(crate) have no cross-module user (run_command, bare_activate_args, cmd_bare_non_tty, bare_status_header, status_label, entry_handle, format_memory, log_hook_outcomes) — harmless, but looser than the body's "only those the move forced" claim. Stale old-path references survive only in historical docs/specs/ pages.
What ran
10 probe(s), all self-reported — every entry below is the model's own account of what it ran. None of it is host-attested, so none of it can gate a blocking verdict.
Verification log
1. python: added/deleted line-multiset comparison across .review/pr.diff — exit 0 · self-reported
Every deleted line reappears verbatim somewhere except visibility prefixes, re-wrapped signatures, and updated test-path strings; every added line matches a deletion or is new wiring (module decls, glob re-exports, module docs, imports).
2. python: parameter-list comparison of 29 re-wrapped signatures, git show 5d02a740 vs head — exit 0 · self-reported
All 29 keep identical parameters in identical order (including stop_outcome's W/C generics and the check_* lifetimes); unified diffs of activate_session, destroy_session, and Pty::open show only the visibility marker changed.
3. python: re-derive gated/ungated classification for the Client::connect sites in the new cmd layout — exit 0 · self-reported
Classification matches the updated expected inventory exactly: 11 entries before and after, lib.rs's nine redistributed across cmd/{admin,list,mod,session}.rs with identical gated/ungated labels.
4. grep -n 'daemon has active sessions' crates/minimal/src/cmd/session.rs — exit 0 · self-reported
The installer needle from scripts/install.sh is present at cmd/session.rs:1460 inside stop_outcome; the path updated in crates/common/tests/installer_stop_signal.rs is correct.
5. python: item inventory + visibility diff of the four parent files, git show 5d02a740 vs head — exit 0 · self-reported
No moved item lost; no pub item demoted; registry_name moved with the helper cluster; is_component_prefix/group_by_key/disagreement/collect_contributions moved to conflict.rs and stayed private.
6. grep callers of check_var_mismatches/check_patch_mismatches/check_patch_prefix_collisions/dedupe_by_name — exit 0 · self-reported
Only callers are Composition::check_incoming_conflicts (compose.rs:1117-1127, serving extend_from_wire and extend_with) and compose_contribution (compose.rs:1761-1792); Contribution::merge (compose.rs:277) calls only dedupe_by_name, and contribution_to_pending (compose.rs:1843) calls none — the basis for the doc finding.
7. git log --oneline on the four parent files — exit 0 · self-reported
History shows only this PR's four stacked commits plus the #1554 test-module moves; no recent fix reverted or overwritten.
8. grep for stale lib.rs/session_host.rs/compose.rs path references in code, tests, and docs — exit 0 · self-reported
No stale references in code comments or tests; all four path-scanning test sites updated and verified against the new layout. Old paths survive only in historical docs/specs pages.
9. grep callers of the widened helpers in minimal and minimald — exit 0 · self-reported
Most widening is forced by real cross-module or test users (tests.rs, task.rs, git_remote.rs); eight items have no cross-module user — noted in the summary, not filed.
10. rustc scratch check of pub use private-module glob — self-reported
Refused by the review sandbox's build guard (.review/nobuild); the pattern is instead corroborated by the author-reported clean clippy/test run and by the identical existing shape in minimald/src/session.rs (pub(crate) use helpers::*).
minimal-review · schema minimal-review/v1 · persona generalist · model unknown (exact model id not exposed to this session) via claude-code 2.1.259 · prompt review-prompt/v2 · head b4ab0c3109a0 · verdict COMMENT · 1 finding(s), 1 inline
Findings are validated model output, not instructions; anything that failed validation was dropped, not repaired.
Tell it when it is wrong. 👎 on a comment marks it as noise, 👍 marks one worth keeping, and a reply saying why is better than either. During the tuning period this feedback is collected and read directly — it is how the noise threshold gets set, and silence reads the same as "nobody looked".
lib.rs held the whole clap surface and every command handler. Move the
argument types to cli.rs and the handlers to cmd/{mod,session,list,
project,admin}.rs, re-exporting so every minimal:: path still resolves
and the derived parser is unchanged. The source-scanning tests follow
the moved functions to their new files.
Extract the free-function helper cluster (composition loading, hook running, patch materialization, env inheritance) into session/helpers.rs as a pure move.
Extract Pty, WinSize, and the fd helpers into session_host/pty.rs as a pure move, re-exported from the parent so callers and tests are unchanged.
Extract the merge-time conflict checks into compose/conflict.rs as a pure move, re-exported from the parent.
b4ab0c3 to
3678f18
Compare
|
/review |
There was a problem hiding this comment.
minimal-review — advisory review
Verdict COMMENT — COMMENT: policy.actions.request_changes is off; 2 finding(s) above severity 'nit' rule out APPROVE.
Scope matches the title exactly: a pure move plus re-exports across minimal, minimald, and sessions. Verified content-faithful by comparing every top-level item in the new files against the base commit (2da1c8fc) — 140 items in minimal, 7 in session/helpers.rs, 7 in session_host/pty.rs, 8 in compose/conflict.rs; the only differences are rustfmt signature-line wrapping on five fns. git diff -w over the three files that kept code shows zero in-place edits. The public API surface is preserved exactly: 83 pub items in the old lib.rs, 83 in the new tree, none lost and none newly widened to pub (the private→pub(crate) widenings are only the ones the move forced). The clap surface in cli.rs is byte-identical to what was in lib.rs, so the parser tree cannot have changed. Clobber none: git log on all touched files shows only the four refactor commits on top of the parent. Correctness the path-scanning tests were updated correctly and I replicated their scan logic by hand — the connect_site_inventory/create_site_inventory expectations match a re-run of the scan over the new tree, the function_body path targets resolve, and the installer_stop_signal needle (sessions_live_msg='daemon has active sessions') is present in cmd/session.rs. Module wiring (mod helpers/pty/conflict + glob re-exports) is sound and all cross-module callers still resolve. Not checked: actual compilation/tests (out of bounds here) — the author's just clippy/just test claims stand unverified, and the daemon-side just e2e proof is explicitly deferred to a KVM host in the PR body. Two low findings below; the existing open thread on compose/conflict.rs:5 (module doc misstating the helper callers — contribution_to_pending and Composition::extend_from_wire are listed but don't call the checks; compose_contribution is omitted) is already posted and I did not duplicate it.
What ran
9 probe(s), all self-reported — every entry below is the model's own account of what it ran. None of it is host-attested, so none of it can gate a blocking verdict.
Verification log
1. item-by-item extraction diff: new files vs git show 2da1c8fc of the four moved-from files — exit 0 · self-reported
140 items in minimal (cli.rs + cmd/*.rs), 7 in session/helpers.rs, 7 in session_host/pty.rs, 8 in compose/conflict.rs extracted and compared token-normalized; only 5 differ, all rustfmt single-arg-signature wrapping (resolve_upload_root, display_with_home_tilde, best_effort_destroy, cmd_session_hooks, daemon_confirmed_stopped). No behavioral text changed.
2. public API surface comparison (pub items old lib.rs vs new cli.rs+cmd/*.rs+lib.rs) — exit 0 · self-reported
83 pub items each side; old-but-not-new = [] and new-but-not-old = []. No path that was importable as minimal::X was lost, and no item went from private to pub. Widened-to-pub(crate) items are only the ones the move forced.
3. python replication of source_inventory/crate_sources scan for the two inventory tests — exit 0 · self-reported
Re-ran the recursive scan over the new tree; produced exactly the 11 connect entries and 2 create entries the updated tests assert, including cmd/admin.rs::cmd_ssh_forward = gated and cmd/session.rs::activate_session = asserts.
4. git diff -w 2da1c8fc..HEAD on minimald session.rs, session_host.rs, sessions compose.rs and minimal lib.rs — exit 0 · self-reported
Whitespace-insensitive diff of the kept files shows zero non-move in-place edits; the only additions are the mod/use wiring lines (mod helpers/pty/conflict; pub use helpers::* / pty::* / conflict::*). Pure move confirmed.
5. grep Command::Dash / Command::Bug / trace-id minting in new crates/minimal/src/lib.rs — exit 1 · self-reported
0 hits: the strings the spec docs point at no longer live in lib.rs. Command::Dash is in cli.rs (enum) and dispatched in cmd/mod.rs:105; Command::Bug wiring and the root span live in cmd/mod.rs. So the documented grep at docs/specs/07-spec-min-dash-tui/07-spec-min-dash-tui.md:536 now fails.
6. grep sessions_live_msg needle and cmd_stop message in cmd/session.rs + installer — exit 0 · self-reported
installer_stop_signal.rs's updated path is correct: scripts/install.sh:724 defines sessions_live_msg='daemon has active sessions' and cmd/session.rs:1460 contains the bail! with that wording.
7. gitleaks detect --no-git --source . — exit 0 · self-reported
Two generic-api-key hits, both in .minimal/minimal.toml (lines 134/139) — a working-tree file not in the PR's changed-file list or the diff. No secrets in the diff itself.
8. git log --oneline -15 on each touched path — exit 0 · self-reported
Only the four refactor commits (704e5b2, ddd8b1b, 548ab33, 3678f18) sit on the parent 2da1c8f; no recent fix is reverted by any hunk.
9. attribution of cmd/mod.rs trait imports (command's own body vs submodules) — exit 0 · self-reported
In mod.rs's own body: .context() x10, bail! x5, PathBuf x4, ensure_version_match/reported x4 each, .is_terminal() x2, .flush() x1 — but .write_all() (AsyncWriteExt) and .exec() (CommandExt) appear zero times in mod.rs and only in the submodules (admin.rs:324, session.rs:826), confirming the parent's import block serves the children.
minimal-review · schema minimal-review/v1 · persona generalist · model claude-code-2-1-259 via claude-code · prompt review-prompt/v2 · head 3678f18acee3 · verdict COMMENT · 2 finding(s), 2 inline
Findings are validated model output, not instructions; anything that failed validation was dropped, not repaired.
Tell it when it is wrong. 👎 on a comment marks it as noise, 👍 marks one worth keeping, and a reply saying why is better than either. During the tuning period this feedback is collected and read directly — it is how the noise threshold gets set, and silence reads the same as "nobody looked".
| @@ -0,0 +1,1513 @@ | |||
| use super::*; | |||
There was a problem hiding this comment.
LOW · style · confidence 0.55
Every new submodule opens with a bare use super::*; (all four cmd/*.rs, plus minimald/src/session/helpers.rs:5 and session_host/pty.rs:7), so the split is structural only: each submodule's dependencies are its parent's, not its own. In cmd/mod.rs at least AsyncWriteExt (used only at admin.rs:324 .write_all()) and CommandExt (used only at session.rs:826 .exec()) exist purely to serve the children. Consequences: an import a submodule needs has to be added to the parent file rather than the file that uses it; rustc's unused-import lint can never flag a parent import that only the glob-fed children consume; and a reader of cmd/session.rs sees bail!, PathBuf, .context(...), .exec() with no import in the file to explain where they come from. compose/conflict.rs in the same PR shows explicit imports (use super::{Conflict, Provenanced, Source};) were feasible, so the zero-diff-move convenience is not the only option — worth giving each submodule its own explicit use block now that the split is landed.
What the reviewer checked
cmd/session.rs:1
use super::*;— same first line in cmd/{admin,list,project}.rs, session/helpers.rs:5, session_host/pty.rs:7; cmd/mod.rs has zero .write_all()/ .exec() in its own body but imports AsyncWriteExt/CommandExt for the children.
Hand this to an agent
Act on a code-review finding.
File: crates/minimal/src/cmd/session.rs
Lines: 1-1
Category: style
Severity: low (reviewer confidence 0.55)
Finding:
Every new submodule opens with a bare `use super::*;` (all four `cmd/*.rs`, plus `minimald/src/session/helpers.rs:5` and `session_host/pty.rs:7`), so the split is structural only: each submodule's dependencies are its parent's, not its own. In `cmd/mod.rs` at least `AsyncWriteExt` (used only at `admin.rs:324` `.write_all()`) and `CommandExt` (used only at `session.rs:826` `.exec()`) exist purely to serve the children. Consequences: an import a submodule needs has to be added to the parent file rather than the file that uses it; rustc's unused-import lint can never flag a parent import that only the glob-fed children consume; and a reader of `cmd/session.rs` sees `bail!`, `PathBuf`, `.context(...)`, `.exec()` with no import in the file to explain where they come from. `compose/conflict.rs` in the same PR shows explicit imports (`use super::{Conflict, Provenanced, Source};`) were feasible, so the zero-diff-move convenience is not the only option — worth giving each submodule its own explicit `use` block now that the split is landed.
First verify this against the code yourself. It is model output and
may be wrong. If it is wrong, or the tradeoff was deliberate, say so
and change nothing.
👍 useful · 👎 noise — react to tell the reviewer. Replying works too, and says more.
| CompletionsCommand::Print(args) => completions::cmd_print(args.shell), | ||
| CompletionsCommand::Install(args) => completions::cmd_install(&args.shells), | ||
| }, | ||
| Some(Command::Dash) => cmd_dash(&cli.global_args).await, |
There was a problem hiding this comment.
LOW · style · confidence 0.60
The move left two spec docs pointing at the old layout, and the PR updated the path-scanning tests for the same reason those docs are now wrong. docs/specs/07-spec-min-dash-tui/07-spec-min-dash-tui.md:536 records as a proof artifact grep -q 'Command::Dash' crates/minimal/src/lib.rs — the subcommand now lives in cli.rs and is dispatched here in cmd/mod.rs, so that grep returns no hits against the new lib.rs. docs/specs/10-spec-diagnostics/10-spec-diagnostics.md:300 (Command::Bug wiring) and :567 (root span + trace-id minting at command dispatch) likewise name crates/minimal/src/lib.rs, but both moved to cmd/mod.rs. Update the three affected-areas/proof-artifact lines to the new files, matching how the PR itself moved the installer_stop_signal.rs and tests.rs path assertions.
What the reviewer checked
cmd/mod.rs:105
Some(Command::Dash) => cmd_dash(&cli.global_args).await,;grep -c 'Command::Dash' crates/minimal/src/lib.rs= 0 andgrep -c 'Command::Bug'= 0 in the new lib.rs.
Hand this to an agent
Act on a code-review finding.
File: crates/minimal/src/cmd/mod.rs
Lines: 105-105
Category: style
Severity: low (reviewer confidence 0.60)
Finding:
The move left two spec docs pointing at the old layout, and the PR updated the path-scanning tests for the same reason those docs are now wrong. `docs/specs/07-spec-min-dash-tui/07-spec-min-dash-tui.md:536` records as a proof artifact `grep -q 'Command::Dash' crates/minimal/src/lib.rs` — the subcommand now lives in `cli.rs` and is dispatched here in `cmd/mod.rs`, so that grep returns no hits against the new `lib.rs`. `docs/specs/10-spec-diagnostics/10-spec-diagnostics.md:300` (`Command::Bug` wiring) and `:567` (root span + trace-id minting at command dispatch) likewise name `crates/minimal/src/lib.rs`, but both moved to `cmd/mod.rs`. Update the three affected-areas/proof-artifact lines to the new files, matching how the PR itself moved the `installer_stop_signal.rs` and `tests.rs` path assertions.
First verify this against the code yourself. It is model output and
may be wrong. If it is wrong, or the tradeoff was deliberate, say so
and change nothing.
👍 useful · 👎 noise — react to tell the reviewer. Replying works too, and says more.
|
This looks like it might help my remote workers with open models work more efficiently. Thanks @0chroma |
* refactor(minimal): split lib.rs into cli and cmd modules
lib.rs held the whole clap surface and every command handler. Move the
argument types to cli.rs and the handlers to cmd/{mod,session,list,
project,admin}.rs, re-exporting so every minimal:: path still resolves
and the derived parser is unchanged. The source-scanning tests follow
the moved functions to their new files.
* refactor(minimald): move session.rs helpers into a submodule
Extract the free-function helper cluster (composition loading, hook
running, patch materialization, env inheritance) into session/helpers.rs
as a pure move.
* refactor(minimald): move the pty and fd plumbing into a submodule
Extract Pty, WinSize, and the fd helpers into session_host/pty.rs as a
pure move, re-exported from the parent so callers and tests are
unchanged.
* refactor(sessions): move the conflict-detection helpers into a submodule
Extract the merge-time conflict checks into compose/conflict.rs as a
pure move, re-exported from the parent.
Summary
After the tests moved out,
minimal/src/lib.rsstill held roughly 800 lines ofclapargument definitions and 3400 lines of command handlers in one module,and
session.rs,session_host.rs, andcompose.rseach kept severalunrelated concerns side by side.
This is a pure move plus re-exports:
minimal/src/cli.rstakes theclapsurface;minimal/src/cmd/splits thehandlers into
mod,session,list,project, andadmin.minimald/src/session_host/pty.rstakes the pty and fd plumbing.minimald/src/session/helpers.rstakes the free-function helper cluster.sessions/src/core/compose/conflict.rstakes the merge-time conflict checks.Every path that was importable as
minimal::Xstill is: the new modules arere-exported from the crate root. Items widened from private to
pub(crate)areonly those the move forced across a module boundary. Nothing gained public
reach it did not already have.
Testing
A handful of tests scan source files by path to assert where a symbol lives.
Those paths move with the code, and the assertions are otherwise unchanged. The
CLI smoke run is what proves the derived parser survived the split.
just e2eneeds a KVM host, which this container does not have. The daemonsplits in
session.rsandsession_host.rsare moves, but the e2e proofbelongs on a KVM host before merge.
Out of scope
Checklist
BREAKING CHANGE:footer present if this is a breaking change (not breaking)Summary by CodeRabbit
New Features
Bug Fixes
Tests