Repository navigation
nvx-rs: drop the guest::clone alias and the code that stale dead-code expectations hid - #1566
Merged
Pedro Henrique Penna (ppenna) merged 4 commits intoNov 13, 2026
Conversation
SL7.3 renamed guest::clone to guest::activation and kept the old name as an alias until SL5.2 deleted the test adapter, its last user (#1105). SL5.2 (#1499) found that nothing used the alias any more, and the slices after it left it in place, since their scopes didn't name it, so the breaking release would have published it as API. The alias goes, with its 144 lines of the Linux public-API snapshot; the Windows snapshot has no guest module. The crate's README no longer calls it a compatibility alias, the migration guide maps guest::clone to guest::activation without keeping the old name, the changelog lists the rename among the breaking changes, and protocol::status names the repair's error at guest::snapshot, where the repair runs. Part of #1076. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
nvx-init's plain-process core (SL7.5c, #1115) carried expectations of dead code, outside tests, until SL7.6a (#1116) used it. SL7.6a merged, but the expectations stayed, and hid what the core's only user, the managed agent, never uses: - AccountMode::Existing, the check that an execution's IDs name an account of the root's passwd and group databases: the agent always starts its workloads by their numeric IDs, so AccountMode and ExecRequest::account go with it. - StartFailure::into_parts: the agent reads the failure's fields. - Outcome's cause and discarded: the agent decides an execution's outcome from its own cancellation, timeout and session flags, and the terminal status, so Event::Ended carries the status alone. - The discard path: reset() closes both outputs as it marks them discarded, so no read ever discarded, and only Outcome counted the bytes. The marks, the counts and Event::Discarded go. - The streams of Closed and ReadFailed, and ReadFailed's error, which the agent maps to events of its own without them. - Exec::output_hung_up and sys::hung_up, which only a test called. Nothing that runs changes. The test-layout allowlist records the two test hooks that init.rs keeps. Tests: the exec tests read the execution's cause where they read its outcome's. only_the_collectors_terminal_status_settles_the_owned_leader_and_output counts the closed outputs, and no longer asks whether a closed output hung up. ending_failures_are_reported_and_discarding_preserves_the_first_cause becomes ending_failures_are_reported_and_the_first_cause_is_kept: it checks the same kill failures, cause and status, with both outputs delivered. invalid_requests_fail_before_a_child_starts drops the missing-account case, and privileged_exec_checks_account_mode_and_enters_cwd_after_dropping_credentials becomes privileged_exec_needs_no_account_and_enters_cwd_after_dropping_credentials, without the account databases' fixtures. The launch tests no longer check the account mode, and the restore tests import io::Read. Part of #1076. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
cold_boot returns the switched root in Layered, beside what the managed agent takes, and an expectation of dead code that named SL7.6b (#1116) covered Layered, since nothing reads the root's field: serve_boot moves the other fields out, and the root stays in the partly moved boot until serve_boot returns. SL7.6b merged, but the root must still live as long as the service: it holds the lock of its runtime directory and the descriptors of its view and live shares. serve_boot now moves the root into a binding of its own, which a comment explains and which drops at the same point, so the expectation goes and nothing that runs changes. The test-layout allowlist drops boot.rs, which keeps no test hook. Part of #1076. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
vm's KEY and DESCRIPTION, a finished capture's key.bin and snapshot.json, carried expectations of dead code until SL2.12b and SL2.14 (#1102) used them. Those slices named the files with snapshot::KEY_FILE and snapshot::DESCRIPTION_FILE instead, which finish_capture writes into the VM's directory, so only vm's tests used the copies. They go, and the tests check that the directory reserves snapshot's names and that a cold capture VM's directory holds none of them. Process::wait_bool also stays from the old lifecycle: it kept a boolean wait "for the legacy lifecycle callers", which phase 4 of #1076 deleted, and wait was its only caller. wait now waits itself. The test-layout allowlist drops vm.rs, which keeps no test hook. Part of #1076. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
This pull request changes existing testsIt modifies or removes 30 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
Relocated unchanged: 0; added: 1. Compared the merge base |
Pedro Henrique Penna (ppenna)
merged commit Nov 13, 2026
ccd2384
into
feature/nvx-refactor
45 checks passed
Pedro Henrique Penna (ppenna)
deleted the
agents/slim-drop-clone-alias-and-dead-code
branch
November 13, 2026 06:10
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.
Part of #1076. It removes scaffolding that the slices of #1105 (SL7.3), #1116 (SL7.6a, SL7.6b), #1102 (SL2.12b, SL2.14) and #1100 (SL2.9a) left behind after they merged.
What and why
A check of #1076's issues against this branch's head,
367f7fe4, found every planned pull request merged. It also found two kinds of scaffolding still in place that the issues said must end. This PR removes both before the breaking release.The
guest::clonealias. SL7.3 renamedguest::clonetoguest::activation, and kept an alias until SL5.2 deleted the test adapter (#1105). SL5.2 (#1499) found that nothing used the alias any more, but SL6.11c, SL6.11d, SL6.13b and SL6.10g each left it, because their scopes didn't name it.0.2.0-alpha.1would have published it: 144 lines of API that #1076's planned surface doesn't hold, and whose later removal would break the release's users a second time.pub use activation as clone;goes, andpublic_api.py --updatedrops its 144 lines fromnvx-rs/public-api/linux.txt. The Windows snapshot has no guest module.nvx-rs/README.mdno longer calls it a compatibility alias.doc/migrate-from-alpha.7.mdmapsguest::clonetoguest::activationand drops the old name.CHANGELOG.mdlists the rename among the breaking changes, andprotocol::statusnamesguest::snapshot::RepairError::status.Stale dead-code expectations. Eight
#[cfg_attr(not(test), expect(dead_code, reason = "…"))]attributes named callers in slices that had already merged: SL7.6a five times inguest/init.rs, SL7.6b inguest/init/boot.rs, and SL2.12b and SL2.14 inhost/vm.rs. Turned into warnings, they let the compiler report 11 items that nothing outside tests uses, and #1076's PR rules don't allow such items in production files:AccountMode::Existing, which checks that an execution's IDs name an account in the root'spasswdandgroup. The managed agent, the core's only user, always starts workloads by numeric ID, soAccountModeandExecRequest::accountgo too.StartFailure::into_parts. The agent reads the fields directly.Outcome'scauseanddiscarded. The agent decides an outcome from its own cancellation, timeout and session flags plus the terminal status, soEvent::Endednow carries only the status.ClosedandReadFailed, andReadFailed's error. The agent maps these events to its own events without them.Exec::output_hung_up, withsys::hung_up, which only a test called.discardedcount.reset()closes both outputs as it marks them discarded, so no read ever discarded anything. The marks, the counts andEvent::Discardedgo.Layered::root(SL7.6b) is not dead.serve_bootmoves the other fields out, and the switched root stays in the partly movedbootuntil the service ends, holding its runtime directory's lock and the descriptors of its view and live shares.serve_bootnow moves it into a_rootbinding of its own, with a comment, which drops at the same point.vm::KEYandvm::DESCRIPTION(SL2.12b, SL2.14). Those slices named the filessnapshot::KEY_FILEandsnapshot::DESCRIPTION_FILE, whichfinish_capturewrites into the VM's directory, so onlyvm's tests used the copies. The tests now checksnapshot's names.Process::wait_bool(SL2.9a) kept a boolean wait "for the legacy lifecycle callers", which phase 4 deleted.wait, its only caller, now waits itself.Runtime behavior doesn't change: no production path read what goes.
scripts/test-layout-allowlist.jsonrecords the test hooks that remain, viacheck_test_layout.py --tighten: 2 ininit.rs, and none inboot.rsorvm.rs.Decisions
Exec::causestays.deadline()andend_withuse it. The tests that read an outcome's cause now read the execution's, so they check the same thing.Layered::rootstays held, not removed. Dropping it at the end ofcold_bootwould release the runtime directory's lock and close the view's and the shares' descriptors early.Tests
python3 scripts/check_test_changes.py --base origin/feature/nvx-refactorlists 30 changes to existing tests and 1 addition, so the PR has thetests-modifiedlabel:Collected,stepandfinishcollect the terminal status instead of the outcome.requestdrops the account mode, andpipe_executiondrops the removed fields.procfs_workload_cwd_checks,host_launch_tests_use_the_syscall_seam_without_mocking_the_execution_core,privileged_exec_resets_priority_credentials_and_signals_before_execandprivileged_exec_streams_pipes_and_reports_its_statusreadcollected.status.unwrap()where they readcollected.outcome.unwrap().status.only_the_collectors_terminal_status_settles_the_owned_leader_and_outputcounts the closed outputs and reads the execution's cause. It no longer checks the discarded counts, which are gone. It also no longer asks whether a closed output hung up, which the preceding check that no output is open already covers.ending_failures_are_reported_and_discarding_preserves_the_first_causebecomesending_failures_are_reported_and_the_first_cause_is_kept. It checks the same kill failures, cause and status, and since no output is discarded any more, both outputs are delivered.invalid_requests_fail_before_a_child_startsdrops its missing-account case.privileged_exec_checks_account_mode_and_enters_cwd_after_dropping_credentialsbecomesprivileged_exec_needs_no_account_and_enters_cwd_after_dropping_credentials; the tool lists it as removed and added. It keeps the run under numeric IDs that no account names, and the working-directory checks. It drops the account databases' fixtures and their helper,check_account_fixture.a_failed_start_preserves_its_first_errno_and_the_cleanup_failuredestructures theStartFailureinstead of callinginto_parts, with the same assertions.a_stolen_or_auto_reaped_status_is_reported_once_and_never_reclassified_by_an_ending,privileged_every_ending_kills_the_process_group_including_normal_completionandprivileged_capture_sweep_kills_setsid_escapees_and_spares_both_helpersread each cause from the execution.direct_launch_uses_the_plain_process_core_without_a_helper_or_cgroupno longer checks the account mode, andprivileged_direct_launch_hardens_credentials_and_resets_prioritymatches the new events.the_reserved_names_are_the_documented_ones_and_leave_the_openvmm_prefix_to_openvmmandcapture_creation_records_sparse_disks_devices_and_a_complete_serde_contextnamesnapshot::KEY_FILEandsnapshot::DESCRIPTION_FILE.Size
guest/init.rs(10),host/process.rs(3),guest/managed_agent/exec.rs(2),guest/managed_agent/launch.rs(1) andguest/sys/mod.rs(1). It deletes 166 lines of code.guest/mod.rs,guest/init/boot.rs,guest/sys/poll.rsandhost/vm.rsonly lose lines, andprotocol/status.rschanges a doc comment's path. Almost all of it is code that leaves.Commits
guest: drop guest::clone, the alias of guest::activationguest: delete what only the exec core's tests usedguest: hold the switched layered root without a dead-code expectationhost: drop the VM directory's copies of the snapshot names, which also foldsProcess::wait_boolintowaitEach commit passes
check_test_layout.py, and Clippy with warnings denied both forx86_64-unknown-linux-gnuwith every feature and forx86_64-unknown-linux-muslwith the guest feature alone.Not in this PR
guest::snapshot::CaptureStage::Fence, which no capture produces any more. It is public API, and SL6.11c left its removal to a later PR.host::nvxs, the compatibility path ofhost::transport'sHostConnectionandHostConnectionError, which no issue of nvx-rs slimming workstream: makenvxa library of mechanisms and value types #1076 names.BOOT_CONTRACT_VERSIONandCONTROL_CONTRACT_REVISION, which nothing here changes.Validation
All checks ran on the head,
c251d842, with Rust 1.95.0 and the locked dependencies. This branch has nolocal_gates.py, so the commands are those of itscheck-nvx-rsandcheck-qualityactions that the change selects.Windows (
x86_64-pc-windows-msvc):cargo fmt --all --check: passed.cargo clippy -- -D warnings: passed with--all-targets --all-features;--lib;--lib --no-default-features;--lib --no-default-features --features serde;--lib --bins --features cli; and--lib --bins --no-default-features --features testing.cargo clippy --target x86_64-unknown-linux-gnu -- -D warnings: passed with--all-targets --all-features, and for the library with default features, without them, withserde,cliandtestingalone.cargo clippy --target x86_64-unknown-linux-musl --no-default-features --features guest --all-targets -- -D warnings: passed.cargo test --locked --all-features,cargo test --lockedandcargo test --locked --lib --no-default-features: passed, with 1065, 518 and 191 library tests.RUSTDOCFLAGS="-D warnings" cargo doc --locked --no-deps --all-features: passed, also forx86_64-unknown-linux-musl.cargo +1.89 check --locked --all-targets --all-features: passed.cargo check --locked --all-targets --all-features --target aarch64-apple-darwin: passed. Its one warning, about two test helpers ofhost::snapshotthat the macOS build doesn't use, predates this PR.python scripts/public_api.py: passed.--updatechanged onlylinux.txt, by the alias's 144 lines.python scripts/check_test_layout.pyandpython scripts/check_markdown_links.py: passed.python -m unittest scripts.test_crate_release scripts.test_public_api scripts.test_test_layout scripts.test_test_changes: passed.Linux (WSL 2, Ubuntu, kernel 6.18):
cargo test --locked --all-features: passed, with 1768 library tests passed and 59 ignored.cargo test --lockedandcargo test --locked --lib --no-default-features: passed.cargo test --locked --target x86_64-unknown-linux-musl --no-default-features --features guest: passed, with 855 library tests passed and 32 ignored.ending_failures_are_reported_and_the_first_cause_is_keptincluded.#[ignore]d privileged test, run as root:privileged_exec_needs_no_account_and_enters_cwd_after_dropping_credentials,privileged_every_ending_kills_the_process_group_including_normal_completion(all five endings),privileged_capture_sweep_kills_setsid_escapees_and_spares_both_helpers,privileged_exec_resets_priority_credentials_and_signals_before_exec,privileged_exec_streams_pipes_and_reports_its_statusandprivileged_direct_launch_hardens_credentials_and_resets_priority: all passed.cargo +1.89 check --locked --all-targets --all-features: passed.Left to CI:
validate-nvx, whose inputs this PR doesn't change.