Skip to content

host: import retained types from their low-level owners (SL6.0b) - #1477

Merged
Pedro Henrique Penna (ppenna) merged 1 commit into
feature/nvx-refactorfrom
agents/slim-sl6-0b-retained-imports
Nov 11, 2026
Merged

Pedro Henrique Penna (ppenna) merged 1 commit into
feature/nvx-refactorfrom
agents/slim-sl6-0b-retained-imports

Conversation

@ppenna

Copy link
Copy Markdown
Contributor

Part of #1120 (SL6.0b, "Retained modules no longer import legacy identity or handle paths"). Parent #1087, umbrella #1076.

What and why

The artifact modules, the snapshot key and PreparedLaunch stay after the slimming, but they named their identity and inherited-handle types through host::store and host::supervisor, which only re-export them and which #1121 deletes. Each import now names the module that owns the type:

File Before After
nvx-rs/src/host/artifacts/mod.rs host::store::RuntimeIdentity host::runtime::RuntimeIdentity
nvx-rs/src/host/artifacts/dir.rs host::store::{ArtifactIdentity, RuntimeIdentity} host::runtime::{ArtifactIdentity, RuntimeIdentity}
nvx-rs/src/host/artifacts/identity.rs host::store::ArtifactIdentity host::runtime::ArtifactIdentity
nvx-rs/src/host/snapshot/key.rs host::store::{ArtifactIdentity, MAX_IDENTITY_LEN, RuntimeIdentity} host::runtime::{ArtifactIdentity, MAX_IDENTITY_LEN, RuntimeIdentity}
nvx-rs/src/host/sandbox/prepared.rs host::supervisor::Inherited host::platform::inherit::Inherited

These are the same types: host::store re-exports the identities that host::runtime defines, and host::supervisor re-exports Inherited from host::platform::inherit. So artifact discovery, identity comparison, snapshot-key construction and prepared launches behave as before, and the public API doesn't change: scripts/public_api.py finds both snapshots current. BOOT_CONTRACT_VERSION and CONTROL_CONTRACT_REVISION don't change.

The issue's Scope names the snapshot key at its old path, host/template/key.rs, which SL2.12a (#1345) moved to host/snapshot/key.rs.

History: the first implementation

Enrique Saurez (@esaurez)'s first implementation is esaurez/slim-4.2.1-sl6.0b-20261108 (b9d3c3ae, checkpoint on #1120): one commit that changed the five production imports. This PR replays it as its only commit, with Enrique Saurez (@esaurez) as its author, and adds the two test imports that the slice's "Done when" needs: the artifact tests imported ArtifactIdentity from host::store, and the snapshot tests' builders, through which the snapshot-key tests build their identities (artifact, network_class), imported both identities from it. The prepared-launch tests never imported Inherited.

Not in this PR

As the issue's "Not in this PR" says, the other users that still name these types through host::store or host::supervisor keep them until the PRs that delete or switch them: the CLI's sandbox module, host::instance, the old clone path and template store, the store's and supervisor's own code and tests, the integration tests and runtime adapter that test them, and the external-launch example. The snapshot-key tests also still write a key with host::store::files::write_private, a store file helper rather than an identity.

Size

Measured against feature/nvx-refactor 35cedfdb: 5 core lines (estimate 30, stop 60) in 5 counted files, one use line each: host/artifacts/mod.rs, host/artifacts/dir.rs, host/artifacts/identity.rs, host/snapshot/key.rs and host/sandbox/prepared.rs. The two test files don't count.

Tests of the area

Every test is kept, unchanged; only the imports of two test modules change (see "Changes to existing tests" below).

Kept tests, by module
  • host::artifacts::tests (19): release_layout_names_the_guest_artifacts, repository_layout_is_detected_beside_the_guest_sources, the_directory_variable_accepts_a_repository_checkout, this_repository_uses_the_repository_layout, explicit_variables_win_and_must_be_complete, the_directory_variable_precedes_the_executable_directory, the_bundle_is_the_last_resort, incompatible_manifests_are_unavailable, repository_manifest_declares_the_supported_contract, guests_name_their_artifacts_as_nvx_py_does, a_checkout_holds_the_guest_artifacts_in_build, a_release_holds_the_guest_artifacts_in_guest, guest_artifacts_are_required_in_the_order_and_words_of_nvx_py, artifact_paths_serialize_every_guest_in_order, a_checkout_identifies_its_runtime_by_the_build_provenance_of_its_artifacts, a_release_identifies_its_runtime_by_its_checksum_list, metadata_that_is_not_a_regular_file_fails_at_once (cfg unix), located_artifacts_have_the_identity_of_their_directory, the_bundle_is_a_compatible_release (cfg feature = "bundled")
  • host::snapshot::key::tests (20): each_part_of_the_key_changes_it, each_contract_version_changes_the_key, a_generations_own_metadata_leaves_the_key_as_it_is, the_guest_build_is_not_part_of_a_snapshot_key, complete_capture_time_round_trips_without_changing_compatibility_identity, canonical_keys_require_capture_time_and_a_known_host_clock, a_key_holds_what_its_capture_made, a_capture_that_does_not_match_its_class_is_refused, a_class_selects_a_profile_as_openvmm_does, invalid_classes_are_refused, each_field_of_a_class_changes_its_identity, keys_read_back_from_their_canonical_encoding, keys_with_the_removed_guest_build_field_are_refused, snapshot_open_refuses_other_key_contracts_and_filesystem_tags (cfg any(target_os = "linux", windows)), other_encodings_of_a_key_are_refused, a_key_that_holds_its_network_s_lowering_after_its_invariants_is_refused, keys_of_machines_that_no_manifest_describes_are_refused, a_key_identity_is_the_identity_that_names_a_clones_template, identities_have_a_text_form, the_conformance_vectors_decode_and_encode
  • host::sandbox::prepared::tests (10): prepared_launches_hand_the_vmm_the_checked_files, an_upper_in_ram_takes_no_scratch_image, gpt_disks_are_prepared_from_their_bindings, prepared_launches_take_only_the_checked_files_of_their_plan, prepared_launches_refuse_final_paths_that_openvmm_cannot_take (cfg windows), prepared_launches_accept_balanced_brackets_in_final_paths (cfg windows), a_release_through_a_process_that_inherited_nothing_closes_none_of_its_handles (cfg windows), staging_checking_and_preparing_a_launch_read_no_content, no_plan_encodes_root_as_the_workload_identity, an_adapter_s_launch_renders_complete_arguments_that_fit_a_command_line
  • host::snapshot::tests (40): snapshot_open_checks_the_complete_directory_and_preserves_its_metadata, snapshot_open_refuses_every_missing_entry, snapshot_open_refuses_extra_entries_and_alternate_names, snapshot_open_refuses_every_directory_in_place_of_a_regular_file, snapshot_open_refuses_files_in_place_of_its_directories, snapshot_open_refuses_both_artifact_length_mismatches, snapshot_open_uses_the_strict_manifest_and_bounded_key_decoders, snapshot_open_refuses_a_key_from_another_manifest_machine, snapshot_description_contents_do_not_affect_opening, snapshot_open_refuses_a_compatible_key_with_another_capture_time, snapshot_open_refuses_every_shared_file_and_both_shared_directories (cfg target_os = "linux"), snapshot_open_refuses_entries_owned_by_another_user (cfg target_os = "linux"), snapshot_open_refuses_file_links_fifos_and_sockets_without_reading_them (cfg target_os = "linux"), snapshot_open_refuses_directory_links_even_with_trailing_separators (cfg target_os = "linux"), snapshot_description_needs_no_read_permission (cfg target_os = "linux"), snapshot_open_refuses_every_shared_file_and_both_shared_directory_acls (cfg windows), snapshot_open_refuses_directory_junctions_and_every_reparse_file_entry (cfg windows), snapshot_description_needs_no_data_read_access (cfg windows), a_restore_view_hard_links_only_the_fixed_openvmm_inventory, partial_restore_links_report_the_original_error_and_only_created_entries, snapshot_accepts_matching_real_disk_geometry_and_every_resource_boundary, snapshot_accepts_refuses_a_blockless_root_and_each_processor_mismatch, snapshot_accepts_treats_zero_boot_processors_as_all_capacity_online, snapshot_accepts_refuses_each_memory_mismatch_without_rounding_or_overflow, snapshot_accepts_reports_missing_image_and_scratch_files_as_io, snapshot_accepts_refuses_an_image_longer_than_its_placeholder, snapshot_accepts_refuses_each_image_block_size_mismatch, snapshot_accepts_refuses_each_scratch_geometry_mismatch, snapshot_accepts_refuses_both_nic_presence_mismatches_and_each_named_address_mismatch, snapshot_accepts_inherits_the_captured_address_and_does_not_compare_policies, snapshot_nic_returns_only_the_captured_presence_and_address_without_rereading, snapshot_open_refuses_captured_network_gateway_and_broadcast_addresses_as_io, snapshot_accepts_requires_the_boot_console_attachment_not_the_control_listener_or_device, snapshot_accepts_refuses_missing_and_unknown_boot_console_policies, snapshot_accepts_refuses_a_different_backend_and_each_cpu_profile_mismatch, snapshot_accepts_the_default_auto_and_matching_host_cpu_profile_requests, snapshot_accepts_refuses_nonregular_disks_without_waiting_for_a_fifo_writer (cfg target_os = "linux"), snapshot_accepts_refuses_every_runtime_identity_part_independently, snapshot_accepts_reports_early_and_expired_time_as_unavailable, snapshot_accepts_never_reopens_snapshot_paths_or_reads_runtime_artifacts

Validation

feature/nvx-refactor has no scripts/local_gates.py, so dev's copy, with --files, selected the gates, which ran with this branch's own action commands and pinned toolchain (1.95.0; MSRV 1.89), on Windows locally and on Linux on nvx-kvm-test (KVM, virtual machine, Azure Linux 3). The full matrix ran on 929bb2e8, based on 5947e4e8. The branch was then rebased onto 8b775211 (SL2.16) and onto 35cedfdb (after #1460 and SL4.3), without conflicts, and git range-diff shows the same patch each time. Of the changed files, only host/snapshot/tests.rs changed in those base commits, where SL2.16 added two restore-view tests and their fixture, away from its imports. On the head 49ea109f, these passed again on Windows: cargo fmt --all --check; cargo clippy -p nvx --lib --no-default-features -- -D warnings and the five Clippy runs of the Lint step; cargo test --locked --lib -- host::artifacts host::snapshot host::sandbox::prepared (126 passed) and the same with --all-features (130 passed); cargo doc --all-features with -D warnings; check_test_layout.py; check_test_changes.py; and public_api.py.

Gate, on 929bb2e8 Windows Linux
cargo fmt --all --check Passed Passed
Clippy with -D warnings, the five feature sets of the Lint step Passed Passed
cargo test --locked --all-features Failed: pre-existing flakes, below Failed: pre-existing guest::* failures, below
cargo test --locked Failed: pre-existing flakes, below Passed
cargo build and cargo test --lib, --no-default-features Passed Passed
Artifact bundling, --features bundled artifacts on a synthetic release Passed Passed
cargo doc --all-features with -D warnings Passed Passed
scripts/public_api.py (both snapshots) Passed, unchanged Passed, unchanged
MSRV: cargo +1.89 check --all-targets --all-features Passed Passed
macOS: cargo check --target aarch64-apple-darwin Passed Passed
nvx.py check-guest-binaries - Failed: pre-existing guest::* failures, below
nvx.py build-guest-binaries, test-guest-binaries - Passed
Runtime adapter: protocol-only and host-only, and guest-only on Linux Passed Passed
check_test_layout.py, check_markdown_links.py Passed -

Every failure also fails at the base on the same host:

  • Windows. Under 82-99 % CPU load from parallel builds, four timing- and spawn-sensitive tests fail intermittently at both revisions: host::cli::snapshots::capture::tests::a_capture_ack_and_successful_output_without_timely_exit_are_stopped_but_never_finished, host::template::clone::tests::restore::the_restore_to_ready_deadline_runs_from_the_launch_through_every_step, host::platform::windows::tests::children_inherit_only_their_standard_handles, and host::vm::tests::an_unrelated_process_started_in_the_library_spawn_window_gets_no_vm_claim. Run alone, the last three pass at both, and the first fails 1 run in 3 at the head and 1 in 5 at the base. The default-feature unit-test binaries of the two revisions differ in 285 of 23.9 M bytes: the PE header and panic line numbers. With --no-fail-fast, every integration test and doctest passes.
  • Linux. With --all-features, the same 28 tests of guest::{entry, exec, init, managed_agent} fail at both revisions, and the guest musl suite of check-guest-binaries fails the same 26 at both. These tests reach none of the changed modules, which the guest build doesn't compile.

No microVM scenario ran: the change renames imports of the same types and changes no runtime behavior. CI runs the selected hypervisor suites on KVM, MSHV and WHP.

Changes to existing tests

python3 scripts/check_test_changes.py --base origin/feature/nvx-refactor lists two changes, both imports, hence the tests-modified label:

  • host::artifacts::tests (nvx-rs/src/host/artifacts/tests.rs) imports ArtifactIdentity from host::runtime instead of host::store. It's the same type, and no test changes.
  • host::snapshot::tests (nvx-rs/src/host/snapshot/tests.rs) imports ArtifactIdentity and RuntimeIdentity from host::runtime instead of host::store, in its existing host::runtime import. They're the same types, and no test or builder changes.

The openvmm gitlink doesn't move.

The artifact modules, the snapshot key and PreparedLaunch stay after
the slimming, but they named ArtifactIdentity, RuntimeIdentity,
MAX_IDENTITY_LEN and Inherited through host::store and
host::supervisor, which only re-export them and which later PRs
delete. Each import now names the module that owns the type:
host::runtime for the identities, and host::platform::inherit for
Inherited. The types are the same, so artifact discovery, identity
comparison, snapshot keys and prepared launches behave as before, and
the public API does not change.

The artifact tests, and the snapshot tests' builders, through which
the snapshot-key tests build their identities, import the identities
from host::runtime too.

Copilot-Session: 1b7e900c-27be-4ae2-9d4b-a912e7dac394
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ppenna Pedro Henrique Penna (ppenna) added tests-modified Changes existing tests, test data, or test wiring feat-nvx-refactor labels Nov 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request changes existing tests

It modifies or removes 2 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 imports the imports of host::artifacts::tests nvx-rs/src/host/artifacts/tests.rs:4 nvx-rs/src/host/artifacts/tests.rs:4
modified imports the imports of host::snapshot::tests nvx-rs/src/host/snapshot/tests.rs:7 nvx-rs/src/host/snapshot/tests.rs:7

Relocated unchanged: 0; added: 0. Compared the merge base 35cedfdbc3a8 with 49ea109f9165.

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 import-path cleanup supporting the planned store and supervisor removal.

No open issues 🎉

What changed in this PR

This PR prepares retained host code for the planned store and supervisor removal in #1120 by importing types directly from their low-level owners. The changes are limited to imports; runtime behavior and the public API remain unchanged.

Changes:

  • Import artifact and snapshot identities from host::runtime.
  • Import PreparedLaunch’s inherited-handle type from host::platform::inherit.
  • Update two test modules to use the retained identity paths without changing test logic.
File Description
nvx-rs/​src/​host/​snapshot/​tests.rs Imports test identity types from host::runtime.
nvx-rs/​src/​host/​snapshot/​key.rs Imports identities and their length limit from host::runtime.
nvx-rs/​src/​host/​sandbox/​prepared.rs Imports Inherited directly from the platform layer.
nvx-rs/​src/​host/​artifacts/​tests.rs Imports ArtifactIdentity from host::runtime.
nvx-rs/​src/​host/​artifacts/​mod.rs Uses the retained runtime identity path.
nvx-rs/​src/​host/​artifacts/​identity.rs Uses the retained artifact identity path.
nvx-rs/​src/​host/​artifacts/​dir.rs Imports both identity types from host::runtime.

Review effort: Balanced

@ppenna
Pedro Henrique Penna (ppenna) merged commit d40228b into feature/nvx-refactor Nov 11, 2026
47 checks passed
@ppenna
Pedro Henrique Penna (ppenna) deleted the agents/slim-sl6-0b-retained-imports branch November 11, 2026 09:12
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