Skip to content

network: keep address-family upper bounds private #1700

Closed

Description

Area: area: nvx (host::network::address).

Base revision: e5330ad60af7f734a7a2fa75338053b0b064e4d1.

What is over-exposed

Family::last_address is pub(crate), although every use is inside its defining host::network::address module:

Caller Use at the base revision
Family::everything Constructs the inclusive interval of all addresses of a family.
Network::host_mask Shifts the family's upper bound to obtain the host mask.
Summary::next Stops summarizing at the end of the family's address space.

All Rust references to last_address in the crate were searched and read at this base revision: there are exactly these three calls and the declaration. No test, re-export, other feature, or platform-specific implementation names it. The module is private to host::network; its code has no target-specific alternative, and host is enabled by the host feature.

Proposed change and benefit

Remove pub(crate) from Family::last_address, leaving const fn last_address(self) -> u128. Private is the least visibility required by every caller. Keep the method name, signature otherwise, body, documentation, and every call site unchanged.

The compiler will enforce that computing an address-family upper bound is an implementation detail of the address module, like its already-private Family::bits and Network::host_mask. Neighboring modules continue using the existing interval and network operations instead of gaining another dependency on the representation. This is one line replacement, with no new abstraction, wrapper, dependency, feature, or unsafe code.

Why behavior is unchanged

Only Rust visibility changes. The IPv4 and IPv6 values, arithmetic, interval boundaries, iteration termination, accepted inputs, rendered addresses, errors and ErrorKinds remain identical. This method is not public API. No protocol bytes, golden fixtures, guest-program command lines, exit statuses, or output change. No module is moved or given a different purpose, so module-layout documentation needs no edit.

Prior work and overlap

All five current open and closed code-quality issues were checked: #1683, #1685, #1689, #1692, and #1696. Their linked production-code PRs #1686 and #1688 are merged, and #1695 is open. Their reviews recommended approval without corrective comments; no closed-unmerged code-quality proposal was found. Those efforts concern sandbox scope, hexadecimal identity helpers, CLI argument arity, NVXS record helpers, and file seals, not address-family bounds.

The changed files of every current open PR targeting dev were checked, including the equivalent legacy nvx-rs/ paths in #1509. None changes nvx/src/host/network/address.rs. Do not modify files held by another open PR.

Acceptance criteria

  • Make only Family::last_address private in nvx/src/host/network/address.rs; leave its body and callers unchanged.
  • Record passing affected tests at the base revision, then run them unchanged with the change: cargo test --locked --all-features --lib --manifest-path nvx/Cargo.toml host::network:: on Windows and Linux. This includes the existing address-parsing, address-space boundary, summarization, and network-lowering tests.
  • Keep existing tests unchanged. Introduce no dependency, feature, or unsafe code. If implementation introduces a new abstraction, give it a focused unit test; none is proposed or needed here.
  • Leave nvx/public-api/ snapshots unchanged and pass the public-API check without rewriting them.
  • Preserve protocol bytes, golden fixtures, error messages and ErrorKinds, guest command lines, exit statuses, and output exactly.
  • Check every applicable feature/target combination through the repository's gates: default host, CLI-only and all-features on Windows and Linux; no-default, serde-only, and testing-only; MSRV; macOS compilation; and the guest-target checks. Distinguish locally run checks from checks left to CI.
  • Pass the gates selected by python3 scripts/local_gates.py --base origin/dev and the applicable commands in check-nvx.
  • Keep the entire diff below 1000 changed lines, insertions plus deletions as git diff --shortstat reports them. Expected: one production file, one insertion and one deletion. Restrict changes to nvx/ and, only if necessary, doc/project-structure.md; no scripts, workflow, data, or OpenVMM changes.

Follow-ups

None required for this self-contained change. Broader visibility cleanup or address-parser refactoring is out of scope. No suspected bug was identified in this candidate.

Activity

  1. ppenna commented on Nov 17, 2026

    @ppenna
    ContributorAuthor

    Discovery handoff: assignment to ppenna is verified. Native planning status remains unset because GitHub reports viewerCanSetStatus=false; In Progress could not be set. After creating this issue I explicitly invoked nvx-fix-issue, but the skill tool refused because disable-model-invocation is enabled and no skill context was supplied. Implementation and PR workflow have therefore not begun; manual invocation is required: /nvx-fix-issue #1700. Baseline validation at e5330ad: python scripts\nvx.py verify failed because the OpenVMM submodule is uninitialized (openvmm/Cargo.toml is absent). Cargo tests were not run, and no passing baseline is claimed. No tracked code, tests, snapshots, or documentation were changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area: networkingInitial title-keyword triage suggestioncode-qualityFindings from focused code-quality reviews

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions