Skip to content

nvx-rs: split filesystem, instance, and sandbox lifecycle - #945

Merged
Pedro Henrique Penna (ppenna) merged 7 commits into
devfrom
agents/issue-898-unblocked-host-modules
Oct 28, 2026
Merged

Pedro Henrique Penna (ppenna) merged 7 commits into
devfrom
agents/issue-898-unblocked-host-modules

Conversation

@ppenna

@ppenna Pedro Henrique Penna (ppenna) commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Continue #898 with the three host files newly unblocked by the merges of #885 and #886:

  • Split filesystem planning into private guest-path, host-path, access-policy, limit, and recorded-plan verification/rendering modules. Keep request types and the planner together.
  • Split instance private-file operations, lock-held lifecycle transitions, and workload execution into focused siblings.
  • Split the managed sandbox CLI lifecycle into state directories, outcome reports, start/exec, and stop/deprovision. Keep configuration and VM discovery in the facade.

The first four candidates already landed in #921. This PR deliberately leaves #898 open: Linux/Windows platform, store, and supervisor splits remain for follow-up; they were deferred for overlapping work when this three-file scope was selected. #887 has since merged; #888 remains open. sandbox/plan.rs stays whole.

Compatibility and commits

Each original file has its own byte-for-byte, history-preserving git mv commit followed by a separate split commit. A seventh commit documents the source layout. No unrelated changes or fixup commits remain.
Existing public entry points are explicitly re-exported, shared private helpers/fields are parent-only, and no duplicated helpers are consolidated. Inline tests move to tests.rs under their original module paths. Moved intra-doc links use stable crate paths, and function links to guest_path/start/stop are disambiguated from the new modules. The CLI's REQUIRED_FEATURES retains its existing crate-private path.

Local validation

Validated on Windows without a hypervisor:

  • python scripts\nvx.py verify, Markdown links, and formatting.
  • Clippy -D warnings for all targets/all features, the default library, and feature-free library.
  • Full all-feature/default test suites; feature-free library build/tests; all 22 host-layering guard tests.
  • Rustdoc with warnings denied and the minimum supported Rust version check.
  • Synthetic artifact bundling: 18 artifact tests passed.
  • Runtime adapter protocol/host formatting, Clippy, builds, tests, and MSRV.
  • Linux/macOS all-target/all-feature cross-checks and musl guest-adapter Clippy/MSRV.

Checked after each split and again on the final head:

  • Complete Windows cargo test --locked --all-features -- --list output is identical to the pre-refactor baseline: 1,090 tests, no renamed tests.
  • Rustdoc JSON public-surface comparisons with cargo-public-api show zero differences for x86_64-pc-windows-msvc and x86_64-unknown-linux-gnu, including re-exports, methods, and trait implementations.

No SSH profiles are configured in this worktree. Linux execution and hardware-dependent gates are left to the PR CI matrix; local Linux checks above are cross-target compilation/API checks, not claims that Linux binaries ran on Windows.

Current working directory: C:\Users\ppenna\Projects\nvx.worktrees\issue-898-fix-split-commits-validate

Completed CI and review

  • Exact-head CI run 40613484582, attempt 1, succeeded at 078e9ff5e4050928366c918a4b5fb3ea64a3d6b0.
  • Copilot recommends approval with no open issues and zero unresolved threads.
  • Full Linux first-all-feature test inventories are identical: 1,767 entries with executable identity, including ignored tests/doctests, against successful source-equivalent merge-base run 40612790110 at 6464eb005bf6b7dc9eb09fc6c1a68a39c702b82d.
  • Existing Windows exact --list parity is 1,090 entries (see validation above).

Perform the byte-for-byte preparatory git mv for #898 in its own
commit. Keep it separate from the following split so git log --follow
and git blame preserve the existing history.

This changes no public paths, test names, or behavior; it only moves the
file into its module directory.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Separate guest/host path helpers, policy resolution, OpenVMM limits, and recorded-plan checks/rendering along existing sections. Keep request/plan types and planning in mod.rs; retain existing public and crate-private entry points through explicit re-exports; expose shared private helpers only to the parent; disambiguate guest_path function links; and move unchanged inline tests to filesystem/tests.rs while preserving host::filesystem::tests paths.

This is partial progress on #898 and does not close the issue.

Validation: 28 filesystem tests, 22 layering tests, identical 1090-test Windows list, and unchanged Windows/Linux public surfaces.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move instance.rs to instance/mod.rs as a pure rename, preserving history and blame for the module.

The source and destination blobs are identical, so this commit contains no content changes. This prepares the instance module for #898 without changing behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Separate atomic private-file helpers, lock-held lifecycle transitions, and workload output/cancellation into focused sibling modules. Leave instance identity, lookup states, launch/session helpers, and the public facade in mod.rs. Explicit reexports keep all public paths; parent-only visibility limits fields and helpers shared by siblings. Keep tests at host::instance::tests and pin moved intra-doc links to crate paths.

This is partial progress on #898 and does not close the issue.

Validation: 7 instance tests, full all-target/all-feature Clippy with -D warnings, layering guard, identical 1090-test Windows list, and zero Windows/Linux API diff.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move lifecycle.rs to lifecycle/mod.rs as a pure rename, preserving history and blame for the sandbox lifecycle module.

The source and destination blobs are identical, so this commit contains no content changes. This prepares the lifecycle module for #898 without changing behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Separate state-directory handling, outcome reports, start/exec, and stop/deprovision along current sections. Keep configuration and VM discovery in the facade, retain REQUIRED_FEATURES at its existing crate-private root path and reexport entry points; parent-only visibility for helpers shared by siblings. Move inline tests to lifecycle/tests.rs without changing host::cli::sandbox::lifecycle::tests; use explicit function links for start/stop and stable crate-qualified doc links.

This is partial unblocked work for #898 and does not close the issue.

Validation: 3 targeted lifecycle tests passed, 22 guard tests passed, all-target/all-feature Clippy with -D warnings passed, identical Windows test list, and zero Windows/Linux API diff.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Describe how filesystem planning, instance lifecycle and execution, and managed CLI transitions are divided into private sibling files while their facades retain the existing public module paths. Keep tests at their existing module paths without renaming them, using re-exports and tests.rs to preserve those interfaces.

Contributors should use the mod.rs facades rather than private siblings so the source boundaries remain enforceable and public APIs and test paths stay stable.

This is partial progress on #898 and does not close the issue.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 28, 2026 01:11

Copilot AI 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.

🟢 Approval recommended

No active review issues are recorded for the host-module refactor.

No open issues 🎉

What changed in this PR

Continues #898 by splitting three large NVX host modules into focused directory modules, following #921. The refactor preserves existing entry points and test module paths; platform, store, and supervisor splits remain deferred.

Changes:

  • Separates filesystem path handling, access policies, limits, and recorded-plan verification from request types and planning.
  • Extracts instance file operations, locked lifecycle transitions, and workload execution, plus managed sandbox CLI lifecycle operations.
  • Moves inline tests into sibling files and documents the new layout.
File Description
nvx-rs/​src/​host/​instance/​tests.rs Relocates instance tests without changing module paths.
nvx-rs/​src/​host/​instance/​mod.rs Retains instance types and entry points with explicit re-exports.
nvx-rs/​src/​host/​instance/​locked.rs Holds lock-protected lifecycle transitions.
nvx-rs/​src/​host/​instance/​files.rs Extracts private-file operations and temporary-file cleanup.
nvx-rs/​src/​host/​instance/​execution.rs Extracts workload output, cancellation, and outcomes.
nvx-rs/​src/​host/​filesystem/​verify.rs Holds recorded-plan checks and argument rendering.
nvx-rs/​src/​host/​filesystem/​policy.rs Extracts access-policy resolution and validation.
nvx-rs/​src/​host/​filesystem/​mod.rs Keeps request types, planning, and existing entry points.
nvx-rs/​src/​host/​filesystem/​limits.rs Extracts export-root checks and policy limits.
nvx-rs/​src/​host/​filesystem/​host_path.rs Extracts host-path normalization and identity helpers.
nvx-rs/​src/​host/​filesystem/​guest_path.rs Extracts guest-path translation and containment helpers.
nvx-rs/​src/​host/​cli/​sandbox/​lifecycle/​tests.rs Relocates lifecycle tests under their existing module path.
nvx-rs/​src/​host/​cli/​sandbox/​lifecycle/​stop.rs Extracts stopping, termination, and deprovisioning.
nvx-rs/​src/​host/​cli/​sandbox/​lifecycle/​start.rs Extracts startup, readiness, and workload execution.
nvx-rs/​src/​host/​cli/​sandbox/​lifecycle/​outcome.rs Extracts outcome-report validation and publication.
nvx-rs/​src/​host/​cli/​sandbox/​lifecycle/​mod.rs Retains configuration, provisioning, VM discovery, and re-exports.
nvx-rs/​src/​host/​cli/​sandbox/​lifecycle/​directory.rs Extracts state-directory creation and resolution.
nvx-rs/​src/​host/​cli/​sandbox/​lifecycle.rs Removes the monolithic file in favor of directory modules.
nvx-rs/​README.md Documents module responsibilities and compatibility preservation.

Review effort: Balanced

@ppenna
Pedro Henrique Penna (ppenna) merged commit 3beaf16 into dev Oct 28, 2026
47 checks passed
@ppenna
Pedro Henrique Penna (ppenna) deleted the agents/issue-898-unblocked-host-modules branch October 28, 2026 20:22
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