Registry Mirror
Skip to content

Conversation

@ppenna

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

Copy link
Copy Markdown
Contributor

Fixes #1981

What does this pull request change?

Restrict the three fields and three formatting methods of host::cli::args::Syntax
from pub(crate) to pub(super), the CLI module and its descendants.

The entire diff is six insertions and six deletions in
nvx/src/host/cli/args.rs. No expression, message, field type, public API
snapshot, test, protocol byte, dependency, feature, or unsafe block changes.
CLI and guest command lines, output, and exit statuses remain identical.

Why is this change needed?

Only CLI command descriptions and CLI error/help rendering use these members.
Their crate-wide visibility permits unrelated modules to couple to CLI
presentation details. The narrower visibility expresses and enforces their
existing ownership.

Private visibility would exclude the parent and sibling CLI modules. The
Syntax type retains its visibility because crate-visible Exit constructors
name it in their signatures; changing those interfaces or other parser items
is outside this focused slice. No new abstraction or error path needs a new
test. Module-purpose and layout documentation remains accurate.

How was this change validated?

Base: b5405859f31da6592b2cc9ed73f8fe0eac0e3999.
Head: 55db64e0868317d96c038f7469f9b07d21a5d239.

Tests are unchanged, as requested for this behavior-preserving task.

Environment Base Head
Local Windows; no hypervisor used 10 parser tests and 2 CLI usage tests passed Same 10 parser tests and 2 CLI usage tests passed
Configured Linux test profile; Azure Linux 3, KVM-capable virtual machine; isolated temporary worktrees, no guest started 10 parser tests and 2 CLI usage tests passed Same 10 parser tests and 2 CLI usage tests passed

The commands on both revisions were:

  • cargo test --locked --manifest-path nvx/Cargo.toml --all-features --lib host::cli::args::tests -- passed, 10 tests.
  • cargo test --locked --manifest-path nvx/Cargo.toml --all-features --test cli usage:: -- passed, 2 tests.
  • python scripts\nvx.py verify (Windows) / python3 scripts/nvx.py verify (Linux) -- passed before builds.
  • cargo build --release --locked --features cli --manifest-path nvx/Cargo.toml -- passed on both platforms at head.
  • python scripts\check_test_changes.py --base origin/dev -- passed: zero test changes.
  • git diff --check -- passed.
  • git diff --shortstat origin/dev HEAD -- 1 file, 6 insertions, 6 deletions.

An initial Windows usage-test invocation with --features cli selected zero
tests because the integration harness also needs testing; it was corrected
to --all-features, and only the two-test result above is counted.

Windows selected gates: $env:PIP_DRY_RUN='1'; $env:PIP_NO_INDEX='1'; python scripts\local_gates.py --base origin/dev --run
-- passed all nine gates: test changes, Markdown links, test layout, formatting,
all Clippy feature combinations, Rust tests, documentation, MSRV, and CLI
validation. The CLI action ran 2314 Python tests (89 standard platform skips)
and 84 adversarial tests (11 standard platform skips), with no failures.
The pinned PyYAML 6.0.3 was already installed; the environment settings made
the action's package-install setup a dry run. No packages were installed.

Linux selected gates: PIP_DRY_RUN=1 PIP_NO_INDEX=1 python3 scripts/local_gates.py --base origin/dev --run --keep-going
-- twelve gates passed, including the public API check against both snapshots,
the feature matrix, MSRV, macOS target check, and guest lint/build/tests.
The raw nvx-cli gate failed at its setup command because this host has no
pip. An earlier invocation stopped at Markdown links because it has
python3 but no python; a temporary, process-local python alias to the
same interpreter resolved that prerequisite and was removed afterward.

Every Linux CLI action test command was then run separately, verbatim from
the action, omitting only its unavailable package-install setup. All passed
with the host's existing PyYAML 6.0.1: 2314 Python tests (41 standard platform
skips), 84 adversarial tests, compilation, and help commands. This is test
evidence, not a claim that the original pip setup passed. Exact commands:

python3 -m compileall -q scripts
python3 -m unittest scripts/test_performance.py scripts/test_nvx_tools.py scripts/test_nvx_cli.py scripts/test_nvx_wrapper.py scripts/test_nvx_common.py scripts/test_nvx_release.py scripts/test_kconfig.py scripts/test_kernel_config.py scripts/test_guest_binaries.py scripts/test_microvm_tests.py scripts/test_nightly_ci.py scripts/test_development_release.py scripts/test_crate_release.py scripts/test_host_telemetry.py scripts/test_time_abi.py scripts/test_tool_versions.py scripts/test_markdown_links.py scripts/test_module_diagrams.py scripts/test_nvx_mutants.py scripts/test_nvx_coverage.py scripts/test_nvx_scenario_coverage.py scripts/test_setup_azure.py scripts/test_setup_azure_linux.py scripts/test_setup_azure_windows.py scripts/test_powershell_testing.py scripts/test_test_layout.py scripts/test_test_changes.py scripts/test_public_api.py scripts/test_scripts_coverage.py scripts/test_openvmm_git.py scripts/test_openvmm_pin.py scripts/test_openvmm_release.py scripts/test_local_gates.py scripts/test_pr_threads.py scripts/test_ci_triage.py scripts/test_issue_workspace.py scripts/test_host_worktree.py scripts/test_rebase_check.py scripts/test_nvx_hosts.py scripts/test_host_probe.py scripts/test_benchmark_series.py scripts/test_label_issues.py scripts/test_issue_link.py -v
python3 scripts/test_adversarial.py -v
python3 scripts/nvx.py --help
python3 scripts/nvx.py test-openvmm-unit --help
python3 scripts/nvx.py test-openvmm --help
python3 scripts/nvx.py test-microvm --help
python3 scripts/nvx.py test-adversarial --help
python3 scripts/nvx.py benchmark --help
python3 scripts/nvx.py doctor --help

Both temporary Linux worktrees were removed. The original host checkout,
submodule, and pre-existing processes were preserved.

Local runtime scenarios are not needed for a visibility-only change.
The selected KVM/MSHV/WHP microVM suites, platform checks, and performance
regression gate passed in current-head CI run 45033533190,
including Required status check, Linux and Windows crate/CLI checks, and
the public API check. The run did not publish releases or performance history.

Copilot reviewed head 55db64e0868317d96c038f7469f9b07d21a5d239 with approval
recommended and no findings. There are no review threads. The Ready PR is
left unmerged and unqueued for maintainer approval.

Checklist

  • Tests cover the new or fixed behavior, in the layout that
    python3 scripts/check_test_layout.py checks.
  • python3 scripts/check_test_changes.py --base origin/dev lists no change
    to an existing test, or a Changes to existing tests section below
    explains each one.
  • The documentation that the change affects is updated, including
    .github/copilot-instructions.md and the skills when a convention or
    workflow changes.
  • A change to the public API of nvx updates nvx-rs/public-api/ with
    python3 scripts/public_api.py --update.
  • Snapshots, protocols, and on-disk formats stay compatible, or the
    description says how the change versions or migrates them.

Restrict Syntax's three fields and presentation methods to host::cli.
Only CLI commands and their tests use these members. Keep the type's
visibility because crate-visible Exit constructors name it.

At base b540585, all ten parser and two CLI usage tests pass on
Windows and a Linux KVM virtual machine. The same unchanged tests pass
with this visibility change on Windows. No expression, diagnostic,
protocol, public API snapshot, or test changes.

Refs #1981.

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

There are no active review issues for the change restricting Syntax members to the CLI module subtree.

No open issues 🎉

What changed in this PR

Addresses #1981 by restricting Syntax members to host::cli and its descendants, enforcing the existing ownership of CLI presentation details.

Changes:

  • Narrows three fields and three formatting methods from pub(crate) to pub(super).
  • Leaves the Syntax type’s visibility, runtime behavior, public API, and tests unchanged.
File Description
nvx/​src/​host/​cli/​args.rs Limits six Syntax members to the CLI module subtree.

Review effort: Balanced

@ppenna
Pedro Henrique Penna (ppenna) added this pull request to the merge queue Nov 22, 2026
Merged via the queue into dev with commit c4f37e5 Nov 22, 2026
58 checks passed
@ppenna
Pedro Henrique Penna (ppenna) deleted the agents/issue-1981-cli-syntax-member-scope branch November 22, 2026 17:49
Aaqibhafeez Khan (Aaqibhafeezkhan) pushed a commit to Aaqib-OSS/nvx that referenced this pull request Nov 30, 2026
The argument parser, Deadline, NetworkOptions and NativeRules, and the
guest-agent Session with its ExecRequest and ExecResult declared their
items pub(crate). host/cli/mod.rs declares these modules private and
re-exports none of their items, so only host::cli can name them, and
pub(crate) made a reader search the whole crate for their users.

Declare the 42 items pub(super), which in a file directly under
host/cli/ is host::cli and its descendants, as microsoft#1980, microsoft#1982, and microsoft#2011
did for other members of these files. Only visibility changes: the
generated code, the CLI's output, and the public API are the same.
download.rs, run.rs, and sandbox/ keep theirs, since open pull requests
change them.

Evidence: at a6ec7d4 on Windows, cargo clippy --locked with
--all-targets --all-features and with --lib --bins --features cli
passes with -D warnings, without private_interfaces warnings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

nvx: limit syntax members to the CLI module

2 participants