Repository navigation
nvx: move InheritedHandle into its own vm submodule - #2329
Merged
Pedro Henrique Penna (ppenna) merged 1 commit intoNov 28, 2026
Merged
Conversation
vm.rs defined the Owned platform alias and the public InheritedHandle type with its platform conversions inline, between the attach helpers and LaunchCommand. Move them unchanged into host/vm/handle.rs, which vm re-exports so nvx::host::vm::InheritedHandle keeps its path, and move their conversion tests and the inherited_file helper into host/vm/handle/tests.rs, which vm's tests reuse. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the refactor separating handle ownership from VM launch logic.
No open issues 🎉
What changed in this PR
Addresses #2328 by separating platform handle ownership from VM launch logic. The refactor preserves nvx::host::vm::InheritedHandle, its behavior, and its public documentation.
Changes:
- Moves
Owned,InheritedHandle, and platform conversion implementations into a privatehandlesubmodule. - Re-exports
InheritedHandlefromvmto preserve its public path. - Relocates the two conversion tests and shares their
inherited_filehelper with the VM tests.
| File | Description |
|---|---|
nvx/src/host/vm/tests.rs |
Imports the relocated helper and removes the moved conversion tests. |
nvx/src/host/vm/handle/tests.rs |
Houses the unchanged conversion tests and shared helper. |
nvx/src/host/vm/handle.rs |
Contains the extracted ownership wrapper, platform implementations, and module documentation. |
nvx/src/host/vm.rs |
Declares the private submodule and re-exports InheritedHandle, replacing its inline definition. |
Review effort: Balanced
Pedro Henrique Penna (ppenna)
deleted the
issue-2328-inherited-handle-module
branch
November 28, 2026 17:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2328
What does this pull request change?
It moves the
Ownedplatform alias and the publicInheritedHandletype, with itsFrom,AsFd, andAsHandleimpls, unchanged fromnvx/src/host/vm.rsinto a new private submodule,nvx/src/host/vm/handle.rs, whichvmre-exports withpub use handle::InheritedHandle;, sonvx::host::vm::InheritedHandlekeeps its path. The two conversion tests and theinherited_filetest helper move unchanged intonvx/src/host/vm/handle/tests.rs, andvm/tests.rsimports the helper, as it importsvm_directory::tests::vm_dir. The only addition is the new module's//!doc line, whichclippy::missing_docs_in_private_itemsrequires.Start at
nvx/src/host/vm/handle.rs. Behavior, doc comments, error messages, and the public API are unchanged.Why is this change needed?
vm.rs(1,308 lines) mixed a self-contained platform handle-ownership wrapper into the VM launch flow, between the attach helpers andLaunchCommand; nothing else invm.rstouches its internals. Splitting it out, asvm/connection.rsalready splits out connections, shortensvm.rsby 70 lines and keeps platformcfgimpls together with their tests.How was this change validated?
Checks and results:
python scripts/local_gates.py --base origin/dev --run --keep-going(Windows 11, with Git'susr\binonPATH,XDG_CACHE_HOMEunset): test-changes, markdown-links, test-layout, nvx-format, nvx-test, nvx-doc, nvx-msrv, nvx-cli passed; nvx-lint failed on the missing module doc, fixed in this commit, then--only nvx-lint nvx-doc nvx-format test-layoutpassed.python scripts/public_api.py: passed, no snapshot change.cargo test --locked --lib -- host::vm::(NVX_BUNDLE=skip): Windows 62 passed, as atorigin/dev(62 passed), includinghost::vm::handle::tests::an_owned_windows_handle_moves_into_and_out_of_an_inherited_handle; Linux (WSL) 66 passed, includinghost::vm::handle::tests::an_owned_descriptor_moves_into_and_out_of_an_inherited_handle.cargo clippy --locked --all-targets --all-features -- -D warningson Linux (WSL): passed.Backend, host OS, host type, and guest: no microVM run; the change is a source move with no runtime effect.
Left to CI: the microVM scenarios that
local_gates.pylists for all backends, and macOS lint.Checklist
python3 scripts/check_test_layout.pychecks.python3 scripts/check_test_changes.py --base origin/devlists no changeto an existing test, or a Changes to existing tests section below
explains each one.
.github/copilot-instructions.mdand the skills when a convention orworkflow changes.
nvxupdatesnvx/public-api/withpython3 scripts/public_api.py --update.description says how the change versions or migrates them.
Changes to existing tests
check_test_changes.pyreports 0 changes to existing tests; it lists the two conversion tests and theinherited_filehelper as relocated unchanged fromnvx/src/host/vm/tests.rstonvx/src/host/vm/handle/tests.rs.