Skip to content

net: keep CIDR overlap checks private #1710

Closed

Description

Area

area: nvx

Base and confirmed uses

Base revision: e5330ad60af7f734a7a2fa75338053b0b064e4d1.

  • Cidr::overlaps is pub(crate), although it is an implementation detail of CIDR subtraction.
  • Its only production caller is Cidr::subtract, in the same module.
  • Its two other callers are in that module's child tests: the subtraction invariant and the reference subtraction. Child modules retain access to private parent items.
  • The similarly named method in the host policy tests belongs to the separate reference-model Net, not Cidr.

The crate-wide use search included all Rust sources and targets without feature filtering. net::cidr is unconditional; there are no platform-specific implementations of this method.

Proposed change

Remove pub(crate) from Cidr::overlaps, leaving its signature, body, callers, and tests otherwise unchanged. Private visibility is sufficient and prevents unrelated crate modules from depending on an internal subtraction helper. This is one insertion and one deletion, with no new abstraction, dependency, feature, or unsafe code.

The method is already absent from the external public API. Only compile-time visibility changes: network calculations, errors and ErrorKinds, protocol bytes, CLI behavior, and guest output and exit statuses remain identical. No module moves or documentation layout changes are needed.

Prior work

Checked all open and closed code-quality issues and their linked pull requests, including recent reviews of #1686, #1688, and #1695. None addresses this helper. #1700 concerns the separate host address-family bounds. No open pull request targeting dev changes nvx/src/net/cidr.rs. Also checked CIDR-related pull requests, including closed-unmerged results; none proposes this scope reduction.

Acceptance criteria

  • Record passing affected CIDR tests at the base revision, then pass the same tests unchanged after the visibility reduction.
  • Keep existing tests, public API snapshots, protocol bytes, golden fixtures, command lines, exit statuses, and output unchanged.
  • Check the least visibility across supported feature and target combinations using the applicable check-nvx gates, including the public API check. Report unavailable local targets explicitly and require their CI gates.
  • If implementation unexpectedly introduces an abstraction, give it a focused unit test; no new abstraction is planned.
  • Change only the production declaration in nvx/src/net/cidr.rs; stay below 1000 inserted plus deleted lines as reported by git diff --shortstat.
  • Pass the gates selected by python scripts/local_gates.py --base origin/dev and the applicable commands in .github/actions/check-nvx/action.yml.

Follow-ups

None required for this self-contained scope reduction. No suspected bug is included in this task.

Metadata

Metadata

Labels

code-qualityFindings from focused code-quality reviews

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions