Repository navigation
nvx: limit address and lowering helpers to the network module - #2314
Merged
github-merge-queue[bot] merged 1 commit intoNov 28, 2026
Merged
Conversation
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>
Contributor
There was a problem hiding this comment.
🟢 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)topub(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
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.
Closes #2313
What does this pull request change?
host/network/address.rsandhost/network/lowering.rsdeclared their production itemspub(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 thempub(super), so they stay visible to all ofhost::networkand no further.Only visibility changes, in these two files. The
#[cfg(test)]hookaddress::testsand its probe stay as they are.CompiledEgressPolicy,LoopbackForward::parse,EgressRule::parse_native,template_argumentsanddns_serverkeeppub(crate)becausehost::cli,host::configorhost::vmuses them.Why is this change needed?
mod.rsdeclares both modules private and re-exports none of these items, and their only users arearguments,loopback,lowering,rule,mod.rsand their tests, all insidehost::network. The crate-wide visibility suggested that other modules could rely on the lowering internals. Withpub(super), the compiler now rejects such a use, matching the siblingsarguments::guest_subnetandrule::parse_rules. No signature that mentions these types is wider thanpub(super), soprivate_interfacesdoes not apply.How was this change validated?
Checks and results:
python scripts/local_gates.py --base origin/dev --runon Windows, withNVXset to a releasenvxbuilt bycargo 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::networkhas no platform-specificcfg.Left to CI: Linux builds and the microVM matrices.
Checklist
python3 scripts/check_test_layout.pychecks.python3 scripts/check_test_changes.py --base origin/devlists no changeto an existing test, or a Changes to existing tests section below
explains each one.
.github/copilot-instructions.mdand the skills when a convention orworkflow changes.
nvxupdatesnvx/public-api/withpython3 scripts/public_api.py --update.description says how the change versions or migrates them.