Skip to content

host: make the platform layer private to nvx (SL6.14) - #1529

Merged
Pedro Henrique Penna (ppenna) merged 2 commits into
feature/nvx-refactorfrom
agents/slim-sl6-14-platform-private
Nov 12, 2026
Merged

Pedro Henrique Penna (ppenna) merged 2 commits into
feature/nvx-refactorfrom
agents/slim-sl6-14-platform-private

Conversation

@ppenna

@ppenna Pedro Henrique Penna (ppenna) commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Part of #1127 (SL6.14, "The host's platform layer is private"). Parent #1088, umbrella #1076.

Its base is feature/nvx-refactor at 04fbbd48. It was stacked on #1525 (SL6.12), which has merged.

What and why

nvx::host::platform is the host's operating-system layer, which the library and the CLI use, yet it was a public module of nvx, with SUPPORTED, create_private_dir, file_identity, process_start_time, and the Transport trait and TransportHandle. Its public parts moved to host::vm, host::transport and host::runtime with the new interface, and its last outside users are gone, so, as SL6.14's Scope says, this PR makes it crate-private where it is. Nothing that stays changes behavior, no production file moves or splits, and no other module becomes private.

  • host::platform is crate-private (host: make the platform layer private to the crate). The module becomes pub(crate) mod platform, and file_identity and process_start_time become pub(crate) on Linux, Windows and other hosts, as unreachable_pub asks. Transport and TransportHandle stay pub where they are defined, since host::transport re-exports them as their public path. No alias of Transport or probe_hypervisor remained: host::runtime::probe_hypervisor wraps the platform's crate-private probe. host::vm::create_private_dir, host::transport and host::runtime keep their public forms.
  • What only the public path kept alive, which the compiler then finds:
    • The platform's own create_private_dir, on Linux, Windows and other hosts, which nothing in the crate calls (host::vm::create_private_dir is the VM directory's own function), is deleted with Linux's PRIVATE_DIR_MODE, which only it read. So is SUPPORTED, whose last reader, the artifact discovery that SL6.6b deleted (a55cb63e), is gone. No test reads either.
    • process_start_time serves only the CLI, which checks the processes that its records name, and the unit tests, which name the processes that they start. Its re-exports on Linux and Windows, and on Windows the function and the open_existing_process that only it calls, are gated by cfg(any(test, feature = "cli")); on other hosts, where no test reads it, cfg(feature = "cli") gates it, with the std::fs import that only the CLI's code uses there now. See Seams.
  • The integration tests that reached the platform layer become unit tests of their owners, unchanged but for the paths and helpers that they reach:
    • tests/security_checklist.rs's a_saved_vm_runs_until_its_process_exits_and_another_runtime_is_refused_without_a_signal and reattaching_refuses_an_endpoint_that_another_process_serves_and_keeps_the_vm_and_its_values, with the idle child and its ignored idle_child, move to host::vm::tests::reattach, whose vm_dir, cold_runtime, saved and bind do what the checklist's private_directory, runtime, saved and endpoint_server did. The idle child starts under the spawn lock, as the unit tests' other children do.
    • tests/process.rs, into which SL6.3 turned tests/supervisor.rs, names every child that it starts with process_start_time, so it moves with git mv to host::process::tests::orchestrator (nvx-rs/src/host/process/tests/orchestrator.rs), with its seven tests and two fixtures unchanged: processes_can_be_shared_between_threads, a_child_that_exits_wakes_its_waiter, a_process_that_is_not_a_child_wakes_its_waiters, a_reused_process_id_is_never_signaled, references_that_name_no_process_are_never_opened, and on Windows a_process_that_this_user_may_not_query_has_an_unknown_state and a_process_that_this_user_may_not_terminate_is_waited_for_but_never_signaled. Its imports take crate paths, its module declaration holds its cfg, fixture_arguments names the fixtures by their unit-test paths, its three spawns take the spawn lock, as the unit tests' children do, and its Windows restricted module allows the unsafe code that host's deny(unsafe_code) refuses. This replaces the earlier revision's copy of the two Windows tests in host::process::tests::windows.
  • The outside callers use public paths. tests/cli/one_shot.rs's four tests of nvx-rs run (forwarding_failure_stops_the_verified_vm_during_connect_and_handshake, terminal_ctrl_c_cancels_boot_and_handshake_and_restores_the_terminal on Linux and on Windows, terminal_quit_and_suspend_keys_remain_guest_console_input) drive the nvx-rs binary, so they stay integration tests, as nvx-rs slimming 4.3.4: NVXC, the host's platform layer and the guest's space are private #1127's notes allow, and their helper reads the fake OpenVMM's start time as ProcessRef's docs define it (tests: read the one-shot fake's start time as ProcessRef documents it). The external-launch example needs nothing this PR makes private: since SL6.3 it launches its VMM itself, takes Transport from host::transport, and reads its VMM's start time as ProcessRef defines it, so the earlier revision's examples: take Transport from host::transport went in the rebase, already upstream.
  • The public-API snapshots drop 11 items on each platform, and add none: mod nvx::host::platform, SUPPORTED, Transport with its four methods, TransportHandle, create_private_dir, file_identity and process_start_time. host::transport::{Transport, TransportHandle}, host::vm::create_private_dir and host::runtime::probe_hypervisor stay listed.
  • Docs. ProcessRef's docs define the start time without linking the private function; host's module docs name platform as private. In nvx-rs/README.md, the nvx::host::platform, report row and section become nvx::host::report's, the Transport paragraphs move to nvx::host::transport's section, its public path, the host-path and security-checklist text say where the moved checks now live, and the testing section's "process and spawn test", which SL6.3 split into tests/process.rs and the spawn's unit tests, describes the process tests where they now live.
  • The case matrix stays true. The rows a_host_program_of_another_runtime_finds_the_vm_mismatched_and_signals_nothing and a_host_program_of_another_runtime_ends_the_clone_through_its_verified_identity name the moved checklist test at nvx-rs/src/host/vm/tests/reattach.rs, and the retired row of host::supervisor's doc test names nvx-rs/src/host/process/tests/orchestrator.rs for the process tests. No inventoried test is added or removed, and SL5.2's check_matrix.py passes.

Seams

process_start_time keeps four test hooks, which scripts/test-layout-allowlist.json records:

File Seams Hooks
nvx-rs/src/host/platform/linux/mod.rs 1 the re-export of process_start_time, which the Linux platform itself also calls
nvx-rs/src/host/platform/windows/mod.rs 1 the re-export of process_start_time
nvx-rs/src/host/platform/windows/process.rs 2 process_start_time and open_existing_process

The public re-export kept it in every build; outside the platform, only the CLI and the unit tests, which name the children that they spawn, call it.

Size

Measured: 0 core lines and 0 counted files, as the Estimate says. Every added code line of production Rust is a pub narrowed to pub(crate), a feature or test gate, or an import edit that they force. Five platform files (linux/{mod,private}.rs, windows/{mod,private}.rs, other.rs) also lose the now-unused create_private_dir, PRIVATE_DIR_MODE and SUPPORTED, deleted lines only. The rest is tests, docs, generated snapshots and test policy.

Judgment calls, approved by the orchestrator for Pedro Henrique Penna (@ppenna)

  • The Scope lists create_private_dir among the items that become pub(crate), but once crate-private the platform's own create_private_dir has no caller, so it goes, rather than staying as dead code under an expect(dead_code) with no later caller to name. host::vm::create_private_dir keeps its public form. SUPPORTED, which SL6.6b left without a reader, follows the same rule in this revision.
  • process_start_time is gated by cfg(any(test, feature = "cli")) rather than gating its tests, with four seams in scripts/test-layout-allowlist.json (see Seams): one in nvx-rs/src/host/platform/linux/mod.rs, its re-export; one in nvx-rs/src/host/platform/windows/mod.rs, its re-export; and two in nvx-rs/src/host/platform/windows/process.rs, process_start_time and open_existing_process.

Other notes

  • The four nvx-rs run tests stay integration tests that drive the binary, and read the documented start time themselves; the security checklist's two saved-VM checks, and SL6.3's tests/process.rs, become unit tests of host::vm and host::process, as the Scope says.

Validation

The gates that local_gates.py --files selects, run from this branch's own action definitions, with Rust 1.95.0 and NVX_BUNDLE=skip, on this head, 659b0052:

Where Check Result
Windows (local) cargo fmt --all --check passed
Windows cargo clippy --locked -- -D warnings with --all-targets --all-features, --all-targets, --lib, --lib --no-default-features, serde alone, --lib --bins --features cli, --lib --bins --no-default-features --features testing (the --all-targets sets compile the external-launch example) passed
Windows the same clippy sets for --target x86_64-unknown-linux-gnu, and --target x86_64-unknown-linux-musl --no-default-features --features guest with --lib --bins and --all-targets passed
Windows RUSTDOCFLAGS="-D warnings" cargo doc --locked --no-deps --all-features, for Windows and x86_64-unknown-linux-gnu; cargo +1.89 check --locked --all-targets --all-features passed
Windows cargo check --locked --all-targets --all-features --target aarch64-apple-darwin passed; its one warning, all_processors_online and console_listener unused in host::snapshot's tests, is the base's too
Windows python scripts/public_api.py passed; the snapshots drop 11 items per platform, all of host::platform
Windows check_test_layout.py, check_markdown_links.py, SL5.2's check_matrix.py against 99d2022085f passed
Windows cargo test --locked --lib for host::process (with the seven moved tests and both Windows restricted-process tests running their checks unprivileged), host::vm::tests::reattach, host::platform, host::transport and host::vm_directory, with the default features and with all of them; the security_checklist and host_modules tests; cargo test --all-features --test cli -- one_shot passed: 68 unit tests (5 ignored), 7, 22, and the CLI's 17 one-shot tests
Linux/KVM (nvx-kvm-test, virtual machine, kernel 6.6) nvx.py verify, cargo fmt --all --check, the seven clippy sets above, natively passed
Linux/KVM cargo test --locked --all-features --no-fail-fast; cargo test --locked every test binary passes but the unit tests' 28 guest:: failures (1847 passed, 60 ignored), the same 28 that fail at the base on this kernel; the CLI's 120 pass, and the defaults' 681 unit tests pass
Linux/KVM public_api.py; nvx.py check-guest-binaries passed; check-guest-binaries fails the same 7 guest:: tests as the base on this kernel (965 passed)
Linux/MSHV (nvx-mshv-test, virtual machine, kernel 6.18) nvx.py verify, cargo fmt --all --check, the seven clippy sets above, natively passed
Linux/MSHV cargo test --locked --all-features --no-fail-fast; cargo test --locked; public_api.py passed: 1875 unit tests (60 ignored), the CLI's 120 and every other binary; 681 unit tests; passed

On both Linux hosts, the moved host::process::tests::orchestrator and host::vm::tests::reattach tests pass with all features and with the defaults, and so do the three Linux one-shot tests that use the new start_time. The KVM host's 28 and 7 guest:: failures are the sets that the base fails on that kernel, compared on the earlier base 8c402eac (no failure is only this branch's); this PR changes no guest code. A code-review subagent reviewed the earlier revision's whole diff and found no significant issues. Left to CI: the microVM scenarios, since no runtime path changes and no scenario runs a moved test; WHP; and benchmarks.

Changes to existing tests

python scripts/check_test_changes.py --base origin/feature/nvx-refactor reports 70 changes to existing tests, 10 added test items, and none relocated unchanged; this PR carries the tests-modified label. Each change and its reason:

  • Moved to host::process::tests::orchestrator (nvx-rs/tests/process.rs -> nvx-rs/src/host/process/tests/orchestrator.rs, with git mv): its seven tests, its process_fixture and launcher_fixture, its helpers (PROCESS_MARKER, EXIT_MARKER, LAUNCHER_DIR, REFERENCE_PREFIX, TIMEOUT, PROCESS_LIFETIME, SHORT_WAIT, SPAWNS, serialized, fixture_arguments, spawn_process, reference_of, ProcessDirectory, Reaped, Launcher, open_running, assert_ended) and its Windows restricted module (Running, spawn, restrict, may_open). Their assertions are unchanged. The tool reports each as modified because it now compiles under the test cfg, and as removed its inner attribute (#![cfg(...)], now its module declaration's) and its imports (nvx:: paths, now crate:: paths); fixture_arguments prefixes the fixture's unit-test path, and spawn_process, Launcher::start and restricted::spawn spawn through crate::host::tests::spawn_locked.
  • Moved to host::vm::tests::reattach (nvx-rs/tests/security_checklist.rs -> nvx-rs/src/host/vm/tests/reattach.rs): a_saved_vm_runs_until_its_process_exits_and_another_runtime_is_refused_without_a_signal, reattaching_refuses_an_endpoint_that_another_process_serves_and_keeps_the_vm_and_its_values, the ignored idle_child, and IdleChild with its start, reference and Drop. Their assertions are unchanged; vm::verify and vm::reattach lose their module prefix, transport::connect_verified takes its crate path, private_directory and runtime become vm_dir and cold_runtime, IdleChild names its test by its unit-test path and spawns under the spawn lock, and reference reads crate::host::platform::process_start_time.
  • Removed from the checklist: the helpers saved and both endpoint_servers, which reattach's existing saved and bind replace: an endpoint in the same place, a test capability and the test runtime's identity, and on Windows the same CreateNamedPipeW server.
  • Modified imports: those of tests/security_checklist.rs, which no longer reach platform, transport, BootId, ProcessRef or the std items that only the moved tests used, and whose io, Command and Stdio only its Windows checks use now.
  • Modified helper: tests/cli/one_shot.rs's gated_native takes the start time from the new start_time.
  • Test policy: the allowlist gains the four seams above.
  • Added: the four test hooks above; host::process' tests' mod orchestrator, with the moved file's new imports and the restricted module's allow(unsafe_code); and the CLI helper start_time, on Linux and on Windows.

No test is retired.

@ppenna Pedro Henrique Penna (ppenna) added tests-modified Changes existing tests, test data, or test wiring feat-nvx-refactor labels Nov 12, 2026
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

This pull request changes existing tests

It modifies or removes 70 existing test asset(s), listed below. Review each with care: a change to a test can hide a regression that the test caught. See doc/contribute.md#changes-to-existing-tests.

Test code

Change What Before After
modified attributes the inner attributes of process/restricted (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test hold, not where any ( target_os = "linux" , windows ) and feature = "host" and windows did) nvx-rs/tests/process.rs:466 nvx-rs/src/host/process/tests/orchestrator.rs:1
modified helper fn gated_native in cli/one_shot (tests) nvx-rs/tests/cli/one_shot.rs:551 nvx-rs/tests/cli/one_shot.rs:551
modified helper const PROCESS_MARKER in process (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test hold, not where any ( target_os = "linux" , windows ) and feature = "host" did) nvx-rs/tests/process.rs:25 nvx-rs/src/host/process/tests/orchestrator.rs:27
modified helper const EXIT_MARKER in process (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test hold, not where any ( target_os = "linux" , windows ) and feature = "host" did) nvx-rs/tests/process.rs:27 nvx-rs/src/host/process/tests/orchestrator.rs:29
modified helper const LAUNCHER_DIR in process (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test hold, not where any ( target_os = "linux" , windows ) and feature = "host" did) nvx-rs/tests/process.rs:30 nvx-rs/src/host/process/tests/orchestrator.rs:32
modified helper const REFERENCE_PREFIX in process (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test hold, not where any ( target_os = "linux" , windows ) and feature = "host" did) nvx-rs/tests/process.rs:33 nvx-rs/src/host/process/tests/orchestrator.rs:35
modified helper const TIMEOUT in process (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test hold, not where any ( target_os = "linux" , windows ) and feature = "host" did) nvx-rs/tests/process.rs:35 nvx-rs/src/host/process/tests/orchestrator.rs:37
modified helper const PROCESS_LIFETIME in process (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test hold, not where any ( target_os = "linux" , windows ) and feature = "host" did) nvx-rs/tests/process.rs:37 nvx-rs/src/host/process/tests/orchestrator.rs:39
modified helper const SHORT_WAIT in process (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test hold, not where any ( target_os = "linux" , windows ) and feature = "host" did) nvx-rs/tests/process.rs:39 nvx-rs/src/host/process/tests/orchestrator.rs:41
modified helper static SPAWNS in process (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test hold, not where any ( target_os = "linux" , windows ) and feature = "host" did) nvx-rs/tests/process.rs:42 nvx-rs/src/host/process/tests/orchestrator.rs:44
modified helper fn serialized in process (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test hold, not where any ( target_os = "linux" , windows ) and feature = "host" did) nvx-rs/tests/process.rs:45 nvx-rs/src/host/process/tests/orchestrator.rs:47
modified helper fn fixture_arguments in process (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test hold, not where any ( target_os = "linux" , windows ) and feature = "host" did) nvx-rs/tests/process.rs:88 nvx-rs/src/host/process/tests/orchestrator.rs:90
modified helper fn spawn_process in process (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test hold, not where any ( target_os = "linux" , windows ) and feature = "host" did) nvx-rs/tests/process.rs:101 nvx-rs/src/host/process/tests/orchestrator.rs:104
modified helper fn reference_of in process (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test hold, not where any ( target_os = "linux" , windows ) and feature = "host" did) nvx-rs/tests/process.rs:114 nvx-rs/src/host/process/tests/orchestrator.rs:117
modified helper struct ProcessDirectory in process (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test hold, not where any ( target_os = "linux" , windows ) and feature = "host" did) nvx-rs/tests/process.rs:126 nvx-rs/src/host/process/tests/orchestrator.rs:129
modified helper impl ProcessDirectory in process (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test hold, not where any ( target_os = "linux" , windows ) and feature = "host" did) nvx-rs/tests/process.rs:133 nvx-rs/src/host/process/tests/orchestrator.rs:136
modified helper fn new in process (tests), impl ProcessDirectory`` (moved, and it now compiles where any ( target_os = "linux" , windows ) and `feature = "host"` and `test` hold, not where `any ( target_os = "linux" , windows )` and `feature = "host"` did) nvx-rs/tests/process.rs:135 nvx-rs/src/host/process/tests/orchestrator.rs:138
modified helper fn path in process (tests), impl ProcessDirectory`` (moved, and it now compiles where any ( target_os = "linux" , windows ) and `feature = "host"` and `test` hold, not where `any ( target_os = "linux" , windows )` and `feature = "host"` did) nvx-rs/tests/process.rs:143 nvx-rs/src/host/process/tests/orchestrator.rs:146
modified helper fn record in process (tests), impl ProcessDirectory`` (moved, and it now compiles where any ( target_os = "linux" , windows ) and `feature = "host"` and `test` hold, not where `any ( target_os = "linux" , windows )` and `feature = "host"` did) nvx-rs/tests/process.rs:148 nvx-rs/src/host/process/tests/orchestrator.rs:151
modified helper fn end in process (tests), impl ProcessDirectory`` (moved, and it now compiles where any ( target_os = "linux" , windows ) and `feature = "host"` and `test` hold, not where `any ( target_os = "linux" , windows )` and `feature = "host"` did) nvx-rs/tests/process.rs:153 nvx-rs/src/host/process/tests/orchestrator.rs:156
modified helper impl Drop for ProcessDirectory in process (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test hold, not where any ( target_os = "linux" , windows ) and feature = "host" did) nvx-rs/tests/process.rs:158 nvx-rs/src/host/process/tests/orchestrator.rs:161
modified helper fn drop in process (tests), impl Drop for ProcessDirectory`` (moved, and it now compiles where any ( target_os = "linux" , windows ) and `feature = "host"` and `test` hold, not where `any ( target_os = "linux" , windows )` and `feature = "host"` did) nvx-rs/tests/process.rs:159 nvx-rs/src/host/process/tests/orchestrator.rs:162
modified helper struct Reaped in process (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test hold, not where any ( target_os = "linux" , windows ) and feature = "host" did) nvx-rs/tests/process.rs:174 nvx-rs/src/host/process/tests/orchestrator.rs:177
modified helper impl Drop for Reaped in process (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test hold, not where any ( target_os = "linux" , windows ) and feature = "host" did) nvx-rs/tests/process.rs:176 nvx-rs/src/host/process/tests/orchestrator.rs:179
modified helper fn drop in process (tests), impl Drop for Reaped`` (moved, and it now compiles where any ( target_os = "linux" , windows ) and `feature = "host"` and `test` hold, not where `any ( target_os = "linux" , windows )` and `feature = "host"` did) nvx-rs/tests/process.rs:177 nvx-rs/src/host/process/tests/orchestrator.rs:180
modified helper struct Launcher in process (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test hold, not where any ( target_os = "linux" , windows ) and feature = "host" did) nvx-rs/tests/process.rs:184 nvx-rs/src/host/process/tests/orchestrator.rs:187
modified helper impl Launcher in process (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test hold, not where any ( target_os = "linux" , windows ) and feature = "host" did) nvx-rs/tests/process.rs:191 nvx-rs/src/host/process/tests/orchestrator.rs:194
modified helper fn start in process (tests), impl Launcher`` (moved, and it now compiles where any ( target_os = "linux" , windows ) and `feature = "host"` and `test` hold, not where `any ( target_os = "linux" , windows )` and `feature = "host"` did) nvx-rs/tests/process.rs:193 nvx-rs/src/host/process/tests/orchestrator.rs:196
modified helper fn launch_reference in process (tests), impl Launcher`` (moved, and it now compiles where any ( target_os = "linux" , windows ) and `feature = "host"` and `test` hold, not where `any ( target_os = "linux" , windows )` and `feature = "host"` did) nvx-rs/tests/process.rs:206 nvx-rs/src/host/process/tests/orchestrator.rs:209
modified helper fn wait in process (tests), impl Launcher`` (moved, and it now compiles where any ( target_os = "linux" , windows ) and `feature = "host"` and `test` hold, not where `any ( target_os = "linux" , windows )` and `feature = "host"` did) nvx-rs/tests/process.rs:230 nvx-rs/src/host/process/tests/orchestrator.rs:233
modified helper fn finish in process (tests), impl Launcher`` (moved, and it now compiles where any ( target_os = "linux" , windows ) and `feature = "host"` and `test` hold, not where `any ( target_os = "linux" , windows )` and `feature = "host"` did) nvx-rs/tests/process.rs:242 nvx-rs/src/host/process/tests/orchestrator.rs:245
modified helper impl Drop for Launcher in process (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test hold, not where any ( target_os = "linux" , windows ) and feature = "host" did) nvx-rs/tests/process.rs:248 nvx-rs/src/host/process/tests/orchestrator.rs:251
modified helper fn drop in process (tests), impl Drop for Launcher`` (moved, and it now compiles where any ( target_os = "linux" , windows ) and `feature = "host"` and `test` hold, not where `any ( target_os = "linux" , windows )` and `feature = "host"` did) nvx-rs/tests/process.rs:249 nvx-rs/src/host/process/tests/orchestrator.rs:252
modified helper fn open_running in process (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test hold, not where any ( target_os = "linux" , windows ) and feature = "host" did) nvx-rs/tests/process.rs:256 nvx-rs/src/host/process/tests/orchestrator.rs:259
modified helper fn assert_ended in process (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test hold, not where any ( target_os = "linux" , windows ) and feature = "host" did) nvx-rs/tests/process.rs:265 nvx-rs/src/host/process/tests/orchestrator.rs:268
modified helper struct Running in process/restricted (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test and windows hold, not where any ( target_os = "linux" , windows ) and feature = "host" and windows did) nvx-rs/tests/process.rs:484 nvx-rs/src/host/process/tests/orchestrator.rs:489
modified helper impl Drop for Running in process/restricted (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test and windows hold, not where any ( target_os = "linux" , windows ) and feature = "host" and windows did) nvx-rs/tests/process.rs:486 nvx-rs/src/host/process/tests/orchestrator.rs:491
modified helper fn drop in process/restricted (tests), impl Drop for Running`` (moved, and it now compiles where any ( target_os = "linux" , windows ) and `feature = "host"` and `test` and `windows` hold, not where `any ( target_os = "linux" , windows )` and `feature = "host"` and `windows` did) nvx-rs/tests/process.rs:487 nvx-rs/src/host/process/tests/orchestrator.rs:492
modified helper fn spawn in process/restricted (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test and windows hold, not where any ( target_os = "linux" , windows ) and feature = "host" and windows did) nvx-rs/tests/process.rs:496 nvx-rs/src/host/process/tests/orchestrator.rs:501
modified helper fn restrict in process/restricted (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test and windows hold, not where any ( target_os = "linux" , windows ) and feature = "host" and windows did) nvx-rs/tests/process.rs:516 nvx-rs/src/host/process/tests/orchestrator.rs:520
modified helper fn may_open in process/restricted (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test and windows hold, not where any ( target_os = "linux" , windows ) and feature = "host" and windows did) nvx-rs/tests/process.rs:567 nvx-rs/src/host/process/tests/orchestrator.rs:571
modified helper struct IdleChild in security_checklist (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test hold, not where any ( target_os = "linux" , windows ) and feature = "host" did) nvx-rs/tests/security_checklist.rs:318 nvx-rs/src/host/vm/tests/reattach.rs:377
modified helper impl IdleChild in security_checklist (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test hold, not where any ( target_os = "linux" , windows ) and feature = "host" did) nvx-rs/tests/security_checklist.rs:320 nvx-rs/src/host/vm/tests/reattach.rs:379
modified helper fn start in security_checklist (tests), impl IdleChild`` (moved, and it now compiles where any ( target_os = "linux" , windows ) and `feature = "host"` and `test` hold, not where `any ( target_os = "linux" , windows )` and `feature = "host"` did) nvx-rs/tests/security_checklist.rs:321 nvx-rs/src/host/vm/tests/reattach.rs:380
modified helper fn reference in security_checklist (tests), impl IdleChild`` (moved, and it now compiles where any ( target_os = "linux" , windows ) and `feature = "host"` and `test` hold, not where `any ( target_os = "linux" , windows )` and `feature = "host"` did) nvx-rs/tests/security_checklist.rs:332 nvx-rs/src/host/vm/tests/reattach.rs:394
modified helper impl Drop for IdleChild in security_checklist (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test hold, not where any ( target_os = "linux" , windows ) and feature = "host" did) nvx-rs/tests/security_checklist.rs:341 nvx-rs/src/host/vm/tests/reattach.rs:403
modified helper fn drop in security_checklist (tests), impl Drop for IdleChild`` (moved, and it now compiles where any ( target_os = "linux" , windows ) and `feature = "host"` and `test` hold, not where `any ( target_os = "linux" , windows )` and `feature = "host"` did) nvx-rs/tests/security_checklist.rs:342 nvx-rs/src/host/vm/tests/reattach.rs:404
modified imports the imports of security_checklist (tests) nvx-rs/tests/security_checklist.rs:12 nvx-rs/tests/security_checklist.rs:13
modified module mod restricted in process (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test and windows hold, not where any ( target_os = "linux" , windows ) and feature = "host" and windows did) nvx-rs/tests/process.rs:466 nvx-rs/src/host/process/tests/orchestrator.rs:470
modified test fn process_fixture in process (tests) (moved, and it now compiles where any ( target_os = "linux" , windows ) and feature = "host" and test hold, not where any ( target_os = "linux" , windows ) and feature = "host" did) nvx-rs/tests/process.rs:52 nvx-rs/src/host/process/tests/orchestrator.rs:54

... and 17 more, which the job's summary lists.

Test policy

Change What Before After
loosened allowlist entry nvx-rs/src/host/platform/linux/mod.rs (the seams allow 1 test hooks) scripts/test-layout-allowlist.json
loosened allowlist entry nvx-rs/src/host/platform/windows/mod.rs (the seams allow 1 test hooks) scripts/test-layout-allowlist.json
loosened allowlist entry nvx-rs/src/host/platform/windows/process.rs (the seams allow 2 test hooks) scripts/test-layout-allowlist.json

Relocated unchanged: 0; added: 10. Compared the merge base 04fbbd480bfb with 659b00524084.

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 platform-visibility change.

No open issues 🎉

What changed in this PR

This PR implements SL6.14 of the NVX library-slimming workstream: it makes host::platform crate-private while preserving the public interfaces in host::vm, host::transport, and host::runtime.

Changes:

  • Narrows platform visibility, removes unused directory helpers, and gates process-start-time helpers by their callers.
  • Moves platform-dependent integration tests into their owning modules and updates remaining outside callers.
  • Updates public-API snapshots, documentation, and coverage references to reflect the private platform layer.
File Description
scripts/​test-layout-allowlist.json Records four process-start-time test hooks.
nvx-rs/​tests/​supervisor.rs Removes Windows process tests relocated to unit tests.
nvx-rs/​tests/​security_checklist.rs Relocates saved-VM checks and updates checklist documentation.
nvx-rs/​tests/​cli/​one_shot.rs Reads fake-process start times without private APIs.
nvx-rs/​src/​host/​vm/​tests/​reattach.rs Receives saved-VM and endpoint-ownership checks.
nvx-rs/​src/​host/​process/​tests/​windows.rs Receives Windows process-access tests and helpers.
nvx-rs/​src/​host/​process/​tests.rs Registers the Windows unit-test module.
nvx-rs/​src/​host/​process.rs Documents start-time values without private API links.
nvx-rs/​src/​host/​platform/​windows/​process.rs Narrows and gates process-start-time helpers.
nvx-rs/​src/​host/​platform/​windows/​private.rs Deletes the unused directory helper.
nvx-rs/​src/​host/​platform/​windows/​mod.rs Narrows exports and gates the start-time re-export.
nvx-rs/​src/​host/​platform/​windows/​identity.rs Makes file identity crate-private.
nvx-rs/​src/​host/​platform/​other.rs Narrows fallback APIs and removes the unused directory helper.
nvx-rs/​src/​host/​platform/​mod.rs Removes public platform re-exports.
nvx-rs/​src/​host/​platform/​linux/​process.rs Makes process start time crate-private.
nvx-rs/​src/​host/​platform/​linux/​private.rs Deletes the unused directory helper.
nvx-rs/​src/​host/​platform/​linux/​mod.rs Narrows exports, gates start-time access, and removes an unused constant.
nvx-rs/​src/​host/​platform/​linux/​identity.rs Makes file identity crate-private.
nvx-rs/​src/​host/​mod.rs Makes the platform module crate-private and updates its documentation.
nvx-rs/​README.md Documents public transport paths and relocated tests.
nvx-rs/​public-api/​windows.txt Removes 11 platform API entries.
nvx-rs/​public-api/​linux.txt Removes 11 platform API entries.
nvx-rs/​examples/​external-launch.rs Imports Transport through its public transport path.
doc/​acceptance-case-matrix.md Points coverage references to the relocated VM test.

Review effort: Balanced

Four tests of nvx-rs run hold the fake OpenVMM that the CLI launched
through nvx::host::process, to see it exit and to end it if it does
not: forwarding_failure_stops_the_verified_vm_during_connect_and_
handshake, terminal_ctrl_c_cancels_boot_and_handshake_and_restores_
the_terminal on Linux and on Windows, and terminal_quit_and_suspend_
keys_remain_guest_console_input. Their helper, gated_native, named the
fake's process with nvx::host::platform::process_start_time, which
SL6.14 (#1127) makes private to the crate.

The tests drive the nvx-rs binary, so they stay integration tests, and
the helper reads the start time itself, as ProcessRef's documentation
defines it: on Linux, the starttime field of /proc/<pid>/stat, and on
Windows, the process's creation time as a 64-bit FILETIME, which
GetProcessTimes reports. It opens the same reference with
Process::open as before, so the four tests assert what they asserted.

Evidence: on Windows with Rust 1.95.0, cargo test --all-features
--test cli -- one_shot passes (17 passed, 2 ignored), with the two
tests that use the helper there; on nvx-kvm-test (Linux 6.6) and
nvx-mshv-test (Linux 6.18), tests/cli.rs passes whole (120 passed),
with the three tests that use it on Linux.

Part of #1127 (SL6.14).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
nvx::host::platform, the host's operating-system layer, was a public
module of nvx, with SUPPORTED, create_private_dir, file_identity,
process_start_time, and the Transport trait and TransportHandle. Its
public parts moved to host::vm, host::transport and host::runtime with
the new interface, and its last outside users are gone, so SL6.14
(#1127) makes it crate-private where it is.

The module becomes pub(crate), and its items pub(crate), as the
unreachable_pub lint asks. Transport and TransportHandle stay pub where
they are defined, since host::transport re-exports them as their public
path. host::vm's create_private_dir, host::transport and host::runtime
keep their public forms.

The compiler then finds what only the public paths kept alive:
- The platform's own create_private_dir, which nothing in the crate
  calls, goes on every host, with Linux's PRIVATE_DIR_MODE, which only
  it read; host::vm::create_private_dir is the VM directory's own
  function, and stays. SUPPORTED goes too: its last reader, the
  artifact discovery that SL6.6b deleted, is gone.
- process_start_time serves only the CLI, which checks the processes
  that its records name, and the unit tests, which name the processes
  that they start. Its re-export on Linux and Windows, and on Windows
  the function and the open_existing_process that only it calls, are
  gated by cfg(any(test, feature = "cli")): four hooks, which the
  test-layout allowlist records as seams of linux/mod.rs,
  windows/mod.rs and windows/process.rs. On other hosts, where no test
  reads it, the cli feature alone gates it, and the import of std::fs,
  which only the CLI's code uses there now.
Nothing that stays changes behavior.

The integration tests that reached the platform layer become unit
tests of their owners:
- tests/security_checklist.rs's
  a_saved_vm_runs_until_its_process_exits_and_another_runtime_is_
  refused_without_a_signal and reattaching_refuses_an_endpoint_that_
  another_process_serves_and_keeps_the_vm_and_its_values, with the
  idle child and its ignored idle_child, move to host::vm's reattach
  tests, whose vm_dir, cold_runtime, saved and bind helpers do what the
  checklist's private_directory, runtime, saved and endpoint_server
  did. The child starts under the spawn lock, as the other children of
  the unit tests do.
- tests/process.rs, whose tests of nvx::host::process name the
  children that they start by process_start_time, moves with git mv to
  host::process's tests as host::process::tests::orchestrator, with its
  seven tests unchanged. Its imports take crate paths, its module
  declaration holds its cfg, it names its fixtures by their unit-test
  paths, it starts its children under the spawn lock, as the other
  children of the unit tests start, and its Windows processes, whose
  security descriptors it restricts, allow the unsafe code that host's
  deny(unsafe_code) refuses.
The case matrix names the moved checklist test and the moved process
tests where they now live, and the checklist and the README say which
unit tests check them.

ProcessRef's documentation, which linked process_start_time, defines
the start time itself, and host's module docs and the README name the
platform layer as private: the README's module table and section cover
report alone, and the Transport paragraphs move to host::transport's
section, the trait's public path. The public-API snapshots drop
host::platform's 11 items on each platform, and only those.

Evidence, with Rust 1.95.0, on Windows: cargo clippy -D warnings passes
for --all-targets --all-features, --all-targets, --lib, --lib
--no-default-features, serde alone, --lib --bins with cli, and with
testing alone, for x86_64-unknown-linux-gnu with those sets, and for
x86_64-unknown-linux-musl with guest alone, --lib --bins and
--all-targets, which also compile the external-launch example; cargo
+1.89 check --all-targets --all-features and cargo check --all-targets
--all-features for aarch64-apple-darwin pass, the latter with the one
warning, in host::snapshot's tests, that the base has too; cargo doc
-D warnings, for Windows and Linux, public_api.py, check_test_layout.py,
check_markdown_links.py and the case matrix check pass; and cargo test
--lib passes for host::process, with the seven moved tests,
host::vm::tests::reattach, host::platform, host::transport and
host::vm_directory, with the default features and with all of them,
as do the security_checklist and host_modules tests and the CLI's
one-shot tests.

Part of #1127 (SL6.14).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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

The platform API visibility changes have no active review issues.

No open issues 🎉

Review effort: Balanced

@ppenna
Pedro Henrique Penna (ppenna) merged commit 1610f77 into feature/nvx-refactor Nov 12, 2026
87 of 90 checks passed
@ppenna
Pedro Henrique Penna (ppenna) deleted the agents/slim-sl6-14-platform-private branch November 12, 2026 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat-nvx-refactor tests-modified Changes existing tests, test data, or test wiring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants