Skip to content

nvx: limit platform-only checks to the platform module - #2307

Merged
Pedro Henrique Penna (ppenna) merged 1 commit into
devfrom
agents/issue-2304-limit-platform-check-helpers
Nov 28, 2026
Merged

Pedro Henrique Penna (ppenna) merged 1 commit into
devfrom
agents/issue-2304-limit-platform-check-helpers

Conversation

@ppenna

Copy link
Copy Markdown
Contributor

Fixes #2304

What does this pull request change?

Makes three helpers of nvx::host::platform private instead of pub(crate), since only the platform module uses them:

  • check_working_dir in nvx/src/host/platform/mod.rs (Windows only), whose one caller is spawn_listed in platform/windows/spawn.rs, a descendant of platform. That module can still reach a private item of its ancestor.
  • check_owner_only_dir in platform/linux/private.rs and platform/other.rs, which is called only by check_published_dir in the same file, and which no mod.rs re-exports.

Behavior, error messages, and the public API of nvx are unchanged. The diff changes 3 lines.

Why is this change needed?

The crate-wide visibility made these checks look like crate-level helpers. Limiting each to the module that uses it states its real scope and keeps new callers from depending on platform internals. Making check_working_dir pub(super) was rejected because, in platform/mod.rs, that would expose it to all of host.

How was this change validated?

Checks and results:

  • python scripts\local_gates.py --base origin/dev --run on Windows: test-changes, markdown-links, test-layout, nvx-format, nvx-lint, nvx-test, nvx-doc, nvx-msrv, and nvx-cli all passed.
  • WSL Ubuntu, Linux build of nvx with NVX_BUNDLE=skip:
    • cargo clippy --locked --all-targets --all-features -- -D warnings: passed.
    • cargo test --locked --all-features --lib host::platform: 27 passed.
  • python scripts/check_test_changes.py --base origin/dev: 0 changes to existing tests.

Backend, host OS, host type, and guest: none. This is a compile-time visibility change and boots no microVM.
Left to CI: the microVM scenarios that local_gates selects for whp/kvm/mshv, Linux check-nvx on its runners, and benchmarks. No configured KVM host was reachable.

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/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.

check_working_dir and check_owner_only_dir were crate-visible although only
host::platform uses them, so make them private.

Fixes #2304

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 28, 2026 03:41

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 reported for the changes making three platform-internal helpers private.

No open issues 🎉

What changed in this PR

Addresses #2304 by making three platform-internal helpers private, matching their actual usage within nvx::host::platform. Runtime behavior, error messages, and the public API remain unchanged.

Changes:

  • Makes the Windows working-directory check private while preserving access from descendant modules.
  • Makes the Linux and unsupported-host owner-only directory checks private to their respective modules.
File Description
nvx/​src/​host/​platform/​other.rs Makes the fallback check_owner_only_dir private.
nvx/​src/​host/​platform/​mod.rs Makes Windows-only check_working_dir private.
nvx/​src/​host/​platform/​linux/​private.rs Makes Linux’s check_owner_only_dir private.

Review effort: Balanced

@ppenna
Pedro Henrique Penna (ppenna) added this pull request to the merge queue Nov 28, 2026
Merged via the queue into dev with commit d75c47c Nov 28, 2026
56 checks passed
@ppenna
Pedro Henrique Penna (ppenna) deleted the agents/issue-2304-limit-platform-check-helpers branch November 28, 2026 15:51
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 check_working_dir and check_owner_only_dir to the platform module

2 participants