Skip to content

nvx: limit address and lowering helpers to the network module - #2314

Merged
github-merge-queue[bot] merged 1 commit into
devfrom
agents/issue-2313-network-helper-visibility
Nov 28, 2026
Merged

github-merge-queue[bot] merged 1 commit into
devfrom
agents/issue-2313-network-helper-visibility

Conversation

@ppenna

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

Copy link
Copy Markdown
Contributor

Closes #2313

What does this pull request change?

host/network/address.rs and host/network/lowering.rs declared their production items pub(crate): the address family, interval and network types, interface parsing, summarizing, merging and subtracting, and the rule types, port selectors, destination grouping and lowering. This pull request declares them pub(super), so they stay visible to all of host::network and no further.

Only visibility changes, in these two files. The #[cfg(test)] hook address::tests and its probe stay as they are. CompiledEgressPolicy, LoopbackForward::parse, EgressRule::parse_native, template_arguments and dns_server keep pub(crate) because host::cli, host::config or host::vm uses them.

Why is this change needed?

mod.rs declares both modules private and re-exports none of these items, and their only users are arguments, loopback, lowering, rule, mod.rs and their tests, all inside host::network. The crate-wide visibility suggested that other modules could rely on the lowering internals. With pub(super), the compiler now rejects such a use, matching the siblings arguments::guest_subnet and rule::parse_rules. No signature that mentions these types is wider than pub(super), so private_interfaces does not apply.

How was this change validated?

Checks and results:

  • python scripts/local_gates.py --base origin/dev --run on Windows, with NVX set to a release nvx built by cargo build --release --locked --features cli --manifest-path nvx/Cargo.toml: test-changes, markdown-links, test-layout, nvx-format, nvx-lint, nvx-test, nvx-doc, nvx-msrv and nvx-cli passed.
  • cargo clippy --locked --manifest-path nvx/Cargo.toml --all-features --all-targets -- -D warnings (NVX_BUNDLE=skip): passed.
  • cargo test --locked --manifest-path nvx/Cargo.toml --all-features --lib -- host::network (NVX_BUNDLE=skip): 128 passed.
  • python scripts/public_api.py: passed; the snapshots are unchanged.
  • python scripts/check_test_changes.py --base origin/dev: no changes to existing tests.

Backend, host OS, host type, and guest: not applicable. No runtime behavior changes, and host::network has no platform-specific cfg.
Left to CI: Linux builds and the microVM matrices.

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.

The address and lowering modules declared their production items
pub(crate), yet only host::network uses them. Declare them pub(super),
as their siblings guest_subnet and parse_rules already are.

Closes #2313

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

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 remain for the change that narrows visibility of network-internal helpers and types.

No open issues 🎉

What changed in this PR

This PR tightens encapsulation of NVX’s network internals, addressing #2313 by limiting address and rule-lowering helpers to host::network.

Changes:

  • Changes production types, fields, and helpers from pub(crate) to pub(super).
  • Preserves access for existing network callers and leaves test hooks, runtime behavior, and the public API unchanged.
File Description
nvx/​src/​host/​network/​lowering.rs Restricts rule types, port selectors, and lowering helpers to the network module.
nvx/​src/​host/​network/​address.rs Restricts address types, parsing, and interval helpers to the network module.

Review effort: Balanced

@ppenna
Pedro Henrique Penna (ppenna) added this pull request to the merge queue Nov 28, 2026
@github-merge-queue
github-merge-queue Bot merged commit 840b404 into dev Nov 28, 2026
58 checks passed
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 address and lowering helpers to the network module

2 participants