Skip to content

T34 — Move the session commands into one file per verb - #2452

Merged
mitodrummer merged 3 commits into
mainfrom
agent/2375-move-the-session-commands-into-one-file-per-verb
Oct 20, 2026
Merged

mitodrummer merged 3 commits into
mainfrom
agent/2375-move-the-session-commands-into-one-file-per-verb

Conversation

@minimal-foundry

@minimal-foundry minimal-foundry Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

T34 — Move the session commands into one file per verb

slice: S0
kind: enablement
covers: none
size: M
est: 240 code, 60 tests
executor: agent
difficulty: routine
model: standard
diagnostics: none: a pure move, no behaviour
observability: none: a pure move, no signal
layers:
- cli:
- crates/minimal/src/cmd/session.rs: clap handlers only
- crates/minimal/src/cmd/mod.rs: mod line
- crates/minimal/src/cmd/boxes.rs (new): one module per verb
- crates/minimal/src/cmd/boxes/create.rs (new): moved
- crates/minimal/src/cmd/boxes/vm_host.rs (new): moved
- crates/minimal/src/cmd/boxes/attach.rs (new): moved
- crates/minimal/src/cmd/boxes/exec.rs (new): moved
- crates/minimal/src/cmd/boxes/policy.rs (new): moved
- crates/minimal/src/cmd/boxes/lifecycle.rs (new): moved
- crates/minimal/src/cmd/boxes/hooks.rs (new): moved
test: cargo nextest run -p minimal host_asks_target_is_none_for_a_box_with_no_address_pair
produces:
- crates/minimal/src/cmd/boxes.rs
- crates/minimal/src/cmd/boxes/create.rs
consumes: none
proof: min session behaves as before, one file per verb.

Proof

min session behaves as before. session.rs now holds only the clap handlers (cmd_activate, cmd_attach, cmd_exec, cmd_session_run, cmd_session_policy, cmd_session_setup_zed, cmd_session_hooks, cmd_destroy, cmd_stop, cmd_rename). Their helpers and tests are in one file per verb under crates/minimal/src/cmd/boxes/. All 55 moved tests pass, and the minimal crate builds with no new clippy warnings.

Notes from the agent: The module is mounted as box_verbs (#[path = "boxes.rs"] mod box_verbs; in cmd/mod.rs), and each child uses #[path = "boxes/<verb>.rs"]. A module named boxes in cmd makes boxes::... ambiguous with the boxes crate (E0659) in admin.rs, list.rs and the other siblings that use use super::*. Those files are outside the layers. The file paths match the task. In the moved attach code, attach:: became crate::attach::, because the new attach module shadows the crate's attach module. session.rs keeps a pub(crate) use super::box_verbs::{...} re-export, because list.rs and finalize_install.rs call these helpers as session::advisory_host_reads and similar paths. The re-export means those files did not need a change. These items became pub(crate) because session.rs calls them: hold_box_name_with_vm_host, stop_wedged_vm_from_host, wedged_vm_unreachable, fetch_live_ingress_degrading and session_policy_as_json. attached_session_record and refuse_dynamic_ingress_off_own_ip became pub(super) for sibling use. cmd_session_setup_zed stays in session.rs because the layers name no setup_zed file. normalize_subnets moved to create.rs, because only activation uses it. should_announce_session and session_announce_label moved to attach.rs. Extra check: all 55 tests under cmd::box_verbs passed (the count before the move was also 55). I did not run just ci or clippy-strict.

Tests

line exit tail
cargo nextest run -p minimal host_asks_target_is_none_for_a_box_with_no_address_pair 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-182f... Compiling args v0.0.1 (/workbench/crates/args) Compiling ot v0.0.1 (/workbench/crates/ot) Compiling paths v0.0.1 (/workbench/crates/paths) Compiling stdlib v0.0.22 (/workbenc

Verify

min task run agent-verify exited 101 under rustc 1.98.1, which the repository does not pin (1.97.0 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.

the sandbox ran rustc (1.98.1), the repository pins 1.97.0 in rust-toolchain.toml; a failure here may be the newer toolchain's, not this change's
Applying loadouts: default
Running task runtime-implement-verify in session task-runtime-implement-verify-f0c3...
    Checking ot v0.0.1 (/workbench/crates/ot)
    Checking args v0.0.1 (/workbench/crates/args)
    Checking paths v0.0.1 (/workbench/crates/paths)
   Compiling stdlib v0.0.22 (/workbench/crates/stdlib)
   Compiling version v0.8.0 (/workbench/crates/version)
    Checking switch v0.0.1 (/workbench/crates/switch)
   Compiling minvmd v0.8.0 (/workbench/crates/minvmd)
    Checking diagnostics v0.0.1 (/workbench/crates/diagnostics)
    Checking bep v0.0.1 (/workbench/crates/bep)
    Checking common v0.0.1 (/workbench/crates/common)
    Checking async-dialog v0.0.1 (/workbench/crates/async-dialog)
    Checking mlog v0.0.1 (/workbench/crates/mlog)
    Checking boxes v0.0.1 (/workbench/crates/boxes)
    Checking sandbox v0.0.1 (/workbench/crates/sandbox)
    Checking mfile v0.0.1 (/workbench/crates/mfile)
    Checking minimald-rpc v0.0.1 (/workbench/crates/minimald-rpc)
    Checking decode v0.0.1 (/workbench/crates/decode)
    Checking checkouts v0.0.1 (/workbench/crates/checkouts)
error: using `chunks_exact` with a constant chunk size
   --> crates/minimald-rpc/src/trace.rs:199:46
    |
199 |     for (byte, pair) in out.iter_mut().zip(s.chunks_exact(2)) {
    |                                              ^^^^^^^^^^^^^^^
    |
help: consider using `as_chunks::<2>()` instead
   --> crates/minimald-rpc/src/trace.rs:199:46
    |
199 |     for (byte, pair) in out.iter_mut().zip(s.chunks_exact(2)) {
    |                                              ^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#chunks_exact_to_as_chunks
    = note: `-D clippy::chunks-exact-to-as-chunks` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::chunks_exact_to_as_chunks)]`

error: could not compile `minimald-rpc` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

Closes #2375


Undrafted 2026-10-20: the edits outside the layers (crates/minimal/src/tests.rs and crates/common/tests/installer_stop_signal.rs) update source-scanning tests that name the moved files by path. The move needs them, and the plan missed them. A maintainer accepted them.

session.rs keeps the clap handlers. The helpers and their tests move
into cmd/boxes/{create,vm_host,attach,exec,policy,hooks,lifecycle}.rs.
There is no change in behaviour.

cmd/mod.rs mounts cmd/boxes.rs as `box_verbs` with #[path]. A `boxes`
module in cmd would shadow the `boxes` crate for the sibling files
that use `use super::*`.
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 76c25b32-5ee8-492f-9915-41e104c7f7d8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@minimal-foundry

minimal-foundry Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor Author

Approved: no findings at ff15aa183102.

Nothing to do.

Clobber: none found.

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

arch-review: PASS · the full ruling

The design of record does not govern how the minimal crate splits its source into files. This change moves the min session helpers and tests into one file per verb and changes no behaviour. I compared the added lines with the removed lines. The only differences are module glue, visibility, crate::attach:: paths and formatting. No condition applies.

Ruled at 15fb90d against gominimal/arch@109541a48c31 by claude-opus-5-5.

@minimal-foundry minimal-foundry Bot left a comment

Copy link
Copy Markdown
Contributor Author

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 — No findings.

Panel: 3 of 3 personas ran (correctness, security, supply-chain).

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Oct 20, 2026
The split of cmd/session.rs moved activate_session, session_record_by,
the destroy-race test and the `min stop` refusal into cmd/boxes/. The
inventory and function-body tests in src/tests.rs, and the installer
stop-signal test in common, read those files by path, so they failed.
They now read the files the code lives in. The inventory keeps its
sorted order.

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

arch-review: PASS · the full ruling

The compare since 15fb90d changes only the paths that the source-scanning tests read. Each moved function exists at its new path. Each gate classification and assertion keeps its value. The design of record does not govern the file layout of the client crate. The earlier PASS by absence stands for this head.

Ruled at 68b10c2 against gominimal/arch@109541a48c31 by claude-opus-5-5.

@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 1 of 10 on a failed check suite, pushed as 68b10c29671f.

line exit tail
cargo nextest run -p minimal host_asks_target_is_none_for_a_box_with_no_address_pair 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-d522... Compiling args v0.0.1 (/workbench/crates/args) Compiling ot v0.0.1 (/workbench/crates/ot) Compiling paths v0.0.1 (/workbench/crates/paths) Compiling stdlib v0.0.22 (/workbenc

Verify min task run agent-verify exited 101 under rustc 1.98.1, which the repository does not pin (1.97.0 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.

the sandbox ran rustc (1.98.1), the repository pins 1.97.0 in rust-toolchain.toml; a failure here may be the newer toolchain's, not this change's
Applying loadouts: default
Running task runtime-implement-verify in session task-runtime-implement-verify-980f...
    Checking ot v0.0.1 (/workbench/crates/ot)
    Checking args v0.0.1 (/workbench/crates/args)
    Checking paths v0.0.1 (/workbench/crates/paths)
   Compiling stdlib v0.0.22 (/workbench/crates/stdlib)
   Compiling version v0.8.0 (/workbench/crates/version)
    Checking switch v0.0.1 (/workbench/crates/switch)
    Checking common v0.0.1 (/workbench/crates/common)
   Compiling minvmd v0.8.0 (/workbench/crates/minvmd)
    Checking diagnostics v0.0.1 (/workbench/crates/diagnostics)
    Checking boxes v0.0.1 (/workbench/crates/boxes)
    Checking sandbox v0.0.1 (/workbench/crates/sandbox)
    Checking bep v0.0.1 (/workbench/crates/bep)
    Checking async-dialog v0.0.1 (/workbench/crates/async-dialog)
    Checking mlog v0.0.1 (/workbench/crates/mlog)
    Checking mfile v0.0.1 (/workbench/crates/mfile)
    Checking minimald-rpc v0.0.1 (/workbench/crates/minimald-rpc)
    Checking checkouts v0.0.1 (/workbench/crates/checkouts)
    Checking decode v0.0.1 (/workbench/crates/decode)
    Checking graph v0.0.1 (/workbench/crates/graph)
    Checking lcache v0.0.1 (/workbench/crates/lcache)
    Checking rcache v0.0.1 (/workbench/crates/rcache)
    Checking op v0.0.1 (/workbench/crates/op)
error: using `chunks_exact` with a constant chunk size
   --> crates/minimald-rpc/src/trace.rs:199:46
    |
199 |     for (byte, pair) in out.iter_mut().zip(s.chunks_exact(2)) {
    |                                              ^^^^^^^^^^^^^^^
    |
help: consider using `as_chunks::<2>()` instead
   --> crates/minimald-rpc/src/trace.rs:199:46
    |
199 |     for (byte, pair) in out.iter_mut().zip(s.chunks_exact(2)) {
    |                                              ^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#chunks_exact_to_as_chunks
    = note: `-D clippy::chunks-exact-to-as-chunks` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::chunks_exact_to_as_chunks)]`

error: could not compile `minimald-rpc` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

Outside the task's layers::

  • crates/common/tests/installer_stop_signal.rs
  • crates/minimal/src/tests.rs

Converted to a draft: something above needs a person before review.

min session behaves as before. Its helpers live one file per verb under crates/minimal/src/cmd/boxes/, and session.rs keeps the clap handlers. The minimal and common test suites pass at this branch head.

Notes from the agent: The directive gave no log for the failed checks: the job logs could not be read. I found the cause locally. Six source-scanning tests read crates/minimal/src/cmd/session.rs by path, and the previous round moved the code they look for into cmd/boxes/. These tests are every_daemon_connection_is_classified, every_create_session_asserts_the_daemon_build, the_activation_path_makes_no_version_round_trip, both_creators_share_the_composition_failure_message and daemon_refusals_print_without_rpc_names in crates/minimal/src/tests.rs, plus installer_matches_the_message_the_cli_actually_prints in crates/common/tests/installer_stop_signal.rs. Both files are outside the task's layers. I changed only the path literals, and I moved two inventory entries to keep the sorted order. A pure move cannot pass CI without these changes, so the plan missed these two files. The installer test now reads cmd/boxes/lifecycle.rs, where the min stop refusal text lives. cargo clippy -p minimal -p common --all-targets -- -D warnings fails on this box in minimald-rpc (chunks_exact_to_as_chunks) and minimald (3 result_unit_err warnings). Those crates are untouched. The cause is the local toolchain (rustc 1.98.1), which is newer than the pinned 1.97.0. minimal and common have no clippy warnings.

@minimal-foundry
minimal-foundry Bot marked this pull request as draft October 20, 2026 14:29
@minimal-foundry minimal-foundry Bot added the needs-human An agent handed off; a human must act, then clear this label. Set by defer and handoffs. label Oct 20, 2026
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

The runtime will not revise this pull request again on its own: the diff is +8133/-8036 (16169 lines), past 3x the plan's estimate of 300 lines (est: 240 code, 60 tests), at round 1 (the last trigger was a failed check suite). A person decides now. Remove needs-human from this pull request to let /revise <note> or the automatic rounds resume, or finish #2375 by hand.

@minimal-foundry minimal-foundry Bot left a comment

Copy link
Copy Markdown
Contributor Author

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 — No findings.

Panel: 3 of 3 personas ran (correctness, security, supply-chain).

@mitodrummer mitodrummer removed the needs-human An agent handed off; a human must act, then clear this label. Set by defer and handoffs. label Oct 20, 2026
@mitodrummer

Copy link
Copy Markdown
Member

/revise

Carry main's full-breadth acknowledgement change to session.rs into
boxes/create.rs, where refuse_unhonourable_grants now lives.
@mitodrummer
mitodrummer marked this pull request as ready for review October 20, 2026 15:47

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

arch-review: PASS · the full ruling

The new head merges main (#2443) into the split. The merge moves the #2443 changes from session.rs to boxes/create.rs without a change to their text. All other merged files are identical to main. The design does not govern the client file layout, so the PASS by absence from the prior heads stands. There are no conditions.

Ruled at ff15aa1 against gominimal/arch@109541a48c31 by claude-opus-5-5.

@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 1 of 10 on a /revise note, pushed as ff15aa183102.

Resolved conflicts in: crates/minimal/src/cmd/mod.rs, crates/minimal/src/cmd/session.rs

line exit tail
cargo nextest run -p minimal host_asks_target_is_none_for_a_box_with_no_address_pair 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-d4be... Compiling ot v0.0.1 (/workbench/crates/ot) Compiling args v0.0.1 (/workbench/crates/args) Compiling paths v0.0.1 (/workbench/crates/paths) Compiling stdlib v0.0.22 (/workbenc

Verify min task run agent-verify exited 101 under rustc 1.98.1, which the repository does not pin (1.97.0 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.

the sandbox ran rustc (1.98.1), the repository pins 1.97.0 in rust-toolchain.toml; a failure here may be the newer toolchain's, not this change's
Applying loadouts: default
Running task runtime-implement-verify in session task-runtime-implement-verify-a4b5...
    Checking args v0.0.1 (/workbench/crates/args)
    Checking ot v0.0.1 (/workbench/crates/ot)
    Checking paths v0.0.1 (/workbench/crates/paths)
   Compiling stdlib v0.0.22 (/workbench/crates/stdlib)
   Compiling version v0.8.0 (/workbench/crates/version)
    Checking common v0.0.1 (/workbench/crates/common)
    Checking switch v0.0.1 (/workbench/crates/switch)
   Compiling minvmd v0.8.0 (/workbench/crates/minvmd)
    Checking diagnostics v0.0.1 (/workbench/crates/diagnostics)
    Checking boxes v0.0.1 (/workbench/crates/boxes)
    Checking sandbox v0.0.1 (/workbench/crates/sandbox)
    Checking bep v0.0.1 (/workbench/crates/bep)
    Checking async-dialog v0.0.1 (/workbench/crates/async-dialog)
    Checking mlog v0.0.1 (/workbench/crates/mlog)
    Checking mfile v0.0.1 (/workbench/crates/mfile)
    Checking minimald-rpc v0.0.1 (/workbench/crates/minimald-rpc)
    Checking checkouts v0.0.1 (/workbench/crates/checkouts)
    Checking decode v0.0.1 (/workbench/crates/decode)
    Checking graph v0.0.1 (/workbench/crates/graph)
error: using `chunks_exact` with a constant chunk size
   --> crates/minimald-rpc/src/trace.rs:199:46
    |
199 |     for (byte, pair) in out.iter_mut().zip(s.chunks_exact(2)) {
    |                                              ^^^^^^^^^^^^^^^
    |
help: consider using `as_chunks::<2>()` instead
   --> crates/minimald-rpc/src/trace.rs:199:46
    |
199 |     for (byte, pair) in out.iter_mut().zip(s.chunks_exact(2)) {
    |                                              ^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#chunks_exact_to_as_chunks
    = note: `-D clippy::chunks-exact-to-as-chunks` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::chunks_exact_to_as_chunks)]`

error: could not compile `minimald-rpc` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

Outside the task's layers::

  • crates/common/tests/installer_stop_signal.rs
  • crates/minimal/src/tests.rs

Converted to a draft: something above needs a person before review.

min session behaves as before, with one file per verb under crates/minimal/src/cmd/boxes/. The branch now also carries main's min box spec command and the full-breadth acknowledgement on the start path.

Notes from the agent: Revise round: I resolved the merge conflicts with main. In mod.rs I kept both mod box_spec; from main and the box_verbs mount from the branch. In session.rs I kept the branch version, the clap handlers only. Main's change to session.rs (the BEP-057 full_breadth_acknowledged parameter on refuse_unhonourable_grants, the config read in activate_session, the new test start_honours_full_breadth_acknowledgement, and the updated call sites in two tests) now lives in boxes/create.rs, where those functions moved. The merge commit also brings in the files that main changed (box_spec.rs, cli.rs, config.rs, crates/boxes, crates/mfile). Those files come from the base branch, and this round did not edit them. cargo clippy -p minimal --all-targets gave no warnings in minimal. I also ran start_honours_full_breadth_acknowledgement and the box_spec tests, and all 5 passed. The directive listed no review threads and no failing checks.

@minimal-foundry
minimal-foundry Bot marked this pull request as draft October 20, 2026 15:53
@mitodrummer
mitodrummer marked this pull request as ready for review October 20, 2026 16:09

@mitodrummer mitodrummer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Babysit review on ff15aa1 against T34's plan block. This is a pure split: cmd/session.rs -8071 into cmd/boxes/{attach,create,exec,hooks,lifecycle,policy,vm_host}.rs, with session.rs keeping the clap handlers. After stripping whitespace, the added lines match the removed lines except for attach:: paths rewritten to crate::attach::, re-exports in cmd/boxes.rs and cmd/mod.rs, and source-path strings updated in the two scanning tests (accepted outside the layers). The merge round kept main's BEP-057 work: full_breadth_acknowledged appears 5 times on main's session.rs and 5 times in boxes/create.rs, and start_honours_full_breadth_acknowledgement moved with it.

@mitodrummer
mitodrummer enabled auto-merge October 20, 2026 17:39
@mitodrummer
mitodrummer added this pull request to the merge queue Oct 20, 2026
Merged via the queue into main with commit f0ffef9 Oct 20, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:approved minimal-review approved the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

T34 — Move the session commands into one file per verb

1 participant