Skip to content

refactor: split the god modules into focused submodules - #1557

Merged
norrietaylor merged 4 commits into
mainfrom
refactor/split-god-modules
Sep 19, 2026
Merged

norrietaylor merged 4 commits into
mainfrom
refactor/split-god-modules

Conversation

@0chroma

@0chroma 0chroma commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

After the tests moved out, minimal/src/lib.rs still held roughly 800 lines of
clap argument definitions and 3400 lines of command handlers in one module,
and session.rs, session_host.rs, and compose.rs each kept several
unrelated concerns side by side.

This is a pure move plus re-exports:

  • minimal/src/cli.rs takes the clap surface; minimal/src/cmd/ splits the
    handlers into mod, session, list, project, and admin.
  • minimald/src/session_host/pty.rs takes the pty and fd plumbing.
  • minimald/src/session/helpers.rs takes the free-function helper cluster.
  • sessions/src/core/compose/conflict.rs takes the merge-time conflict checks.

Every path that was importable as minimal::X still is: the new modules are
re-exported from the crate root. Items widened from private to pub(crate) are
only those the move forced across a module boundary. Nothing gained public
reach it did not already have.

Testing

just fmt-check   # pass
just clippy      # pass, no warnings
just test        # pass, 2103 tests run: 2103 passed, 13 skipped
target/debug/min --help
target/debug/min session --help   # both exit 0 with the parser tree intact

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 e2e needs a KVM host, which this container does not have. The daemon
splits in session.rs and session_host.rs are moves, but the e2e proof
belongs on a KVM host before merge.

Out of scope

Checklist

  • Docs updated if behavior changed (none: pure code move)
  • BREAKING CHANGE: footer present if this is a breaking change (not breaking)

Summary by CodeRabbit

  • New Features

    • Added a comprehensive command-line interface for managing sessions, tasks, projects, loadouts, diagnostics, completions, providers, and remote access.
    • Added session activation, attachment, execution, renaming, stopping, destruction, policy inspection, and editor integration.
    • Added project initialization, package add/update workflows, and automatic project configuration discovery.
    • Added daemon proxying, mesh management, SSH forwarding, login certificates, and version reporting.
    • Improved session listings with JSON, raw ID, status, resource, and lifecycle details.
  • Bug Fixes

    • Improved safety checks, shutdown handling, terminal behavior, conflict detection, hook execution, and environment filtering.
  • Tests

    • Added broad regression and integration coverage across CLI, sessions, projects, networking, and terminal workflows.

@0chroma
0chroma requested a review from a team as a code owner September 18, 2026 21:11
@coderabbitai

coderabbitai Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Essentials

Run ID: c076fe54-bb48-4c1d-9a5a-7556b58f840a

📥 Commits

Reviewing files that changed from the base of the PR and between 2da1c8f and b4ab0c3.

📒 Files selected for processing (18)
  • crates/common/tests/installer_stop_signal.rs
  • crates/minimal/src/cli.rs
  • crates/minimal/src/cmd/admin.rs
  • crates/minimal/src/cmd/list.rs
  • crates/minimal/src/cmd/mod.rs
  • crates/minimal/src/cmd/project.rs
  • crates/minimal/src/cmd/session.rs
  • crates/minimal/src/lib.rs
  • crates/minimal/src/tests.rs
  • crates/minimald/src/session.rs
  • crates/minimald/src/session/helpers.rs
  • crates/minimald/src/session/tests.rs
  • crates/minimald/src/session_host.rs
  • crates/minimald/src/session_host/pty.rs
  • crates/minimald/src/session_host/tests.rs
  • crates/sessions/src/core/compose.rs
  • crates/sessions/src/core/compose/conflict.rs
  • crates/sessions/src/core/compose/tests.rs

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.


📝 Walkthrough

Walkthrough

The change adds a complete min CLI, session and project commands, daemon administration, PTY support, composition conflict validation, and broad regression coverage across client and daemon behavior.

Changes

Minimal CLI runtime

Layer / File(s) Summary
CLI contracts and parsing
crates/minimal/src/cli.rs, crates/common/tests/installer_stop_signal.rs, crates/minimal/src/tests.rs
Adds the clap command model, global options, session and task commands, ingress parsing, provider and network modes, compatibility commands, completions, and parser tests.
Command entrypoints and administration
crates/minimal/src/cmd/mod.rs, crates/minimal/src/cmd/admin.rs, crates/minimal/src/cmd/list.rs, crates/minimal/src/cmd/project.rs, crates/minimal/src/tests.rs
Adds command dispatch, proxying, mesh and SSH operations, login, diagnostics, bare invocation, session listing, project initialization, dependency updates, and related tests.
Session lifecycle workflows
crates/minimal/src/cmd/session.rs, crates/minimal/src/cmd/mod.rs, crates/minimal/src/tests.rs
Adds activation, attachment, execution, policy, hooks, destruction, shutdown, renaming, upload, interrupt cleanup, and lifecycle regression tests.
Daemon session behavior
crates/minimald/src/session/helpers.rs, crates/minimald/src/session/tests.rs
Adds patch materialization, hook execution, environment filtering, composition persistence, session deltas, attach and detach behavior, and destruction-path tests.
PTY extraction and host tests
crates/minimald/src/session_host.rs, crates/minimald/src/session_host/pty.rs, crates/minimald/src/session_host/tests.rs
Moves PTY and descriptor helpers into a dedicated module and adds tests for terminal sizing, binding delivery, teardown, environment handling, network cleanup, and stale input.
Composition conflict validation
crates/sessions/src/core/compose/conflict.rs, crates/sessions/src/core/compose/tests.rs
Adds variable and patch conflict checks, destination-prefix collision detection, stable package deduplication, and composition merge, gating, wire, and error-format tests.

Priority: ➖ Normal

Estimated code review effort: 5 (Critical) | ~90 minutes

Change: Refactor

Suggested reviewers: norrietaylor

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 87.26% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 416 functions across 15 files.
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.
Title check ✅ Passed The title clearly and concisely describes the main change: splitting large modules into focused submodules. It follows the repository's Conventional Commit format.
Description check ✅ Passed The description includes the required Summary, Testing, and Checklist sections. It explains the scope, documents successful checks and skipped end-to-end tests, and records the non-breaking status.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

A rabbit hops through commands bright
Sessions wake and shells take flight
PTYs size the moonlit room
Conflicts learn where paths may bloom
Tests guard each trail and turn
Clean new workflows softly burn

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

@minimal-foundry minimal-foundry Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 pub items of the old crate root keep their minimal::X path through the pub use cli::* / pub use cmd::* chain; the only widened items are private → pub(crate), none gained public reach. minimald and sessions splits are line-for-line moves modulo the same private → pub(crate) widening; Pty/WinSize keep their pub reach through pub use pty::*.
  • Re-ran the three source-scanning test inventories by replicating their exact logic (fn_decl_lines + region marker scan): connect_site_inventory and create_site_inventory outputs match the new expected arrays verbatim, and the composition_failure_message usage counts (2/2/1) hold at the new locations. The installer_stop_signal needle (daemon has active sessions) is present in cmd/session.rs where the moved test now reads.
  • Feature-gate placement (#[cfg(feature = "remote-access")]) is preserved on cmd_mesh_*, cmd_ssh_forward, and the Mesh/SshForward variants; mesh_enrolment_path was 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".

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Sep 18, 2026
@0chroma
0chroma force-pushed the refactor/split-god-modules branch from d344027 to b4ab0c3 Compare September 19, 2026 01:35
Base automatically changed from refactor/split-test-modules to main September 19, 2026 01:54

@minimal-foundry minimal-foundry Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@minimal-foundry minimal-foundry Bot removed the review:approved minimal-review approved the current head label Sep 19, 2026
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.
@0chroma
0chroma force-pushed the refactor/split-god-modules branch from b4ab0c3 to 3678f18 Compare September 19, 2026 02:27
@norrietaylor

Copy link
Copy Markdown
Member

/review

@minimal-foundry minimal-foundry Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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::*;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 and grep -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.

@norrietaylor
norrietaylor enabled auto-merge (squash) September 19, 2026 07:31
@norrietaylor
norrietaylor merged commit 6b425f6 into main Sep 19, 2026
33 checks passed
@norrietaylor
norrietaylor deleted the refactor/split-god-modules branch September 19, 2026 07:32
@norrietaylor

Copy link
Copy Markdown
Member

This looks like it might help my remote workers with open models work more efficiently.

Thanks @0chroma

gominimal-aw-bot Bot added a commit that referenced this pull request Sep 19, 2026
* 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.
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