8000 refactor: rename the session types for the box they model by mitodrummer · Pull Request #2229 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

refactor: rename the session types for the box they model - #2229

Merged
mitodrummer merged 4 commits into
mainfrom
refactor/box-type-names
Oct 16, 2026
Merged

mitodrummer merged 4 commits into
mainfrom
refactor/box-type-names

Conversation

@mitodrummer
@mitodrummer mitodrummer commented Oct 15, 2026 •
Copy link
Copy Markdown
Member

What

R4 of the box naming plan (AGENTS.md, "Naming: box, Box Type, sandbox"), after R1 (#2106), R2 (#2201) and R3 (#2228): the types and traits whose subject is the box take box names. Stacked on #2228 (base refactor/minimald-box-module-names, so this diff is R4 only); it retargets to main once #2228 merges.

A pure rename, done as R1–R3 were: a recorded script (word-boundary, crate-scoped), then a review of every hit. No behaviour change, no moves, no serialised/wire/on-disk/CLI/env name changes. SessionId is not here (R5, after T45).

Renamed

Crate Old New Note
boxes SessionStatus BoxState plan's name
boxes SessionPolicy BoxPolicy
boxes EffectiveSessionPolicy EffectiveBoxPolicy
boxes SessionObject (store trait) BoxObject
boxes SessionKey (store trait) BoxKey the CLI dash's unrelated SessionKey struct is untouched
boxes DiskSession / DiskSessionKey DiskBox / DiskBoxKey
boxes SessionStep (SubmitVerdict reply) BoxStep the box's create-flow step
minimald-rpc SessionConfig BoxConfig CreateSessionRequest.config
minimald-rpc SessionRuntimeFacts BoxRuntimeFacts
minimald Session BoxActor plan's name
minimald SessionHandle / WeakSessionHandle BoxHandle / WeakBoxHandle plan's name
minimald Manager / ManagerHandle / WeakManagerHandle BoxManager / BoxManagerHandle / WeakBoxManagerHandle plan's name; checkouts::Manager untouched
minimald SessionConfig (actor spawn config) BoxActorConfig collision: BoxConfig is now minimald-rpc's
minimald SessionInner / SessionMessage BoxInner / BoxMessage
minimald SessionPaths / SessionInfo / SessionKeyPredicate / SessionControl BoxPaths / BoxInfo / BoxKeyPredicate / BoxControl plan's five, with BoxState
minimald SessionsError (alias) BoxManagerError BoxesError would read as the crate's
minimald SessionProcess / SessionLauncher / SessionEnvironment / SessionGuard BoxProcess / BoxLauncher / BoxEnvironment / BoxGuard runtime traits
minimald SessionExec / SessionProgram BoxExec / BoxProgram
minimald SessionRecordHandle BoxRecordHandle
minimald SessionCommands (+ test double DeadSession) BoxCommands (DeadBox)
minimald SessionGate (net switch) BoxGate
minimald SessionChannel (in-sandbox min channel actor) BoxChannel

Collision check: git grep -nw for every target found no existing type. Near misses, not collisions: minimald_rpc::BoxControlRequest/BoxControlReply (minvmd's control protocol) beside the new BoxControl; the enum variant audit::DecidedBy::BoxPolicy (always path-qualified) beside the new BoxPolicy type.

Deliberately unchanged

  • SessionId — R5.
  • RPC marker/request/response types named after their RPC (CreateSession*, FinalizeSession*, GetSessionRuntimeFacts*, SessionDelta*, GetSessionPolicy*, …) and CreateSessionMsg: they mirror the RPC NAME strings, which are wire.
  • Composition types SessionComposer, SessionVar, SessionPatch, WireSessionVar, WireSessionPatch: they compose the session Box Type's [session] table (borderline; a follow-up if wanted).
  • SessionKeys / SessionKeysConfig: the attach key chords of the interactive terminal session, per channel.
  • RunningSessionAttrs: the session shell's terminal state (title, bells, last I/O).
  • SftpSession, russh::server::Session, mfile::Session ([session] table), sandbox::WdSetup::Session, mctx::{WdLayout,PatchHome}::Session, and the minimal CLI's Session* types (SessionArgs, SessionCommand, dash SessionKey, …): CLI noun, SSH/SFTP session, or session Box Type.
  • Enum variants (AttachError::SessionPending/SessionBusy, WireError::UnknownSessionId, NsenterError::NoSessionLeader — a POSIX session leader): R4 renames types only; the wire error variant is serialised.
  • Functions, fields, locals (session_config(), sessions: field, …) and the historical spec 03 architecture.md mention of SessionMessage.

Wire and serialisation safety

  • Serde never emits a Rust type name here: no #[serde(tag/content)] names a type, all renamed enums keep their variant names, and no #[serde(from/into/try_from/remote = "…")] string names a renamed type. The serialised types renamed (BoxState, BoxPolicy, EffectiveBoxPolicy, BoxStep, BoxConfig, BoxRuntimeFacts) produce identical JSON, so no #[serde(rename)] was needed and none was added.
  • RPC method names are explicit const NAME strings (constcat!(RPC_SUBSYSTEM_PREFIX, "GetSessionRuntimeFacts") etc.), untouched.
  • No std::any::type_name, no schemars/JSON schema in these crates.
  • No string literal (log, error Display, panic) contains a renamed name. No log/record writes a whole renamed struct with {:?} (only fields such as ?config.name). Debug of the renamed structs changes its type-name prefix, but nothing asserts or persists it.
  • Insta snapshots: none reference these names; no snapshot changed (dash_snapshots 20/20 pass unchanged).

Counts

56 files; renamed tokens (script output): SessionPolicy 271, SessionKeyPredicate 178, SessionStatus 148, SessionGate 99, SessionMessage 89, SessionInner 74, Session 55, EffectiveSessionPolicy 53, SessionConfig 55 (45 → BoxConfig, 10 → BoxActorConfig), SessionHandle 47, SessionStep 43, ManagerHandle 38, Manager 29, SessionsError 28, WeakSessionHandle 24, DiskSessionKey 23, SessionPaths 20, SessionRecordHandle 19, SessionProcess 18, SessionChannel 17, SessionLauncher 12, SessionCommands 11, SessionControl 11, DiskSession 10, WeakManagerHandle 10, SessionEnvironment 9, SessionGuard 9, SessionObject 9, SessionRuntimeFacts 9, SessionProgram 6, SessionKey 5, SessionInfo 4, SessionExec 4, DeadSession 4. rustfmt reflowed the lines whose length changed. Two prose comments ("Manager-initiated", "Manager is down") were kept as prose. crates/boxes/docs/COMPOSITION.md follows the names; two of its touched sentences were split for the prose lint.

Verification

  • just fmt then just fmt-check: clean.
  • cargo check --workspace --all-targets --locked: clean, zero warnings.
  • just test-one '' -p boxes: 627/627. just test-one '' -p minimald-rpc: 71/71. just test-one '' -p minimald --lib: 1010/1010 (1 skipped). just test-one '' -p minimal --test dash_snapshots: 20/20.
  • just clippy not used as a gate: this sandbox's rustc 1.98 (repo pins 1.97) stops on toolchain-only lints in untouched code, as on refactor(minimald): rename the session modules for what they hold #2228. CI runs the pinned toolchain.
  • Not run here: the full workspace just test, doctests, e2e; CI covers them.
  • just lint-prose crates/boxes/docs/COMPOSITION.md: no alerts on the changed lines.

Leftover scan (git grep -ohwE '[A-Za-z]*Session[A-Z][A-Za-z]*' over boxes, minimald, minimald-rpc): only the "Deliberately unchanged" names above, plus a pre-existing stale doc link SessionSeed::hostnames in box_actor.rs (no such type before this PR either).

Open-PR overlap

Diffs of every open PR scanned for the old names: only #2224 (bryan-minimal) uses them (SessionKeyPredicate, SessionsError, Session in box_manager.rs, ex-sessions.rs); it needs a mechanical rename after this merges. Any open PR adding a use of an old name needs the new one.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NSAwDroXL6KqsSxUzdbZGw

Summary by CodeRabbit

  • Refactor
    • Updated public terminology across box management, lifecycle, networking, and RPC interfaces to use “box” naming instead of “session” naming.
    • Existing workflows, policy rules, lifecycle states, and runtime behavior remain unchanged.

mitodrummer and others added 2 commits October 15, 2026 18:04
R3 of the box naming plan, after R1 (#2106) and R2 (#2201). The
minimald modules whose subject is the box take box names, and so does
minimal-client's autogen name module:

- sessions -> box_manager (with sessions/composables.rs)
- session -> box_actor (with session/{helpers,kind,tests}.rs)
- session_host -> box_runtime (with session_host/{pty,tests}.rs)
- session_sop -> box_ops
- session_delta -> workspace_delta
- session_shell -> attach_shell
- minimal-client session_name -> box_name

A pure rename: git mv, the mod declarations, every module path
(crate::, minimald::, minimal_client::, bare and grouped imports),
module mentions in doc comments, the source path the minimal test
scans, the RUST_LOG filters in the session e2e, and current docs that
name the files. Types, functions, fields, serialised names and the
min session verb are unchanged. rustfmt applied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NSAwDroXL6KqsSxUzdbZGw
R4 of the box naming plan: the types and traits whose subject is the
box take box names. SessionStatus becomes BoxState, the minimald actor
and manager become BoxActor and BoxManager with their handles, and the
runtime traits, store traits, exec types and network gate follow.
minimald_rpc::SessionConfig becomes BoxConfig, so the actor's spawn
config is BoxActorConfig. SessionId is left for R5.

A pure rename: no serialised, wire, on-disk, CLI or env name changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NSAwDroXL6KqsSxUzdbZGw
@mitodrummer
Copy link
Copy Markdown
Member Author

@coderabbitai review

@mitodrummer
Copy link
Copy Markdown
Member Author

/review

@coderabbitai
coderabbitai Bot commented Oct 15, 2026 •
Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: dcd06da9-aa99-47c4-af05-991ebec65708
📥 Commits

Reviewing files that changed from the base of the PR and between ff18bf7 and e442078.

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

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: 7773bc83-9305-44c4-8851-b3a924590fed
📥 Commits

Reviewing files that changed from the base of the PR and between 9602f10 and ff18bf7.

📒 Files selected for processing: 56
  • crates/boxes/docs/COMPOSITION.md
  • crates/boxes/src/core/egress.rs
  • crates/boxes/src/lib.rs
  • crates/boxes/src/store.rs
  • crates/boxes/src/wire/request.rs
  • crates/mctx/src/env.rs
  • crates/minimal-client/src/box_registration.rs
  • crates/minimal/src/attach.rs
  • crates/minimal/src/cmd/list.rs
  • crates/minimal/src/cmd/mod.rs
  • crates/minimal/src/cmd/session.rs
  • crates/minimal/src/dash/app.rs
  • crates/minimal/src/dash/filter.rs
  • crates/minimal/src/dash/render.rs
  • crates/minimal/src/dash/rpc.rs
  • crates/minimal/src/task.rs
  • crates/minimal/src/tests.rs
  • crates/minimal/tests/cli.rs
  • crates/minimal/tests/dash_snapshots.rs
  • crates/minimald-rpc/src/lib.rs
  • crates/minimald/src/box_actor.rs
  • crates/minimald/src/box_actor/helpers.rs
  • crates/minimald/src/box_actor/kind.rs
  • crates/minimald/src/box_actor/tests.rs
  • crates/minimald/src/box_manager.rs
  • crates/minimald/src/box_manager/composables.rs
  • crates/minimald/src/box_ops.rs
  • crates/minimald/src/box_runtime.rs
  • crates/minimald/src/box_runtime/tests.rs
  • crates/minimald/src/connection.rs
  • crates/minimald/src/env.rs
  • crates/minimald/src/exec.rs
  • crates/minimald/src/hooks.rs
  • crates/minimald/src/maintenance.rs
  • crates/minimald/src/net/answerer.rs
  • crates/minimald/src/net/dns.rs
  • crates/minimald/src/net/dns_gate.rs
  • crates/minimald/src/net/gvproxy_network.rs
  • crates/minimald/src/net/listeners.rs
  • crates/minimald/src/net/policy.rs
  • crates/minimald/src/net/provider.rs
  • crates/minimald/src/net/proxy.rs
  • crates/minimald/src/net/switch.rs
  • crates/minimald/src/nsenter.rs
  • crates/minimald/src/rpc.rs
  • crates/minimald/src/server.rs
  • crates/minimald/src/sftp.rs
  • crates/minimald/src/store.rs
  • crates/minimald/src/test_harness.rs
  • crates/minimald/tests/netns_root_integration.rs
  • crates/minvmd/examples/exec.rs
  • crates/minvmd/tests/egress_allowlist_integration.rs
  • crates/minvmd/tests/guest_classifier_integration.rs
  • crates/minvmd/tests/minimald_session_integration.rs
  • crates/minvmd/tests/vm_escape_integration.rs
  • crates/switch/src/bep_host.rs

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour.

Priority: ➖ Normal

Change: Refactor

Merge Risk: ⚪ Minimal · up to ff18b

No issue requiring a fix before merge is identified; the rename appears mergeable after normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Docstring Coverage Passed Docstring coverage is 91.10% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 337 functions across 42 files. (14 skipped:…
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 primary change: renaming session-oriented types to box-oriented names.
Description check Passed The description is mostly complete. It explains the rename scope, unchanged behavior, compatibility considerations, testing performed, and deferred work. It uses equivalent headings instead of the tem…
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit reads each line,
Box names hop into place,
Old session labels fade,
The tests keep each state in view,
A tidy patch rests in the burrow.

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

@minimal-foundry
minimal-foundry Bot commented Oct 15, 2026 •
Copy link
Copy Markdown
Contributor

Approved: no findings at e44207838c91.

Nothing to do.

Clobber: none: the working tree is at the PR head commit and the diff is self-contained; git log shows no reverted fix.

@coderabbitai
coderabbitai Bot commented Oct 15, 2026 •
Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

correctness

minimal-review — approved

Verdict APPROVE — No findings.

security

minimal-review — approved

Verdict APPROVE — No findings.

supply-chain

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 15, 2026
@mitodrummer
mitodrummer marked this pull request as ready for review October 15, 2026 20:38
@mitodrummer
mitodrummer requested a review from a team as a code owner October 15, 2026 20:38
@norrietaylor norrietaylor 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.

Approved.

Base automatically changed from refactor/minimald-box-module-names to main October 16, 2026 17:50
mitodrummer and others added 2 commits October 16, 2026 17:53
R4 of the BOX naming plan, rebuilt on main after R3 (#2228) squash-merged:
the same rename as ff18bf7, applied to main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NSAwDroXL6KqsSxUzdbZGw
@mitodrummer
mitodrummer enabled auto-merge (squash) October 16, 2026 17:53
@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.

correctness

minimal-review — approved

Verdict APPROVE — No findings.

security

minimal-review — approved

Verdict APPROVE — No findings.

supply-chain

minimal-review — approved

Verdict APPROVE — No findings.

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

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.

2 participants

0